/* ==========================================================================
   Auth pages — split-screen brand panel + form panel
   ========================================================================== */

.auth-shell { min-height: 100vh; display: flex; }
/* Auth pages fill exactly one screen and the page itself never scrolls; on a very short window
   only the form column scrolls, so nothing is ever cut off. */
html:has(.auth-shell), html:has(.auth-shell) body { height: 100%; overflow: hidden; }
.auth-shell { height: 100vh; height: 100dvh; min-height: 0; }

/* ---------------------------------- Brand panel (desktop only) ---------------------------------- */
.auth-brand-panel {
  flex: 0 0 44%;
  max-width: 560px;
  background: var(--gradient-brand);
  position: relative;
  overflow: hidden;
  padding: var(--space-10);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  gap: var(--space-8);
  color: #fff;
}
.auth-brand-content { margin: auto 0; }
.auth-brand-panel::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255, 255, 255, 0.14) 1px, transparent 1px);
  background-size: 22px 22px;
  opacity: 0.5;
}
.auth-brand-logo, .auth-brand-content, .auth-brand-quote { position: relative; z-index: 1; }
.auth-brand-logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: var(--fs-lg); }
.auth-brand-logo .brand-badge { background: rgba(255, 255, 255, 0.18); box-shadow: none; }

.auth-brand-content h2 { color: #fff; font-size: var(--fs-3xl); margin-top: var(--space-6); }
.auth-brand-content p { color: rgba(255, 255, 255, 0.78); margin-top: var(--space-3); }

.auth-benefit-list { display: flex; flex-direction: column; gap: var(--space-4); margin-top: var(--space-8); }
.auth-benefit-item { display: flex; gap: var(--space-3); align-items: flex-start; }
.auth-benefit-item .abi-icon {
  width: 34px; height: 34px; border-radius: 10px; flex-shrink: 0;
  background: rgba(255, 255, 255, 0.16); display: flex; align-items: center; justify-content: center;
}
.auth-benefit-item span:last-child { color: rgba(255, 255, 255, 0.9); font-size: var(--fs-sm); font-weight: 600; padding-top: 6px; }

.auth-brand-quote { border-top: 1px solid rgba(255, 255, 255, 0.2); padding-top: var(--space-6); }
.auth-brand-quote p { color: rgba(255, 255, 255, 0.9); font-size: var(--fs-base); font-style: italic; }
.auth-brand-quote .quote-person { display: flex; align-items: center; gap: var(--space-3); margin-top: var(--space-4); }
.auth-brand-quote .quote-person .avatar-modern { background: rgba(255, 255, 255, 0.18); }

/* ---------------------------------- Form panel ---------------------------------- */
.auth-form-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: safe center;
  padding: 76px var(--space-6) var(--space-6);
  position: relative;
  height: 100%;
  overflow-y: auto;
}
.auth-form-topbar {
  position: absolute;
  top: var(--space-6); left: var(--space-6); right: var(--space-6);
  display: flex; align-items: center; justify-content: space-between;
}
.auth-form-topbar .brand-mark { font-size: var(--fs-base); }
.auth-form-topbar .brand-mark .brand-badge { width: 32px; height: 32px; font-size: 1rem; border-radius: 9px; }

.auth-card { width: 100%; max-width: 440px; }
.auth-card .auth-eyebrow-icon {
  width: 52px; height: 52px; border-radius: var(--radius-lg); background: var(--brand-50); color: var(--brand-600);
  display: flex; align-items: center; justify-content: center; font-size: 1.4rem; margin-bottom: var(--space-5);
}
[data-theme="dark"] .auth-card .auth-eyebrow-icon { background: rgba(29, 81, 163, 0.14); color: var(--brand-400); }

.auth-card h1 { font-size: var(--fs-3xl); }
.auth-card .auth-subtitle { margin-top: var(--space-2); }

.auth-divider { display: flex; align-items: center; gap: var(--space-3); color: var(--text-tertiary); font-size: var(--fs-xs); font-weight: 600; margin: var(--space-5) 0; text-transform: uppercase; letter-spacing: 0.04em; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--border-subtle); }

.auth-social-row { display: flex; gap: var(--space-3); }
.auth-social-btn {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: 0.7rem; border-radius: var(--radius-md); border: 1px solid var(--border-default);
  background: var(--bg-surface); color: var(--text-primary); font-weight: 600; font-size: var(--fs-sm);
  cursor: pointer; transition: all var(--dur-fast);
}
.auth-social-btn:hover { border-color: var(--border-strong); transform: translateY(-2px); box-shadow: var(--shadow-sm); }

.auth-footer-link { text-align: center; margin-top: var(--space-6); font-size: var(--fs-sm); color: var(--text-secondary); }
.auth-footer-link a { color: var(--brand-600); font-weight: 700; }
[data-theme="dark"] .auth-footer-link a { color: var(--brand-400); }

/* ---------------------------------- Password field ---------------------------------- */
.password-field-wrap { position: relative; }
.password-field-wrap .form-control-modern { padding-right: 2.8rem; }
.password-toggle-btn {
  position: absolute; right: 0.9rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--text-tertiary); cursor: pointer; padding: 4px;
}
.password-toggle-btn:hover { color: var(--text-primary); }

.password-strength { display: flex; gap: 4px; margin-top: var(--space-2); }
.password-strength-bar { height: 4px; flex: 1; border-radius: var(--radius-full); background: var(--bg-surface-2); transition: background var(--dur-fast); }
.password-strength-label { font-size: var(--fs-xs); font-weight: 700; margin-top: 6px; }

/* ---------------------------------- OTP input ---------------------------------- */
.otp-input-group { display: flex; gap: var(--space-3); justify-content: center; }
.otp-box {
  width: 54px; height: 62px; text-align: center; font-size: 1.5rem; font-weight: 800;
  border-radius: var(--radius-md); border: 1.5px solid var(--border-default); background: var(--bg-surface); color: var(--text-primary);
  transition: border-color var(--dur-fast), box-shadow var(--dur-fast);
}
.otp-box:focus { outline: none; border-color: var(--brand-500); box-shadow: 0 0 0 4px var(--brand-50); }
[data-theme="dark"] .otp-box:focus { box-shadow: 0 0 0 4px rgba(29, 81, 163, 0.16); }
@media (max-width: 420px) { .otp-box { width: 44px; height: 54px; font-size: 1.25rem; } }

/* ---------------------------------- Success / sent state ---------------------------------- */
.auth-success-icon {
  width: 76px; height: 76px; border-radius: 50%; background: var(--success-100); color: var(--success-500);
  display: flex; align-items: center; justify-content: center; font-size: 2rem; margin: 0 auto var(--space-5);
}
[data-theme="dark"] .auth-success-icon { background: rgba(18, 183, 106, 0.15); }

/* ---------------------------------- Responsive ---------------------------------- */
@media (max-width: 991px) {
  .auth-brand-panel { display: none; }
  .auth-form-panel { padding-top: 72px; }
}

/* Shorter screens (small laptops, phones): a more compact form so it still fits on one screen. */
@media (max-height: 820px), (max-width: 575px) {
  .auth-form-panel { padding-top: 64px; padding-bottom: var(--space-4); }
  .auth-card h1 { font-size: var(--fs-2xl); }
  .auth-card .form-control-modern { padding-top: .6rem; padding-bottom: .6rem; }
  .auth-card .form-label-modern { margin-bottom: 4px; }
  .auth-card .btn-lg { padding-top: .7rem; padding-bottom: .7rem; }
  .auth-card .row.g-3 { --bs-gutter-y: .75rem; }
  .auth-card .password-strength-label { margin-top: 4px; }
  .auth-divider { margin: var(--space-4) 0; }
  .auth-social-btn { padding: .55rem; }
  .auth-footer-link { margin-top: var(--space-4); }
}

/* ---------------------------------- Social sign-in (assets/js/social-auth.js) ---------------------------------- */
.auth-social-row[hidden], .auth-divider[hidden], .auth-social-btn[hidden], .auth-sso-form[hidden] { display: none !important; }
.auth-sso-form { margin-top: var(--space-4); }
.auth-sso-fields { display: flex; gap: var(--space-2); }
.auth-sso-fields .form-control-modern { flex: 1; }
.auth-sso-hint { margin: 6px 0 0; font-size: var(--fs-xs); color: var(--text-tertiary); }
.auth-social-finish .asf-who { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-3) var(--space-4); border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--bg-surface); }
.asf-avatar { width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--brand-500); color: #fff; font-weight: 800; }
.asf-who strong { display: block; font-size: var(--fs-sm); }
.asf-who small { display: block; font-size: var(--fs-xs); color: var(--text-tertiary); }
.asf-note { margin: var(--space-4) 0; font-size: var(--fs-sm); color: var(--text-secondary); }

/* ---------------------------------- Code on WhatsApp (assets/js/otp-whatsapp.js) ---------------------------------- */
.otp-wa[hidden] { display: none; }
.otp-wa .auth-divider { margin-top: var(--space-5); }
.otp-wa-btn { background: #25d366; border-color: #25d366; color: #fff; font-weight: 700; }
.otp-wa-btn:hover { background: #1ebe5b; border-color: #1ebe5b; color: #fff; }
.otp-wa-btn:disabled { opacity: .7; }
.otp-wa-note { margin: var(--space-2) 0 0; font-size: var(--fs-xs); color: var(--text-tertiary); }
.otp-wa-ok { color: #15803d; font-size: var(--fs-sm); }

/* ==========================================================================
   Split layout — Sign in and Create account (login.html, register.html)
   A large dark-navy story panel with playful shapes on the left, a calm white form on the right:
   Go back, a short greeting, square-cornered fields, pill buttons, "Or continue with" and a grey
   footer box. Scoped to .auth-split so the other auth pages keep their own look.
   ========================================================================== */
.auth-split .auth-hero {
  flex: 0 0 58%; position: relative; overflow: hidden; display: flex; align-items: center;
  padding: var(--space-10) var(--space-10) var(--space-10) clamp(48px, 18%, 300px);
  background:
    radial-gradient(60% 45% at 22% 112%, rgba(29, 81, 163, .75), transparent 70%),
    radial-gradient(45% 40% at 62% 118%, rgba(236, 28, 36, .38), transparent 70%),
    radial-gradient(40% 35% at 92% 108%, rgba(245, 165, 36, .22), transparent 70%),
    #0a1630;
  color: #fff;
}
.auth-hero-art { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }

/* The illustration: a radar watching over the school's devices, centred on the logo's eye. The sweep
   turns slowly and each device blip pings in turn; both stop for people who prefer less motion. */
.radar-rings circle { stroke: rgba(255, 255, 255, .09); stroke-width: 1.2; }
.radar-spokes line { stroke: rgba(255, 255, 255, .045); stroke-width: 1; }
.radar-sweep { animation: radar-spin 9s linear infinite; }
.radar-ping { transform-box: fill-box; transform-origin: center; opacity: 0; animation: radar-ping 3.6s ease-out infinite; animation-delay: var(--d, 0s); }
@keyframes radar-spin { to { transform: rotate(360deg); } }
@keyframes radar-ping { 0% { transform: scale(1); opacity: .9; } 70%, 100% { transform: scale(3.6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  .radar-sweep, .radar-ping { animation: none; }
}
.auth-hero-content { position: relative; z-index: 1; max-width: 600px; }
.auth-hero-logo { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-weight: 800; font-size: var(--fs-base); }
.auth-hero-logo .brand-badge { width: 32px; height: 32px; font-size: 1rem; border-radius: 9px; background: rgba(255, 255, 255, .16); box-shadow: none; }
.auth-hero-logo .brand-logo-wide { height: 34px; max-width: 220px; transform: translateX(-10.7%); }  /* the uploaded logo has ~11% empty space on its left; line it up with the headline */
.auth-hero h2 {
  margin-top: var(--space-6); color: #fff; font-weight: 300; letter-spacing: -0.015em;
  font-size: clamp(2.3rem, 3.5vw, 3.5rem); line-height: 1.16; text-wrap: balance;
}
.auth-hero p { margin-top: var(--space-6); color: rgba(255, 255, 255, .88); font-size: clamp(1rem, 1.25vw, 1.2rem); line-height: 1.55; max-width: 34em; }

/* the form side */
.auth-split .auth-form-panel { background: var(--bg-surface); align-items: stretch; padding: 48px clamp(24px, 4.5vw, 64px) 32px; }
.auth-split .auth-card { max-width: 568px; }
.auth-split .auth-card h1 { font-size: 2rem; font-weight: 500; letter-spacing: -0.01em; }
.auth-split .auth-card .auth-subtitle { margin-top: 6px; font-size: var(--fs-base); }
.auth-split .form-label-modern { font-weight: 500; font-size: var(--fs-sm); margin-bottom: 6px; }
.auth-split .form-label-modern .req { color: var(--text-tertiary); margin-left: 2px; }
.auth-split .form-control-modern { border-radius: 6px; border: 1px solid var(--border-strong); background: var(--bg-surface); box-shadow: none; }
.auth-split .form-control-modern:focus { border-color: var(--brand-500); box-shadow: inset 0 0 0 1px var(--brand-500); }
[data-theme="dark"] .auth-split .form-control-modern:focus { box-shadow: inset 0 0 0 1px var(--brand-400); border-color: var(--brand-400); }
.auth-field-link { display: block; margin-top: 10px; text-align: right; font-size: var(--fs-sm); font-weight: 500; color: var(--brand-600); }
[data-theme="dark"] .auth-field-link { color: var(--brand-400); }

.auth-submit {
  align-self: flex-start; min-width: 200px; height: 44px; padding: 0 32px; border-radius: 999px; border: 0;
  background: var(--brand-500); color: #fff; font-weight: 700; font-size: var(--fs-base);
  transition: background var(--dur-fast), box-shadow var(--dur-fast);
}
.auth-submit:hover { background: var(--brand-600); box-shadow: var(--shadow-brand); }
.auth-submit:disabled { opacity: .75; }

/* "Or continue with ——————" */
.auth-split .auth-divider { margin: var(--space-8) 0 var(--space-5); text-transform: none; letter-spacing: 0; font-size: var(--fs-sm); font-weight: 500; color: var(--text-secondary); }
.auth-split .auth-divider::before { display: none; }
.auth-split .auth-social-row { flex-wrap: wrap; }
.auth-split .auth-social-btn { flex: 0 0 auto; min-width: 170px; padding: .65rem 1.4rem; border-radius: 999px; border: 1.5px solid var(--border-strong); font-weight: 700; }
.auth-split .auth-social-btn:hover { transform: none; border-color: var(--text-secondary); }

/* "Don't have an account? Sign up" */
.auth-split .auth-footer-link { margin-top: var(--space-10); padding: 22px 24px; text-align: left; border-radius: 4px; background: var(--bg-surface-2); font-size: var(--fs-base); color: var(--text-primary); }

.auth-hero-art-sm { display: none; }

/* Phones and tablets: the story panel becomes a short banner (artwork either side, logo in the
   middle) above the form, the page scrolls normally, and the form's actions are centred. */
@media (max-width: 991px) {
  html:has(.auth-split), html:has(.auth-split) body { height: auto; overflow: auto; }
  .auth-split { flex-direction: column; height: auto; min-height: 100vh; min-height: 100dvh; }
  .auth-split .auth-hero { flex: 0 0 auto; height: 120px; padding: 0; justify-content: center; }
  .auth-split .auth-hero-art { display: none; }
  .auth-hero-art-sm { display: block; position: absolute; top: 0; left: 0; width: 50%; height: 100%; pointer-events: none; }
  .auth-hero-art-sm.is-right { left: auto; right: 0; transform: scaleX(-1); }
  .auth-split .auth-hero-content { text-align: center; }
  .auth-split .auth-hero h2, .auth-split .auth-hero p { display: none; }
  .auth-split .auth-hero-logo .brand-logo-wide { height: 32px; transform: none; }
  .auth-split .auth-form-panel { height: auto; overflow: visible; padding: 32px 24px 32px; justify-content: flex-start; }
  .auth-split .auth-card { margin: 0 auto; }
  .auth-submit { align-self: center; }
  .auth-split .auth-divider { justify-content: center; }
  .auth-split .auth-divider::after { display: none; }
  .auth-split .auth-social-row { justify-content: center; }
  .auth-split .auth-social-btn { min-width: 140px; }
  .auth-split .auth-footer-link { text-align: center; }
}
@media (max-height: 820px), (max-width: 575px) {
  .auth-split .auth-card h1 { font-size: 1.75rem; }
  .auth-split .auth-divider { margin: var(--space-5) 0 var(--space-4); }
  .auth-split .auth-footer-link { margin-top: var(--space-6); padding: 16px 20px; }
}

/* ---------------------------------- Code page (two-factor.html at /verify/<challenge>) ---------------------------------- */
html.sg-otp-wait body { visibility: hidden; }   /* until the server confirms this one-off address */
.auth-split .otp-input-group.otp-start { justify-content: flex-start; gap: 10px; margin-top: 2px; }
.auth-split .otp-box { border-radius: 6px; border-color: var(--border-strong); }
.auth-text-btn { display: inline-block; margin-top: 12px; padding: 0; border: 0; background: none; color: var(--brand-600); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.auth-text-btn:hover { text-decoration: underline; }
.auth-text-btn:disabled { color: var(--text-tertiary); cursor: default; text-decoration: none; }
[data-theme="dark"] .auth-text-btn { color: var(--brand-400); }
.auth-split .otp-wa .auth-social-btn { min-width: 220px; }
@media (max-width: 991px) {
  .auth-split .otp-input-group.otp-start { justify-content: center; }
  .auth-split #otpForm .form-label-modern, .auth-split #otpForm .auth-text-btn { display: block; width: 100%; text-align: center; }
  .auth-split .otp-wa { text-align: center; }
}

/* Two-factor set-up (pages/auth/setup-2fa.html) */
.tfa-steps { padding-left: 1.2rem; margin: var(--space-4) 0 var(--space-2); color: var(--text-secondary); font-size: var(--fs-sm); }
.tfa-qr { width: 184px; height: 184px; padding: 8px; border-radius: var(--radius-md); background: #fff; border: 1px solid var(--border-subtle); }
.tfa-qr svg { width: 100%; height: 100%; display: block; }
.tfa-key { margin-top: var(--space-2); font-size: var(--fs-sm); color: var(--text-secondary); }
.tfa-key summary { cursor: pointer; color: var(--brand-600); }
.tfa-key code { display: block; margin-top: 6px; padding: 8px 10px; border-radius: var(--radius-md); background: var(--bg-surface-2); color: var(--text-primary); letter-spacing: .08em; word-break: break-all; }
.tfa-code { font-size: 1.4rem; letter-spacing: .3em; text-align: center; max-width: 220px; }
.tfa-codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; list-style: none; padding: 0; margin: var(--space-4) 0; }
.tfa-codes code { display: block; padding: 8px 10px; border-radius: var(--radius-md); background: var(--bg-surface-2); color: var(--text-primary); font-size: var(--fs-base); text-align: center; letter-spacing: .06em; }
.tfa-saved { display: flex; gap: 8px; align-items: center; margin: var(--space-4) 0 var(--space-3); font-size: var(--fs-sm); }
