/* Fable account surfaces: sign-in and dashboard.
   Self-contained so the account area does not inherit marketing-page overrides. */

:root {
  --ground: #f5efe6;
  --paper: #faf6f0;
  --sunk: #efe6d8;
  --ink: #2a2622;
  --dim: #6b645c;
  --faint: #857d74;
  --rule: #e0d6c8;
  --rule-strong: #d4c8b8;
  --meadow: #2a2622;
  --meadow-ink: #413a34;
  --meadow-wash: #efe6d8;
  --night: #191b1a;
  --night-2: #232624;
  --night-ink: #f3f2ec;
  --night-dim: #a9ada4;
  --danger: #a3402c;
  --danger-wash: #f6e6e0;
  --usage-high: #805617;
  --usage-high-wash: #f2e9d8;
  --focus: #c4a574;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "New York", "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --radius: 14px;
  color-scheme: light;
}

:root[data-theme="dark"] {
  --ground: #121412;
  --paper: #191c19;
  --sunk: #202420;
  --ink: #ecebe4;
  --dim: #a7ab9f;
  --faint: #868b81;
  --rule: #2b2f2a;
  --rule-strong: #3a3f39;
  --meadow: #93b598;
  --meadow-ink: #b5d0b9;
  --meadow-wash: #223026;
  --night: #0c0d0c;
  --night-2: #171917;
  --danger: #e08b74;
  --danger-wash: #3a221c;
  --usage-high: #e2c483;
  --usage-high-wash: #2d2619;
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  /* The dashboard never follows the OS dark preference (see the
     html.dashboard-page block below): it is light by default. */
  :root:not([data-theme="light"]):not([data-theme="dark"]):not(.dashboard-page):not(.consent-page) {
    --ground: #121412;
    --paper: #191c19;
    --sunk: #202420;
    --ink: #ecebe4;
    --dim: #a7ab9f;
    --faint: #868b81;
    --rule: #2b2f2a;
    --rule-strong: #3a3f39;
    --meadow: #93b598;
    --meadow-ink: #b5d0b9;
    --meadow-wash: #223026;
    --night: #0c0d0c;
    --night-2: #171917;
    --danger: #e08b74;
    --danger-wash: #3a221c;
    --usage-high: #e2c483;
    --usage-high-wash: #2d2619;
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }

/* ------------------------------------------------------------------ */
/* Dashboard: always light (white)                                     */
/* Scoped to the dashboard page only (html.dashboard-page). Consent,   */
/* control-center and the login pages keep their own themes. An        */
/* explicit Dark choice in Settings still applies:                    */
/* :root[data-theme="dark"] is not matched by this block.              */
/* ------------------------------------------------------------------ */

html.dashboard-page:not([data-theme="dark"]) {
  --ground: #ffffff;
  --paper: #ffffff;
  --sunk: #f6f6f4;
  --ink: #171717;
  --dim: #5c5c5c;
  --faint: #8a8a8a;
  --rule: #e8e8e6;
  --rule-strong: #dcdcd9;
  --meadow: #171717;
  --meadow-ink: #404040;
  --meadow-wash: #f0f0ee;
  --night: #ffffff;
  --night-2: #f4f4f2;
  --night-ink: #171717;
  --night-dim: #5c5c5c;
  --danger: #a3402c;
  --danger-wash: #f6e6e0;
  --usage-high: #805617;
  --usage-high-wash: #f2e9d8;
  --focus: #b8956a;
  color-scheme: light;
}
/* The dark sidebar becomes a white rail with a hairline divider. */
html.dashboard-page:not([data-theme="dark"]) .rail { border-right: 1px solid var(--rule); }html.dashboard-page:not([data-theme="dark"]) .rail-link[aria-current="page"] { background: #ececea; }
html.dashboard-page:not([data-theme="dark"]) .rail-link[aria-current="page"]::before { background: #b8956a; }
html.dashboard-page:not([data-theme="dark"]) .rail-foot { border-top-color: var(--rule); }
/* Profile forms stop stretching across the full content width. */
html.dashboard-page #section-account .form { max-width: 640px; }

/* ------------------------------------------------------------------ */
/* OAuth consent: always light (white), like the Fable web             */
/* The owner wants a white page, no exceptions: unlike the dashboard,  */
/* a saved Dark choice does NOT apply here.                            */
/* ------------------------------------------------------------------ */

html.consent-page {
  --ground: #ffffff;
  --paper: #ffffff;
  --sunk: #f6f6f4;
  --ink: #171717;
  --dim: #5c5c5c;
  --faint: #8a8a8a;
  --rule: #e8e8e6;
  --rule-strong: #dcdcd9;
  --meadow: #171717;
  --meadow-ink: #404040;
  --meadow-wash: #f0f0ee;
  --night: #ffffff;
  --night-2: #f4f4f2;
  --night-ink: #171717;
  --night-dim: #5c5c5c;
  --danger: #a3402c;
  --danger-wash: #f6e6e0;
  --usage-high: #805617;
  --usage-high-wash: #f2e9d8;
  --focus: #b8956a;
  color-scheme: light;
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ground);
  color: var(--ink);
  font: 400 14px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { display: block; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }

.skip-link {
  position: fixed; z-index: 100; top: 12px; left: 12px;
  padding: 10px 14px; border-radius: 10px;
  background: var(--night); color: var(--night-ink); text-decoration: none;
  transform: translateY(-160%); transition: transform 200ms var(--ease);
}
.skip-link:focus { transform: none; }

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

.wordmark { color: inherit; font: 640 19px/1 var(--sans); letter-spacing: -.055em; text-decoration: none; }
.wordmark span { color: #b8956a; }

/* Fable blob mark beside the Fable wordmark (login, dashboard rail, consent). */
.wordmark .fable-mark { width: 22px; height: 22px; margin-right: 8px; border-radius: 6px; background: #fff; flex: none; }

/* Buttons */
.btn {
  display: inline-flex; min-height: 40px; align-items: center; justify-content: center; gap: 8px;
  padding: 0 16px; border: 1px solid transparent; border-radius: 999px;
  background: var(--ink); color: var(--paper);
  font: 560 13px/1 var(--sans); text-decoration: none; white-space: nowrap;
  transition: background-color 160ms ease, border-color 160ms ease, transform 160ms var(--ease), opacity 160ms ease;
}
.btn:hover { background: color-mix(in srgb, var(--ink) 86%, var(--ground)); }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .45; cursor: not-allowed; transform: none; }
.btn-quiet { border-color: var(--rule-strong); background: transparent; color: var(--ink); }
.btn-quiet:hover { border-color: var(--ink); background: transparent; }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: transparent; color: var(--danger); }
.btn-danger:hover { background: var(--danger-wash); }
.btn svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* Fields */
.field { display: grid; gap: 7px; min-width: 0; }
.field > span, .field > label { color: var(--ink); font-size: 13px; font-weight: 560; }
.field small { color: var(--faint); font-size: 12px; font-weight: 400; }
.field-optional { color: var(--faint); font-weight: 400; }
.input {
  width: 100%; height: 44px; padding: 0 14px;
  border: 1px solid var(--rule-strong); border-radius: 11px;
  background: var(--paper); color: var(--ink); font-size: 15px;
  transition: border-color 160ms ease, box-shadow 160ms ease, background-color 160ms ease;
}
.input::placeholder { color: var(--faint); }
.input:hover { border-color: color-mix(in srgb, var(--ink) 40%, var(--rule-strong)); }
.input:focus { border-color: var(--meadow); outline: none; box-shadow: 0 0 0 4px color-mix(in srgb, var(--meadow) 18%, transparent); }
.input:disabled { background: var(--sunk); color: var(--dim); cursor: not-allowed; }
.input-wrap { position: relative; }
.input-wrap .input { padding-right: 46px; }
.password-toggle {
  position: absolute; top: 50%; right: 5px; display: grid; width: 36px; height: 36px; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--dim); transform: translateY(-50%);
}
.password-toggle:hover { background: var(--sunk); color: var(--ink); }
.password-toggle svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.password-toggle [data-eye="hide"], .password-toggle[aria-pressed="true"] [data-eye="show"] { display: none; }
.password-toggle[aria-pressed="true"] [data-eye="hide"] { display: block; }

.message { min-height: 0; margin: 0; color: var(--dim); font-size: 13px; line-height: 1.45; }
.message:empty { display: none; }
.message[data-state="error"] { color: var(--danger); }
.message[data-state="success"] { color: var(--meadow-ink); }

/* ------------------------------------------------------------------ */
/* Sign in                                                             */
/* ------------------------------------------------------------------ */

body.auth-surface--centered {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background: var(--ground);
}

.auth-standalone {
  display: grid;
  width: min(100%, 440px);
  gap: 20px;
  margin: auto;
  padding: clamp(20px, 5vw, 48px) clamp(16px, 4vw, 24px);
}

.auth-standalone__brand { text-align: center; }
.auth-standalone__footer { text-align: center; color: var(--faint); font-size: 12px; }
.auth-standalone__footer a { color: var(--dim); text-decoration: none; }
.auth-standalone__footer a:hover { color: var(--ink); }

body.auth-surface--centered > .auth {
  display: block;
  width: min(100%, 440px);
  min-height: auto;
  grid-template-columns: 1fr;
}

body.auth-surface--centered .auth-art,
body.auth-surface--centered .auth-footer { display: none; }
body.auth-surface--centered .auth-panel {
  padding: 0;
  min-height: auto;
}
body.auth-surface--centered .auth-panel-top { display: none; }

.auth-card--sheet {
  max-width: none;
  margin: 0;
  padding: clamp(28px, 4vw, 36px);
  border: 1px solid var(--rule);
  border-radius: calc(var(--radius) + 2px);
  background: var(--paper);
  box-shadow: 0 20px 56px rgba(42, 38, 34, .08);
}

.consent-block { margin-top: 24px; }
.consent-lead { margin: 0 0 16px; color: var(--dim); font-size: 14px; line-height: 1.55; }
.consent-actions { display: grid; gap: 10px; margin-top: 22px; }

.auth {
  display: grid; min-height: 100svh;
  grid-template-columns: minmax(0, 1fr) minmax(420px, 560px);
}
.auth-art { position: relative; overflow: hidden; margin: 12px 0 12px 12px; border-radius: 18px; background: #c9d0b8; }
.auth-art img { width: 100%; height: 100%; object-fit: cover; object-position: 58% 60%; animation: art-settle 1600ms var(--ease) both; }
.auth-art::after {
  position: absolute; inset: 0; content: "";
  background: linear-gradient(180deg, rgba(14, 18, 14, .32) 0%, rgba(14, 18, 14, 0) 26%, rgba(14, 18, 14, 0) 55%, rgba(14, 18, 14, .5) 100%);
}
.auth-art-top, .auth-art-quote { position: absolute; z-index: 1; left: clamp(22px, 3vw, 40px); right: clamp(22px, 3vw, 40px); color: #f7f5ee; }
.auth-art-top { top: clamp(20px, 3vw, 34px); display: flex; align-items: center; justify-content: space-between; }
.auth-art-top a:not(.wordmark) { display: inline-flex; min-height: 44px; align-items: center; font-size: 13px; text-decoration: none; opacity: .86; transition: opacity 160ms ease; }
.auth-art-top a:not(.wordmark):hover { opacity: 1; }
.auth-art-quote { bottom: clamp(22px, 3.4vw, 44px); max-width: 520px; margin: 0; font: 400 clamp(30px, 3.3vw, 46px)/1.04 var(--serif); letter-spacing: -.035em; text-wrap: balance; }

.auth-panel { display: flex; flex-direction: column; padding: clamp(24px, 4vw, 48px) clamp(24px, 5vw, 64px); }
.auth-panel-top { display: none; align-items: center; justify-content: space-between; }
.auth-panel-top a:not(.wordmark) { display: inline-flex; min-height: 44px; align-items: center; color: var(--dim); font-size: 13px; text-decoration: none; }
.auth-card { width: 100%; max-width: 380px; margin: auto; padding-block: 32px; animation: rise 640ms 80ms var(--ease) both; }
.auth-card h1 { margin: 0; font: 400 clamp(32px, 3vw, 38px)/1.08 var(--serif); letter-spacing: -.03em; text-wrap: balance; }
.auth-intro { margin: 10px 0 0; color: var(--dim); font-size: 14.5px; line-height: 1.55; }

.auth-tabs { position: relative; display: grid; grid-template-columns: 1fr 1fr; margin-top: 28px; padding: 4px; border-radius: 12px; background: var(--sunk); }
.auth-tabs::before {
  position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); content: "";
  border-radius: 9px; background: var(--paper); box-shadow: 0 1px 2px rgba(20, 24, 20, .08), 0 0 0 1px var(--rule);
  transition: transform 300ms var(--ease);
}
.auth-tabs[data-mode="signup"]::before { transform: translateX(100%); }
.auth-tab { position: relative; z-index: 1; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--dim); font-size: 13px; font-weight: 560; transition: color 200ms ease; }
.auth-tab:hover:not(.is-active) { color: var(--ink); }
.auth-tab.is-active { color: var(--ink); }

.auth-form { display: grid; gap: 16px; margin-top: 22px; }
.auth-form-step { display: grid; gap: 16px; }
.auth-name-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.auth-password-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.text-button { padding: 0; border: 0; background: none; color: var(--meadow-ink); font-size: 13px; font-weight: 520; text-decoration: underline; text-decoration-color: color-mix(in srgb, currentColor 35%, transparent); text-underline-offset: 3px; transition: text-decoration-color 160ms ease, color 160ms ease; }
.text-button:hover { text-decoration-color: currentColor; }
.text-button:disabled { color: var(--faint); cursor: default; text-decoration: none; }

.auth-submit { width: 100%; min-height: 46px; margin-top: 4px; font-size: 14px; }
.auth-submit .spinner { display: none; width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 700ms linear infinite; }
.auth-submit.is-loading .spinner { display: block; }
.auth-submit.is-loading .auth-submit-label { opacity: .7; }

.auth-secondary { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 18px; }

.auth-divider { display: flex; align-items: center; gap: 12px; margin: 22px 0; color: var(--dim); font-size: 12px; }
.auth-divider::before, .auth-divider::after { height: 1px; flex: 1; background: var(--rule); content: ""; }
.google-button { display: flex; width: 100%; min-height: 46px; align-items: center; justify-content: center; gap: 10px; border: 1px solid var(--rule-strong); border-radius: 999px; background: var(--paper); font-size: 14px; font-weight: 560; transition: border-color 160ms ease, background-color 160ms ease, transform 160ms var(--ease), box-shadow 200ms ease; }
.google-button:hover:not(:disabled) { border-color: var(--ink); transform: translateY(-1px); box-shadow: 0 4px 14px rgba(20, 24, 20, .10); }
.google-button:active:not(:disabled) { transform: scale(.98); box-shadow: none; }
.google-button:disabled { opacity: .5; cursor: not-allowed; }
.google-button svg { width: 18px; height: 18px; }

.auth-message { margin-top: 16px; padding: 11px 13px; border-radius: 10px; background: var(--sunk); }
.auth-message[data-state="error"] { background: var(--danger-wash); }
.auth-message[data-state="success"] { background: var(--meadow-wash); }
.auth-legal { margin: 22px 0 0; color: var(--dim); font-size: 12px; line-height: 1.55; }
.auth-legal a { color: var(--ink); text-underline-offset: 2px; }
.auth-footer { display: flex; justify-content: space-between; gap: 16px; color: var(--faint); font-size: 12px; }
.auth-footer a { color: var(--dim); text-decoration: none; }
.auth-footer a:hover { color: var(--ink); }

/* Eight-digit code */
.otp-field { display: grid; gap: 10px; }
.otp-label { font-size: 13px; font-weight: 560; }
.otp-entry { position: relative; }
.otp-slots { display: grid; grid-template-columns: repeat(4, 1fr) 10px repeat(4, 1fr); gap: 6px; align-items: center; }
.otp-gap { width: 6px; height: 2px; justify-self: center; border-radius: 2px; background: var(--rule-strong); }
.otp-slot {
  display: grid; height: 50px; place-items: center;
  border: 1px solid var(--rule-strong); border-radius: 10px; background: var(--paper);
  font: 500 21px/1 var(--sans); font-variant-numeric: tabular-nums;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 200ms var(--ease);
}
.otp-slot.is-filled { border-color: color-mix(in srgb, var(--ink) 45%, var(--rule-strong)); animation: digit-in 220ms var(--ease); }
.otp-slot.is-current { border-color: var(--meadow); box-shadow: 0 0 0 4px color-mix(in srgb, var(--meadow) 18%, transparent); }
.otp-slot.is-current::after { width: 1.5px; height: 22px; background: var(--ink); content: ""; animation: caret 1s steps(1) infinite; }
.otp-entry input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; cursor: text; }
.otp-entry.is-verifying .otp-slot { animation: pulse 900ms ease-in-out infinite; }
.otp-entry.is-invalid .otp-slots { animation: shake 360ms var(--ease); }
.otp-entry.is-invalid .otp-slot { border-color: var(--danger); }
.otp-entry.is-success .otp-slot { border-color: var(--meadow); background: var(--meadow-wash); }
.otp-help { color: var(--dim); font-size: 12.5px; }

.auth-welcome { padding-block: 32px; text-align: left; animation: rise 520ms var(--ease) both; }
.auth-welcome h2 { margin: 0; font: 400 clamp(35px, 7vw, 46px)/1.08 var(--serif); letter-spacing: -.055em; text-wrap: balance; }
.welcome-mark { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: 22px; border-radius: 50%; background: var(--meadow-wash); color: var(--meadow-ink); }
.welcome-mark svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.welcome-progress { height: 2px; margin-top: 26px; overflow: hidden; border-radius: 2px; background: var(--rule); }
.welcome-progress::after { display: block; width: 100%; height: 100%; background: var(--meadow); content: ""; transform-origin: left; animation: progress 1200ms var(--ease) both; }

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { height: 180px; margin: 10px 10px 0; }
  .auth-art-top { display: none; }
  .auth-art-quote { font-size: 28px; }
  .auth-panel { padding: 20px 20px 28px; }
  .auth-panel-top { display: flex; }
  .auth-card { padding-block: 26px 32px; }
}
@media (max-width: 420px) {
  .auth-name-fields { grid-template-columns: 1fr; }
  .otp-slots { gap: 4px; grid-template-columns: repeat(4, 1fr) 6px repeat(4, 1fr); }
  .otp-slot { height: 44px; font-size: 18px; }
}

/* ------------------------------------------------------------------ */
/* Dashboard                                                           */
/* ------------------------------------------------------------------ */

.app { display: grid; min-height: 100svh; grid-template-columns: 252px minmax(0, 1fr); transition: grid-template-columns 320ms var(--ease); }
.app.is-collapsed { grid-template-columns: 72px minmax(0, 1fr); }

.rail {
  position: sticky; top: 0; display: flex; height: 100svh; flex-direction: column;
  padding: 18px 12px 14px; background: var(--night); color: var(--night-ink); overflow: hidden;
}
.rail-head { display: flex; height: 36px; align-items: center; justify-content: space-between; padding: 0 8px 0 10px; }
.rail-head .wordmark { overflow: hidden; color: var(--night-ink); white-space: nowrap; transition: opacity 200ms ease; }
.rail-toggle {
  display: grid; flex: none; width: 32px; height: 32px; place-items: center;
  border: 0; border-radius: 9px; background: transparent; color: var(--night-dim);
  transition: background-color 160ms ease, color 160ms ease;
}
.rail-toggle:hover { background: var(--night-2); color: var(--night-ink); }
.rail-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; transition: transform 320ms var(--ease); }
.app.is-collapsed .rail-toggle svg { transform: scaleX(-1); }
.app.is-collapsed .rail-head { justify-content: center; padding: 0; }
.app.is-collapsed .rail-head .wordmark { display: none; }

.rail-nav { display: grid; gap: 2px; margin-top: 26px; }
.rail-link {
  position: relative; display: flex; height: 40px; align-items: center; gap: 12px;
  padding: 0 11px; border: 0; border-radius: 10px; background: transparent;
  color: var(--night-dim); font-size: 13.5px; font-weight: 520; text-align: left; white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease;
}
.rail-link-route { cursor: pointer; text-decoration: none; }
.rail-link svg { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; transition: transform 200ms var(--ease); }
.rail-link:hover { background: var(--night-2); color: var(--night-ink); }
.rail-link:hover svg { transform: translateX(1px); }
.rail-link[aria-current="page"] { background: #2b2e2b; color: var(--night-ink); }
.rail-link[aria-current="page"]::before { position: absolute; top: 11px; bottom: 11px; left: -12px; width: 3px; border-radius: 0 3px 3px 0; background: #e3b285; content: ""; }
.rail-label { overflow: hidden; text-overflow: ellipsis; transition: opacity 180ms ease; }
.app.is-collapsed .rail-link { justify-content: center; padding: 0; }
.app.is-collapsed .rail-label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

.rail-foot { display: grid; gap: 6px; margin-top: auto; padding-top: 14px; border-top: 1px solid #2c2f2c; }
.rail-user { display: flex; min-width: 0; align-items: center; gap: 10px; padding: 6px 8px; }
.avatar {
  display: grid; flex: none; width: 32px; height: 32px; place-items: center;
  border-radius: 50%; background: #e3b285; color: #2b1c10; font-size: 12px; font-weight: 650; letter-spacing: .02em;
}
.rail-user-copy { display: grid; min-width: 0; }
.rail-user-copy strong, .rail-user-copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-user-copy strong { font-size: 13px; font-weight: 580; }
.rail-user-copy small { color: var(--night-dim); font-size: 12px; }
.app.is-collapsed .rail-user { justify-content: center; padding: 6px 0; }
.app.is-collapsed .rail-user-copy { display: none; }

.main { min-width: 0; padding: 0 clamp(20px, 4vw, 56px) 64px; }
.topbar {
  position: sticky; z-index: 5; top: 0; display: flex; min-height: 64px; align-items: center; justify-content: space-between; gap: 16px;
  margin-inline: calc(clamp(20px, 4vw, 56px) * -1); padding: 0 clamp(20px, 4vw, 56px);
  border-bottom: 1px solid transparent; background: color-mix(in srgb, var(--ground) 88%, transparent);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: border-color 200ms ease;
}
.topbar.is-scrolled { border-bottom-color: var(--rule); }
.crumbs { display: flex; min-width: 0; align-items: center; gap: 8px; color: var(--faint); font-size: 13px; }
.crumbs > span, .crumbs strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumbs strong { color: var(--ink); font-weight: 560; }
.crumbs svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.6; }
.topbar-actions { display: flex; align-items: center; gap: 10px; }
.status-chip { display: inline-flex; align-items: center; gap: 8px; padding: 6px 11px; border: 1px solid var(--rule); border-radius: 999px; background: var(--paper); color: var(--dim); font-size: 12px; white-space: nowrap; }
.status-chip i { width: 7px; height: 7px; border-radius: 50%; background: var(--meadow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--meadow) 20%, transparent); /* Slow breathing ring so the status reads as live, not a dead dot. The global reduced-motion rule damps this to a single instant frame. */ animation: status-pulse 2.8s ease-in-out infinite; }

.content { width: min(1040px, 100%); margin: 0 auto; }
.section { padding-top: clamp(28px, 4.5vw, 52px); }
.section.is-shown { animation: section-in 360ms var(--ease) both; }
.section-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 24px; }
.section-head h1,
.section-head .page-title { margin: 0; font: 400 clamp(34px, 4vw, 48px)/1.04 var(--serif); letter-spacing: -.035em; text-wrap: balance; }
.section-head p { max-width: 560px; margin: 10px 0 0; color: var(--dim); font-size: 15px; }
.greeting-date { margin: 0 0 12px; color: var(--faint); font-size: 13px; }

/* Figures read as a ledger line, not as a row of cards. */
.figures { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-top: clamp(26px, 3.5vw, 40px); border-block: 1px solid var(--rule); }
.figure { min-width: 0; padding: 20px 20px 22px 0; }
.figure + .figure { padding-left: 20px; border-left: 1px solid var(--rule); }
.figure dt { color: var(--dim); font-size: 12.5px; }
.figure dd { margin: 10px 0 0; font: 400 clamp(26px, 2.6vw, 32px)/1 var(--serif); letter-spacing: -.03em; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.figure dd small { color: var(--faint); font: 400 13px/1 var(--sans); letter-spacing: 0; }
.figure .figure-note { display: block; margin-top: 8px; color: var(--faint); font: 400 12.5px/1.4 var(--sans); letter-spacing: 0; }

.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; margin-top: 20px; align-items: start; }
.panel { min-width: 0; padding: clamp(20px, 2.4vw, 28px); border: 1px solid var(--rule); border-radius: var(--radius); background: var(--paper); container-type: inline-size; transition: border-color 160ms ease; }
/* Panels answer the hover so the dashboard reads as a surface, not a printout. */
.panel:hover { border-color: var(--rule-strong); }
.panel + .panel { margin-top: 20px; }
.grid-2 > .panel + .panel { margin-top: 0; }
.panel-head { display: flex; flex-wrap: wrap; align-items: start; justify-content: space-between; gap: 16px; }
.panel-head h2 { margin: 0; font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.panel-head p { margin: 5px 0 0; color: var(--dim); font-size: 13.5px; }
.panel-body { margin-top: 18px; color: var(--dim); font-size: 14px; line-height: 1.6; }
.panel-body p { margin: 0; }
.panel-body p + p { margin-top: 10px; }
.panel-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 22px; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: 999px; background: var(--meadow-wash); color: var(--meadow-ink); font-size: 12px; font-weight: 560; white-space: nowrap; }
.pill-quiet { background: var(--sunk); color: var(--dim); }
.usage-plan { margin: 5px 0 0; color: var(--dim); font-size: 13.5px; }
.usage-status-block { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 24px; margin-top: 20px; padding: 22px 24px; border: 1px solid var(--rule); border-radius: 12px; background: var(--ground); }
.usage-current { position: relative; min-width: 0; padding-left: 19px; }
.usage-current::before { position: absolute; top: 7px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--faint); content: ""; }
.usage-status-block[data-state="normal"] .usage-current::before { background: var(--meadow); }
.usage-status-block[data-state="high"] .usage-current::before { background: var(--usage-high); }
.usage-status-block[data-state="limit_reached"] .usage-current::before { background: var(--dim); }
.usage-status-block[data-state="error"] .usage-current::before { background: var(--danger); }
.usage-current-label, .usage-reset > span { display: block; color: var(--dim); font-size: 12.5px; }
.usage-current > strong { display: block; margin-top: 3px; font: 400 30px/1.15 var(--serif); letter-spacing: -.025em; }
.usage-progress { display: block; width: 100%; height: 10px; margin-top: 14px; accent-color: var(--meadow); }
.usage-status-block[data-state="high"] .usage-progress { accent-color: var(--usage-high); }
.usage-status-block[data-state="limit_reached"] .usage-progress { accent-color: var(--dim); }
.usage-state { max-width: 58ch; margin: 8px 0 0; color: var(--dim); font-size: 13px; line-height: 1.5; }
.usage-status-block[data-state="high"] .usage-state { color: var(--usage-high); }
.usage-status-block[data-state="limit_reached"] .usage-state { color: var(--dim); }
.usage-status-block[data-state="error"] .usage-state { color: var(--danger); }
.usage-reset { min-width: 185px; padding-left: 20px; border-left: 1px solid var(--rule-strong); }
.usage-reset time { display: block; margin-top: 4px; color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
.usage-details { margin-top: 18px; color: var(--dim); font-size: 13px; }
.usage-details summary { width: fit-content; color: var(--meadow-ink); cursor: pointer; font-weight: 600; }
.usage-details summary:focus-visible { border-radius: 3px; }
.usage-details p { max-width: 78ch; margin: 10px 0 0; line-height: 1.65; }
#usage-history ul { display: grid; gap: 0; margin: 0; padding: 0; list-style: none; }
#usage-history li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: baseline; gap: 8px 18px; padding: 12px 0; border-bottom: 1px solid var(--rule); }
#usage-history li:first-child { padding-top: 0; }
#usage-history li:last-child { padding-bottom: 0; border-bottom: 0; }
#usage-history time { color: var(--dim); font-size: 12.5px; }
#usage-history strong { color: var(--ink); font-size: 13px; font-variant-numeric: tabular-nums; }
#usage-history li > span { color: var(--dim); font-size: 12.5px; }

.plan-hero { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; margin-top: 18px; }
.plan-hero strong { font: 400 44px/1 var(--serif); letter-spacing: -.04em; }
.plan-hero span { color: var(--dim); font-size: 13.5px; }

@container (max-width: 760px) {
  .usage-status-block { grid-template-columns: 1fr; gap: 18px; }
  .usage-reset { min-width: 0; padding: 14px 0 0; border-top: 1px solid var(--rule-strong); border-left: 0; }
  #usage-history li { grid-template-columns: minmax(0, 1fr) auto; }
  #usage-history li > span { grid-column: 1 / -1; }
}

.plan-compare { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin-top: 18px; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; }
.plan-compare > div { padding: 18px; }
.plan-compare > div + div { border-left: 1px solid var(--rule); background: var(--ground); }
.plan-compare > div:nth-child(odd) { border-left: 0; }
.plan-compare > div:nth-child(n + 3) { border-top: 1px solid var(--rule); }
.plan-compare h3 { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 0; font-size: 14px; font-weight: 600; }
.plan-compare .plan-price { margin: 12px 0 0; font: 400 28px/1 var(--serif); letter-spacing: -.03em; }
.plan-compare .plan-price small { color: var(--faint); font: 400 12.5px var(--sans); }
.plan-compare ul { display: grid; gap: 8px; margin: 14px 0 0; padding: 0; list-style: none; color: var(--dim); font-size: 13px; }
.plan-compare li { display: flex; gap: 9px; }
.plan-compare li::before { flex: none; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; background: var(--meadow-wash); box-shadow: inset 0 0 0 4px var(--paper), inset 0 0 0 10px var(--meadow); content: ""; }
.plan-compare > div + div li::before { box-shadow: inset 0 0 0 4px var(--ground), inset 0 0 0 10px var(--meadow); }

.rows { margin: 16px 0 0; padding: 0; }
.row { display: grid; grid-template-columns: minmax(7.5rem, 12.5rem) minmax(0, 1fr); align-items: center; gap: 8px 20px; min-height: 52px; padding: 10px 0; border-top: 1px solid var(--rule); }
.row:has(> .row-action) { grid-template-columns: minmax(7.5rem, 12.5rem) minmax(0, 1fr) auto; }
.row:last-child { border-bottom: 1px solid var(--rule); }
.row dt { color: var(--dim); font-size: 13.5px; }
.row dd { min-width: 0; margin: 0; color: var(--ink); font-size: 14px; overflow-wrap: anywhere; }
.row .row-action { justify-self: end; }

.empty { display: grid; justify-items: start; gap: 6px; margin-top: 18px; padding: 26px; border: 1px dashed var(--rule-strong); border-radius: 12px; }
.empty strong { font-size: 14px; font-weight: 600; }
.empty p { margin: 0; color: var(--dim); font-size: 13.5px; }
.model-list { display: grid; gap: 10px; width: 100%; margin: 0; padding: 0; list-style: none; }
.model-item { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); transition: border-color 160ms ease; }
.model-item:hover { border-color: var(--rule-strong); }
.announcement-list { display: grid; gap: 10px; width: 100%; margin: 0; padding: 0; list-style: none; }
.announcement-item { display: grid; gap: 6px; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 10px; background: var(--paper); transition: border-color 160ms ease; }
.announcement-item:hover { border-color: var(--rule-strong); }
.announcement-item p { margin: 0; color: var(--dim); font-size: 13.5px; line-height: 1.55; }
.announcement-item time { color: var(--dim); font-size: 12px; }
.announcement-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.announcement-head strong { font-size: 14px; font-weight: 600; }
.announcement-severity { color: var(--dim); font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.model-item strong { font-size: 14px; font-weight: 600; }
.model-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--dim); font-size: 12.5px; }
.model-status { color: var(--meadow-ink); font-weight: 600; }

.table { width: 100%; margin-top: 16px; border-collapse: collapse; font-size: 13.5px; }
.table th { padding: 0 0 10px; border-bottom: 1px solid var(--rule); color: var(--dim); font-weight: 500; text-align: left; }
.table td { padding: 14px 0; border-bottom: 1px solid var(--rule); }

.form { display: grid; gap: 16px; margin-top: 20px; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin-top: 4px; }
textarea.input { min-height: 100px; height: auto; padding: 12px 14px; resize: vertical; }
.customer-ticket-area { display: grid; gap: 14px; margin-top: 24px; }
.customer-ticket-area h3 { margin: 0; font-size: 15px; }
.customer-ticket-list { display: grid; gap: 8px; }
.customer-ticket-item { justify-content: flex-start; min-height: 42px; white-space: normal; text-align: left; }
.customer-ticket-item[aria-current="true"] { border-color: var(--meadow); }
.customer-ticket-detail { display: grid; gap: 14px; border-top: 1px solid var(--rule); padding-top: 16px; }
.customer-ticket-messages { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.customer-ticket-message { padding: 12px 14px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sunk); }
.customer-ticket-message.from-staff { border-color: color-mix(in srgb, var(--meadow) 45%, var(--rule)); }
.customer-ticket-message p { margin: 8px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.customer-ticket-message-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; color: var(--dim); font-size: 12px; }

.profile-card { display: flex; align-items: center; gap: 16px; }
.profile-card .avatar { width: 56px; height: 56px; font-size: 18px; }
.profile-card h2 { margin: 0; font: 400 24px/1.1 var(--serif); letter-spacing: -.02em; }
.profile-card p { margin: 4px 0 0; color: var(--dim); font-size: 13.5px; overflow-wrap: anywhere; }

.choice-group { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.choice { position: relative; display: grid; gap: 10px; padding: 12px; border: 1px solid var(--rule-strong); border-radius: 12px; background: var(--paper); cursor: pointer; transition: border-color 160ms ease, box-shadow 160ms ease; }
.choice:hover { border-color: color-mix(in srgb, var(--ink) 40%, var(--rule-strong)); }
.choice input { position: absolute; opacity: 0; pointer-events: none; }
.choice:has(input:checked) { border-color: var(--meadow); box-shadow: 0 0 0 3px color-mix(in srgb, var(--meadow) 18%, transparent); }
.choice:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 2px; }
.choice-swatch { height: 54px; border-radius: 8px; border: 1px solid var(--rule); }
.swatch-system { background: linear-gradient(110deg, #f3f2ec 0 50%, #121412 50% 100%); }
.swatch-light { background: #f3f2ec; }
.swatch-dark { background: #121412; }
.choice span { font-size: 13px; font-weight: 560; }

.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 16px 0; border-top: 1px solid var(--rule); }
.switch-row:last-child { border-bottom: 1px solid var(--rule); }
.switch-row > div { min-width: 0; }
.switch-row strong { display: block; font-size: 14px; font-weight: 560; overflow-wrap: anywhere; }
.switch-row small { display: block; margin-top: 3px; color: var(--dim); font-size: 13px; overflow-wrap: anywhere; }
.switch { position: relative; flex: none; width: 42px; height: 24px; }
.switch input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: var(--rule-strong); pointer-events: none; transition: background-color 200ms ease; }
.switch span::after { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .2); content: ""; transition: transform 240ms var(--ease); }
.switch input:checked + span { background: var(--meadow); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 2px; }

.link-list { display: grid; margin: 16px 0 0; padding: 0; list-style: none; }
.link-list a { display: flex; min-height: 50px; align-items: center; justify-content: space-between; gap: 16px; border-top: 1px solid var(--rule); color: var(--ink); font-size: 14px; text-decoration: none; transition: color 160ms ease, padding 200ms var(--ease); }
.link-list li:last-child a { border-bottom: 1px solid var(--rule); }
.link-list a:hover { padding-inline: 4px; color: var(--meadow-ink); }
.link-list svg { width: 15px; height: 15px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--faint); }

.toast {
  position: fixed; z-index: 50; right: 20px; bottom: 20px; display: flex; max-width: min(420px, calc(100vw - 40px)); align-items: center; gap: 10px;
  padding: 12px 16px; border-radius: 12px; background: var(--night); color: var(--night-ink); font-size: 13.5px;
  box-shadow: 0 12px 30px rgba(10, 12, 10, .22);
  opacity: 0; transform: translateY(10px); pointer-events: none;
  transition: opacity 220ms ease, transform 300ms var(--ease);
}
.toast.is-visible { opacity: 1; transform: none; }
.toast[data-state="error"] { background: #5a2418; }
.toast i { width: 7px; height: 7px; flex: none; border-radius: 50%; background: #9cc2a1; }
.toast[data-state="error"] i { background: #f0a48f; }

/* Loading: keep the frame, hold the content until the session is verified. */
.app .content { transition: opacity 260ms ease; }
.app.is-loading .content { opacity: 0; }
/* Centered loading state while the session is verified: without it the
   signed-in visitor stares at an empty frame (blank sidebar, "Loading…"
   placeholders) until the module finishes. It lives outside .content so
   the opacity hold above does not hide it, and disappears with the
   is-loading class — including on the load-error path, which also clears
   is-loading before showing the retry panel. */
.app-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: min(1040px, 100%);
  margin: 0 auto;
  padding: clamp(48px, 18vh, 120px) 16px;
  color: var(--dim);
  font-size: 14px;
  text-align: center;
}
.app.is-loading .app-loading { display: flex; }
.app-loading .spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid color-mix(in srgb, var(--ink) 25%, transparent);
  border-right-color: var(--ink); border-radius: 50%;
  animation: spin 700ms linear infinite;
}
.app-loader { position: fixed; top: 0; right: 0; left: 0; z-index: 60; height: 2px; overflow: hidden; pointer-events: none; }
.app-loader::after { display: block; width: 40%; height: 100%; background: var(--meadow); content: ""; animation: loader 1.1s var(--ease) infinite; }
.app:not(.is-loading) ~ .app-loader { display: none; }

dialog.confirm {
  width: min(440px, calc(100vw - 32px)); padding: 26px; border: 1px solid var(--rule); border-radius: 16px;
  background: var(--paper); color: var(--ink); box-shadow: 0 24px 60px rgba(10, 12, 10, .25);
}
dialog.confirm::backdrop { background: rgba(14, 16, 14, .4); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
dialog.confirm[open] { animation: dialog-in 260ms var(--ease); }
dialog.confirm h2 { margin: 0; font: 400 26px/1.1 var(--serif); letter-spacing: -.02em; }
dialog.confirm p { margin: 10px 0 0; color: var(--dim); font-size: 14px; }
dialog.confirm .panel-actions { justify-content: flex-end; }

.mobile-signout { display: none !important; }

@media (max-width: 1000px) {
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .figure:nth-child(3) { padding-left: 0; border-left: 0; }
  .figure:nth-child(n + 3) { border-top: 1px solid var(--rule); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app, .app.is-collapsed { display: block; }
  .rail { position: sticky; z-index: 10; height: auto; max-width: 100%; overflow-x: clip; flex-direction: column; padding: 10px 12px 8px; }
  .rail-head { padding: 0 2px 0 6px; }
  .rail-toggle { display: none; }
  .rail-nav { display: flex; gap: 4px; margin: 8px -12px 0; padding: 0 12px 2px; overflow-x: auto; scrollbar-width: none; }
  .rail-nav::-webkit-scrollbar { display: none; }
  .rail-link, .app.is-collapsed .rail-link { height: 36px; flex: none; justify-content: flex-start; padding: 0 12px; }
  .switch-row { flex-wrap: wrap; }
  .rail-link svg { display: none; }
  .rail-link[aria-current="page"]::before { display: none; }
  .app.is-collapsed .rail-label { position: static; width: auto; height: auto; clip: auto; }
  .app.is-collapsed .rail-head .wordmark { display: block; }
  .rail-foot { display: none; }
  /* One topbar row on phones: the crumb truncates and the plan chip
     hides (the plan is in the figures below), so Sign out never wraps
     onto a second line under the crumbs. */
  .topbar { position: static; min-height: 54px; flex-wrap: nowrap; }
  .topbar-actions { flex: none; }
  .status-chip { display: none; }
  .figure { padding: 16px 14px 18px 0; }
  .figure + .figure { padding-left: 14px; }
  .plan-compare { grid-template-columns: 1fr; }
  .plan-compare > div + div { border-top: 1px solid var(--rule); border-left: 0; }
  .row, .row:has(> .row-action) { grid-template-columns: minmax(0, 1fr) auto; }
  .row dt { grid-column: 1 / -1; }
  .form-row { grid-template-columns: 1fr; }
  .choice-group { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .choice-swatch { height: 40px; }
  .mobile-signout { display: inline-flex !important; }
}

/* Narrow panels, such as the half-width cards on the overview, stack label above value. */
@container (max-width: 26rem) {
  .row, .row:has(> .row-action) { grid-template-columns: minmax(0, 1fr); gap: 4px; padding-block: 12px; }
  .row .row-action { justify-self: start; }
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes auth-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes art-settle { from { transform: scale(1.04); } to { transform: none; } }
@keyframes section-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes caret { 50% { opacity: 0; } }
@keyframes digit-in { from { transform: scale(.92); } to { transform: none; } }
@keyframes pulse { 50% { opacity: .55; } }
@keyframes shake { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
@keyframes progress { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes status-pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--meadow) 20%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--meadow) 0%, transparent); }
}
@keyframes loader { from { transform: translateX(-100%); } to { transform: translateX(260%); } }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition-duration: 1ms !important; }
  .app-loader::after { animation: none; width: 100%; opacity: .5; }
}

/* Phone-width tap targets for sign-in controls (44px minimum). */
@media (max-width: 600px) {
  .wordmark, header a, a[href="/fable/"] { display: inline-flex; align-items: center; min-height: 44px; }
  .auth-tab, .text-button, .password-toggle { min-height: 44px; }
  .password-toggle { min-width: 44px; }
  a[href^="mailto:"] { display: inline-flex; align-items: center; min-height: 44px; }
  [data-section], .btn, .btn-quiet { min-height: 44px; }
  .panel-actions .btn { max-width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-block: 8px; }
}

/* ------------------------------------------------------------------ */
/* ChatGPT-style minimalist monochrome login / signup                 */
/* Scoped to body.auth-page--modern. Shared .auth-* classes keep      */
/* their rules on dashboard and consent surfaces.                     */
/* ------------------------------------------------------------------ */

body.auth-page--modern {
  --auth-bg: #ffffff;
  --auth-card-bg: #ffffff;
  --auth-ink: #0d0d0d;
  --auth-muted: #5d5d5d;
  --auth-border: #d9d9d9;
  --auth-border-hover: #b4b4b4;
  --auth-input-bg: #ffffff;
  --auth-tab-track: #f4f4f4;
  --auth-tab-pill: #ffffff;
  --auth-primary-bg: #0d0d0d;
  --auth-primary-fg: #ffffff;
  --auth-primary-hover: #2f2f2f;
  --auth-google-hover: #f9f9f9;
  --auth-msg-bg: #f4f4f4;
  position: relative;
  min-height: 100svh;
  background: var(--auth-bg);
  color: var(--auth-ink);
  color-scheme: light;
}
html[data-theme="dark"] body.auth-page--modern {
  --auth-bg: #212121;
  --auth-card-bg: #212121;
  --auth-ink: #ececec;
  --auth-muted: #b4b4b4;
  --auth-border: #424242;
  --auth-border-hover: #676767;
  --auth-input-bg: #2f2f2f;
  --auth-tab-track: #2f2f2f;
  --auth-tab-pill: #424242;
  --auth-primary-bg: #ececec;
  --auth-primary-fg: #0d0d0d;
  --auth-primary-hover: #ffffff;
  --auth-google-hover: #2f2f2f;
  --auth-msg-bg: #2f2f2f;
  color-scheme: dark;
}
@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.auth-page--modern {
    --auth-bg: #212121;
    --auth-card-bg: #212121;
    --auth-ink: #ececec;
    --auth-muted: #b4b4b4;
    --auth-border: #424242;
    --auth-border-hover: #676767;
    --auth-input-bg: #2f2f2f;
    --auth-tab-track: #2f2f2f;
    --auth-tab-pill: #424242;
    --auth-primary-bg: #ececec;
    --auth-primary-fg: #0d0d0d;
    --auth-primary-hover: #ffffff;
    --auth-google-hover: #2f2f2f;
    --auth-msg-bg: #2f2f2f;
    color-scheme: dark;
  }
}
body.auth-page--modern.auth-surface--centered {
  display: block;
  background: var(--auth-bg);
}

body.auth-page--modern > .auth {
  position: relative;
  z-index: 2;
  display: flex;
  min-height: 100svh;
  grid-template-columns: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  justify-content: safe center;
  padding: 24px 16px;
}
body.auth-page--modern.auth-surface--centered > .auth {
  display: flex;
  width: 100%;
  min-height: 100svh;
}
body.auth-page--modern .auth-panel,
body.auth-page--modern .auth-standalone {
  width: 100%;
  max-width: 380px;
  margin: 0;
  padding: 0;
  gap: 0;
}
body.auth-page--modern .auth-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
body.auth-page--modern .auth-panel-top a:not(.wordmark) {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 999px;
  color: var(--auth-muted);
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  transition: background-color 140ms ease, color 140ms ease;
}
body.auth-page--modern .auth-panel-top a:not(.wordmark):hover {
  background: var(--auth-tab-track);
  color: var(--auth-ink);
}
body.auth-page--modern .wordmark { color: var(--auth-ink); }
body.auth-page--modern .auth-art { display: none; }

body.auth-page--modern .auth-card,
body.auth-page--modern .auth-card--sheet {
  max-width: 380px;
  margin: 0;
  padding: 8px 4px;
  border: 0;
  border-radius: 0;
  background: var(--auth-card-bg);
  box-shadow: none;
}
body.auth-page--modern .auth-card h1 {
  font: 600 28px/1.22 var(--sans);
  letter-spacing: -.025em;
  color: var(--auth-ink);
  text-align: center;
}
body.auth-page--modern .auth-intro {
  color: var(--auth-muted);
  text-align: center;
  font-size: 14px;
  margin-top: 8px;
}
body.auth-page--modern .field > span,
body.auth-page--modern .field > label { color: var(--auth-ink); font-size: 13px; font-weight: 500; }
body.auth-page--modern .field small,
body.auth-page--modern .field-optional { color: var(--auth-muted); }

/* Pill segmented Sign in / Create account toggle. */
body.auth-page--modern .auth-tabs {
  background: #f4f4f4;
  border-radius: 999px;
  padding: 4px;
  margin-top: 20px;
}
body.auth-page--modern .auth-tabs::before {
  border-radius: 999px;
  background: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}
body.auth-page--modern .auth-tab {
  min-height: 38px;
  border-radius: 999px;
  color: #5d5d5d;
  font-weight: 500;
}
body.auth-page--modern .auth-tab.is-active { color: #0d0d0d; }

/* Clean rounded inputs. */
body.auth-page--modern .input {
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid #d9d9d9;
  border-radius: 14px;
  background: #ffffff;
  color: #0d0d0d;
  font-size: 15px;
}
body.auth-page--modern .input::placeholder { color: #5d5d5d; }
body.auth-page--modern .input:hover { border-color: #b4b4b4; }
body.auth-page--modern .input:focus {
  border-color: #0d0d0d;
  box-shadow: 0 0 0 1px #0d0d0d;
}
body.auth-page--modern .input:disabled { background: #f4f4f4; color: #5d5d5d; }
body.auth-page--modern .password-toggle { color: #5d5d5d; border-radius: 999px; }
body.auth-page--modern .password-toggle:hover { background: #f4f4f4; color: #0d0d0d; }
body.auth-page--modern .text-button { color: #5d5d5d; font-weight: 500; }
body.auth-page--modern .text-button:hover:not(:disabled) { color: #0d0d0d; }
body.auth-page--modern .text-button:disabled { opacity: .5; }

/* ChatGPT pill primary button & outlined Google pill button. */
body.auth-page--modern .auth-form { margin-top: 18px; gap: 14px; }
body.auth-page--modern .auth-submit {
  min-height: 48px;
  border-radius: 999px;
  background: #0d0d0d;
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  transition: background-color 140ms ease;
}
body.auth-page--modern .auth-submit:hover:not(:disabled) { background: #2f2f2f; transform: none; }
body.auth-page--modern .auth-submit:active:not(:disabled) { transform: scale(.99); }
body.auth-page--modern .auth-submit:disabled { opacity: .45; }
body.auth-page--modern .google-button {
  min-height: 48px;
  border: 1px solid #d9d9d9;
  border-radius: 999px;
  background: #ffffff;
  color: #0d0d0d;
  font-size: 15px;
  font-weight: 500;
  transition: border-color 140ms ease, background-color 140ms ease;
}
body.auth-page--modern .google-button:hover:not(:disabled) {
  border-color: #b4b4b4;
  background: #f9f9f9;
  transform: none;
}
body.auth-page--modern .google-button:active:not(:disabled) { transform: scale(.99); }

/* Explicit ChatGPT dark-mode control overrides (prevents :root inheritance quirks). */
html[data-theme="dark"] body.auth-page--modern .auth-tabs { background: #2f2f2f; }
html[data-theme="dark"] body.auth-page--modern .auth-tabs::before { background: #424242; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
html[data-theme="dark"] body.auth-page--modern .auth-tab { color: #b4b4b4; }
html[data-theme="dark"] body.auth-page--modern .auth-tab.is-active { color: #ffffff; }
html[data-theme="dark"] body.auth-page--modern .input { background: #2f2f2f; border-color: #424242; color: #ececec; }
html[data-theme="dark"] body.auth-page--modern .input:disabled { background: #262626; border-color: #383838; color: #8e8e8e; }
html[data-theme="dark"] body.auth-page--modern .input::placeholder { color: #9b9b9b; }
html[data-theme="dark"] body.auth-page--modern .input:hover { border-color: #676767; }
html[data-theme="dark"] body.auth-page--modern .input:focus { border-color: #ececec; box-shadow: 0 0 0 1px #ececec; }
html[data-theme="dark"] body.auth-page--modern .password-toggle,
html[data-theme="dark"] body.auth-page--modern .text-button { color: #b4b4b4; }
html[data-theme="dark"] body.auth-page--modern .password-toggle:hover,
html[data-theme="dark"] body.auth-page--modern .text-button:hover:not(:disabled) { background: #383838; color: #ffffff; }
html[data-theme="dark"] body.auth-page--modern .auth-submit { background: #ffffff; color: #0d0d0d; }
html[data-theme="dark"] body.auth-page--modern .auth-submit:hover:not(:disabled) { background: #e3e3e3; }
html[data-theme="dark"] body.auth-page--modern .google-button { background: #2f2f2f; border-color: #424242; color: #ececec; }
html[data-theme="dark"] body.auth-page--modern .google-button:hover:not(:disabled) { background: #383838; border-color: #676767; }

@media (prefers-color-scheme: dark) {
  html:not([data-theme="light"]) body.auth-page--modern .auth-tabs { background: #2f2f2f; }
  html:not([data-theme="light"]) body.auth-page--modern .auth-tabs::before { background: #424242; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); }
  html:not([data-theme="light"]) body.auth-page--modern .auth-tab { color: #b4b4b4; }
  html:not([data-theme="light"]) body.auth-page--modern .auth-tab.is-active { color: #ffffff; }
  html:not([data-theme="light"]) body.auth-page--modern .input { background: #2f2f2f; border-color: #424242; color: #ececec; }
  html:not([data-theme="light"]) body.auth-page--modern .input:disabled { background: #262626; border-color: #383838; color: #8e8e8e; }
  html:not([data-theme="light"]) body.auth-page--modern .input::placeholder { color: #9b9b9b; }
  html:not([data-theme="light"]) body.auth-page--modern .input:hover { border-color: #676767; }
  html:not([data-theme="light"]) body.auth-page--modern .input:focus { border-color: #ececec; box-shadow: 0 0 0 1px #ececec; }
  html:not([data-theme="light"]) body.auth-page--modern .password-toggle,
  html:not([data-theme="light"]) body.auth-page--modern .text-button { color: #b4b4b4; }
  html:not([data-theme="light"]) body.auth-page--modern .password-toggle:hover,
  html:not([data-theme="light"]) body.auth-page--modern .text-button:hover:not(:disabled) { background: #383838; color: #ffffff; }
  html:not([data-theme="light"]) body.auth-page--modern .auth-submit { background: #ffffff; color: #0d0d0d; }
  html:not([data-theme="light"]) body.auth-page--modern .auth-submit:hover:not(:disabled) { background: #e3e3e3; }
  html:not([data-theme="light"]) body.auth-page--modern .google-button { background: #2f2f2f; border-color: #424242; color: #ececec; }
  html:not([data-theme="light"]) body.auth-page--modern .google-button:hover:not(:disabled) { background: #383838; border-color: #676767; }
}

body.auth-page--modern .auth-divider {
  color: var(--auth-muted);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin: 18px 0;
}
body.auth-page--modern .auth-divider::before,
body.auth-page--modern .auth-divider::after { background: var(--auth-border); }

body.auth-page--modern .auth-message { background: var(--auth-msg-bg); color: var(--auth-ink); border-radius: 12px; }
body.auth-page--modern .auth-message[data-state="error"] { background: #fef2f2; color: #991b1b; }
html[data-theme="dark"] body.auth-page--modern .auth-message[data-state="error"] { background: #3a221c; color: #f8b4a6; }
body.auth-page--modern .auth-message[data-state="success"] { background: #ecfdf5; color: #065f46; }
html[data-theme="dark"] body.auth-page--modern .auth-message[data-state="success"] { background: #1e3326; color: #a7f3d0; }

/* Legal footer: #5d5d5d on #ffffff = 6.6:1 contrast; #b4b4b4 on #212121 = 7.4:1 contrast. */
body.auth-page--modern .auth-legal {
  color: var(--auth-muted);
  margin: 18px 0 0;
  text-align: center;
  font-size: 12px;
}
body.auth-page--modern .auth-legal a { color: var(--auth-ink); text-decoration: underline; text-underline-offset: 2px; }

/* OTP slots. */
body.auth-page--modern .otp-label { color: var(--auth-ink); }
body.auth-page--modern .otp-slot {
  border-color: var(--auth-border);
  border-radius: 10px;
  background: var(--auth-input-bg);
  color: var(--auth-ink);
}
body.auth-page--modern .otp-gap { background: var(--auth-border); }
body.auth-page--modern .otp-slot.is-filled { border-color: var(--auth-border-hover); }
body.auth-page--modern .otp-slot.is-current {
  border-color: var(--auth-ink);
  box-shadow: 0 0 0 2px rgba(13, 13, 13, .12);
}
body.auth-page--modern .otp-slot.is-current::after { background: var(--auth-ink); }
body.auth-page--modern .otp-entry.is-invalid .otp-slot { border-color: #dc2626; }
body.auth-page--modern .otp-entry.is-success .otp-slot { border-color: #10a37f; }
body.auth-page--modern .otp-help { color: var(--auth-muted); }

/* Welcome panel. */
body.auth-page--modern .auth-welcome { text-align: center; }
body.auth-page--modern .auth-welcome h2 { color: var(--auth-ink); font: 600 26px/1.2 var(--sans); letter-spacing: -.02em; }
body.auth-page--modern .welcome-mark { background: var(--auth-primary-bg); color: var(--auth-primary-fg); margin-inline: auto; }
body.auth-page--modern .welcome-progress { background: var(--auth-tab-track); }
body.auth-page--modern .welcome-progress::after { background: var(--auth-primary-bg); }

/* Footers. */
body.auth-page--modern .auth-footer,
body.auth-page--modern .auth-standalone__footer {
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 24px;
  color: var(--auth-muted);
  font-size: 12px;
}
body.auth-page--modern .auth-footer a,
body.auth-page--modern .auth-standalone__footer a { color: var(--auth-muted); }
body.auth-page--modern .auth-footer a:hover,
body.auth-page--modern .auth-standalone__footer a:hover { color: var(--auth-ink); }
body.auth-page--modern .auth-privacy-link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--auth-muted);
  font: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
body.auth-page--modern .auth-privacy-link:hover { color: var(--auth-ink); text-decoration: underline; text-underline-offset: 2px; }

body.auth-page--modern .btn-quiet { border-color: var(--auth-border); color: var(--auth-ink); border-radius: 999px; }
body.auth-page--modern .btn-quiet:hover { border-color: var(--auth-border-hover); background: var(--auth-google-hover); }
body.auth-page--modern .consent-redirect { text-align: center; }
body.auth-page--modern .consent-redirect-fallback { margin: 22px 0 0; }

/* ------------------------------------------------------------------ */
/* Fable chat entry: shared sign-in, sign-up and recovery layout. */
body.auth-page--chat > .auth { padding-block: 90px 32px; }
body.auth-page--chat .auth-panel-top { position: absolute; inset: 20px 28px auto; }
body.auth-page--chat .auth-card { padding: 0 8px; }
body.auth-page--chat #auth-flow { display: flex; flex-direction: column; }
body.auth-page--chat .auth-brand-mark { align-self: center; border-radius: 14px; margin-bottom: 24px; }
body.auth-page--chat .auth-card h1 { font-size: 28px; text-wrap: balance; margin: 0; }
body.auth-page--chat .auth-intro { margin: 12px 0 4px; line-height: 1.6; }
body.auth-page--chat #auth-tabs { margin-block: 20px 18px; }
body.auth-page--chat #auth-divider { margin-block: 22px; }
body.auth-page--chat #email-form { margin-top: 0; }
body.auth-page--chat #auth-legal { margin-top: 24px; }
body.auth-page--chat .input { border-radius: 999px; }
body.auth-page--chat .auth-standalone__footer { margin-top: 28px; }
@media (max-width: 480px) {
  body.auth-page--chat .auth-panel-top { inset: 12px 12px auto; }
  body.auth-page--chat .auth-brand-mark { margin-bottom: 18px; }
}

/* OAuth consent card (html.consent-page)                              */
/* One small white card on a white page: brand, question, account,     */
/* what the app can do in one plain line, and a single Yes / No click. */
/* No products, no legal, no footer — the whole card fits one screen   */
/* without scrolling. The class lives on <html>, so every rule here    */
/* is scoped to html.consent-page — a selector anchored on the body     */
/* element never matches, and that used to leave the SVGs unstyled      */
/* at 300px.                                                           */
/* ------------------------------------------------------------------ */

html.consent-page body.auth-surface--centered {
  display: grid;
  min-height: 100svh;
  place-items: center;
  background: #fff;
}
html.consent-page body.auth-surface--centered > .auth {
  display: block;
  width: min(100%, 400px);
  min-height: auto;
}
html.consent-page .consent {
  width: 100%;
  padding: clamp(16px, 4vw, 24px) clamp(14px, 4vw, 20px);
}
html.consent-page .consent-card {
  padding: 28px 28px 26px;
  border: 1px solid var(--rule);
  border-radius: 20px;
  background: #fff;
  box-shadow: 0 24px 64px rgba(23, 23, 23, .09), 0 2px 8px rgba(23, 23, 23, .04);
  animation: consent-rise 480ms var(--ease) both;
}
html.consent-page .consent-brand { margin: 0 0 18px; text-align: center; }
html.consent-page .consent-brand .wordmark { font-size: 20px; }
html.consent-page .consent-card h1 {
  margin: 0;
  font: 600 23px/1.25 var(--sans);
  letter-spacing: -.02em;
  text-align: center;
  text-wrap: balance;
}
html.consent-page .consent-intro {
  margin: 8px 0 0;
  color: var(--dim);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}
html.consent-page .consent-block { margin-top: 20px; }
html.consent-page .consent-lead { margin: 0 0 16px; color: var(--dim); font-size: 14px; line-height: 1.55; text-align: center; }
html.consent-page .consent-account {
  display: flex; align-items: center; gap: 10px;
  margin: 0; padding: 9px 12px;
  border: 1px solid var(--rule); border-radius: 999px; background: var(--sunk);
  color: var(--dim); font-size: 13px; line-height: 1.45;
}
html.consent-page .consent-account .avatar { flex: none; width: 26px; height: 26px; font-size: 11px; }
html.consent-page .consent-account strong { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
html.consent-page .consent-app {
  display: flex; align-items: center; gap: 12px;
  margin-top: 12px; padding: 12px;
  border: 1px solid var(--rule); border-radius: 14px; background: var(--sunk);
}
html.consent-page .consent-app-glyph {
  display: grid; flex: none; width: 44px; height: 44px; place-items: center;
  border-radius: 12px; background: #171717; color: #fff;
}
html.consent-page .consent-app-glyph svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
html.consent-page .consent-app-copy { display: grid; gap: 2px; min-width: 0; }
html.consent-page .consent-app-copy strong { color: var(--ink); font-size: 15px; font-weight: 600; letter-spacing: -.01em; }
html.consent-page .consent-app-copy span { color: var(--dim); font-size: 13px; line-height: 1.45; }
html.consent-page .consent-access {
  margin: 14px 2px 0;
  color: var(--dim); font-size: 13px; line-height: 1.5; text-align: center;
}
html.consent-page .consent-access:empty { display: none; }
html.consent-page .consent-actions { display: grid; gap: 10px; margin-top: 20px; }
html.consent-page .consent-actions .btn { min-height: 48px; width: 100%; font-size: 14px; }
html.consent-page .consent-approve { background: #171717; color: #fff; }
html.consent-page .consent-approve:hover:not(:disabled) { background: #000; transform: translateY(-1px); }
html.consent-page .consent-approve:active:not(:disabled) { transform: translateY(0) scale(.99); }
html.consent-page .consent-success { text-align: center; }
html.consent-page .consent-success .welcome-mark {
  display: grid; width: 56px; height: 56px; place-items: center;
  margin: 4px auto 18px; border-radius: 50%; background: #171717; color: #fff;
  animation: consent-pop 480ms var(--ease) both;
}
html.consent-page .consent-success .welcome-mark svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
html.consent-page .consent-success .welcome-mark svg path { stroke-dasharray: 24; stroke-dashoffset: 24; animation: check-draw 520ms 160ms var(--ease) forwards; }
html.consent-page .consent-success h2 { margin: 0 0 8px; font: 600 23px/1.25 var(--sans); letter-spacing: -.02em; }
html.consent-page .consent-success .consent-intro { margin: 0; }
html.consent-page .consent-success .welcome-progress { margin-top: 22px; }
html.consent-page .consent-redirect { text-align: center; }
html.consent-page .consent-redirect-fallback { margin: 22px 0 0; }

@keyframes consent-rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes consent-pop { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }

/* Short viewports: tighten the card so it still fits on one screen. */
@media (max-height: 700px) {
  html.consent-page .consent-card { padding: 20px 24px; }
  html.consent-page .consent-brand { margin-bottom: 12px; }
  html.consent-page .consent-block { margin-top: 14px; }
  html.consent-page .consent-actions { margin-top: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html.consent-page .consent-card,
  html.consent-page .consent-success .welcome-mark,
  html.consent-page .consent-success .welcome-mark svg path { animation: none; }
  html.consent-page .consent-success .welcome-mark svg path { stroke-dashoffset: 0; }
  html.consent-page .consent-approve:hover:not(:disabled) { transform: none; }
}

/* ------------------------------------------------------------------ */
/* Post-purchase welcome dialog (dashboard)                            */
/* A centered white card over the dashboard. The check draws itself    */
/* in, the card rises, and the progress bar only runs while the        */
/* subscription is still being confirmed.                              */
/* ------------------------------------------------------------------ */

.welcome-dialog { text-align: center; }
.welcome-dialog .welcome-mark { margin: 6px auto 20px; animation: welcome-pop 480ms var(--ease) both; }
.welcome-dialog .welcome-mark svg path {
  stroke-dasharray: 24; stroke-dashoffset: 24;
  animation: check-draw 520ms 160ms var(--ease) forwards;
}
.welcome-dialog h2 { font-size: 26px; }
.welcome-dialog .welcome-progress { display: none; margin-top: 22px; }
.welcome-dialog[data-state="activating"] .welcome-progress { display: block; }
.welcome-dialog .panel-actions { justify-content: center; margin-top: 24px; }
.welcome-dialog .panel-actions .btn { min-width: 140px; }

@keyframes welcome-pop { from { opacity: 0; transform: scale(.82); } to { opacity: 1; transform: none; } }
@keyframes check-draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  .welcome-dialog .welcome-mark,
  .welcome-dialog .welcome-mark svg path { animation: none; }
  .welcome-dialog .welcome-mark svg path { stroke-dashoffset: 0; }
}

body.auth-page--modern :focus-visible { outline-color: var(--auth-ink); }

@media (max-width: 600px) {
  body.auth-page--modern .auth-panel-top a:not(.wordmark),
  body.auth-page--modern .auth-tab { min-height: 44px; }
}

@media (max-width: 480px) {
  body.auth-page--modern > .auth { padding: 16px 14px; }
  body.auth-page--modern .auth-card,
  body.auth-page--modern .auth-card--sheet { padding: 4px 0; }
}

/* Short viewports: tighten the card further so the whole sign-in column
   fits without scrolling on a ~700px-tall laptop window. */
@media (max-height: 720px) {
  body.auth-page--modern > .auth { padding-block: 12px; }
  body.auth-page--modern .auth-card,
  body.auth-page--modern .auth-card--sheet { padding: 4px 0; }
  body.auth-page--modern .auth-panel-top { margin-bottom: 10px; }
  body.auth-page--modern .auth-tabs { margin-top: 14px; }
  body.auth-page--modern .auth-divider { margin: 12px 0; }
  body.auth-page--modern .auth-legal { margin-top: 12px; }
  body.auth-page--modern .auth-footer,
  body.auth-page--modern .auth-standalone__footer { margin-top: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  body.auth-page--modern .auth-card { animation: none; }
  body.auth-page--modern #auth-flow > * { animation: none; }
  body.auth-page--modern .auth-panel-top,
  body.auth-page--modern .auth-footer,
  body.auth-page--modern .auth-standalone__footer { animation: none; }
}

/* Already-signed-in gate: the <head> script adds .has-stored-session
   when a live session is stored, so the form is never flashed. */
.auth-redirecting {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 280px;
  color: var(--auth-ink, #0d0d0d);
  font-size: 14px;
  text-align: center;
}
.auth-redirecting .spinner {
  width: 16px; height: 16px; flex: none;
  border: 2px solid var(--auth-border, #d9d9d9); border-right-color: var(--auth-ink, #0d0d0d); border-radius: 50%;
  animation: spin 700ms linear infinite;
}
html.has-stored-session body.auth-page--modern #auth-flow { display: none; }
html.has-stored-session body.auth-page--modern #auth-redirecting { display: flex !important; }

/* Per-model weekly usage cards. */
.model-usage-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.model-usage-item { display: grid; grid-template-columns: 1fr auto; gap: 2px 16px; align-items: baseline; padding: 12px 14px; border: 1px solid var(--line, #d8d5cb); border-radius: 12px; background: var(--surface, #fff); transition: border-color 160ms ease; }
.model-usage-item:hover { border-color: var(--rule-strong, #b9b4a4); }
.model-usage-item strong { font-size: 15px; }
.model-usage-state { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--muted, #6b675e); }
.model-usage-item p { grid-column: 1 / -1; margin: 0; font-size: 13px; color: var(--muted, #6b675e); }
.model-usage-item[data-unlimited="true"] { border-color: #b9a15f; background: linear-gradient(0deg, rgba(185,161,95,.06), rgba(185,161,95,.06)), var(--surface, #fff); }
.model-usage-item[data-unlimited="true"] .model-usage-state { color: #8a6d2f; }

/* Coming-soon placeholder (dashboard API keys). */
.coming-soon {
  display: grid;
  justify-items: center;
  gap: 6px;
  max-width: 560px;
  margin: 0 auto;
  padding: clamp(32px, 6vw, 56px) clamp(20px, 4vw, 40px);
  text-align: center;
}
.coming-soon-mark {
  display: grid; width: 52px; height: 52px; place-items: center;
  margin-bottom: 10px; border: 1px solid var(--rule); border-radius: 14px;
  background: var(--sunk); color: var(--dim);
}
.coming-soon-mark svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.coming-soon h2 { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -.01em; }
.coming-soon p { max-width: 46ch; margin: 4px 0 0; color: var(--dim); font-size: 14px; line-height: 1.6; text-wrap: balance; }
.coming-soon .panel-actions { justify-content: center; margin-top: 18px; }
