/* Shared mobile authentication layout for SME and Investor portals. */
@media (max-width: 640px) {
  html,
  body {
    width: 100%;
    max-width: 100%;
    overflow-x: clip;
  }

  .auth-page {
    width: 100%;
    min-height: 100dvh;
    padding: 12px !important;
    place-items: start center !important;
    overflow: visible !important;
  }

  .auth-shell {
    width: min(100%, 430px) !important;
    max-width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    border-radius: 28px !important;
    overflow: hidden !important;
  }

  .form-panel {
    width: 100% !important;
    min-width: 0 !important;
    padding: 28px 20px 24px !important;
    align-items: stretch !important;
  }

  .form-wrap,
  .form-wrap > form {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  .mobile-brand {
    position: relative !important;
    isolation: isolate;
    width: calc(100% + 40px) !important;
    max-width: none !important;
    min-height: 158px !important;
    display: grid !important;
    align-content: start !important;
    justify-items: start !important;
    gap: 0 !important;
    margin: -28px -20px 28px !important;
    padding: 22px 24px 20px !important;
    overflow: hidden !important;
    border: 0 !important;
    border-radius: 0 !important;
    background:
      linear-gradient(rgba(255, 255, 255, .055) 1px, transparent 1px),
      linear-gradient(90deg, rgba(255, 255, 255, .055) 1px, transparent 1px),
      linear-gradient(135deg, #21104f, #351873) !important;
    background-size: 34px 34px, 34px 34px, auto !important;
    box-shadow: none !important;
  }

  .mobile-brand::before {
    position: absolute;
    z-index: -1;
    top: -88px;
    right: -92px;
    width: 210px;
    height: 210px;
    content: "";
    border-radius: 50%;
    background: #06ad6b;
    box-shadow: 0 112px 0 22px rgba(255, 255, 255, .08);
  }

  .mobile-brand::after {
    position: relative;
    z-index: 1;
    display: block;
    max-width: 285px;
    margin-top: 14px;
    color: #fff;
    font-size: 14px;
    font-weight: 750;
    line-height: 1.4;
    letter-spacing: 0;
    text-transform: none;
  }

  body[data-auth-portal="investor"] .mobile-brand::after {
    content: "Secure access to investment opportunities and your portfolio.";
  }

  body[data-auth-portal="sme"] .mobile-brand::after {
    content: "Secure access to onboarding, LPO financing and active facilities.";
  }

  .mobile-brand img {
    position: relative;
    z-index: 1;
    width: min(145px, 48vw) !important;
    height: auto !important;
    max-width: 145px !important;
    min-width: 0 !important;
    display: block !important;
    padding: 0 !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    object-fit: contain !important;
  }

  .mobile-brand > div,
  .mobile-brand strong,
  .mobile-brand span {
    display: none !important;
  }

  .form-eyebrow {
    margin-bottom: 9px !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    letter-spacing: .22em !important;
  }

  h2 {
    margin-bottom: 10px !important;
    font-size: clamp(28px, 8.4vw, 33px) !important;
    line-height: 1.08 !important;
    letter-spacing: -.045em !important;
    overflow-wrap: normal !important;
  }

  .subtitle {
    margin-bottom: 22px !important;
    font-size: 14px !important;
    line-height: 1.5 !important;
    overflow-wrap: anywhere;
  }

  .form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 17px !important;
  }

  .form-grid > label,
  .conditional-fields,
  .conditional-fields > .form-grid,
  .full-width {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-column: 1 / -1 !important;
  }

  form label > span:first-child,
  .label-text {
    font-size: 13px !important;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select,
  .password-field {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
  }

  input:not([type="checkbox"]):not([type="radio"]),
  select {
    min-height: 54px !important;
    padding-left: 15px !important;
    padding-right: 15px !important;
    border-radius: 16px !important;
    font-size: 16px !important;
  }

  .password-field input {
    padding-right: 78px !important;
  }

  .password-toggle {
    right: 10px !important;
    min-width: 58px !important;
    min-height: 36px !important;
    padding: 0 12px !important;
    border-radius: 999px !important;
    font-size: 12px !important;
  }

  .account-type {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px !important;
    margin-bottom: 22px !important;
  }

  .type-card {
    min-width: 0 !important;
    padding: 12px 10px !important;
    border-radius: 16px !important;
  }

  .type-card .type-icon {
    width: 34px !important;
    height: 34px !important;
  }

  .type-card .type-copy strong {
    font-size: 12px !important;
  }

  .type-card .type-copy > span {
    font-size: 10px !important;
    line-height: 1.3 !important;
  }

  .password-note {
    margin-top: 18px !important;
    font-size: 12px !important;
    line-height: 1.48 !important;
  }

  .password-strength-summary {
    gap: 10px !important;
    font-size: 11px !important;
  }

  .password-strength-summary > :first-child {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .password-strength-summary > :last-child {
    flex: 0 0 auto;
  }

  .password-strength-checks {
    display: none !important;
  }

  .password-strength-rule {
    width: 100% !important;
    min-width: 0 !important;
    padding: 7px 6px !important;
    font-size: 10.5px !important;
    line-height: 1.25 !important;
    text-align: center !important;
  }

  /* Do not let the generic mobile input rule turn the checkbox into a full-width field. */
  .terms-row {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: 20px minmax(0, 1fr) !important;
    align-items: start !important;
    gap: 11px !important;
    margin-top: 4px !important;
    font-size: 12.5px !important;
    line-height: 1.5 !important;
  }

  .terms-row input[type="checkbox"] {
    width: 20px !important;
    max-width: 20px !important;
    min-width: 20px !important;
    height: 20px !important;
    margin: 1px 0 0 !important;
    padding: 0 !important;
    justify-self: start;
  }

  .terms-row > span {
    min-width: 0 !important;
    overflow-wrap: anywhere;
  }

  .primary-btn {
    width: 100% !important;
    max-width: 100% !important;
    min-height: 54px !important;
    height: auto !important;
    padding: 14px 16px !important;
    border-radius: 16px !important;
    font-size: 14px !important;
    line-height: 1.35 !important;
    white-space: normal !important;
  }

  .auth-links {
    width: 100% !important;
    display: flex !important;
    flex-flow: row wrap !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px 16px !important;
    margin-top: 20px !important;
  }

  .auth-links a {
    font-size: 13px !important;
    line-height: 1.35 !important;
  }

  .portal-switch {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: .72fr 1fr 1.12fr !important;
    gap: 8px !important;
    margin-top: 17px !important;
  }

  .portal-switch a {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 7px 5px !important;
    border-radius: 14px !important;
    font-size: 11.5px !important;
    line-height: 1.25 !important;
    text-align: center !important;
    white-space: normal !important;
  }

  .support-note {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    display: grid !important;
    grid-template-columns: 20px minmax(0, 1fr) !important;
    gap: 10px !important;
    margin-top: 22px !important;
    padding: 14px !important;
    border-radius: 17px !important;
    font-size: 12px !important;
    line-height: 1.46 !important;
  }

  .support-note svg {
    width: 20px !important;
    height: 20px !important;
    margin-top: 1px !important;
  }

  .support-note > span {
    min-width: 0;
    overflow-wrap: anywhere;
  }
}

@media (max-width: 359px) {
  .auth-page {
    padding: 8px !important;
  }

  .form-panel {
    padding-right: 17px !important;
    padding-left: 17px !important;
  }

  .mobile-brand {
    width: calc(100% + 34px) !important;
    margin-right: -17px !important;
    margin-left: -17px !important;
    padding-right: 20px !important;
    padding-left: 20px !important;
  }

  .portal-switch a {
    font-size: 10.5px !important;
  }
}
