/* ==========================================================================
   Planexa — authentication surface (pages/login.html)
   --------------------------------------------------------------------------
   Design system deliberately mirrors the landing page (css/planexa.css):
   same indigo accent (#5B7CFA), same navy/slate neutrals, same radii, spacing
   and easing. The landing page is dark-only; this page supports both themes,
   so every token below is themed through the `.auth-page` / `.dark` classes.

   Structure
     01  Tokens
     02  Reset + base
     03  Layout
     04  Brand + wordmark
     05  Marketing (left) panel
     06  Form (right) panel
     07  Inputs
     08  Buttons
     09  Segmented tabs
     10  Saved-account switcher
     11  Password strength meter
     12  Status messages, alerts, dividers
     13  App-lock dialog
     14  Motion
     15  Responsive
   Editing guide: change a colour/radius/spacing once in section 01 — nothing
   below hard-codes a hex value except the semantic strength colours in 11.
   ========================================================================== */

/* ==========================================================================
   01  Tokens
   ========================================================================== */
.auth-page {
  /* Surfaces */
  --a-bg: #F6F8FC;
  --a-surface: #FFFFFF;
  --a-surface-2: #F1F4FA;
  --a-surface-3: #E8ECF5;
  --a-marketing: linear-gradient(160deg, #070E24 0%, #0A1533 42%, #0C1B45 100%);

  /* Borders */
  --a-border: #DFE5F0;
  --a-border-soft: #E9EDF6;
  --a-border-strong: #C6D0E4;

  /* Text */
  --a-text: #0B1220;
  --a-text-soft: #33405A;
  --a-text-muted: #5A6782;
  --a-text-faint: #8A94AA;

  /* Accent — identical to the landing page accent */
  --a-accent: #4A6BF0;
  --a-accent-hover: #3D5CE0;
  --a-accent-soft: #EDF1FE;
  --a-accent-soft-2: rgba(74, 107, 240, 0.14);
  --a-accent-border: #C3CFFB;
  --a-accent-text: #3D5CE0;
  --a-on-accent: #FFFFFF;

  /* Marketing panel (always dark, on both themes) */
  --a-on-dark: #FFFFFF;
  --a-on-dark-soft: #C6CFE2;
  --a-on-dark-muted: #95A1BC;
  --a-on-dark-faint: #7481A0;
  --a-on-dark-border: rgba(255, 255, 255, 0.12);
  --a-on-dark-surface: rgba(255, 255, 255, 0.055);

  /* Semantic */
  --a-green: #16A34A;
  --a-green-soft: #ECFDF3;
  --a-amber: #B45309;
  --a-amber-soft: #FEF6E7;
  --a-red: #DC2626;
  --a-red-soft: #FEF2F2;
  --a-violet: #7C5CF6;

  /* Elevation */
  --a-shadow-sm: 0 1px 2px rgba(11, 18, 32, 0.05);
  --a-shadow-md: 0 10px 30px -12px rgba(11, 18, 32, 0.18);
  --a-shadow-lg: 0 40px 90px -40px rgba(7, 14, 36, 0.35);
  --a-ring: 0 0 0 4px var(--a-accent-soft-2);

  /* Radii */
  --a-r-xs: 4px;
  --a-r-sm: 8px;
  --a-r-md: 10px;
  --a-r-lg: 12px;
  --a-r-xl: 16px;
  --a-r-2xl: 20px;
  --a-r-shell: 24px;
  --a-r-pill: 999px;

  /* Spacing */
  --a-1: 4px;
  --a-2: 8px;
  --a-3: 12px;
  --a-4: 16px;
  --a-5: 20px;
  --a-6: 24px;
  --a-8: 32px;
  --a-10: 40px;
  --a-12: 48px;

  /* Type */
  --a-font: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;

  /* Motion */
  --a-t-fast: 140ms cubic-bezier(0.4, 0, 0.2, 1);
  --a-t: 200ms cubic-bezier(0.4, 0, 0.2, 1);
  --a-t-slow: 320ms cubic-bezier(0.16, 1, 0.3, 1);

  color-scheme: light;
  font-family: var(--a-font);
}

.dark .auth-page {
  --a-bg: #070B12;
  --a-surface: #0D1420;
  --a-surface-2: #111A28;
  --a-surface-3: #16202F;

  --a-border: #1B2637;
  --a-border-soft: #16202F;
  --a-border-strong: #263449;

  --a-text: #F2F5F9;
  --a-text-soft: #C3CCDA;
  --a-text-muted: #8B97A9;
  --a-text-faint: #64748B;

  --a-accent: #5B7CFA;
  --a-accent-hover: #6E8CFF;
  --a-accent-soft: rgba(91, 124, 250, 0.12);
  --a-accent-soft-2: rgba(91, 124, 250, 0.22);
  --a-accent-border: rgba(91, 124, 250, 0.34);
  --a-accent-text: #9DB0FF;
  --a-on-accent: #FFFFFF;

  --a-green: #3FB984;
  --a-green-soft: rgba(63, 185, 132, 0.12);
  --a-amber: #D6A14A;
  --a-amber-soft: rgba(214, 161, 74, 0.12);
  --a-red: #F87171;
  --a-red-soft: rgba(248, 113, 113, 0.12);

  --a-shadow-sm: 0 1px 2px rgba(2, 6, 23, 0.4);
  --a-shadow-md: 0 12px 34px -14px rgba(2, 6, 23, 0.8);
  --a-shadow-lg: 0 50px 100px -50px rgba(2, 6, 23, 0.95);

  color-scheme: dark;
}

/* ==========================================================================
   02  Reset + base
   ========================================================================== */
.auth-page,
.auth-page *,
.auth-page *::before,
.auth-page *::after {
  box-sizing: border-box;
}

.auth-page {
  margin: 0;
  padding: clamp(8px, 1.6vw, 20px);
  min-height: 100vh;
  min-height: 100dvh;
  background-color: var(--a-bg);
  color: var(--a-text);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color var(--a-t), color var(--a-t);
}

.auth-page h1,
.auth-page h2,
.auth-page h3,
.auth-page p,
.auth-page ul,
.auth-page li { margin: 0; padding: 0; }

.auth-page ul { list-style: none; }
.auth-page img { display: block; max-width: 100%; height: auto; }
/* `font: inherit` is a shorthand and would reset size/weight on every button,
   out-ranking later single-class rules. Use a zero-specificity reset so each
   button's own class still owns its size, weight and colour. */
.auth-page :where(button) {
  font: inherit;
  color: inherit;
  background: none;
}
.auth-page a { color: inherit; text-decoration: none; }

.auth-page :focus-visible {
  outline: 2px solid var(--a-accent);
  outline-offset: 2px;
  border-radius: var(--a-r-sm);
}

/* Utility visibility helpers. js/login.js toggles `hidden` on the theme
   sun/moon icons; without this rule the class was a no-op and both icons
   rendered at once. */
.hidden {
  display: none;
}

/* Visually hidden, but still announced by screen readers. Used by the
   email-field hint and the app-lock label, which would otherwise render as
   visible body copy. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}



.auth-page ::selection {
  background: var(--a-accent-soft-2);
  color: var(--a-text);
}

.auth-card__foot,
.auth-badge { color: var(--a-text-muted); }

/* ==========================================================================
   03  Layout
   ========================================================================== */
.auth-shell {
  width: 100%;
  max-width: 1380px;
  margin-inline: auto;
  min-height: calc(100vh - 2 * clamp(8px, 1.6vw, 20px));
  min-height: calc(100dvh - 2 * clamp(8px, 1.6vw, 20px));
  display: grid;
  grid-template-columns: minmax(0, 1.02fr) minmax(0, 1fr);
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-shell);
  background: var(--a-surface);
  box-shadow: var(--a-shadow-lg);
  overflow: hidden;
  transition: background-color var(--a-t), border-color var(--a-t);
}

.auth-skip-link {
  position: absolute;
  left: var(--a-4);
  top: -64px;
  z-index: 100;
  padding: 10px 16px;
  border-radius: var(--a-r-sm);
  background: var(--a-accent);
  color: #fff;
  font-size: 0.875rem;
  font-weight: 600;
  transition: top var(--a-t);
}
.auth-skip-link:focus { top: var(--a-4); }

/* ==========================================================================
   04  Brand + wordmark
   ========================================================================== */
.auth-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1.0625rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--a-text);
}

.auth-brand__mark {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: linear-gradient(150deg, var(--a-accent), #4358D6);
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.auth-brand__mark svg { width: 18px; height: 18px; }

/* Real logo image variant: keeps its own artwork instead of the icon
   gradient plate (see pages/login.html .auth-brand). */
img.auth-brand__mark {
  object-fit: contain;
  background: none;
  box-shadow: none;
}

.auth-brand--on-dark { color: var(--a-on-dark); }
.auth-brand--on-dark .auth-brand__mark {
  background: rgba(255, 255, 255, 0.12);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16);
}

/* ==========================================================================
   05  Marketing (left) panel
   ========================================================================== */
.auth-marketing {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: var(--a-10);
  padding: clamp(32px, 4vw, 56px);
  background: var(--a-marketing);
  color: var(--a-on-dark);
  isolation: isolate;
}

/* Single soft accent glow, matching the landing hero. */
.auth-marketing::before {
  content: '';
  position: absolute;
  top: -240px;
  left: -160px;
  width: 900px;
  height: 700px;
  background: radial-gradient(closest-side, rgba(91, 124, 250, 0.22), transparent 72%);
  pointer-events: none;
  z-index: -1;
}

.auth-marketing__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 78%);
  -webkit-mask-image: radial-gradient(circle at 30% 20%, #000 0%, transparent 78%);
  pointer-events: none;
  z-index: -1;
}

.auth-marketing__head { position: relative; display: flex; flex-direction: column; gap: var(--a-6); }
.auth-marketing__body { position: relative; display: flex; flex-direction: column; gap: var(--a-6); }

.auth-headline {
  font-size: clamp(1.9rem, 3.1vw, 2.6rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.032em;
  color: var(--a-on-dark);
}
.auth-headline em { font-style: normal; color: #9DB0FF; }

.auth-marketing__lead {
  max-width: 44ch;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--a-on-dark-muted);
}

.auth-benchmarks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--a-3);
  padding: var(--a-5);
  border: 1px solid var(--a-on-dark-border);
  border-radius: var(--a-r-xl);
  background: var(--a-on-dark-surface);
}
.auth-benchmarks__item { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.auth-benchmarks__value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--a-on-dark);
}
.auth-benchmarks__label {
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.45;
  color: var(--a-on-dark-faint);
}
.auth-benchmarks__note {
  grid-column: 1 / -1;
  padding-top: var(--a-4);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.6875rem;
  color: var(--a-on-dark-faint);
}

.auth-points { position: relative; display: flex; flex-direction: column; gap: var(--a-3); }

.auth-point {
  display: flex;
  align-items: flex-start;
  gap: var(--a-3);
  padding: var(--a-4);
  border: 1px solid var(--a-on-dark-border);
  border-radius: var(--a-r-lg);
  background: var(--a-on-dark-surface);
  transition: border-color var(--a-t), background-color var(--a-t);
}
.auth-point:hover { border-color: rgba(91, 124, 250, 0.4); background: rgba(91, 124, 250, 0.09); }

.auth-point__icon {
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 9px;
  background: rgba(91, 124, 250, 0.16);
  border: 1px solid rgba(91, 124, 250, 0.24);
  color: #9DB0FF;
}
.auth-point__icon svg { width: 16px; height: 16px; }

.auth-point__title { font-size: 0.8125rem; font-weight: 600; color: var(--a-on-dark); }
.auth-point__desc { margin-top: 2px; font-size: 0.75rem; line-height: 1.55; color: var(--a-on-dark-muted); }

.auth-marketing__foot {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--a-2) var(--a-4);
  padding-top: var(--a-5);
  border-top: 1px solid rgba(255, 255, 255, 0.09);
  font-size: 0.75rem;
  color: var(--a-on-dark-faint);
}
.auth-marketing__foot span { display: inline-flex; align-items: center; gap: 6px; }
.auth-marketing__foot svg { width: 13px; height: 13px; color: var(--a-green); flex-shrink: 0; }

/* ==========================================================================
   06  Form (right) panel
   ========================================================================== */
.auth-panel {
  display: flex;
  flex-direction: column;
  gap: var(--a-6);
  padding: clamp(24px, 3vw, 48px);
  background: var(--a-surface);
  overflow-y: auto;
  transition: background-color var(--a-t);
}

.auth-toolbar { display: flex; align-items: center; justify-content: space-between; gap: var(--a-4); }
.auth-toolbar__spacer { flex: 1; }
.auth-toolbar__actions { display: flex; align-items: center; gap: var(--a-2); }

.auth-panel__body {
  width: 100%;
  max-width: 440px;
  margin-inline: auto;
  margin-block: auto;
  display: flex;
  flex-direction: column;
  /* One generous step between the major blocks: tabs, heading, form,
     alternatives, footer. */
  gap: var(--a-6);
}

.auth-card__lead {
  max-width: 42ch;
  font-size: 0.875rem;
  line-height: 1.65;
  color: var(--a-text-muted);
}

.auth-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: var(--a-2);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--a-accent-text);
}
.auth-eyebrow::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--a-accent);
}

.auth-card__title {
  margin-top: var(--a-2);
  font-size: clamp(1.5rem, 2vw, 1.75rem);
  font-weight: 700;
  letter-spacing: -0.028em;
  line-height: 1.2;
  color: var(--a-text);
}

.auth-badge {
  display: inline-flex;
  align-items: flex-start;
  gap: 7px;
  align-self: flex-start;
  max-width: 100%;
  margin-top: var(--a-3);
  padding: 6px 12px;
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-lg);
  background: var(--a-surface-2);
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.5;
  color: var(--a-text-muted);
}
.auth-badge svg { width: 13px; height: 13px; flex-shrink: 0; }
.auth-badge[hidden] { display: none; }

.auth-card__foot {
  display: flex;
  flex-direction: column;
  gap: var(--a-3);
  padding-top: var(--a-5);
  border-top: 1px solid var(--a-border-soft);
  font-size: 0.8125rem;
  text-align: center;
}
.auth-card__foot-links { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--a-2) var(--a-5); }

.auth-link {
  font-weight: 600;
  color: var(--a-accent-text);
  transition: color var(--a-t);
}
.auth-link:hover { color: var(--a-accent-hover); }
.auth-link--quiet { color: var(--a-text-muted); font-weight: 500; font-size: 0.75rem; }
.auth-link--quiet:hover { color: var(--a-text); }

.auth-security-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--a-2);
  padding: 10px var(--a-4);
  border: 1px solid var(--a-border-soft);
  border-radius: var(--a-r-lg);
  background: var(--a-surface-2);
  font-size: 0.6875rem;
  color: var(--a-text-muted);
  text-align: center;
}
.auth-security-note svg { width: 14px; height: 14px; flex-shrink: 0; color: var(--a-text-faint); }

/* ==========================================================================
   07  Inputs
   ========================================================================== */
.auth-field { display: flex; flex-direction: column; gap: 7px; position: relative; }

.auth-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--a-3);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--a-text-soft);
}

.auth-control { position: relative; }

.auth-control__icon {
  position: absolute;
  inset-block: 0;
  left: 0;
  display: flex;
  align-items: center;
  padding-left: 13px;
  color: var(--a-text-faint);
  pointer-events: none;
  transition: color var(--a-t);
}
.auth-control__icon svg { width: 16px; height: 16px; }
.auth-control:focus-within .auth-control__icon { color: var(--a-accent); }

.auth-input {
  width: 100%;
  height: 48px;
  padding-inline: 40px var(--a-4);
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-lg);
  background: var(--a-surface-2);
  color: var(--a-text);
  font-family: inherit;
  /* 0.875rem (14px) made iOS Safari zoom the page on every field focus. */
  font-size: 1rem;
  transition: border-color var(--a-t), background-color var(--a-t), box-shadow var(--a-t);
}
.auth-input::placeholder { color: var(--a-text-faint); }
.auth-input:hover { border-color: var(--a-border-strong); }
.auth-input:focus {
  outline: none;
  border-color: var(--a-accent);
  background: var(--a-surface);
  box-shadow: var(--a-ring);
}
.auth-input--with-action { padding-right: 74px; }
.auth-input--plain { padding-inline: var(--a-4); }

.auth-control__action {
  position: absolute;
  inset-block: 0;
  right: 6px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding-inline: 4px;
}

.auth-text-btn {
  border: 0;
  background: transparent;
  padding: 6px 8px;
  border-radius: var(--a-r-sm);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--a-accent-text);
  cursor: pointer;
  transition: color var(--a-t), background-color var(--a-t);
}
.auth-text-btn:hover { color: var(--a-accent-hover); background: var(--a-accent-soft); }

.auth-chevron-btn {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: var(--a-r-sm);
  background: transparent;
  color: var(--a-text-faint);
  cursor: pointer;
  transition: color var(--a-t), background-color var(--a-t), transform var(--a-t);
}
.auth-chevron-btn:hover { color: var(--a-text); background: var(--a-surface-3); }
.auth-chevron-btn svg { width: 16px; height: 16px; }
.auth-chevron-btn[aria-expanded="true"] svg { transform: rotate(180deg); }

.auth-field__hint { font-size: 0.6875rem; color: var(--a-text-faint); }
.auth-field__msg { font-size: 0.75rem; font-weight: 500; }
.auth-field__msg.is-ok { color: var(--a-green); }
.auth-field__msg.is-bad { color: var(--a-red); }

/* The form is a single vertical rhythm: every field group is one step apart,
   so adding or removing a sign-up-only field never needs a spacing tweak. */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--a-5);
}

.auth-field-group {
  display: flex;
  flex-direction: column;
  gap: var(--a-5);
}
.auth-field-group[hidden] { display: none; }

.auth-row {
  display: flex;
  /* The checkbox label runs to two lines; centre the single-line action
     opposite it so the row reads as one balanced band. */
  align-items: center;
  justify-content: space-between;
  gap: var(--a-4);
  flex-wrap: wrap;
  /* Balanced breathing room above and below the primary action. */
  margin-top: var(--a-4);
  margin-bottom: var(--a-4);
}

/* A `hidden` attribute must win over the layout display above. Without this the
   row's own `display: flex` outranks the browser default for [hidden], so the
   "Resend verification email" row rendered for every user — including verified
   ones, on both the login and sign-up sides. Same guard as .auth-field-group. */
.auth-row[hidden] { display: none; }

.auth-check {
  display: inline-flex;
  align-items: flex-start;
  gap: var(--a-2);
  font-size: 0.75rem;
  color: var(--a-text-muted);
  cursor: pointer;
  user-select: none;
}
.auth-check input {
  width: 17px;
  height: 17px;
  margin: 0;
  flex-shrink: 0;
  accent-color: var(--a-accent);
  cursor: pointer;
  /* Native boxes inherit the page border/radius so they match the inputs. */
  border: 1px solid var(--a-border-strong);
  border-radius: var(--a-r-xs);
  appearance: none;
  display: grid;
  place-content: center;
  background: var(--a-surface);
  transition: background-color var(--a-t), border-color var(--a-t);
  /* Sit level with the first line of the two-line label. */
  margin-top: 2px;
}

.auth-check input::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 2px;
  transform: scale(0);
  transition: transform 0.12s ease-out;
  background: var(--a-on-accent);
}

.auth-check input:checked {
  background: var(--a-accent);
  border-color: var(--a-accent);
}

.auth-check input:checked::before {
  transform: scale(1);
}

.auth-check input:focus-visible {
  outline: 2px solid var(--a-accent);
  outline-offset: 2px;
}
.auth-check__text { display: flex; flex-direction: column; gap: 2px; }
.auth-check__text span:first-child { font-weight: 600; color: var(--a-text-soft); }
.auth-check__text span:last-child { font-size: 0.6875rem; color: var(--a-text-faint); }

/* ==========================================================================
   08  Buttons
   ========================================================================== */
.auth-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--a-2);
  height: 48px;
  width: 100%;
  padding-inline: var(--a-6);
  border: 1px solid transparent;
  border-radius: var(--a-r-lg);
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  letter-spacing: -0.005em;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--a-t), border-color var(--a-t), color var(--a-t),
    box-shadow var(--a-t), transform var(--a-t);
}
.auth-btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.auth-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none !important; }

.auth-btn--primary {
  background: var(--a-accent);
  color: var(--a-on-accent);
  box-shadow: var(--a-shadow-sm);
}
.auth-btn--primary:hover:not(:disabled) {
  background: var(--a-accent-hover);
  transform: translateY(-1px);
  box-shadow: 0 8px 22px -8px rgba(91, 124, 250, 0.6);
}

.auth-btn--secondary {
  background: var(--a-surface);
  border-color: var(--a-border);
  color: var(--a-text-soft);
}
.auth-btn--secondary:hover:not(:disabled) {
  border-color: var(--a-border-strong);
  color: var(--a-text);
  background: var(--a-surface-2);
}

.auth-btn--ghost {
  background: transparent;
  /* A soft border reads as a disabled control; this one is live, so it uses the
     same border weight as the secondary button but a quieter label. */
  border-color: var(--a-border);
  color: var(--a-text-soft);
  font-weight: 500;
}
.auth-btn--ghost:hover:not(:disabled) {
  color: var(--a-text);
  border-color: var(--a-border-strong);
  background: var(--a-surface-2);
}

.auth-btn__arrow { transition: transform var(--a-t); }
.auth-btn--primary:hover .auth-btn__arrow { transform: translateX(3px); }

.auth-icon-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-md);
  background: transparent;
  color: var(--a-text-muted);
  cursor: pointer;
  transition: color var(--a-t), background-color var(--a-t), border-color var(--a-t);
}
.auth-icon-btn:hover { color: var(--a-text); background: var(--a-surface-2); border-color: var(--a-border-strong); }
.auth-icon-btn svg { width: 16px; height: 16px; }
.auth-icon-btn[hidden] { display: none; }

/* ==========================================================================
   09  Segmented tabs
   ========================================================================== */
.auth-switch {
  position: relative;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--a-1);
  padding: var(--a-1);
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-xl);
  background: var(--a-surface-2);
  transition: background-color var(--a-t), border-color var(--a-t);
}

.auth-switch__btn {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 11px var(--a-3);
  border: 0;
  border-radius: var(--a-r-lg);
  background: transparent;
  color: var(--a-text-muted);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: color var(--a-t), background-color var(--a-t), box-shadow var(--a-t);
}
.auth-switch__btn:hover { color: var(--a-text-soft); }
.auth-switch__btn[aria-selected="true"] {
  background: var(--a-surface);
  color: var(--a-accent-text);
  box-shadow: var(--a-shadow-sm);
}
.dark .auth-switch__btn[aria-selected="true"] { background: var(--a-surface-3); color: var(--a-text); }

.auth-switch__title { font-size: 0.875rem; font-weight: 600; letter-spacing: -0.01em; }
.auth-switch__sub { font-size: 0.6875rem; font-weight: 500; opacity: 0.8; }

/* ==========================================================================
   10  Saved-account switcher
   ========================================================================== */
.auth-switcher {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 8px);
  z-index: 40;
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-xl);
  background: var(--a-surface);
  box-shadow: var(--a-shadow-md);
  overflow: hidden;
}
.auth-switcher[hidden] { display: none; }

.auth-switcher__list { max-height: 260px; overflow-y: auto; padding: var(--a-2); }
.auth-switcher__list::-webkit-scrollbar { width: 6px; }
.auth-switcher__list::-webkit-scrollbar-track { background: transparent; }
.auth-switcher__list::-webkit-scrollbar-thumb { background: var(--a-border-strong); border-radius: 3px; }

.auth-switcher__row {
  display: flex;
  align-items: center;
  gap: var(--a-3);
  padding: 9px 10px;
  border-radius: var(--a-r-md);
  cursor: pointer;
  transition: background-color var(--a-t-fast);
}
.auth-switcher__row:hover,
.auth-switcher__row:focus-visible { background: var(--a-surface-2); outline: none; }

.auth-switcher__avatar {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  overflow: hidden;
  background: var(--a-accent-soft);
  border: 1px solid var(--a-accent-border);
  color: var(--a-accent-text);
  font-size: 0.8125rem;
  font-weight: 600;
}
.auth-switcher__avatar img { width: 100%; height: 100%; object-fit: cover; }

.auth-switcher__meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.auth-switcher__name { font-size: 0.8125rem; font-weight: 600; color: var(--a-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.auth-switcher__email { font-size: 0.6875rem; color: var(--a-text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.auth-switcher__tag {
  flex-shrink: 0;
  padding: 2px 7px;
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-pill);
  font-size: 0.5625rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--a-text-faint);
}

.auth-switcher__remove {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: var(--a-r-sm);
  background: transparent;
  color: var(--a-text-faint);
  cursor: pointer;
  transition: color var(--a-t-fast), background-color var(--a-t-fast);
}
.auth-switcher__remove:hover { color: var(--a-red); background: var(--a-red-soft); }
.auth-switcher__remove svg { width: 14px; height: 14px; }

.auth-switcher__foot { border-top: 1px solid var(--a-border-soft); padding: 6px; }

.auth-switcher__add {
  width: 100%;
  display: flex;
  align-items: center;
  gap: var(--a-2);
  padding: 9px 10px;
  border: 0;
  border-radius: var(--a-r-md);
  background: transparent;
  color: var(--a-accent-text);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: background-color var(--a-t-fast);
}
.auth-switcher__add:hover { background: var(--a-accent-soft); }
.auth-switcher__add svg { width: 14px; height: 14px; flex-shrink: 0; }

.auth-switcher__empty {
  padding: var(--a-4);
  font-size: 0.75rem;
  color: var(--a-text-faint);
  text-align: center;
}

/* ==========================================================================
   11  Password strength meter
   ========================================================================== */
.auth-strength { display: flex; flex-direction: column; gap: 8px; }

/* A `hidden` attribute must win over the layout display above, otherwise the
   strength meter leaks into login mode. Same guard as .auth-field-group. */
.auth-strength[hidden] { display: none; }

.auth-strength__track {
  height: 6px;
  width: 100%;
  border-radius: var(--a-r-pill);
  background: var(--a-surface-3);
  overflow: hidden;
}
.auth-strength__bar {
  height: 100%;
  width: 0;
  border-radius: var(--a-r-pill);
  background: var(--a-red);
  transition: width var(--a-t-slow), background-color var(--a-t);
}

.auth-strength__meta { display: flex; align-items: center; justify-content: space-between; gap: var(--a-3); }
.auth-strength__text { font-size: 0.6875rem; font-weight: 600; }
.auth-strength__hint { font-size: 0.6875rem; color: var(--a-text-faint); }

.auth-strength__feedback {
  display: flex;
  flex-wrap: wrap;
  gap: 4px var(--a-3);
  font-size: 0.6875rem;
  color: var(--a-text-muted);
}
.auth-strength__feedback li { display: inline-flex; align-items: center; gap: 5px; }
.auth-strength__feedback li::before {
  content: '';
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: var(--a-text-faint);
  flex-shrink: 0;
}
.auth-strength__feedback[hidden] { display: none; }

/* Password requirements checklist */
.auth-requirements {
  margin-top: var(--a-3);
}

.auth-requirements[hidden] {
  display: none;
}

.auth-requirements__title {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--a-text-muted);
  margin-bottom: 4px;
}

.auth-requirements__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 8px;
  font-size: 0.75rem;
  color: var(--a-text-muted);
}

.auth-requirements__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-requirements__item.met {
  color: var(--a-text);
}

.auth-requirements__icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--a-text-faint);
}

.auth-requirements__item.met .auth-requirements__icon {
  color: var(--a-emerald-600, #16a34a);
}

/* The confirm-match message is hidden until the user types, but an empty
   element still occupies a row. Guard it the same way as the strength meter so
   no blank line shows under the field in sign-up mode. */
.auth-field__msg[hidden] { display: none; }
.auth-field__msg:empty { display: none; }

/* ==========================================================================
   12  Status messages, alerts, dividers
   ========================================================================== */
.auth-status {
  min-height: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  color: var(--a-text-muted);
}
.auth-status.is-error { color: var(--a-red); }
.auth-status.is-success { color: var(--a-green); }
.auth-status.is-busy { color: var(--a-text-muted); }

.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: var(--a-3);
  padding: var(--a-3) var(--a-4);
  border: 1px solid var(--a-accent-border);
  border-radius: var(--a-r-lg);
  background: var(--a-accent-soft);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--a-text-soft);
}
.auth-alert svg { width: 16px; height: 16px; flex-shrink: 0; margin-top: 1px; color: var(--a-accent-text); }
.auth-alert strong { display: block; margin-bottom: 2px; font-weight: 600; color: var(--a-text); }
.auth-alert[hidden] { display: none; }

.auth-divider {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  /* The divider carries the break between the primary action and the
     alternative routes, so it owns the space on both sides. */
  margin-block: var(--a-2);
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--a-text-faint);
}
.auth-divider::before {
  content: '';
  position: absolute;
  inset-inline: 0;
  top: 50%;
  /* Must stay visible against the panel surface, or the rule disappears. */
  border-top: 1px solid var(--a-border);
}
.auth-divider span { position: relative; padding-inline: var(--a-3); background: var(--a-surface); }

.auth-stack { display: flex; flex-direction: column; gap: var(--a-4); }
.auth-stack[hidden] { display: none; }

/* Guest access is a secondary route: it sits apart from the sign-in methods
   above it so the two never read as one block of buttons. The auth-panel's
   flex gap already provides 24px; no extra margin is needed. */
#guestBtn { margin-top: 0; }
#statusMessage:not(:empty) { margin-top: 0; }

/* ==========================================================================
   13  App-lock dialog
   ========================================================================== */
.auth-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--a-4);
  background: rgba(5, 9, 18, 0.68);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.auth-modal[hidden] { display: none; }

.auth-modal__card {
  width: 100%;
  max-width: 384px;
  padding: var(--a-6);
  border: 1px solid var(--a-border);
  border-radius: var(--a-r-2xl);
  background: var(--a-surface);
  box-shadow: var(--a-shadow-lg);
  text-align: center;
}

.auth-modal__icon {
  width: 52px;
  height: 52px;
  margin: 0 auto var(--a-4);
  display: grid;
  place-items: center;
  border-radius: var(--a-r-xl);
  background: var(--a-accent-soft);
  border: 1px solid var(--a-accent-border);
  color: var(--a-accent-text);
}
.auth-modal__icon svg { width: 22px; height: 22px; }

.auth-modal__title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; color: var(--a-text); }
.auth-modal__desc { margin-top: 6px; font-size: 0.75rem; line-height: 1.6; color: var(--a-text-muted); }
.auth-modal__body { margin-top: var(--a-5); display: flex; flex-direction: column; gap: var(--a-3); }
.auth-modal__error { font-size: 0.75rem; font-weight: 600; color: var(--a-red); }
.auth-modal__error[hidden] { display: none; }

/* The modal's passcode field is the only input on an otherwise empty card; give
   it the accent ring the rest of the form uses so the focus state is obvious. */
.auth-input--plain:focus {
  outline: none;
  border-color: var(--a-accent);
  background: var(--a-surface);
  box-shadow: var(--a-ring);
}
.auth-modal__actions { display: flex; gap: var(--a-2); }
.auth-modal__actions .auth-btn { height: 42px; font-size: 0.8125rem; }

/* Autofill styling so the native yellow/blue fill cannot break the palette. */
.auth-input:-webkit-autofill,
.auth-input:-webkit-autofill:hover,
.auth-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--a-text);
  box-shadow: 0 0 0 40px var(--a-surface-2) inset;
  caret-color: var(--a-text);
}

/* ==========================================================================
   14  Motion
   ========================================================================== */
@keyframes auth-fade-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes auth-pop {
  from { opacity: 0; transform: translateY(-6px) scale(0.99); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.auth-anim { animation: auth-fade-up 0.45s cubic-bezier(0.16, 1, 0.3, 1) both; }
.auth-anim--swap { animation: auth-fade-up 0.3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.auth-switcher:not([hidden]) { animation: auth-pop 0.16s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .auth-page *,
  .auth-page *::before,
  .auth-page *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}

/* ==========================================================================
   15  Responsive
   ========================================================================== */
@media (max-width: 1080px) {
  .auth-shell { grid-template-columns: 1fr; min-height: auto; }
  .auth-marketing { display: none; }
  .auth-panel { min-height: calc(100vh - 2 * clamp(8px, 1.6vw, 20px)); }
}

@media (max-width: 640px) {
  .auth-panel { padding: var(--a-5) var(--a-4) var(--a-6); gap: var(--a-5); }
  .auth-panel__body { max-width: 100%; }
  .auth-switch__sub { display: none; }
  .auth-benchmarks { grid-template-columns: 1fr 1fr; }
  .auth-modal__actions { flex-direction: column-reverse; }
}

@media (max-width: 400px) {
  .auth-input--with-action { padding-right: 62px; }
}

@media print {
  .auth-marketing, .auth-switcher, .auth-modal { display: none !important; }
  .auth-page { background: #fff; padding: 0; }
  .auth-shell { border: 0; box-shadow: none; }
}