@import url('svg-icons.css');

    :root {
      --navy: #f4fbf7;
      --sidebar: #ecfdf5;
      --panel: #ffffff;
      --panel2: #f0fdf4;
      --border: rgba(22, 101, 52, 0.14);
      --blue: #16a34a;
      --gold: #eab308;
      --green: #059669;
      --amber: #ca8a04;
      --orange: #ea580c;
      --red: #dc2626;
      --purple: #7c3aed;
      --text: #14532d;
      --muted: #5f7268;
      --r: 14px;
      --shadow-sm: 0 1px 3px rgba(20, 83, 45, 0.06);
      --shadow-md: 0 12px 40px rgba(20, 83, 45, 0.08);
      --overlay-scrim: rgba(15, 60, 35, 0.45);
    }
    * { margin: 0; padding: 0; box-sizing: border-box; }
    html { scroll-behavior: smooth; scroll-padding-top: 88px; }
    body {
      font-family: 'Outfit', sans-serif;
      background: linear-gradient(165deg, #fafefa 0%, #f4fbf7 45%, #ecfdf5 100%);
      color: var(--text);
      min-height: 100vh; overflow-x: hidden; font-size: 15px; line-height: 1.55;
    }
    h1, h2, h3, .font-display { font-family: 'Playfair Display', serif; }
    .gradient-brand,
    .gradient-text {
      background: linear-gradient(90deg, #15803d, #eab308);
      -webkit-background-clip: text;
      background-clip: text;
      -webkit-text-fill-color: transparent;
    }
    #page-landing {
      position: relative;
      min-height: 100vh;
    }
    .lnav-left {
      display: flex;
      align-items: center;
      gap: clamp(14px, 3vw, 28px);
      flex-wrap: wrap;
      flex: 1;
      min-width: 0;
    }
    .lnav-logo {
      display: flex;
      align-items: center;
      flex-shrink: 0;
      line-height: 0;
    }
    .lnav-links {
      display: flex;
      align-items: center;
      gap: clamp(10px, 2vw, 22px);
      flex-wrap: wrap;
    }
    /* Circular school seal — same size in nav and login header (masks square PNG to a circle). */
    .brand-seal-frame {
      width: 56px;
      height: 56px;
      min-width: 56px;
      min-height: 56px;
      border-radius: 50%;
      overflow: hidden;
      flex-shrink: 0;
      background: #fff;
      box-shadow: 0 2px 14px rgba(0, 0, 0, 0.22);
      display: flex;
      align-items: center;
      justify-content: center;
    }
    .brand-seal-frame img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      object-position: center;
      display: block;
    }
    .lnav-institution {
      font-size: 0.72rem;
      text-transform: uppercase;
      letter-spacing: 0.12em;
      color: var(--muted);
      font-weight: 600;
      line-height: 1.35;
      max-width: 240px;
    }
    .landing-brand-title {
      font-family: 'Playfair Display', serif;
      font-weight: 900;
      font-size: clamp(1.35rem, 2.5vw, 1.65rem);
      line-height: 1.15;
    }
    .pill-landing {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      padding: 7px 14px;
      border-radius: 999px;
      font-size: 0.82rem;
      font-weight: 500;
      background: rgba(255, 255, 255, 0.9);
      border: 1px solid rgba(34, 197, 94, 0.2);
      color: var(--text);
      box-shadow: var(--shadow-sm);
    }
    .login-btn-row {
      display: grid;
      grid-template-columns: 1fr;
      gap: 10px;
      margin-top: 20px;
    }
    .login-btn-row button { width: 100%; justify-content: center; }
    .login-back-home {
      color: var(--blue);
      text-decoration: none;
    }
    .login-back-home:hover {
      color: var(--blue);
      text-decoration: none;
      opacity: 0.9;
    }
    .signup-back-home {
      color: var(--blue);
      text-decoration: none;
    }
    .signup-back-home:hover {
      color: var(--blue);
      text-decoration: none;
      opacity: 0.9;
    }
    .auth-portal-card {
      max-width: 440px;
      width: 100%;
      margin: 0 auto;
      border-radius: 24px;
      padding: 36px 32px 30px;
      box-shadow: 0 20px 50px rgba(20, 83, 45, 0.1), 0 0 0 1px rgba(22, 101, 52, 0.06);
      border: 1px solid rgba(22, 101, 52, 0.1);
      background: var(--panel);
      animation: pageIn 0.55s ease forwards;
    }
    .auth-portal-card.auth-portal-signup {
      max-width: 520px;
    }
    .auth-portal-card--signin {
      max-width: 420px;
    }
    #panel-signup .signup-role-tabs {
      display: flex;
      gap: 0;
      padding: 5px;
      margin-bottom: 20px;
      border-radius: 14px;
      background: var(--panel2);
      border: 1px solid var(--border);
    }
    #panel-signup .signup-role-tabs .tab-btn {
      flex: 1;
      min-width: 0;
      padding: 11px 14px;
      border-radius: 10px;
      border: none;
      background: transparent;
      color: var(--muted);
      font-family: 'Outfit', sans-serif;
      font-size: 0.88rem;
      font-weight: 600;
      cursor: pointer;
      transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    }
    #panel-signup .signup-role-tabs .tab-btn.active {
      background: linear-gradient(135deg, #15803d 0%, var(--blue) 55%, #047857 100%);
      color: #fff;
      box-shadow: 0 4px 14px rgba(22, 101, 52, 0.22);
    }
    #panel-signup .signup-role-tabs .tab-btn:not(.active):hover {
      color: var(--text);
      background: rgba(255, 255, 255, 0.7);
    }
    #panel-signup select {
      margin-bottom: 16px;
    }
    .auth-portal-header {
      text-align: center;
      margin-bottom: 22px;
    }
    .auth-portal-header .brand-seal-frame {
      margin: 0 auto 14px;
    }
    .auth-portal-title {
      font-family: 'Playfair Display', serif;
      font-size: 1.45rem;
      font-weight: 700;
      color: var(--text);
      margin: 0 0 6px;
      line-height: 1.2;
    }
    .auth-portal-sub {
      font-size: 0.68rem;
      letter-spacing: 0.14em;
      text-transform: uppercase;
      color: var(--muted);
      font-weight: 600;
      margin: 0;
    }
    .auth-switch {
      display: flex;
      gap: 0;
      padding: 4px;
      border-radius: 999px;
      background: var(--panel2);
      border: 1px solid var(--border);
      margin-bottom: 22px;
    }
    .auth-switch-btn {
      flex: 1;
      border: none;
      background: transparent;
      color: var(--muted);
      font-family: 'Outfit', sans-serif;
      font-size: 0.88rem;
      font-weight: 600;
      padding: 10px 16px;
      border-radius: 999px;
      cursor: pointer;
      transition: background 0.2s, color 0.2s, box-shadow 0.2s;
    }
    .auth-switch-btn.active {
      background: linear-gradient(135deg, #15803d 0%, var(--blue) 55%, #047857 100%);
      color: #fff;
      box-shadow: 0 4px 12px rgba(22, 101, 52, 0.25);
    }
    .auth-portal-card .auth-field-label {
      display: block;
      font-size: 0.8rem;
      font-weight: 600;
      color: var(--text);
      margin-bottom: 8px;
      letter-spacing: 0.02em;
    }
    .auth-portal-card input[type="email"],
    .auth-portal-card input[type="password"],
    .auth-portal-card input[type="text"] {
      margin-bottom: 16px;
    }
    .auth-portal-card .pw-field-wrap {
      margin-bottom: 16px;
    }
    .auth-portal-card .pw-field-wrap input {
      margin-bottom: 0;
    }
    .auth-portal-footer {
      text-align: center;
      margin-top: 18px;
      font-size: 0.86rem;
      color: var(--muted);
    }
    .auth-forgot-wrap {
      text-align: center;
      margin-top: 14px;
      font-size: 0.86rem;
    }
    .auth-forgot-wrap a {
      color: var(--blue);
      font-weight: 600;
      text-decoration: none;
    }
    .auth-forgot-wrap a:hover {
      text-decoration: underline;
    }
    .auth-portal-footer a {
      color: var(--blue);
      font-weight: 600;
      text-decoration: none;
    }
    .auth-portal-footer a:hover {
      text-decoration: underline;
    }
    .auth-portal-note {
      font-size: 0.78rem;
      color: var(--muted);
      text-align: center;
      margin: 0 0 16px;
      line-height: 1.45;
    }
    /* Password field: stretch a slot so the icon stays vertically centered (fixes misalignment). */
    .pw-field-wrap { position: relative; }
    .pw-field-wrap input { width: 100%; box-sizing: border-box; padding-right: 44px; }
    .pw-toggle-slot {
      position: absolute;
      top: 0;
      right: 0;
      bottom: 0;
      display: flex;
      align-items: center;
      justify-content: center;
      padding-right: 8px;
      pointer-events: none;
    }
    .pw-toggle-btn {
      position: relative;
      top: auto;
      transform: none;
      background: rgba(22, 101, 52, 0.06);
      border: none;
      border-radius: 8px;
      padding: 6px;
      cursor: pointer;
      color: var(--blue);
      display: flex;
      align-items: center;
      justify-content: center;
      line-height: 0;
      pointer-events: auto;
      transition: background 0.2s, color 0.2s;
    }
    .pw-toggle-btn:hover {
      background: rgba(22, 101, 52, 0.12);
      color: #15803d;
    }
    .pw-toggle-btn:focus-visible {
      outline: 2px solid var(--blue);
      outline-offset: 2px;
      border-radius: 4px;
    }
    .pw-toggle-btn svg { display: block; flex-shrink: 0; }
    /* Login layout: viewport-locked section; only the form column (.login-right-col) scrolls. */
    #page-login.page-active {
      height: 100vh;
      max-height: 100dvh;
      overflow: hidden;
      box-sizing: border-box;
    }
    .login-split {
      display: grid;
      grid-template-columns: 40% 60%;
      height: 100%;
      min-height: 0;
      max-height: 100%;
      overflow: hidden;
      position: relative;
      z-index: 1;
    }
    .login-split > * {
      min-height: 0;
    }
    .login-brand-panel {
      height: 100%;
      overflow: hidden;
      box-sizing: border-box;
    }
    .login-right-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      padding: 32px 24px 48px;
      height: 100%;
      min-height: 0;
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      box-sizing: border-box;
    }
    /* Vertically center the auth card only on the login tab (sign-up stays top-aligned for long forms). */
    .login-right-col.auth-view-login {
      justify-content: center;
    }
    .login-right-col .auth-card {
      width: 100%;
      flex-shrink: 0;
    }
    .auth-card { width: 100%; }
    .nav-brand-block { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; }
    .nav-brand-block.nav-brand-with-logo {
      flex-direction: row;
      align-items: center;
      gap: 12px;
    }
    .nav-brand-block .landing-brand-title { font-size: 1.05rem; }
    /* Toast — fixed bottom alerts (must beat portal-background.css stacking) */
    body[data-auth-page] #toast-host,
    #toast-host {
      position: fixed;
      bottom: max(22px, env(safe-area-inset-bottom, 0px));
      left: 50%;
      right: auto;
      top: auto;
      transform: translateX(-50%) translateY(110%);
      z-index: 100000;
      opacity: 0;
      pointer-events: none;
      transition: opacity 0.35s ease, transform 0.4s cubic-bezier(0.22, 1, 0.36, 1);
      width: min(calc(100vw - 32px), 520px);
    }
    body[data-auth-page] #toast-host.show,
    #toast-host.show {
      opacity: 1;
      transform: translateX(-50%) translateY(0);
      pointer-events: auto;
    }
    .toast-pill {
      display: flex;
      align-items: center;
      justify-content: center;
      gap: 8px;
      width: 100%;
      padding: 8px 16px;
      border-radius: 0;
      font-weight: 600;
      font-size: 0.88rem;
      line-height: 1.5;
      text-align: center;
      background: transparent;
      border: none;
      box-shadow: none;
      backdrop-filter: none;
    }
    .toast-icon {
      display: none;
    }
    .toast-msg {
      flex: 0 1 auto;
      min-width: 0;
    }
    .toast-success {
      background: transparent;
      color: #047857;
    }
    .toast-error {
      background: transparent;
      color: #b91c1c;
    }
    .toast-warning {
      background: transparent;
      color: #a16207;
    }
    .toast-info {
      background: transparent;
      color: #15803d;
    }
    .auth-signup-success {
      margin: 0 0 16px;
      padding: 14px 16px;
      border-radius: var(--r);
      font-size: .88rem;
      line-height: 1.55;
      border: 1px solid transparent;
    }
    .auth-signup-success--success {
      background: rgba(16, 185, 129, 0.14);
      border-color: rgba(16, 185, 129, 0.35);
      color: #047857;
    }
    .auth-signup-success--warning {
      background: rgba(254, 249, 195, 0.85);
      border-color: rgba(245, 158, 11, 0.45);
      color: #a16207;
    }
    /* Page sections */
    .page-section { display: none; opacity: 0; transform: translateY(8px); min-height: 100vh; }
    .page-section.page-active { animation: pageIn .35s ease forwards; }
    @keyframes pageIn { to { opacity: 1; transform: translateY(0); } }
    /* Base controls (auth pages) */
    button,
    .btn {
      font-family: 'Outfit', sans-serif;
      cursor: pointer;
      border-radius: 12px;
      font-weight: 600;
      transition: transform 0.15s ease, box-shadow 0.2s ease, opacity 0.15s ease;
      border: none;
    }
    button:hover:not(:disabled),
    .btn:hover:not(:disabled) {
      transform: translateY(-1px);
    }
    button:disabled {
      opacity: 0.55;
      cursor: not-allowed;
      transform: none;
    }
    .btn-grad {
      background: linear-gradient(135deg, #15803d 0%, var(--blue) 55%, #047857 100%);
      color: #fff;
      padding: 14px 24px;
      font-size: 1rem;
      box-shadow: 0 6px 20px rgba(22, 101, 52, 0.28);
      letter-spacing: 0.02em;
    }
    .btn-grad:hover:not(:disabled) {
      box-shadow: 0 10px 28px rgba(22, 101, 52, 0.35);
    }
    .auth-submit-btn {
      width: 100%;
      margin-top: 8px;
      padding: 15px 24px;
      border-radius: 12px;
    }
    .card {
      background: var(--panel);
      border: 1px solid var(--border);
      border-radius: calc(var(--r) + 4px);
    }
    input,
    select,
    textarea {
      font-family: 'Outfit', sans-serif;
      border-radius: 12px;
      border: 1px solid var(--border);
      background: #fff;
      color: var(--text);
      padding: 13px 15px;
      width: 100%;
      font-size: 0.95rem;
      line-height: 1.4;
      transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
    }
    input::placeholder {
      color: #94a89e;
    }
    input:hover,
    select:hover {
      border-color: rgba(22, 101, 52, 0.28);
    }
    input:focus,
    select:focus,
    textarea:focus {
      outline: none;
      border-color: rgba(34, 197, 94, 0.55);
      box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
      background: #fff;
    }
    select {
      appearance: none;
      background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2315803d' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
      background-repeat: no-repeat;
      background-position: right 14px center;
      padding-right: 42px;
      cursor: pointer;
    }
    .field-error {
      color: var(--red);
      font-size: 0.78rem;
      margin: -8px 0 12px;
      min-height: 1em;
      line-height: 1.35;
    }
    .password-hint {
      color: var(--muted, #54685c);
      font-size: 0.76rem;
      line-height: 1.4;
      margin: -4px 0 10px;
    }
    .pw-requirements {
      list-style: none;
      margin: 8px 0 14px;
      padding: 12px 14px;
      border-radius: 12px;
      border: 1px solid rgba(22, 101, 52, 0.14);
      background: rgba(240, 253, 244, 0.72);
      display: grid;
      gap: 6px;
    }
    .pw-requirements--full {
      grid-column: 1 / -1;
    }
    .pw-requirements--valid {
      border-color: rgba(22, 163, 74, 0.35);
      background: rgba(220, 252, 231, 0.85);
    }
    .pw-req-item {
      display: flex;
      align-items: center;
      gap: 8px;
      font-size: 0.76rem;
      line-height: 1.35;
      color: #64748b;
      transition: color 0.15s ease;
    }
    .pw-req-item--met {
      color: #15803d;
      font-weight: 600;
    }
    .pw-req-icon {
      width: 16px;
      flex-shrink: 0;
      text-align: center;
      font-size: 0.82rem;
      line-height: 1;
    }
    .pw-match-indicator {
      display: flex;
      align-items: center;
      gap: 8px;
      margin: 8px 0 12px;
      font-size: 0.76rem;
      color: #64748b;
    }
    .pw-match-indicator--met {
      color: #15803d;
      font-weight: 600;
    }
    .pw-match-indicator--mismatch {
      color: #dc2626;
      font-weight: 600;
    }
    .pw-match-icon {
      width: 16px;
      text-align: center;
      flex-shrink: 0;
    }

    /* Brand sidebar */
    .auth-brand-panel {
      padding: 48px 40px;
      display: flex;
      flex-direction: column;
      justify-content: center;
      border-right: 1px solid var(--border);
      background: linear-gradient(180deg, #ffffff 0%, #f8fdf9 100%);
      position: relative;
    }
    .auth-brand-panel::before {
      content: '';
      position: absolute;
      left: 0;
      top: 0;
      bottom: 0;
      width: 4px;
      background: linear-gradient(180deg, #15803d, var(--gold));
    }
    .brand-title-row {
      display: flex;
      align-items: center;
      gap: clamp(14px, 2vw, 22px);
      margin-bottom: 20px;
    }

    .brand-title-row .auth-brand-logo-link {
      margin-bottom: 0;
      flex-shrink: 0;
    }

    .brand-title-row .auth-hero-title {
      margin-bottom: 0;
      line-height: 1.05;
    }

    .auth-brand-logo-link {
      display: inline-block;
      text-decoration: none;
    }

    .auth-brand-logo-frame {
      display: flex;
      align-items: center;
      justify-content: center;
      width: 72px;
      height: 72px;
      border-radius: 50%;
      overflow: hidden;
      background: #fff;
      border: 2px solid rgba(22, 101, 52, 0.12);
      box-shadow: 0 4px 20px rgba(20, 83, 45, 0.12);
    }

    .auth-brand-logo-frame img {
      width: 100%;
      height: 100%;
      object-fit: contain;
      display: block;
    }

    .auth-brand-panel .auth-hero-title {
      font-family: 'Playfair Display', serif;
      font-weight: 900;
      font-size: clamp(1.75rem, 3vw, 2.35rem);
      line-height: 1.12;
      margin-bottom: 20px;
      color: #1e293b;
    }

    .auth-brand-panel .subtitle {
      font-family: 'Playfair Display', serif;
      font-style: italic;
      font-size: 1.1rem;
      color: var(--muted);
      margin: 0 0 18px;
      line-height: 1.55;
      max-width: 420px;
    }

    .auth-brand-panel .auth-hero-lead {
      color: var(--muted);
      font-size: 0.95rem;
      line-height: 1.65;
      margin: 0 0 20px;
      max-width: 420px;
      font-family: 'Outfit', sans-serif;
    }

    .auth-brand-institution {
      margin-bottom: 22px;
    }
    .auth-brand-divider {
      height: 1px;
      background: var(--border);
      margin-bottom: 22px;
    }
    .auth-feature-list {
      font-size: 0.88rem;
      line-height: 1.5;
      list-style: none;
      color: var(--text);
      display: flex;
      flex-direction: column;
      gap: 10px;
    }
    .auth-feature-list li {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      padding: 12px 14px;
      border-radius: 12px;
      background: rgba(22, 101, 52, 0.05);
      border: 1px solid rgba(22, 101, 52, 0.08);
    }
    .auth-feature-icon {
      flex-shrink: 0;
      font-size: 1.1rem;
      line-height: 1.2;
    }
    .auth-brand-legal {
      margin-top: auto;
      font-size: 0.76rem;
      color: var(--muted);
      padding-top: 28px;
      line-height: 1.55;
      max-width: 380px;
    }
    .auth-signup-panel-label {
      font-size: 0.72rem;
      font-weight: 700;
      text-transform: uppercase;
      letter-spacing: 0.08em;
      color: #166534;
      margin: 0 0 12px;
    }
    .auth-signup-steps {
      list-style: none;
      margin: 0 0 8px;
      padding: 0;
      display: flex;
      flex-direction: column;
      gap: 10px;
      max-width: 420px;
    }
    .auth-signup-steps li {
      display: flex;
      align-items: flex-start;
      gap: 12px;
      font-size: 0.86rem;
      line-height: 1.5;
      color: var(--text);
      padding: 12px 14px;
      border-radius: 12px;
      background: rgba(234, 179, 8, 0.06);
      border: 1px solid rgba(234, 179, 8, 0.14);
    }
    .auth-step-num {
      flex-shrink: 0;
      width: 26px;
      height: 26px;
      border-radius: 50%;
      display: inline-flex;
      align-items: center;
      justify-content: center;
      font-size: 0.78rem;
      font-weight: 700;
      color: #fff;
      background: linear-gradient(135deg, #15803d, #166534);
      box-shadow: 0 2px 8px rgba(22, 101, 52, 0.25);
    }
    body[data-auth-page="signin"] .login-brand-panel,
    body[data-auth-page="signup"] .login-brand-panel {
      background: #ffffff;
    }

    /* Solid white left half — sign-in & sign-up */
    body[data-auth-page="signin"] .login-split,
    body[data-auth-page="signup"] .login-split {
      grid-template-columns: 40% 60%;
      min-height: 100%;
      align-items: stretch;
    }

    body[data-auth-page="signin"] .login-split::before {
      content: '';
      position: absolute;
      top: 0;
      left: 0;
      bottom: 0;
      width: 40%;
      background: #ffffff;
      z-index: 0;
      pointer-events: none;
    }

    body[data-auth-page="signup"] .login-split::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      bottom: 0;
      width: 40%;
      height: 100vh;
      height: 100dvh;
      background: #ffffff;
      z-index: 0;
      pointer-events: none;
    }

    body[data-auth-page="signin"] .login-brand-panel,
    body[data-auth-page="signup"] .login-brand-panel,
    body[data-auth-page="signin"] .login-right-col,
    body[data-auth-page="signup"] .login-right-col {
      position: relative;
      z-index: 1;
    }

    body[data-auth-page="signin"] .auth-brand-panel {
      background: #ffffff;
    }

    body[data-auth-page="signin"] .auth-brand-panel::before {
      display: none;
    }

    body[data-auth-page="signin"] .auth-brand-panel .brand-title-row {
      align-items: center;
    }

    body[data-auth-page="signin"] .auth-brand-panel .auth-brand-logo-link {
      display: flex;
      align-items: center;
    }

    body[data-auth-page="signin"] .auth-brand-panel .auth-hero-title {
      margin-bottom: 0;
      display: flex;
      align-items: center;
      line-height: 1;
    }

    body[data-auth-page="signin"] .login-brand-panel.auth-brand-panel {
      background: #ffffff;
      min-height: 100dvh;
      height: 100%;
      width: 100%;
      align-self: stretch;
      box-sizing: border-box;
      border-right: 1px solid rgba(22, 101, 52, 0.08);
    }

    body[data-auth-page="signin"] .portal-bg-layers {
      clip-path: inset(0 0 0 40%);
    }

    .auth-brand-panel--signup {
      justify-content: flex-start;
      padding-top: 48px;
      padding-bottom: 40px;
      background: linear-gradient(180deg, #ffffff 0%, #f8fdf9 100%);
      overflow-y: auto;
    }

    .auth-brand-panel--signup::before {
      display: block;
    }

    body[data-auth-page="signup"] .login-brand-panel.auth-brand-panel {
      background: linear-gradient(180deg, #ffffff 0%, #f8fdf9 100%);
      min-height: 100dvh;
      height: 100%;
      width: 100%;
      align-self: stretch;
      box-sizing: border-box;
      border-right: 1px solid rgba(22, 101, 52, 0.08);
      position: relative;
      z-index: 1;
    }

    body[data-auth-page="signup"] .portal-bg-layers {
      clip-path: inset(0 0 0 40%);
      -webkit-clip-path: inset(0 0 0 40%);
    }

    body[data-auth-page="signup"] #page-login.page-active,
    body[data-auth-page="signup"] .login-split {
      position: relative;
      z-index: 1;
    }

    .auth-brand-panel--signup .brand-title-row {
      align-items: center;
    }

    .auth-brand-panel--signup .auth-brand-logo-link {
      display: flex;
      align-items: center;
    }

    .auth-brand-panel--signup .auth-hero-title {
      margin-bottom: 0;
      display: flex;
      align-items: center;
      line-height: 1;
    }

    /* Form layout */
    .auth-form-row-2 {
      display: grid;
      grid-template-columns: 1fr 1fr;
      gap: 14px;
    }
    .auth-form-row-2 > div .auth-field-label {
      margin-top: 0;
    }
    .auth-portal-card .auth-signup-intro {
      background: rgba(22, 101, 52, 0.06);
      border: 1px solid rgba(22, 101, 52, 0.1);
      border-radius: 12px;
      padding: 12px 14px;
      color: #166534;
      font-size: 0.84rem;
      line-height: 1.55;
      margin: 0 0 20px;
    }
    .auth-portal-header .brand-seal-frame {
      box-shadow: 0 4px 20px rgba(20, 83, 45, 0.15);
      border: 2px solid rgba(22, 101, 52, 0.12);
    }
    .auth-portal-title {
      font-size: 1.55rem;
    }
    .auth-portal-sub {
      color: #166534;
      letter-spacing: 0.12em;
    }
    .login-btn-row {
      margin-top: 8px;
    }
    .login-btn-row .btn-grad {
      width: 100%;
      padding: 15px 24px;
    }
    .auth-page-back {
      text-align: center;
      margin-top: 22px;
      font-size: 0.84rem;
    }
    .login-back-home {
      display: inline-flex;
      align-items: center;
      gap: 6px;
      font-weight: 500;
      padding: 6px 12px;
      border-radius: 8px;
      transition: background 0.2s, color 0.2s;
    }
    .login-back-home:hover {
      background: rgba(22, 101, 52, 0.08);
      text-decoration: none;
    }
    .auth-portal-footer a {
      padding: 2px 4px;
      border-radius: 4px;
    }
    .auth-portal-footer a:hover {
      background: rgba(22, 101, 52, 0.08);
      text-decoration: none;
    }

    body[data-auth-page="signin"] .login-right-col,
    body[data-auth-page="signup"] .login-right-col {
      background: transparent;
      padding-bottom: 72px;
    }

    /* Sign-in only: lock page scroll. */
    body[data-auth-page="signin"] {
      overflow: hidden;
      height: 100vh;
      max-height: 100dvh;
    }

    body[data-auth-page="signin"] .login-right-col {
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: center;
      overflow-x: hidden;
      overflow-y: auto;
      min-height: 100%;
      height: 100%;
      padding: 28px 24px 32px;
      box-sizing: border-box;
    }

    body[data-auth-page="signin"] .login-right-col .auth-portal-card {
      margin: auto;
      flex: 0 0 auto;
    }

    /* Sign-up: scroll the right column (outside the card); no inner box scroll. */
    body[data-auth-page="signup"] {
      overflow: hidden;
      height: 100vh;
      max-height: 100dvh;
      background: linear-gradient(90deg, #ffffff 0%, #ffffff 40%, #fafefa 40%, #f4fbf7 72.5%, #ecfdf5 100%);
    }

    /* Full-height solid white on the left half only (signup). */
    body[data-auth-page="signup"]::before {
      content: '';
      position: fixed;
      top: 0;
      left: 0;
      width: 40%;
      height: 100vh;
      height: 100dvh;
      background: #ffffff;
      z-index: 0;
      pointer-events: none;
    }

    body[data-auth-page="signup"] .login-right-col {
      overflow-x: hidden;
      overflow-y: auto;
      -webkit-overflow-scrolling: touch;
      display: flex;
      flex-direction: column;
      align-items: center;
      justify-content: flex-start;
      height: 100%;
      min-height: 0;
      box-sizing: border-box;
      scrollbar-width: thin;
      scrollbar-color: #64748b #e2e8f0;
    }

    body[data-auth-page="signup"] .login-right-col::-webkit-scrollbar {
      width: 8px;
    }

    body[data-auth-page="signup"] .login-right-col::-webkit-scrollbar-track {
      background: #e2e8f0;
      border-radius: 4px;
    }

    body[data-auth-page="signup"] .login-right-col::-webkit-scrollbar-thumb {
      background: #64748b;
      border-radius: 4px;
    }

    body[data-auth-page="signup"] .login-right-col::-webkit-scrollbar-thumb:hover {
      background: #475569;
    }

    body[data-auth-page="signup"] .login-right-col .auth-portal-card.auth-portal-signup {
      flex: 0 0 auto;
      width: 100%;
    }

    body[data-auth-page="signup"] .auth-portal-card.auth-portal-signup {
      height: auto;
      max-height: none;
      overflow: visible;
    }

    body[data-auth-page="signup"] #panel-signup,
    body[data-auth-page="signup"] .signup-form-scroll,
    body[data-auth-page="signup"] #panel-signup-student,
    body[data-auth-page="signup"] #panel-signup-instructor {
      overflow: visible;
    }

    @media (max-width: 960px) {
      body[data-auth-page="signin"] .login-split {
        overflow: hidden;
      }
      body[data-auth-page="signin"] #page-login.page-active {
        height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
      }
      .login-split {
        grid-template-columns: 1fr;
        overflow-y: auto;
      }
      #page-login.page-active {
        height: auto;
        max-height: none;
        overflow: visible;
      }
      .login-brand-panel {
        height: auto;
        min-height: auto;
        border-right: none;
        border-bottom: 1px solid var(--border);
        padding: 32px 28px;
      }
      .auth-brand-panel::before {
        width: 100%;
        height: 4px;
        top: 0;
        left: 0;
        right: 0;
        bottom: auto;
      }
      .auth-brand-panel--signup::before,
      body[data-auth-page="signin"] .auth-brand-panel::before {
        display: none;
      }
      .auth-brand-legal {
        margin-top: 20px;
      }
      .login-right-col {
        height: auto;
        min-height: 50vh;
        padding: 28px 20px 40px;
      }
      body[data-auth-page="signin"] .login-right-col {
        overflow-y: hidden;
      }
      body[data-auth-page="signup"] #page-login.page-active {
        height: 100vh;
        max-height: 100dvh;
        overflow: hidden;
      }
      body[data-auth-page="signup"] .login-split {
        overflow: hidden;
        grid-template-rows: auto minmax(0, 1fr);
      }
      body[data-auth-page="signup"] .login-right-col {
        overflow-y: auto;
        min-height: 0;
        max-height: none;
        display: flex;
        flex-direction: column;
      }
      body[data-auth-page="signin"] .login-split::before,
      body[data-auth-page="signup"] .login-split::before {
        display: none;
      }
      body[data-auth-page="signup"]::before {
        display: none;
      }
      body[data-auth-page="signup"] {
        background: linear-gradient(165deg, #fafefa 0%, #f4fbf7 45%, #ecfdf5 100%);
      }
      body[data-auth-page="signin"] .portal-bg-layers,
      body[data-auth-page="signup"] .portal-bg-layers {
        clip-path: none;
      }
      body[data-auth-page="signin"] .login-brand-panel.auth-brand-panel,
      body[data-auth-page="signup"] .login-brand-panel.auth-brand-panel {
        min-height: auto;
        width: 100%;
      }
      .auth-form-row-2 {
        grid-template-columns: 1fr;
      }
    }

    @media (max-width: 480px) {
      .auth-portal-card,
      .auth-portal-card.auth-portal-signup {
        padding: 28px 22px 24px;
        border-radius: 20px;
      }
      .auth-brand-title {
        font-size: 1.85rem;
      }
    }