/* ==========================================================================
   MCVote auth + account UI (login, code, password, passkey nudge,
   dashboard "Sign-in methods" card, rename/remove popovers).

   Additive on top of site.v6.css: uses the V6 tokens (--bg, --sf, --sf2,
   --ln, --tx, --mu, --ac, --ink, --link, --halo, --r-*, --font, --disp,
   --mono, --ease) and the existing .button / .button--primary classes.
   Every class is prefixed .auth- so nothing leaks into other pages.

   Contrast notes (WCAG AA):
   - Text in green always uses --link (light: #15803d), never --ac.
   - Error text has its own token per theme (--auth-err), because the
     global --danger (#ff5c72) is only ~3:1 on white.
   ========================================================================== */

:root {
  --auth-err: #ff8593;
  --auth-err-bg: rgba(255, 92, 114, 0.1);
  --auth-err-ln: rgba(255, 92, 114, 0.42);
  --auth-err-solid: #ff6b7d;
  --auth-err-ink: #2b0309;
  --auth-warn: #fbbf24;
  --auth-warn-bg: rgba(245, 158, 11, 0.12);
  --auth-ok-ln: color-mix(in srgb, var(--ac) 38%, var(--ln));
  --auth-ring: color-mix(in srgb, var(--link) 38%, transparent);
  --auth-field: var(--bg);
  --auth-card-w: 440px;
}
[data-theme="light"] {
  --auth-err: #b4232f;
  --auth-err-bg: #fdf0f1;
  --auth-err-ln: #efb3ba;
  --auth-err-solid: #c42b3a;
  --auth-err-ink: #ffffff;
  --auth-warn: #8a4b07;
  --auth-warn-bg: #fdf3d8;
  --auth-ring: color-mix(in srgb, var(--link) 30%, transparent);
  --auth-field: #fbfcf9;
}

/* `hidden` must win over component display values. */
.auth-shell [hidden], .auth-sec [hidden] { display: none !important; }

.auth-sr {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---- Focus: always visible, never colour-only ---- */
.auth-shell :focus-visible,
.auth-sec :focus-visible {
  outline: 2px solid var(--link);
  outline-offset: 3px;
}
.auth-shell .auth-input:focus-visible,
.auth-sec .auth-input:focus-visible,
.auth-otp__box:focus-visible { outline: none; }

/* ==========================================================================
   Page shell + card
   ========================================================================== */
.auth-shell {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: clamp(28px, 7vh, 80px) 0 40px;
}

.auth-card {
  position: relative;
  width: 100%;
  max-width: var(--auth-card-w);
  padding: 36px 36px 32px;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
/* Hairline of accent light on the top edge (same motif as the header). */
.auth-card::before {
  content: "";
  position: absolute;
  top: -1px;
  left: 24px;
  right: 24px;
  height: 1px;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ac) 70%, transparent), transparent);
  opacity: 0.8;
}
.auth-card--nudge { --auth-card-w: 460px; }

/* ---- Head ---- */
.auth-head {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  margin-bottom: 24px;
}
.auth-mark {
  position: relative;
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
}
.auth-mark::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(closest-side, var(--halo), transparent);
}
.auth-block { position: relative; display: block; filter: drop-shadow(0 6px 10px rgba(0, 0, 0, 0.25)); }

.auth-tile {
  display: grid;
  place-items: center;
  width: 56px;
  height: 56px;
  border-radius: 16px;
  color: var(--link);
  background:
    radial-gradient(circle at 30% 20%, var(--halo), transparent 70%),
    var(--sf2);
  border: 1px solid var(--auth-ok-ln);
  box-shadow: inset 0 -3px 0 rgba(0, 0, 0, 0.12);
}
.auth-tile--sm { width: 44px; height: 44px; border-radius: 12px; flex: none; }

.auth-title {
  margin-top: 16px;
  font-family: var(--disp);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--tx);
  text-wrap: balance;
}
.auth-lead {
  margin-top: 8px;
  max-width: 34ch;
  font-size: 15.5px;
  line-height: 1.55;
  color: var(--mu);
  text-wrap: pretty;
}
.auth-lead--tight { margin: -12px auto 12px; text-align: center; }
.auth-eyebrow {
  margin-top: 18px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--link);
}
.auth-eyebrow + .auth-title { margin-top: 6px; }

/* ==========================================================================
   Buttons (extend .button from site.v6.css)
   ========================================================================== */
.auth-btn {
  position: relative;
  width: 100%;
  justify-content: center;
  min-height: 50px;
  font-size: 16px;
  gap: 10px;
}
.auth-btn .auth-ico { flex: none; }
.auth-btn--hero {
  min-height: 56px;
  font-size: 16.5px;
  border-radius: 10px;
}
.auth-btn--sm {
  width: auto;
  min-height: 44px;
  padding: 8px 14px;
  font-size: 14px;
  gap: 6px;
}
.auth-btn--ghost {
  background: transparent;
  box-shadow: none;
}
.auth-btn--ghost:hover { background: var(--sf2); }
.auth-btn--danger { color: var(--auth-err); }
.auth-btn--danger:hover { border-color: var(--auth-err-ln); background: var(--auth-err-bg); }
.auth-btn--danger-solid {
  background: var(--auth-err-solid);
  border-color: transparent;
  color: var(--auth-err-ink);
}
.auth-btn--danger-solid:hover { border-color: transparent; filter: brightness(1.05); }
.auth-btn--quiet { background: transparent; }
.auth-btn--quiet:hover { background: var(--sf2); }
.button--primary:focus-visible { outline-offset: 3px; }

/* "Recommended" badge, sitting on the top edge of the hero button so it
   never fights the label for width (fits 360px screens). */
.auth-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.5;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.auth-btn--hero .auth-badge {
  position: absolute;
  top: -11px;
  right: 14px;
  background: var(--ink);
  color: #86efac;
  border: 1px solid color-mix(in srgb, var(--ac) 55%, transparent);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.18);
}
[data-theme="light"] .auth-btn--hero .auth-badge {
  background: #ffffff;
  color: #15803d;
  border-color: #86d9a3;
  box-shadow: 0 2px 6px rgba(40, 60, 30, 0.12);
}
.auth-badge--soft {
  background: var(--halo);
  color: var(--link);
  border: 1px solid var(--auth-ok-ln);
}

/* One primary per view: when passkeys are available (set by passkey.js on
   <html data-passkey="on">), the email button steps back to secondary. */
.auth-when-pk { display: none; }
[data-passkey="on"] .auth-when-pk { display: inline; }
[data-passkey="on"] .auth-when-nopk { display: none; }
[data-passkey="on"] .auth-demote {
  background: transparent;
  color: var(--tx);
  border-color: var(--ln);
  box-shadow: none;
}
[data-passkey="on"] .auth-demote:hover { border-color: var(--ac); background: var(--sf2); }

/* Loading: keep the width, swap the label for a spinner. */
.auth-shell .button.is-loading,
.auth-sec .button.is-loading {
  color: transparent !important;
  pointer-events: none;
  transform: none;
}
.auth-shell .button.is-loading > *,
.auth-sec .button.is-loading > * { visibility: hidden; }
.auth-shell .button.is-loading::after,
.auth-sec .button.is-loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border-radius: 50%;
  border: 2px solid var(--auth-spin, var(--tx));
  border-right-color: transparent;
  animation: auth-spin 0.7s linear infinite;
}
.auth-shell .button--primary.is-loading,
.auth-sec .button--primary.is-loading { --auth-spin: var(--ink); }
.auth-shell .button, .auth-sec .button { position: relative; }

/* Text-style button / link. 44px tall hit area, tight visual box. */
.auth-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 4px;
  font: inherit;
  font-weight: 600;
  color: var(--link);
  background: none;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  text-underline-offset: 3px;
}
.auth-link:hover { text-decoration: underline; }
.auth-link--sm { font-size: 14px; }
.auth-link--muted { color: var(--mu); font-weight: 500; }
.auth-link--muted:hover { color: var(--tx); }

/* ==========================================================================
   Fields
   ========================================================================== */
.auth-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.auth-field { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.auth-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--tx);
}
.auth-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: -8px 0 -6px; /* the 44px link target must not add visual gap */
}

.auth-input {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  font-size: 16px; /* no iOS zoom */
  color: var(--tx);
  background: var(--auth-field);
  border: 1px solid var(--ln);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, background-color 0.15s;
}
.auth-input:hover { border-color: var(--border-strong); }
.auth-input:focus,
.auth-input:focus-visible {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--auth-ring);
}
.auth-input::placeholder { color: color-mix(in srgb, var(--mu) 80%, transparent); }
.auth-input[readonly] { color: var(--mu); }

.is-invalid .auth-input,
.auth-input[aria-invalid="true"] { border-color: var(--auth-err); }
.is-invalid .auth-input:focus,
.auth-input[aria-invalid="true"]:focus {
  border-color: var(--auth-err);
  box-shadow: 0 0 0 3px var(--auth-err-bg);
}

.auth-field__error {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--auth-err);
}
.auth-field__error .auth-ico { flex: none; margin-top: 2px; }

.auth-hint {
  font-size: 14px;
  line-height: 1.5;
  color: var(--mu);
}
.auth-hint--center { text-align: center; }
.auth-hint--link {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  margin-top: 16px;
}
.auth-hint--link .auth-ico { flex: none; color: var(--mu); }

/* ---- Password + show/hide ---- */
.auth-pw { position: relative; }
.auth-pw__input { padding-right: 104px; }
.auth-pw__toggle {
  position: absolute;
  top: 4px;
  right: 4px;
  bottom: 4px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 44px;
  padding: 0 12px;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--mu);
  border-radius: 8px;
  transition: color 0.15s, background-color 0.15s;
}
.auth-pw__toggle:hover { color: var(--tx); background: var(--sf2); }
.auth-pw__toggle .auth-ico--eye-off { display: none; }
.auth-pw__toggle[data-shown="true"] .auth-ico--eye { display: none; }
.auth-pw__toggle[data-shown="true"] .auth-ico--eye-off { display: block; }
.auth-pw__toggle:focus-visible { outline-offset: -2px; }

/* ---- Strength meter (hint, never a gate beyond the 10-char minimum) ---- */
.auth-meter {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 20px;
}
.auth-meter__bar {
  flex: 1;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
}
.auth-meter__bar i {
  height: 4px;
  border-radius: 2px;
  background: var(--ln);
  transition: background-color 0.25s var(--ease);
}
.auth-meter__text {
  min-width: 96px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--mu);
}
.auth-meter[data-level="1"] i:nth-child(-n+1) { background: var(--auth-err); }
.auth-meter[data-level="2"] i:nth-child(-n+2) { background: var(--auth-warn); }
.auth-meter[data-level="3"] i:nth-child(-n+3) { background: var(--link); }
.auth-meter[data-level="4"] i { background: var(--ac); }
.auth-meter[data-level="1"] .auth-meter__text { color: var(--auth-err); }
.auth-meter[data-level="2"] .auth-meter__text { color: var(--auth-warn); }
.auth-meter[data-level="3"] .auth-meter__text,
.auth-meter[data-level="4"] .auth-meter__text { color: var(--link); }

/* ---- Code: single field (no JS) + six boxes (JS) ---- */
.auth-field--code { justify-items: stretch; }
.auth-field--code > .auth-label { text-align: center; }
.auth-code-single {
  text-align: center;
  font-family: var(--mono);
  font-size: 24px;
  letter-spacing: 0.4em;
  padding-left: calc(14px + 0.4em);
}
.auth-otp {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.auth-otp__gap { flex: 0 0 6px; }
.auth-otp__box {
  flex: 1 1 0;
  min-width: 0;
  max-width: 52px;
  height: 62px;
  padding: 0;
  text-align: center;
  font-family: var(--mono);
  font-size: 26px;
  font-weight: 500;
  color: var(--tx);
  caret-color: var(--ac);
  background: var(--auth-field);
  border: 1px solid var(--ln);
  border-radius: 10px;
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s var(--ease);
}
.auth-otp__box:hover { border-color: var(--border-strong); }
.auth-otp__box.is-filled { border-color: color-mix(in srgb, var(--tx) 32%, var(--ln)); }
.auth-otp__box:focus {
  outline: none;
  border-color: var(--link);
  box-shadow: 0 0 0 3px var(--auth-ring);
}
.auth-otp__box[aria-invalid="true"] { border-color: var(--auth-err); }
.auth-otp__box[aria-invalid="true"]:focus { box-shadow: 0 0 0 3px var(--auth-err-bg); }
.auth-otp__box:disabled { opacity: 0.5; cursor: not-allowed; }
.auth-otp.is-complete .auth-otp__box { border-color: var(--auth-ok-ln); }

/* ==========================================================================
   Small building blocks
   ========================================================================== */
.auth-or {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 22px 0;
  font-size: 13px;
  color: var(--mu);
}
.auth-or::before, .auth-or::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--ln);
}
.auth-sep { height: 1px; margin: 24px 0; background: var(--ln); }

.auth-passkey .auth-hint { margin-top: 10px; }
.auth-live:empty { display: none; }
.auth-live { margin-top: 14px; }
.auth-live .auth-alert { margin: 0; }

.auth-alt {
  margin-top: -10px;
  font-size: 14px;
  color: var(--mu);
  text-align: center;
  line-height: 1.4;
}
.auth-alt .auth-link { font-size: 14px; }
.auth-alt--center { display: flex; justify-content: center; margin-top: 0; }
.auth-alt a { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-weight: 600; }

/* Email chip with change action (44px). */
.auth-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  width: fit-content;
  max-width: 100%;
  min-height: 44px;
  margin: 0 auto 24px;
  padding-left: 14px;
  background: var(--sf2);
  border: 1px solid var(--ln);
  border-radius: 22px;
  color: var(--mu);
}
.auth-chip > .auth-ico { flex: none; }
.auth-chip__text {
  min-width: 0;
  padding: 10px 0;
  line-height: 1.3;
  overflow-wrap: break-word; /* never hide part of the address; breaks before @ */
  font-weight: 600;
  font-size: 15px;
  color: var(--tx);
}
.auth-chip__action {
  flex: none;
  display: inline-flex;
  align-items: center;
  align-self: stretch;
  margin-left: 4px;
  padding: 0 16px;
  font-size: 14px;
  font-weight: 600;
  border-left: 1px solid var(--ln);
  border-radius: 0 21px 21px 0;
}
.auth-chip__action:hover { background: var(--sf); text-decoration: none; }

/* Alerts (role=alert / status). */
.auth-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0 0 20px;
  padding: 12px 14px;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--tx);
  border: 1px solid var(--ln);
  border-radius: 10px;
  background: var(--sf2);
}
.auth-alert .auth-ico { flex: none; margin-top: 2px; color: var(--mu); }
.auth-alert--error { background: var(--auth-err-bg); border-color: var(--auth-err-ln); }
.auth-alert--error .auth-ico { color: var(--auth-err); }
.auth-alert--warn { background: var(--auth-warn-bg); border-color: color-mix(in srgb, var(--auth-warn) 40%, transparent); }
.auth-alert--warn .auth-ico { color: var(--auth-warn); }
.auth-alert--success { background: var(--halo); border-color: var(--auth-ok-ln); }
.auth-alert--success .auth-ico { color: var(--link); }
.auth-alert--quiet { background: transparent; }

/* Help box (spam folder etc.). */
.auth-help {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: 16px;
  padding: 12px 14px;
  font-size: 14px;
  line-height: 1.5;
  color: var(--mu);
  background: var(--sf2);
  border-radius: 10px;
}
.auth-help .auth-ico { flex: none; margin-top: 1px; }

/* Resend row. */
.auth-resend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 4px 10px;
}
.auth-resend__q { font-size: 14px; color: var(--mu); }
.auth-resend .button { font-variant-numeric: tabular-nums; }
.auth-resend .button[disabled] { opacity: 1; color: var(--mu); border-color: var(--ln); }
.auth-resend .button[disabled]:hover { background: transparent; }

/* Below-card meta. */
.auth-meta {
  display: grid;
  gap: 6px;
  width: 100%;
  max-width: var(--auth-card-w);
  margin-top: 20px;
  padding: 0 8px;
  text-align: center;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--mu);
}
.auth-meta__new {
  display: flex;
  justify-content: center;
  gap: 8px;
}
.auth-meta__new .auth-ico { flex: none; margin-top: 2px; }
.auth-meta a { font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* ==========================================================================
   Passkey nudge
   ========================================================================== */
.auth-hero-ico {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  color: var(--link);
  background: radial-gradient(circle at 35% 25%, var(--halo), transparent 75%), var(--sf2);
  border: 1px solid var(--auth-ok-ln);
}
.auth-hero-ico::after {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: 50%;
  border: 1px solid color-mix(in srgb, var(--ac) 45%, transparent);
  opacity: 0;
}
.auth-hero-ico--done { color: var(--ink); background: var(--ac); border-color: transparent; }

.auth-benefits {
  list-style: none;
  display: grid;
  gap: 4px;
  margin: 0 0 24px;
  padding: 6px;
  background: var(--sf2);
  border: 1px solid var(--ln);
  border-radius: var(--r-card);
}
.auth-benefits li {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 10px 10px;
}
.auth-benefits li > .auth-ico {
  flex: none;
  box-sizing: content-box;
  padding: 9px;
  border-radius: 10px;
  color: var(--link);
  background: var(--sf);
  border: 1px solid var(--ln);
}
.auth-benefits b { display: block; font-size: 15px; font-weight: 600; color: var(--tx); line-height: 1.35; }
.auth-benefits span { display: block; margin-top: 2px; font-size: 14px; line-height: 1.45; color: var(--mu); }

.auth-nudge-actions {
  display: grid;
  justify-items: center;
  gap: 4px;
  margin-top: 12px;
}
[data-passkey="on"] .auth-nudge-actions { margin-top: 10px; }
.auth-card--nudge [data-passkey-unsupported] { margin-bottom: 8px; }
.auth-fine {
  margin-top: 8px;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
  color: var(--mu);
}
[data-nudge-view="done"]:focus { outline: none; }

/* ==========================================================================
   Dashboard card: Sign-in methods
   ========================================================================== */
.auth-sec {
  position: relative;
  padding: 28px;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-card);
}
.auth-sec__head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 20px;
}
.auth-sec__head h2 {
  font-family: var(--disp);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  margin-top: 2px;
}
.auth-sec__head p { margin-top: 4px; font-size: 15px; color: var(--mu); max-width: 60ch; }
.auth-sec > .auth-alert { margin-bottom: 4px; }
.auth-sec > .auth-alert + .auth-alert { margin-top: 10px; }

.auth-sec__group { margin-top: 24px; }
.auth-sec__group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-bottom: 8px;
}
.auth-sec__group-head h3 {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mu);
}

.auth-methods {
  list-style: none;
  border: 1px solid var(--ln);
  border-radius: var(--r-card);
}
.auth-method {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 12px 12px 12px 16px;
}
.auth-method + .auth-method { border-top: 1px solid var(--ln); }
.auth-method__ico {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  color: var(--mu);
  background: var(--sf2);
}
.auth-method__body { display: grid; gap: 3px; min-width: 0; }
.auth-method__name {
  font-size: 15px;
  font-weight: 600;
  color: var(--tx);
  overflow-wrap: anywhere;
}
.auth-method__meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 8px;
  font-size: 13.5px;
  color: var(--mu);
}
.auth-method__actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}
.auth-method__actions > form { display: contents; }
.auth-method__actions .auth-btn--sm { padding: 8px 12px; }

.auth-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 8px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.6;
  border-radius: 999px;
  color: var(--mu);
  border: 1px solid var(--ln);
}
.auth-pill--ok { color: var(--link); background: var(--halo); border-color: var(--auth-ok-ln); }
.auth-pill--warn { color: var(--auth-warn); background: var(--auth-warn-bg); border-color: color-mix(in srgb, var(--auth-warn) 35%, transparent); }

/* Recommendation box (no passkey yet). */
.auth-reco {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px 20px;
  padding: 18px 20px;
  border: 1px dashed color-mix(in srgb, var(--ac) 50%, var(--ln));
  border-radius: var(--r-card);
  background: linear-gradient(135deg, var(--halo), transparent 70%);
}
.auth-reco__text { flex: 1 1 280px; min-width: 0; }
.auth-reco__title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  color: var(--tx);
}
.auth-reco__title .auth-ico { color: var(--link); }
.auth-reco__title b { font-size: 15.5px; }
.auth-reco__text > p + p { margin-top: 4px; font-size: 14px; color: var(--mu); line-height: 1.5; }
.auth-reco .auth-hint { flex-basis: 100%; }

/* Popovers built on <details> (work without JS). */
.auth-pop { position: relative; }
.auth-pop > summary { list-style: none; }
.auth-pop > summary::-webkit-details-marker { display: none; }
.auth-pop[open] > summary { border-color: var(--ac); background: var(--sf2); }
.auth-pop > summary.auth-btn--danger { border-color: var(--ln); }
.auth-pop[open] > summary.auth-btn--danger { border-color: var(--auth-err-ln); background: var(--auth-err-bg); }
.auth-pop__panel {
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  gap: 10px;
  width: 300px;
  padding: 16px;
  text-align: left;
  background: var(--sf);
  border: 1px solid var(--ln);
  border-radius: var(--r-card);
  box-shadow: var(--sh);
}
.auth-pop__title { font-weight: 600; font-size: 15px; color: var(--tx); overflow-wrap: anywhere; }
.auth-pop__text { font-size: 14px; line-height: 1.5; color: var(--mu); }
.auth-pop__row { display: flex; gap: 8px; margin-top: 4px; }

/* Add email (inline disclosure). */
.auth-add { margin-top: 8px; }
.auth-add > summary { list-style: none; width: fit-content; }
.auth-add > summary::-webkit-details-marker { display: none; }
.auth-add__form { display: grid; gap: 8px; margin-top: 8px; max-width: 520px; }
.auth-inline { display: flex; gap: 8px; }
.auth-inline .auth-input { flex: 1; min-width: 0; }
.auth-inline .button { flex: none; min-height: 52px; }

.auth-sec__note {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  margin-top: 20px;
  padding: 10px 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--mu);
  background: var(--sf2);
  border-radius: 10px;
}
.auth-sec__note .auth-ico { flex: none; margin-top: 2px; }
.auth-sec .button .auth-ico--lock { opacity: 0.7; }

/* ==========================================================================
   Motion (subtle; nothing moves with prefers-reduced-motion)
   ========================================================================== */
@keyframes auth-spin { to { transform: rotate(360deg); } }
@keyframes auth-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-5px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(2px); }
}
@keyframes auth-ring {
  0% { opacity: 0.7; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.35); }
}
@keyframes auth-pop {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: no-preference) {
  .auth-card { animation: auth-in 0.4s var(--ease) both; }
  .auth-alert { animation: auth-in 0.3s var(--ease) both; }
  .auth-otp.is-shake { animation: auth-shake 0.4s var(--ease); }
  .auth-otp__box.is-filled { animation: auth-in 0.18s var(--ease); }
  .auth-hero-ico::after { animation: auth-ring 2.4s var(--ease) 0.5s 3; }
  .auth-pop[open] > .auth-pop__panel { animation: auth-pop 0.16s var(--ease); }
}
@media (prefers-reduced-motion: reduce) {
  .auth-shell *, .auth-sec * { transition: none !important; }
  .auth-shell .button.is-loading::after,
  .auth-sec .button.is-loading::after { animation-duration: 1.6s; }
  .auth-shell .button:hover, .auth-sec .button:hover { transform: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */
@media (max-width: 560px) {
  .auth-sec { padding: 20px 16px; }
  .auth-sec__head .auth-tile { display: none; }
  .auth-method {
    grid-template-columns: 40px minmax(0, 1fr);
    padding: 12px;
  }
  .auth-method__actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
    padding-left: 54px;
  }
  .auth-pop[open] { flex-basis: 100%; }
  .auth-pop__panel { position: static; width: auto; margin-top: 8px; box-shadow: none; background: var(--sf2); }
  .auth-reco .button { width: 100%; justify-content: center; }
  .auth-inline { flex-wrap: wrap; }
  .auth-inline .button { width: 100%; justify-content: center; }
}

@media (max-width: 480px) {
  .auth-shell { padding-top: 20px; }
  .auth-card { padding: 28px 20px 24px; border-radius: 14px; }
  .auth-title { font-size: 24px; }
  .auth-lead { font-size: 15px; }
  .auth-otp { gap: 6px; }
  .auth-otp__gap { flex-basis: 2px; }
  .auth-otp__box { height: 56px; font-size: 23px; }
  .auth-head { margin-bottom: 20px; }
}

/* Windows high contrast: keep boundaries visible. */
@media (forced-colors: active) {
  .auth-card, .auth-sec, .auth-otp__box, .auth-input, .auth-alert, .auth-chip { border: 1px solid CanvasText; }
  .auth-meter__bar i { background: GrayText; }
  .auth-meter[data-level] i:nth-child(-n+1) { background: Highlight; }
}

/* A 44px text link already brings its own air: trim surrounding margins. */
.auth-sep + .auth-alt--center { margin-top: -12px; margin-bottom: -8px; }
.auth-card > .auth-alt--center:last-child { margin-bottom: -10px; }
.auth-method__actions:not(:has(*)) { display: none; }
/* Green text on the green-tinted halo needs a darker tone in light mode (AA). */
[data-theme="light"] .auth-pill--ok,
[data-theme="light"] .auth-badge--soft { color: #166534; }
