/* ============================================================
   SHARED_AUTH auth wizard — page styles (the ONLY app stylesheet)
   2026-07-11 redesign port: brand-adaptive split-panel card,
   per-site accent from --site-primary, self-hosted type.
   Aesthetic: "refined trust" (approved mockup .sa98-ui-analysis).
   CSP: no inline styles anywhere; fonts + icons self-hosted.
   Units: rem/vh/vw/% only — ZERO px (DEV_GUIDE rule #1).
   Themes: :root = dark defaults; html[data-theme="light"] overrides
   (auth-theme-init.js sets class + data-theme before paint).
   ============================================================ */

/* ---------------- Self-hosted fonts (OFL — see fonts/README.md) --------- */
@font-face {
  font-family: 'Manrope';
  src: url('fonts/manrope-latin.woff2') format('woff2');
  font-weight: 400 800;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: 'Fraunces';
  src: url('fonts/fraunces-italic-latin.woff2') format('woff2');
  font-weight: 400 700;
  font-style: italic;
  font-display: swap;
}

/* ---------------- Design tokens ---------------- */
:root {
  /* Brand pipe. THREE tiers, highest first — each falls back to the next, so
     a site that supplies none of them computes exactly the historical gold:

       1. --site-* from /auth/api/branding/theme.css (linked LAST on the page).
          Server-generated and contrast-CLAMPED: --site-accent-fill is nudged
          until --site-on-accent clears WCAG AA on it, so the fill/ink pair is
          guaranteed readable. This is the tier that must win.
       2. --site-primary, still injected at runtime by _renderAuthHeader from
          GET /api/branding/{site} (D5). Unchanged, and now the fallback for
          sites the generator serves a neutral stub for.
       3. The retuned house gold literal.

     --c-on-accent is still recomputed in JS from the brand colour's luminance,
     but _renderAuthHeader now skips that write when tier 1 supplied
     --site-on-accent, so the clamped fill keeps the ink it was clamped against
     instead of an ink derived from the RAW primary. */
  --site-primary: #c9a84c;
  --c-accent: var(--site-accent-fill, var(--site-primary, #c9a84c));
  --c-on-accent: var(--site-on-accent, #16181d);
  /* Accent used AS TEXT on the surface: full accent works on dark surfaces;
     the light theme darkens it (below) so pale brand colors (the gold
     fallback included) stay >=4.5:1 on white. --site-accent-ink is the
     server's per-theme textSafe derivation of the same idea. */
  --c-accent-ink: var(--site-accent-ink, var(--c-accent));
  --c-accent-tint: var(--site-accent-tint, color-mix(in srgb, var(--c-accent) 14%, transparent));
  --c-accent-soft: var(--site-accent-soft, color-mix(in srgb, var(--c-accent) 8%, transparent));
  /* Deliberately NOT mapped to --site-accent-hover / --site-accent-glow —
     the names match but the roles do not, and mapping them would regress:
       --c-accent-hover is only ever a TEXT colour here (.link-btn:hover,
         .forgot-link:hover, .mfa-resend:hover) on the page surface, whereas
         --site-accent-hover is a FILL hover clamped against --site-on-accent.
         A fill that is AA against its own ink is not AA as text on --surface.
       --c-accent-glow is a 55% box-shadow bloom tuned for this page;
         --site-accent-glow is 20%/10%, matched to the dashboard shell's
         rgba(59,130,246,.2) (see branding/tokens.py).
     Both still inherit the brand through var(--c-accent) above.
     Dark hover LIGHTENS the text accent toward the ink (2026-10-24): it
     used to darken the fill toward black, 2.55-3.87:1 on six themed sites'
     surfaces. Both arms clear AA on the surface, so the mix does too; the
     light block below keeps its own darker hover. */
  --c-accent-hover: color-mix(in srgb, var(--c-accent-ink) 65%, var(--ink));
  --c-accent-glow: color-mix(in srgb, var(--c-accent) 55%, transparent);

  /* L3 site theme (theme contract v1, served FIRST inside theme.css): the
     page reads the site's surfaces, text, borders and BODY font, each with
     today's literal as the fallback, so a site with no L3 block (58-byte
     stub, or hub accent only) computes exactly what it did before. Owner
     scope 2026-10-24: "surfaces, text, body font" -- headings keep
     Fraunces (--font-display) and the card radius (--r-card) stays.
     tests/test_signin_site_theme_tokens.py pins every mapping and literal. */
  --font-body: var(--site-font-body, 'Manrope', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif);
  --font-display: 'Fraunces', Georgia, 'Times New Roman', serif;

  --r-card: 1.25rem;
  --r-field: 0.7rem;
  --r-pill: 999rem;
  --ease: cubic-bezier(.22, .61, .36, 1);
  --dur: .42s;

  /* Dark theme (default). With a site theme the page background is the
     site's flat --site-bg (both gradient stops take it); without one the
     two literal stops give today's radial gradient. */
  --bg: var(--site-bg, #0b0e14);
  --bg-grad-a: var(--site-bg, #0d1119);
  --bg-grad-b: var(--site-bg, #090b10);
  --surface: var(--site-surface, #121722);
  --surface-2: var(--site-surface-2, #0e131c);
  --field: var(--site-surface-2, #0f141d);
  /* Owner 2026-10-24: field edges mix 30% of the text colour into the
     border, so a site whose border sits close to its field still shows an
     input edge. With no site theme both arms are today's literal, so it
     mixes the literal with itself and renders exactly as before. */
  --field-border: color-mix(in srgb, var(--site-border, #232b39) 70%, var(--site-text, #232b39));
  --field-border-focus: var(--site-accent-strong, var(--c-accent));
  --ink: var(--site-text, #eef2f8);
  --ink-2: var(--site-text-muted, #aeb8c8);
  --ink-3: var(--site-text-muted, #94a0b4);
  --hair: var(--site-border, #1e2634);
  --hair-2: var(--site-border, #262f3f);
  /* Error-banner body text. --ink-2 (the site's muted text) is too light
     on the tinted banner for some sites (AICHUMS light 4.28:1), so the
     banner takes the site's full text colour; with no site theme it is
     today's --ink-2 literal, unchanged. */
  --err-ink: var(--site-text, #aeb8c8);
  --shadow: 0 2rem 4rem -1.5rem rgba(0, 0, 0, .7), 0 1rem 2rem -1rem rgba(0, 0, 0, .5);
  --brand-ink: #ffffff;
  --brand-ink-2: rgba(255, 255, 255, .85);
  --c-error: #f87171;
  /* Glyph on a --c-error fill (.err-ico): white on #f87171 was 2.77:1. */
  --c-on-error: #16181d;
  --c-error-bg: color-mix(in srgb, #ef4444 12%, transparent);
  --c-success: #34d399;
  --c-warn: #fbbf24;
}

html[data-theme="light"] {
  --bg: var(--site-bg, #f4f1ee);
  --bg-grad-a: var(--site-bg, #f6f3f0);
  --bg-grad-b: var(--site-bg, #efe9e4);
  --surface: var(--site-surface, #ffffff);
  --surface-2: var(--site-surface-2, #faf8f6);
  --field: var(--site-surface-2, #faf8f7);
  --field-border: color-mix(in srgb, var(--site-border, #e6ded9) 70%, var(--site-text, #e6ded9));
  --ink: var(--site-text, #1c1a20);
  --ink-2: var(--site-text-muted, #575061);
  --ink-3: var(--site-text-muted, #746d80);
  --hair: var(--site-border, #ece6e2);
  --hair-2: var(--site-border, #e2dad5);
  --err-ink: var(--site-text, #575061);
  --shadow: 0 2rem 4rem -1.5rem rgba(60, 30, 45, .18), 0 1rem 2rem -1rem rgba(60, 30, 45, .10);
  --brand-ink: #ffffff;
  --brand-ink-2: rgba(255, 255, 255, .92);
  /* Text-accent darkened for AA on white (gold fallback: 5.9:1); hover
     goes darker still so the hover STATE also clears AA. */
  --c-accent-ink: var(--site-accent-ink, color-mix(in srgb, var(--c-accent) 58%, #000));
  --c-accent-hover: color-mix(in srgb, var(--c-accent) 45%, #000);
  --c-error: #b91c1c;
  --c-on-error: #ffffff;
  --c-error-bg: color-mix(in srgb, #dc2626 8%, transparent);
  --c-success: #047857;
  --c-warn: #92400e;
}

/* ---------------- Base ---------------- */
*, *::before, *::after { box-sizing: border-box; }
html { font-size: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.sr-only {
  position: absolute;
  width: 0.0625rem;
  height: 0.0625rem;
  padding: 0;
  margin: -0.0625rem;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.hidden { display: none !important; }

/* S101 WP-A2: the brand pane, the header mark and the other-sites
   checkboxes carry no wording until auth-sso-flow.js fills it from the
   branding answer (_settleHub / _setCopy). visibility, not display: the box
   keeps its space, so the form fields never move when the wording lands,
   and an invisible element is neither clickable nor focusable nor read
   out. A different property from the display rules on .brand / .cb-row
   (which beat the [hidden] attribute); !important keeps it unbeatable. */
.copy-pending { visibility: hidden !important; }

.otl-noscript {
  position: fixed;
  top: 1rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 50;
  max-width: 28rem;
  margin: 0;
  padding: 1rem 1.25rem;
  border-radius: var(--r-field);
  background: var(--surface);
  color: var(--ink);
  border: 0.0625rem solid var(--hair-2);
  box-shadow: var(--shadow);
}

/* ---------------- Background layers ---------------- */
.auth-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: var(--bg);
  background-image: radial-gradient(120% 80% at 100% 0%, var(--bg-grad-a), var(--bg-grad-b));
}
.auth-bg::before {
  content: "";
  position: absolute;
  width: 44rem;
  height: 44rem;
  right: -14rem;
  top: -16rem;
  border-radius: 50%;
  background: radial-gradient(circle, var(--c-accent-soft), transparent 70%);
  pointer-events: none;
}
.auth-grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  opacity: 0.4;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.06'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-size: 12.5rem;
}

/* ---------------- Minimal auth header (D6) ---------------- */
.auth-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(1.25rem, 4vw, 3rem) 0;
}
.auth-hdr-brand {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  min-height: 2.75rem;
  text-decoration: none;
}
.auth-hdr-brand:hover .auth-hdr-name { text-decoration: underline; }
.auth-hdr-icon {
  width: 2.1rem;
  height: 2.1rem;
  border-radius: .6rem;
  display: grid;
  place-items: center;
  flex: none;
  font-size: 1rem;
  /* TWO-STOP gradient. The ink and the stops are a MATCHED TRIPLE and must
     move together: branding/tokens.py::grad_tokens derives --site-on-grad for
     the (--site-grad-start, --site-grad-end) pair specifically, then NUDGES
     those two stops until that ink clears 4.5:1 on BOTH. The guarantee does
     not transfer to any other gradient — pairing --site-on-grad with stops
     derived locally from --site-accent-fill was wave-1's contrast bug here
     (white on #f59e0b at 2.15:1 whenever the on-accent/on-grad inks diverge).
     Measured over the 21-brand fleet palette plus 5000 random brand pairs:
     min contrast of --site-on-grad against either token stop = 4.50.
     A site served the neutral stub defines none of the three, so every
     fallback below reproduces the historical rendering byte-for-byte. */
  color: var(--site-on-grad, var(--c-on-accent));
  background: linear-gradient(135deg,
      var(--site-grad-start, var(--c-accent)),
      var(--site-grad-end, color-mix(in srgb, var(--c-accent) 55%, #14060d)));
  box-shadow: 0 .4rem 1rem -.3rem var(--c-accent-glow);
  overflow: hidden;
}
.auth-hdr-icon img { width: 100%; height: 100%; object-fit: cover; }
/* Header items may shrink (owner 2026-10-18: the hint was clipped off the
   right edge): a long brand name truncates, the hint wraps before it can
   overflow, and the switch link itself never breaks. */
.auth-hdr-brand { min-width: 0; flex: 0 1 auto; }
.auth-hdr-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.h-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  font-size: .86rem;
  color: var(--ink-2);
  min-width: 0;
  flex: 0 1 auto;
}
.h-hint { min-width: 0; text-align: right; }
.h-hint .link-btn { white-space: nowrap; }
.theme-toggle {
  width: 2.75rem;
  height: 2.75rem;
  border-radius: var(--r-pill);
  border: 0.0625rem solid var(--hair-2);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-3); }

/* ---------------- Stage: full-viewport centering ---------------- */
/* ~1in (6rem) guaranteed gutters on every side; card centered both axes
   (desktop, mobile handled below, and TV-class widths via the 64rem cap). */
.auth-page {
  height: 100vh;
  height: 100dvh; /* mobile URL-bar-aware; 100vh line above is the fallback */
  display: grid;
  place-items: center;
  /* `safe` guarantees overflow becomes a page SCROLLBAR, never clipped
     content: if the card is ever taller than the stage (exotic zoom /
     scaling combos), it aligns to start instead of losing both edges. */
  place-items: safe center;
  padding: max(6rem, 7vh) max(6rem, 5vw);
}
.stage-inner {
  width: 100%;
  max-width: 64rem;
  max-height: 100%;
  display: flex;
  justify-content: center;
}

/* ---------------- Card: split panel ---------------- */
/* Fixed height (not max-height) so the card NEVER resizes/jumps when
   switching between short (sign-in) and tall (register) views — only the
   internal form pane scrolls. 70vh locked with the user (deliberately not
   the 85vh modal convention). */
.auth-card {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  width: 100%;
  /* 70vh, continuously clamped so the card can never exceed the viewport
     minus the minimum gutters — identical to plain 70vh on any viewport
     >=40rem tall, a hard safety net everywhere else. */
  height: min(70vh, calc(100vh - 12rem));
  height: min(70vh, calc(100dvh - 12rem));
  background: var(--surface);
  border: 0.0625rem solid var(--hair);
  border-radius: var(--r-card);
  overflow: hidden;
  box-shadow: var(--shadow);
  /* backwards, not both: cardIn ends at the card's own style (opacity 1,
     no transform), and a forwards fill would keep an identity transform
     on the card for good, which turns it into the containing block of the
     position:fixed back/to-top icon on phones (owner 2026-10-18). */
  animation: cardIn var(--dur) var(--ease) backwards;
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(1.2rem) scale(.99); }
  to { opacity: 1; transform: none; }
}
.auth-card[hidden], .auth-card.hidden { display: none !important; }

/* ---------------- Wide-pane mode: site selection at scale ----------------
   The network has 20+ sites — site-selection views (the bulk-login picker
   and the register sites step) collapse the brand pane and take the FULL
   card width, old-layout style, so the grid scales to as many columns as
   fit. Toggled per card by the flow engine; every other step keeps the
   split panel. */
.auth-card.wide-pane { grid-template-columns: 1fr; }
.auth-card.wide-pane .brand { display: none; }
.wide-pane .site-grid {
  grid-template-columns: repeat(auto-fill, minmax(13rem, 1fr));
  max-height: 24rem;
}

/* ---------------- Brand pane ---------------- */
.brand {
  position: relative;
  padding: clamp(1.75rem, 3vw, 2.6rem);
  color: var(--brand-ink);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 1.5rem;
  /* Conservative default: deep accent-toned pane readable with ANY brand
     primary (incl. the pale gold fallback — white ink >=7:1). When
     _renderAuthHeader confirms a DARK brand primary it adds
     html.accent-deep, enabling the vivid approved-mockup gradient below. */
  background:
    radial-gradient(130% 90% at 0% 0%, color-mix(in srgb, var(--c-accent) 30%, transparent), transparent 60%),
    linear-gradient(150deg, color-mix(in srgb, var(--c-accent) 38%, #1c0f18), color-mix(in srgb, var(--c-accent) 20%, #120a10));
}
html.accent-deep .brand {
  background:
    radial-gradient(130% 90% at 0% 0%, color-mix(in srgb, var(--c-accent) 92%, transparent), transparent 60%),
    linear-gradient(150deg, color-mix(in srgb, var(--c-accent) 88%, #2a0a1a), color-mix(in srgb, var(--c-accent) 45%, #1a0510));
}
.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: .5;
  mix-blend-mode: overlay;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.5'/%3E%3C/svg%3E");
}
.brand::before {
  content: "";
  position: absolute;
  width: 24rem;
  height: 24rem;
  right: -8rem;
  top: -6rem;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .22), transparent 65%);
  pointer-events: none;
}
.brand > * { position: relative; z-index: 1; }
.brand-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--brand-ink-2);
}
.brand-dot {
  width: .4rem;
  height: .4rem;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 .28rem rgba(255, 255, 255, .18);
}
.brand-head {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.9rem, 3.2vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -.01em;
  margin: .9rem 0 .7rem;
}
.brand-head em { font-style: italic; color: #fff; }
.brand-sub {
  font-size: .95rem;
  color: var(--brand-ink-2);
  max-width: 24rem;
  line-height: 1.55;
  margin: 0;
}
.brand-feats {
  display: flex;
  flex-direction: column;
  gap: .85rem;
  margin-top: .4rem;
}
.brand-feat {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-size: .9rem;
  color: var(--brand-ink-2);
}
.brand-feat i {
  width: 1.3rem;
  flex: none;
  text-align: center;
  color: #fff;
  opacity: .92;
}
.brand-badges { display: flex; flex-wrap: wrap; gap: .5rem; }
.brand-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .34rem .7rem;
  border-radius: var(--r-pill);
  color: var(--brand-ink);
  background: rgba(255, 255, 255, .12);
  border: 0.0625rem solid rgba(255, 255, 255, .18);
  backdrop-filter: blur(0.25rem);
}
.icon-spacer { margin-right: .3rem; }

/* ---------------- Form pane (footer pinned, inner region scrolls) ------ */
/* The footer lives OUTSIDE the scroll region so the primary CTA can never
   be buried below the fold on tall panes (QA F5); only .pane-scroll
   scrolls, with a styled stable-gutter scrollbar. */
.form-pane {
  padding: clamp(1.5rem, 2.6vw, 2.5rem) clamp(1.5rem, 2.8vw, 2.75rem);
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.pane-scroll {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  scrollbar-gutter: stable;
  scrollbar-width: thin;
  scrollbar-color: var(--hair-2) transparent;
  padding-right: .25rem;
}
.pane-scroll::-webkit-scrollbar { width: .45rem; }
.pane-scroll::-webkit-scrollbar-track { background: transparent; }
.pane-scroll::-webkit-scrollbar-thumb { background: var(--hair-2); border-radius: var(--r-pill); }
.pane-scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-3); }

/* Back / to-top icon (owner 2026-10-18). Pinned to the BOTTOM right of the
   pane scroller, just above the pinned footer, so it never scrolls away
   with the content and never sits on the step heading (gate doc Trap 2:
   at the top right it covered "Welcome back" once the tabs scrolled off).
   bottom = the pane's bottom padding + the footer row (1.3rem padding-top
   + a .btn: 2 x .8rem padding + 1.5 x .95rem line + 2 x 0.0625rem border
   = 3.15rem) + a .75rem gap. Phone and very-short layouts pin it to the
   viewport instead (see the media blocks below), because there the page
   scrolls. */
.pane-top-btn {
  position: absolute;
  top: auto;
  bottom: calc(clamp(1.5rem, 2.6vw, 2.5rem) + 4.45rem + .75rem);
  right: calc(clamp(1.5rem, 2.8vw, 2.75rem) + .7rem);
  z-index: 6;
  width: 2.75rem;
  height: 2.75rem;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  border: 0.0625rem solid var(--hair-2);
  background: var(--surface);
  color: var(--ink);
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 .4rem 1rem -.35rem rgba(0, 0, 0, .35);
  transition: background .18s var(--ease), color .18s var(--ease);
}
.pane-top-btn:hover { background: var(--surface-2); color: var(--c-accent-ink); }
.pane-top-btn:focus-visible { outline: 0.125rem solid var(--c-accent); outline-offset: 0.125rem; }
.pane-top-btn[hidden] { display: none; }
/* While the icon shows, give the scroller the icon's height + gap of extra
   room at the end, so the last row (e.g. "Forgot password?") can scroll
   clear of it. Desktop split layout only: phone and very-short layouts
   pin the icon to the viewport and are left as they were. */
@media (min-width: 52.0625rem) and (min-height: 30.0625rem) {
  .form-pane:has(> .pane-top-btn:not([hidden])) .pane-scroll { padding-bottom: 3.5rem; }
}

/* ---------------- Flow tabs (Sign in / Create account) ---------------- */
.auth-tabs {
  display: inline-flex;
  padding: .28rem;
  gap: .2rem;
  background: var(--surface-2);
  border: 0.0625rem solid var(--hair);
  border-radius: var(--r-pill);
  align-self: flex-start;
  margin-bottom: 1.4rem;
  flex: none;
}
.modal-tab {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-3);
  padding: .5rem 1rem;
  min-height: 2.75rem;
  border-radius: var(--r-pill);
  border: 0.0625rem solid transparent;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: color .22s var(--ease), background .22s var(--ease);
}
.modal-tab:hover { color: var(--ink-2); }
.modal-tab.active {
  background: var(--surface);
  color: var(--ink);
  border-color: var(--hair-2);
  box-shadow: 0 .2rem .6rem -.2rem rgba(0, 0, 0, .25);
}
html[data-theme="light"] .modal-tab.active { color: var(--c-accent-ink); }

/* ---------------- Branch chip (D3) ---------------- */
.branch-chip {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  font-size: .78rem;
  font-weight: 600;
  color: var(--c-accent-ink);
  background: var(--c-accent-tint);
  border: 0.0625rem solid var(--c-accent-soft);
  padding: .34rem .7rem;
  border-radius: var(--r-pill);
  margin-bottom: .9rem;
  width: fit-content;
  flex: none;
}
.branch-chip[hidden] { display: none; }

/* ---------------- Pane head ---------------- */
.pane-head { margin-bottom: 1.1rem; flex: none; }
.pane-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  letter-spacing: -.01em;
  color: var(--ink);
  margin: 0;
  outline: none;
}
.step-desc {
  font-size: .9rem;
  color: var(--ink-2);
  margin: 0 0 1.1rem;
  line-height: 1.55;
}
.step-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.25rem;
  color: var(--ink);
  margin: 0 0 .5rem;
  outline: none;
}

/* ---------------- Register word-stepper ---------------- */
.word-stepper {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .45rem;
  margin-bottom: 1.1rem;
  font-size: .76rem;
  font-weight: 600;
  color: var(--ink-3);
  flex: none;
}
.word-step {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: color .2s var(--ease);
}
.word-step-num {
  display: inline-grid;
  place-items: center;
  width: 1.25rem;
  height: 1.25rem;
  border-radius: 50%;
  border: 0.0625rem solid var(--hair-2);
  font-size: .66rem;
  color: var(--ink-3);
  transition: background .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.word-step.active { color: var(--c-accent-ink); }
.word-step.active .word-step-num {
  background: var(--c-accent);
  border-color: var(--c-accent);
  color: var(--c-on-accent);
}
.word-step.done { color: var(--ink-2); }
.word-step.done .word-step-num {
  background: var(--c-accent-tint);
  border-color: var(--c-accent-soft);
  color: var(--c-accent-ink);
}
.word-step-sep { font-size: .66rem; color: var(--ink-3); opacity: .6; }
.step-label-mobile {
  display: none;
  font-size: .78rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .9rem;
}

/* ---------------- Step panes + transitions ---------------- */
/* flex:none is load-bearing: as a flex child of the scrolling .form-pane,
   the stack must NOT shrink — shrinking would let tall pane content
   overflow over the footer instead of engaging the pane's own
   overflow-y scroll. */
.pane-stack { position: relative; flex: none; }
.step-pane { display: none; }
.step-pane.active {
  display: block;
  animation: viewIn .34s var(--ease) both;
}
.step-pane.exiting { display: none; }
@keyframes viewIn {
  from { opacity: 0; transform: translateX(.6rem); }
  to { opacity: 1; transform: none; }
}

/* Staggered first-load entrance (mockup .entering) */
.entering .form-group,
.entering .row-between,
.entering .auth-tabs,
.entering .form-row { animation: fieldIn .5s var(--ease) both; }
.entering .auth-tabs { animation-delay: .02s; }
.entering .form-group:nth-of-type(1) { animation-delay: .08s; }
.entering .form-group:nth-of-type(2) { animation-delay: .14s; }
.entering .row-between { animation-delay: .2s; }
@keyframes fieldIn {
  from { opacity: 0; transform: translateY(.5rem); }
  to { opacity: 1; transform: none; }
}

/* ---------------- Form controls ---------------- */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .8rem;
  max-width: 28rem;
}
.form-group { margin-bottom: 1.05rem; max-width: 28rem; }
.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .4rem;
}
.req-asterisk { color: var(--c-accent); margin-left: .15rem; }
.optional-tag { font-weight: 400; color: var(--ink-3); font-size: .78rem; }
.form-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  max-width: 28rem;
}
.form-input-wrap .form-input-icon {
  position: absolute;
  left: .95rem;
  font-size: .95rem;
  color: var(--ink-3);
  pointer-events: none;
  z-index: 1;
}
.form-input {
  width: 100%;
  font: inherit;
  font-size: .95rem;
  color: var(--ink);
  background: var(--field);
  border: 0.0625rem solid var(--field-border);
  border-radius: var(--r-field);
  padding: .8rem .9rem .8rem 2.6rem;
  min-height: 2.75rem;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.form-input.has-peek { padding-right: 3rem; }
.form-input::placeholder { color: var(--ink-3); }
.form-input:focus {
  border-color: var(--field-border-focus);
  box-shadow: 0 0 0 .22rem var(--c-accent-tint);
}
.peek {
  position: absolute;
  right: .1rem;
  width: 2.75rem;
  height: 2.75rem;
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: .95rem;
  border-radius: var(--r-field);
}
.peek:hover { color: var(--ink); }
.form-error {
  color: var(--c-error);
  font-size: .8rem;
  margin-top: .35rem;
}
.form-error:empty { display: none; }

.row-between {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem 1rem;
  margin: -.1rem 0 1rem;
  flex-wrap: wrap;
  max-width: 28rem;
}

/* Custom checkboxes (role="checkbox" rows) */
.cb-row {
  display: flex;
  align-items: flex-start;
  gap: .6rem;
  cursor: pointer;
  font-size: .86rem;
  color: var(--ink-2);
  user-select: none;
  padding: .55rem 0;
  min-height: 2.75rem;
  max-width: 28rem;
}
.cb-box {
  width: 1.15rem;
  height: 1.15rem;
  min-width: 1.15rem;
  flex: none;
  border-radius: .35rem;
  border: 0.09rem solid var(--field-border);
  background: var(--field);
  display: grid;
  place-items: center;
  transition: background .18s var(--ease), border-color .18s var(--ease);
  margin-top: .1rem;
}
.cb-row:hover .cb-box { border-color: var(--c-accent); }
.cb-check {
  font-size: .62rem;
  color: var(--c-on-accent);
  opacity: 0;
  transform: scale(.6);
  transition: opacity .18s var(--ease), transform .18s var(--ease);
}
.cb-row[aria-checked="true"] .cb-box {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.cb-row[aria-checked="true"] .cb-check { opacity: 1; transform: none; }
.cb-text { line-height: 1.45; }
.cb-row.needs-attention .cb-box { border-color: var(--c-error); box-shadow: 0 0 0 0.1875rem color-mix(in srgb, var(--c-error) 25%, transparent); }
#terms-row-err { margin: -.35rem 0 .6rem; }

/* Links — standalone link-buttons meet the 2.75rem touch floor via
   min-height; inline prose links (.forgot-link.inline) are exempt per the
   WCAG 2.5.8 inline exception. */
.link-btn {
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  color: var(--c-accent-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: none;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
}
.link-btn:hover { text-decoration: underline; color: var(--c-accent-hover); }
.forgot-link { color: var(--c-accent-ink); font-size: .84rem; font-weight: 600; text-decoration: none; }
.forgot-link:hover { text-decoration: underline; color: var(--c-accent-hover); }
.forgot-link.inline { display: inline; min-height: 0; }
.alt-line {
  font-size: .82rem;
  color: var(--ink-3);
  margin: 1rem 0 0;
}
.verify-hint { font-size: .84rem; color: var(--ink-2); margin: 1rem 0 0; }

/* ---------------- Buttons ---------------- */
.btn {
  font: inherit;
  font-weight: 700;
  font-size: .95rem;
  border-radius: var(--r-field);
  padding: .8rem 1.3rem;
  min-height: 2.75rem;
  cursor: pointer;
  border: 0.0625rem solid transparent;
  transition: transform .12s var(--ease), box-shadow .2s var(--ease), background .2s, color .2s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  white-space: nowrap;
}
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary {
  color: var(--c-on-accent);
  background: var(--c-accent);
  box-shadow: 0 .6rem 1.4rem -.5rem var(--c-accent-glow);
}
.btn-primary:hover:not(:disabled) {
  transform: translateY(-0.0625rem);
  box-shadow: 0 .9rem 1.8rem -.5rem var(--c-accent-glow);
}
.btn-primary:active { transform: translateY(0); }
.btn-success {
  color: var(--c-on-accent);
  background: var(--c-accent);
  box-shadow: 0 .6rem 1.4rem -.5rem var(--c-accent-glow);
}
.btn-success:hover:not(:disabled) { transform: translateY(-0.0625rem); }
.btn-ghost {
  color: var(--ink-2);
  background: transparent;
  border-color: var(--hair-2);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--ink-3); }
.hidden-back { visibility: hidden; }

/* Footer pinned to the pane bottom (inside the scroller, mockup
   .form-foot pattern: margin-top:auto). */
.auth-card-footer {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-top: auto;
  padding-top: 1.3rem;
  flex: none;
}
.auth-card-footer .btn-primary,
.auth-card-footer .btn-success { flex: 1; }

/* Back-hidden steps (sign-in step 1 / success, register sites / done, etc.):
   the empty Back slot used to shove the primary CTA against the right edge
   (asymmetric). Center it instead, keeping it a large button. Desktop only —
   the mobile block (@media max-width:52rem) already stacks the CTA full-width,
   and this rule must not override that (higher :has() specificity), so it is
   gated to the split-panel width. */
@media (min-width: 52.0625rem) {
  .auth-card-footer:has(.btn-ghost.hidden-back) { justify-content: center; }
  .auth-card-footer:has(.btn-ghost.hidden-back) .btn-ghost.hidden-back { display: none; }
  .auth-card-footer:has(.btn-ghost.hidden-back) .btn-primary,
  .auth-card-footer:has(.btn-ghost.hidden-back) .btn-success {
    flex: 0 1 auto;
    width: 100%;
    max-width: calc(100% - 6.5rem);  /* ~3.25rem symmetric inset each side */
  }
}

/* ---------------- OTP inputs ---------------- */
.otp-group {
  display: flex;
  gap: .6rem;
  margin: .3rem 0 .2rem;
  border: none;
  padding: 0;
}
.otp-input {
  width: 2.9rem;
  height: 3.4rem;
  text-align: center;
  font: inherit;
  font-size: 1.3rem;
  font-weight: 600;
  color: var(--ink);
  background: var(--field);
  border: 0.0625rem solid var(--field-border);
  border-radius: var(--r-field);
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.otp-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 .22rem var(--c-accent-tint);
}
.otp-input.filled { border-color: var(--c-accent-soft); }

/* ---------------- MFA ---------------- */
.mfa-tabs {
  display: flex;
  gap: .5rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}
.mfa-tab {
  font: inherit;
  font-size: .8rem;
  font-weight: 600;
  color: var(--ink-2);
  padding: .55rem .8rem;
  min-height: 2.75rem;
  border-radius: var(--r-field);
  border: 0.0625rem solid var(--field-border);
  background: var(--field);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: color .18s var(--ease), border-color .18s var(--ease), background .18s var(--ease);
}
.mfa-tab:hover { color: var(--ink); }
.mfa-tab.active {
  border-color: var(--c-accent);
  color: var(--c-accent-ink);
  background: var(--c-accent-tint);
}
.mfa-pane { display: none; }
.mfa-pane.active { display: block; animation: viewIn .3s var(--ease) both; }
.mfa-sms-info { font-size: .86rem; color: var(--ink-2); margin: 0 0 .6rem; }
.mfa-sms-info strong { color: var(--ink); }
.backup-input {
  width: 100%;
  max-width: 18rem;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .12em;
  color: var(--ink);
  background: var(--field);
  border: 0.0625rem solid var(--field-border);
  border-radius: var(--r-field);
  padding: .8rem .9rem;
  min-height: 2.75rem;
  text-transform: uppercase;
  outline: none;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease);
}
.backup-input:focus {
  border-color: var(--c-accent);
  box-shadow: 0 0 0 .22rem var(--c-accent-tint);
}
.mfa-resend-wrap { margin: .8rem 0 0; }
.mfa-resend {
  font: inherit;
  font-size: .84rem;
  font-weight: 600;
  color: var(--c-accent-ink);
  background: none;
  border: none;
  padding: .5rem 0;
  min-height: 2.75rem;
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}
.mfa-resend:hover:not(:disabled) { text-decoration: underline; color: var(--c-accent-hover); }
.mfa-resend:disabled { color: var(--ink-3); cursor: default; }
/* "Can't use this method? Try another way" reuses the .mfa-resend link
   button look; it is shown by JS only when 2+ methods are offered. */
.mfa-try-another-wrap { margin: .2rem 0 0; }
.mfa-try-another { text-align: left; }
.mfa-try-hint { margin: .35rem 0 0; }
.verify-back-wrap { margin-top: 1.2rem; }

/* ---------------- Role list ---------------- */
.role-list { display: flex; flex-direction: column; gap: .9rem; max-width: 28rem; }
.role-site {
  border: 0.0625rem solid var(--field-border);
  border-radius: var(--r-field);
  background: var(--field);
  padding: .9rem 1rem;
}
.role-site-hdr {
  display: flex;
  align-items: center;
  gap: .6rem;
  margin-bottom: .6rem;
  font-weight: 600;
  color: var(--ink);
  font-size: .92rem;
}
.role-site-hdr i { color: var(--c-accent); }
.site-name { flex: 1; }
.badge-primary {
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--c-accent);
  background: var(--c-accent-tint);
  border: 0.0625rem solid var(--c-accent-soft);
  padding: .2rem .55rem;
  border-radius: var(--r-pill);
}
.role-select {
  width: 100%;
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: var(--surface);
  border: 0.0625rem solid var(--field-border);
  border-radius: var(--r-field);
  padding: .6rem .8rem;
  min-height: 2.75rem;
  cursor: pointer;
}
.role-select:focus {
  outline: none;
  border-color: var(--c-accent);
  box-shadow: 0 0 0 .22rem var(--c-accent-tint);
}

/* ---------------- Site grid (register + bulk picker) ---------------- */
.mb-075 { margin-bottom: .75rem; }
.site-search { padding-left: 2.6rem; }
.sel-count { font-size: .82rem; color: var(--ink-2); margin: 0 0 .7rem; }
.sel-count b { color: var(--c-accent-ink); }
.site-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .6rem;
  max-height: 16rem;
  overflow-y: auto;
  padding-right: .2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--hair-2) transparent;
}
.site-grid::-webkit-scrollbar { width: .35rem; }
.site-grid::-webkit-scrollbar-thumb { background: var(--hair-2); border-radius: var(--r-pill); }
.site-card {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas:
    "icon name"
    "icon desc";
  align-items: center;
  column-gap: .65rem;
  row-gap: .1rem;
  padding: .7rem 2.1rem .7rem .8rem;
  min-height: 2.75rem;
  border: 0.09rem solid var(--field-border);
  border-radius: var(--r-field);
  background: var(--field);
  cursor: pointer;
  transition: border-color .16s var(--ease), background .16s var(--ease);
}
.site-card:hover:not(.locked) { border-color: var(--hair-2); }
.site-card.selected {
  border-color: var(--c-accent);
  background: var(--c-accent-tint);
}
/* Already-registered sites read as a settled "Joined" state — an outlined
   success check (top-right) + a green "Joined" label — deliberately distinct
   from the accent-FILLED "selected" pick, and non-interactive. Registration
   is once-per-email in the network, so these can't be re-selected. */
.site-card.locked { cursor: default; }
.site-card.locked .card-name { color: var(--ink-2); }
.site-card.locked .card-icon { opacity: .8; }
.site-card .card-desc.card-joined { color: var(--c-success); font-weight: 600; }
.site-card .card-check {
  position: absolute;
  top: .6rem;
  right: .6rem;
  width: 1.2rem;
  height: 1.2rem;
  border-radius: 50%;
  border: 0.09rem solid var(--field-border);
  display: grid;
  place-items: center;
  transition: background .16s var(--ease), border-color .16s var(--ease);
}
.site-card .card-check i { font-size: .6rem; color: var(--c-on-accent); opacity: 0; }
.site-card.selected .card-check {
  background: var(--c-accent);
  border-color: var(--c-accent);
}
.site-card.selected .card-check i { opacity: 1; }
.site-card.locked .card-check {
  visibility: visible;
  background: transparent;
  border-color: var(--c-success);
}
.site-card.locked .card-check i { opacity: 1; color: var(--c-success); }
.site-card .card-icon {
  grid-area: icon;
  width: 2rem;
  height: 2rem;
  border-radius: .5rem;
  display: grid;
  place-items: center;
  background: var(--surface-2);
  color: var(--c-accent);
  font-size: .9rem;
  align-self: start;
}
.site-card .card-name {
  grid-area: name;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.site-card .card-desc {
  grid-area: desc;
  font-size: .72rem;
  color: var(--ink-3);
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.site-card .card-desc:empty { display: none; }

/* ---------------- Success ---------------- */
.success-wrap { display: flex; flex-direction: column; align-items: flex-start; }
.done-check,
.success-icon-ring {
  width: 3.6rem;
  height: 3.6rem;
  border-radius: 50%;
  background: var(--c-accent-tint);
  border: 0.0625rem solid var(--c-accent-soft);
  display: grid;
  place-items: center;
  margin-bottom: 1.1rem;
  font-size: 1.5rem;
  color: var(--c-accent);
  animation: successReveal .5s var(--ease) both;
}
@keyframes successReveal {
  from { opacity: 0; transform: scale(.6); }
  to { opacity: 1; transform: none; }
}
.success-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.6rem;
  color: var(--ink);
  margin: 0 0 .4rem;
  outline: none;
}
.success-desc { font-size: .9rem; color: var(--ink-2); margin: 0 0 1.1rem; }
.access-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: .86rem;
  border: 0.0625rem solid var(--hair);
  border-radius: var(--r-field);
  overflow: hidden;
}
.access-table th {
  text-align: left;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: .55rem .8rem;
  border-bottom: 0.0625rem solid var(--hair);
}
.access-table td {
  padding: .6rem .8rem;
  border-bottom: 0.0625rem solid var(--hair);
  color: var(--ink-2);
}
.access-table tbody tr:last-child td { border-bottom: none; }
.access-table td:first-child { color: var(--ink); font-weight: 600; }
.row-status {
  font-size: .74rem;
  font-weight: 700;
  padding: .2rem .6rem;
  border-radius: var(--r-pill);
  white-space: nowrap;
}
.row-status-ok { color: var(--c-success); background: color-mix(in srgb, var(--c-success) 12%, transparent); }
.row-status-err { color: var(--c-error); background: var(--c-error-bg); }
.row-status-muted { color: var(--ink-3); background: var(--surface-2); }
.redirect-note {
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: .84rem;
  color: var(--ink-3);
  margin: 1.1rem 0 0;
}
.redirect-note .spin {
  width: 1rem;
  height: 1rem;
  border: 0.125rem solid var(--hair-2);
  border-top-color: var(--c-accent);
  border-radius: 50%;
  animation: sp 1s linear infinite;
  flex: none;
}
@keyframes sp { to { transform: rotate(360deg); } }

/* ---------------- Error banner (built at runtime by _showError) -------- */
.otl-error.error-banner {
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  background: var(--c-error-bg);
  border: 0.0625rem solid color-mix(in srgb, var(--c-error) 35%, transparent);
  border-radius: var(--r-field);
  padding: .8rem .9rem;
  margin: .9rem 0;
  max-width: 28rem;
  text-align: left;
}
.otl-error.error-banner--next-step {
  background: var(--surface-2);
  border-color: color-mix(in srgb, var(--c-accent) 35%, transparent);
}
.error-banner--next-step .err-ico {
  background: var(--c-accent);
  color: var(--c-on-accent);
}
.error-banner--next-step .err-body { color: var(--ink); }
.err-body a.err-cta {
  margin-top: .7rem;
  color: var(--c-on-accent);
  text-decoration: none;
  white-space: normal;
}
.err-ico {
  flex: none;
  width: 1.3rem;
  height: 1.3rem;
  border-radius: 50%;
  background: var(--c-error);
  color: var(--c-on-error);
  font-weight: 800;
  font-size: .8rem;
  display: grid;
  place-items: center;
}
.err-body { font-size: .84rem; color: var(--err-ink); min-width: 0; flex: 1; }
.err-body strong { display: block; color: var(--ink); margin-bottom: .15rem; }
/* Enrollment / "Start a new sign-in" links (_showError) had no rule, so the
   browser default #0000ee drew at 1.38-1.71:1 on the dark banner. */
.err-body a { color: var(--c-accent-ink); text-decoration: underline; }
.err-body p { margin: 0; overflow-wrap: anywhere; }
.err-body ul { margin: .2rem 0 0 1rem; padding: 0; }
.err-body code {
  font-size: .74rem;
  color: var(--ink-3);
  background: var(--surface-2);
  padding: .05rem .3rem;
  border-radius: .25rem;
  word-break: break-word;
}

/* ---------------- Password strength ---------------- */
.pw-strength { margin-top: .5rem; max-width: 28rem; }
.pw-strength-track {
  height: .35rem;
  border-radius: var(--r-pill);
  background: var(--hair);
  overflow: hidden;
}
.pw-strength-fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: var(--hair-2);
  transition: width .25s var(--ease), background-color .25s var(--ease);
}
.pw-strength-fill.pw-weak { background: var(--c-error); }
.pw-strength-fill.pw-fair { background: var(--c-warn); }
.pw-strength-fill.pw-good { background: var(--c-warn); }
.pw-strength-fill.pw-strong { background: var(--c-success); }
.pw-strength-fill.pw-vstrong { background: var(--c-success); }
.pw-strength-text { font-size: .74rem; font-weight: 600; margin-top: .3rem; color: var(--ink-3); }
.pw-strength-text.pw-weak { color: var(--c-error); }
.pw-strength-text.pw-fair, .pw-strength-text.pw-good { color: var(--c-warn); }
.pw-strength-text.pw-strong, .pw-strength-text.pw-vstrong { color: var(--c-success); }

/* ---------------- Focus visibility (a11y) ---------------- */
/* Ring uses the ink variant: >=3:1 against the light surface even with
   the pale gold fallback accent. */
:focus-visible {
  outline: 0.14rem solid var(--c-accent-ink);
  outline-offset: 0.14rem;
}
/* Headings and error banners receive programmatic focus (announcement
   anchors); they are not interactive — no visible ring (QA F19/R2-N1). */
.pane-title:focus-visible,
.step-heading:focus-visible,
.success-title:focus-visible,
.otl-error:focus-visible {
  outline: none;
}

/* ---------------- Short viewports (wide-but-short) ----------------
   Scaled-display laptops (125-150% Windows scaling), split-screen
   windows and projectors present WIDE but SHORT viewports the mobile
   width-query never catches. The approved geometry (70vh card + ~1in
   gutters) needs ~44rem of height; below that, step the type down one
   notch and fit the card to the viewport with EQUAL gutters — the pane
   scroller absorbs the difference. Viewports >=44.0625rem tall (e.g.
   1280x800, 1920x1080) are pixel-for-pixel untouched. */
@media (min-width: 52.0625rem) and (max-height: 44rem) {
  html { font-size: 93.75%; }
  .auth-header { padding-top: .75rem; }
  .auth-page {
    padding-top: 4rem;
    padding-bottom: 4rem;
  }
  .auth-card {
    height: calc(100vh - 8rem);
    height: calc(100dvh - 8rem);
  }
}
/* Very short: fixed heights can no longer work — fall back to natural
   height and let the page itself scroll (nothing may ever be clipped). */
@media (min-width: 52.0625rem) and (max-height: 30rem) {
  .auth-page {
    height: auto;
    min-height: 100vh;
    min-height: 100dvh;
    align-items: start;
    padding-top: 4rem;
    padding-bottom: 2rem;
  }
  .auth-card { height: auto; }
  .form-pane { overflow: visible; }
  .pane-scroll { overflow: visible; scrollbar-gutter: auto; flex: none; padding-right: 0; }
  .pane-top-btn { position: fixed; top: auto; right: 1rem; bottom: 1rem; }
}

/* ---------------- Mobile (<52rem): single column ---------------- */
@media (max-width: 52rem) {
  .auth-page {
    height: auto;
    min-height: 100vh;
    align-items: start;
    padding: 5.5rem 1.25rem calc(2rem + env(safe-area-inset-bottom, 0rem));
  }
  .auth-card {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }
  .form-pane { overflow: visible; }
  .pane-scroll { overflow: visible; scrollbar-gutter: auto; flex: none; padding-right: 0; }
  .brand { padding: 1.5rem; gap: 1.1rem; }
  .brand-head { font-size: 1.5rem; margin: .5rem 0; }
  .brand-sub { display: none; }
  .brand-feats { flex-direction: row; flex-wrap: wrap; gap: .5rem 1.2rem; margin-top: 0; }
  .brand-feat { font-size: .78rem; }
  .brand-feat span { display: none; }
  .brand-badges { display: none; }
  .site-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .auth-header { padding-top: 1rem; }
  .h-hint { display: none; }
  /* The page scrolls here, not the pane: pin the icon to the viewport,
     below the header row so it never covers the theme toggle. */
  .pane-top-btn {
    position: fixed;
    top: calc(4.25rem + env(safe-area-inset-top, 0rem));
    bottom: auto;
    right: 1rem;
  }
  .word-stepper { display: none; }
  .step-label-mobile { display: block; }
  .step-label-mobile.hidden { display: none; }
  .auth-card-footer { flex-wrap: wrap; padding-bottom: env(safe-area-inset-bottom, 0rem); }
  .auth-card-footer .btn-primary,
  .auth-card-footer .btn-success { flex: 1 1 100%; order: -1; }
  /* On mobile a hidden Back must not leave a phantom empty row under the
     full-width CTA (desktop keeps visibility-hidden for layout stability). */
  .auth-card-footer .btn-ghost.hidden-back { display: none; }
  /* 2.75rem touch floor: 6 x 2.75rem + 5 x .25rem gap = 17.75rem, fits the
     22.5rem minimum-width content box. */
  .otp-group { gap: .25rem; }
  .otp-input { width: 2.75rem; height: 3.2rem; }
}

/* Very large screens (smart TV): the 64rem stage cap keeps the card
   composed and perfectly centered; nudge base type up at 4K widths. */
@media (min-width: 160rem) {
  html { font-size: 112.5%; }
}

/* ---------------- Reduced motion ---------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}

/* S101 WP-C: a white-label page removes the "Also sign in to partner sites"
   box from .row-between; keep "Forgot password?" where it was (right). */
.row-between > .forgot-link:only-child { margin-left: auto; }
