/*
 * app.css — Bybit-style dark design system for the CopyTrade web UI.
 *
 * Every color token and class name below is a HARD CONTRACT: the follower and
 * admin route templates (built by other agents) reference these exact names.
 * Tokens live in :root so a single edit re-themes the whole app.
 */

:root {
  --bg: #0B0E11;
  --panel: #17181E;
  --panel-2: #1E2329;
  --border: #2B3139;
  --text: #EAECEF;
  --muted: #848E9C;
  --gold: #F7A600;
  --gold-press: #D98F00;
  --green: #20B26C;
  --red: #EF454A;
  --radius: 10px;
}

/* ── light theme tokens ───────────────────────────────────────────────────────
   Applied when the follower explicitly picks Light, or is on Auto and their OS
   prefers light. The no-FOUC <head> script in base.html sets html[data-theme]
   before paint; the top-bar toggle updates it live. Admin pages re-scope every
   token under .admin-shell (admin.css, loaded after this sheet), so this
   :root-level set only reaches the follower + auth pages. */
html[data-theme="light"] {
  --bg: #F5F6F8;
  --panel: #FFFFFF;
  --panel-2: #F1F3F6;
  --border: #E4E7EC;
  --text: #171A20;
  --muted: #697080;
  --gold: #C97F00;
  --gold-press: #A86A00;
  --green: #15A05A;
  --red: #E0474C;
}
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] {
    --bg: #F5F6F8;
    --panel: #FFFFFF;
    --panel-2: #F1F3F6;
    --border: #E4E7EC;
    --text: #171A20;
    --muted: #697080;
    --gold: #C97F00;
    --gold-press: #A86A00;
    --green: #15A05A;
    --red: #E0474C;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "IBM Plex Sans", -apple-system, system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold); text-decoration: none; }
a:hover { color: var(--gold-press); }

h1, h2, h3 { margin: 0 0 12px; font-weight: 600; }

/* ── layout ──────────────────────────────────────────────────────────────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  height: 56px;
  padding: 0 24px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar__brand {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.2px;
  white-space: nowrap;
}
.topbar__brand:hover { color: var(--gold); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-wrap: wrap;
}

.nav__link {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--muted);
  font-weight: 500;
  font-size: 13px;
}
.nav__link:hover {
  color: var(--text);
  background: var(--panel-2);
}
.nav__link--active {
  color: var(--gold);
  background: var(--panel-2);
}

/* ── theme toggle (top-bar segmented auto/light/dark) ─────────────────────────
   Follower top bar only. The admin console ships its own .theme-toggle in
   admin.css (loaded after this sheet), so the sidebar variant wins there. */
.theme-toggle {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
}
.theme-toggle button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 26px;
  padding: 0;
  border: none;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.theme-toggle button svg { width: 15px; height: 15px; }
.theme-toggle button:hover { color: var(--text); }
.theme-toggle button[aria-pressed="true"] {
  background: var(--panel);
  color: var(--gold);
}

/* ── mobile nav toggle (hamburger) ────────────────────────────────────────────
   Hidden on desktop; the mobile media block reveals it and collapses .nav into
   a drop-down panel that this button opens. */
.nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  cursor: pointer;
}
.nav-toggle:hover { color: var(--gold); }
.nav-toggle svg { width: 20px; height: 20px; }

.container {
  width: 100%;
  max-width: 1080px;
  margin: 0 auto;
  padding: 28px 24px 56px;
  flex: 1;
}

.grid { display: grid; gap: 16px; }
.grid--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid--3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }

/* ── vertical rhythm: keep stacked blocks & wording from touching, app-wide ───
   "Owl" selectors space only CONSECUTIVE siblings — first/single children and
   grid-gapped cards stay untouched, and margin-collapsing prevents doubling with
   margins a block already sets. Fixes adjacent cards (and stacked text/forms
   inside a card body) that previously sat flush against each other. */
.container > *:not(style) + *:not(style) { margin-top: 28px; }
.card__body > *:not(style) + *:not(style) { margin-top: 16px; }

/* ── cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.card__title {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.card__body {
  padding: 18px;
}

/* ── kpi ─────────────────────────────────────────────────────────────────── */
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.kpi__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
}

.kpi__value {
  font-size: 22px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.up { color: var(--green); }
.down { color: var(--red); }

/* ── tables ──────────────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.table tbody td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--panel-2); }

.table td.mono,
.table th.mono { text-align: right; }
.table tbody tr.leg-row td { padding-top: 4px; padding-bottom: 4px; font-size: 12px; }
.rounds-table.js-enhanced tbody tr.round-row { cursor: pointer; }
.rounds-table .caret { display: inline-block; width: 9px; margin-right: 2px; color: var(--muted); font-size: 10px; transition: transform 0.12s ease; }
.rounds-table:not(.js-enhanced) .caret { visibility: hidden; }
.rounds-table tbody tr.round-row.open .caret { transform: rotate(90deg); }
.rounds-table thead th,
.rounds-table thead th.mono { text-align: center; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease, color 0.12s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

.btn--primary {
  background: var(--gold);
  border-color: var(--gold);
  color: #0B0E11;
}
.btn--primary:hover {
  background: var(--gold-press);
  border-color: var(--gold-press);
  color: #0B0E11;
}

.btn--ghost {
  background: transparent;
  color: var(--text);
}
.btn--ghost:hover { background: var(--panel-2); }

.btn--danger {
  background: transparent;
  border-color: var(--red);
  color: var(--red);
}
.btn--danger:hover {
  background: var(--red);
  color: #0B0E11;
}

.btn--sm {
  padding: 6px 12px;
  font-size: 12px;
}

/* ── badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.4px;
  border: 1px solid transparent;
}
.badge--on,
.badge--approved {
  color: var(--green);
  background: rgba(32, 178, 108, 0.12);
  border-color: rgba(32, 178, 108, 0.35);
}
.badge--off {
  color: var(--red);
  background: rgba(239, 69, 74, 0.12);
  border-color: rgba(239, 69, 74, 0.35);
}
.badge--pending {
  color: var(--gold);
  background: rgba(247, 166, 0, 0.12);
  border-color: rgba(247, 166, 0, 0.35);
}
.badge--muted {
  color: var(--muted);
  background: var(--panel-2);
  border-color: var(--border);
}

/* ── forms ───────────────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.field__label {
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
}

.input {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
}
.input:focus {
  outline: none;
  border-color: var(--gold);
}
.input::placeholder { color: var(--muted); }

.form-row {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  flex-wrap: wrap;
}

.help {
  font-size: 12px;
  color: var(--muted);
  margin: 4px 0 0;
}

/* ── flash ───────────────────────────────────────────────────────────────── */
.flash-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 20px;
}

.flash {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--panel-2);
}
.flash--ok {
  color: var(--green);
  border-color: rgba(32, 178, 108, 0.4);
  background: rgba(32, 178, 108, 0.1);
}
.flash--error {
  color: var(--red);
  border-color: rgba(239, 69, 74, 0.4);
  background: rgba(239, 69, 74, 0.1);
}
.flash--warn {
  color: var(--gold);
  border-color: rgba(247, 166, 0, 0.4);
  background: rgba(247, 166, 0, 0.1);
}
/* Dismissible warning banner: text + an inline close control. */
.flash--dismissible {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.flash__dismiss {
  flex: none;
  border: none;
  background: transparent;
  color: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
}
.flash__dismiss:hover { opacity: 1; }

/* ── misc ────────────────────────────────────────────────────────────────── */
.mono {
  font-family: "IBM Plex Mono", ui-monospace, "SF Mono", Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.pill {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--muted);
}

.muted { color: var(--muted); }

.empty {
  padding: 40px 18px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

/* gold "Sign in with Google" CTA */
.btn-google {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 12px 18px;
  background: var(--gold);
  color: #0B0E11;
  border: none;
  border-radius: 999px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
}
.btn-google:hover {
  background: var(--gold-press);
  color: #0B0E11;
}
.btn-google__g {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #0B0E11;
  color: var(--gold);
  font-weight: 800;
  font-size: 13px;
}

/* ── inline help disclosure ("how to create a key") ──────────────────────── */
.guide { margin: 0 0 16px; }
.guide > summary {
  cursor: pointer;
  color: var(--gold);
  font-size: 13px;
  font-weight: 500;
  list-style: none;
}
.guide > summary::-webkit-details-marker { display: none; }
.guide > summary::before { content: "› "; }
.guide[open] > summary::before { content: "⌄ "; }
.guide__steps {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}
.guide__steps li { margin-bottom: 6px; }

/* ── auth screens (login / admin login) ──────────────────────────────────── */
.auth-wrap {
  min-height: calc(100vh - 56px - 84px);
  display: flex;
  align-items: center;
  justify-content: center;
}
.auth-card {
  width: 100%;
  max-width: 380px;
}
.auth-card__title { margin-bottom: 6px; }
.auth-card__sub { margin: 0 0 22px; }
.auth-card__note { text-align: center; margin-top: 16px; }

/* ── consent gate (/terms) ────────────────────────────────────────────────── */
.auth-card--wide { max-width: 560px; }
.terms-body {
  margin: 16px 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}
.terms-body p { margin: 0 0 10px; }
.terms-body p:last-child { margin-bottom: 0; }
.terms-list { margin: 0 0 10px; padding-left: 20px; }
.terms-list li { margin-bottom: 6px; }
.terms-check {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
}
.terms-check input { margin-top: 3px; accent-color: var(--primary);
  width: 16px; height: 16px; flex: 0 0 auto; }

/* ── responsive: stack columns under ~720px ──────────────────────────────── */
@media (max-width: 720px) {
  .grid--2,
  .grid--3 { grid-template-columns: minmax(0, 1fr); }

  .topbar {
    height: auto;
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 16px;
  }
  .nav { margin-left: 0; }
  .container { padding: 20px 16px 40px; }
  .form-row { flex-direction: column; align-items: stretch; }
  .stepper { flex-direction: column; gap: 8px; }

  /* ── hamburger nav (JS-enhanced) ──────────────────────────────────────────
     With JS the bar stays a single row (menu button + brand) and the links
     collapse into a drop-down panel toggled by #nav-toggle. Without JS the
     column-stacked nav above remains the fallback, so navigation still works. */
  html.js .topbar {
    flex-direction: row;
    align-items: center;
    height: 56px;
    gap: 12px;
  }
  html.js .nav-toggle { display: inline-flex; }
  html.js .nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    padding: 8px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
    box-shadow: 0 10px 24px rgba(0, 0, 0, 0.35);
    display: none;
  }
  html.js .nav.is-open { display: flex; }
  html.js .nav .nav__link { display: flex; align-items: center; }
  html.js .nav .theme-toggle { align-self: flex-start; margin-top: 4px; }
}

/* ── shared page layout helpers ───────────────────────────────────────────────
   Used by the FOLLOWER pages (page header + position groups). The admin console
   ships equivalents in admin/_style.html; these live in the global sheet so the
   follower templates — which include no style partial — are styled identically. */
.page-head { margin: 4px 0 20px; }
.page-head__title { font-size: 22px; font-weight: 600; margin: 0 0 6px;
                    display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.pos-group { margin-top: 14px; }
.pos-group:first-of-type { margin-top: 6px; }
.pos-group__head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pos-group__foot { font-size: 12px; margin-top: 8px; }
.pos-group__note { font-size: 12px; margin-top: 6px; }

/* ── onboarding stepper (dashboard setup progress) ───────────────────────── */
.stepper {
  display: flex;
  gap: 10px;
  list-style: none;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.stepper__step { flex: 1; display: flex; align-items: center; gap: 10px;
                 color: var(--muted); font-size: 13px; font-weight: 500; }
.stepper__dot {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid var(--border); font-size: 12px; font-weight: 700;
}
.stepper__step--done { color: var(--text); }
.stepper__step--done .stepper__dot { background: var(--green); border-color: var(--green); color: #0B0E11; }
.stepper__step--active { color: var(--text); }
.stepper__step--active .stepper__dot { background: var(--gold); border-color: var(--gold); color: #0B0E11; }

/* ── track-record sparkline ──────────────────────────────────────────────── */
.spark { width: 100%; height: 84px; display: block; }
.spark__line { fill: none; stroke: var(--gold); stroke-width: 1.4; vector-effect: non-scaling-stroke; }
.spark__line--up { stroke: var(--green); }
.spark__line--down { stroke: var(--red); }

/* ── learn page bullets ──────────────────────────────────────────────────── */
.learn-list { margin: 10px 0 0; padding-left: 18px; line-height: 1.6; }
.learn-list li { margin-bottom: 6px; }

/* ── leaderboard: highlight the viewer's own row ─────────────────────────── */
.lb-me { background: rgba(247, 166, 0, 0.08); }
.lb-me td { border-color: rgba(247, 166, 0, 0.25); }

/* ── mobile / PWA pass (FOLLOWER pages only) ──────────────────────────────────
   Tightens the follower top bar + content for phone widths. The admin shell
   (.admin-shell, scoped in admin.css) is never matched here. Goals:
     • top nav wraps and scrolls instead of overflowing,
     • wide .table blocks scroll horizontally INSIDE their card (no page-wide
       overflow, account columns stay aligned),
     • touch targets ≥ 44px,
     • the live #status / #live region stays readable.
   The existing max-width:720px block above already collapses .grid--2/3 to one
   column and stacks the topbar; this block layers the touch + scroll refinements
   on the narrower phone range. */
@media (max-width: 560px) {
  /* Let the follower nav wrap onto multiple rows and scroll if still too wide,
     instead of pushing the brand off-screen. */
  .topbar .nav {
    width: 100%;
    flex-wrap: wrap;
    gap: 2px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  /* Touch targets ≥ 44px tall for the primary tap areas. */
  .nav__link,
  .btn,
  .btn--sm {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
  }
  .theme-toggle button { width: 44px; height: 44px; }

  /* Full-width primary actions read better on a phone. */
  .btn { width: 100%; }
  .form-row .btn,
  .btn--sm { width: auto; }

  /* Wide tables scroll horizontally within their own card instead of forcing the
     whole page to overflow. .card keeps overflow:hidden, so the scroll lives on
     the body wrapper; momentum scrolling on iOS. */
  .card__body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table { min-width: 480px; }

  /* Keep the live status numbers from cramping on small screens. */
  .kpi__value { font-size: 20px; }
  #live .card__body { padding: 18px 14px; }
}

/* i18n language picker (#18) — a quiet footer row under the follower/public app. */
.site-foot {
  margin-top: 28px;
  padding: 16px 0 8px;
  border-top: 1px solid var(--border);
}
.lang-picker {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  font-size: 13px;
}
.lang-picker__form { display: inline; margin: 0; }
.lang-picker__link {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  text-decoration: underline;
}
.lang-picker__link:hover { color: var(--text); }
.lang-picker__cur { color: var(--text); font-weight: 600; }

/* ── POST-form logout + link-style submit buttons ────────────────────────────
   /logout and /admin/logout are POST (a forged cross-site GET can't clear the
   session), so the nav uses a same-origin form. `display:contents` lets the
   button sit in the flex nav exactly where the old <a> did; the resets below
   strip native button chrome so it matches its sibling links. */
.logout-form { display: contents; }
button.nav__link {
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}
.linkbtn {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-decoration: underline;
}

/* ── modern auth pages (login / signup / forgot / reset) ──────────────────────────
   A full-bleed, app-like sign-in surface rendered with bare=True (base.html), so it
   owns the whole viewport: an ambient CSS aurora behind a frosted-glass card. Mobile
   = a bottom sheet that rounds up over the aurora; ≥600px = a centered floating card.
   Colours are tokens-only (auto-themes light/dark) and ALL motion is gated behind
   prefers-reduced-motion. New .auth-main/.login-* classes only — the older
   .auth-wrap/.auth-card (admin login + /terms) are intentionally left untouched. */
.auth-main {
  position: relative;
  min-height: 100vh;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}
/* Server flashes (login errors, reset notices) float as a centred banner over the
   aurora rather than pushing the card down. */
.auth-main > .flash-area {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  z-index: 20;
  width: min(420px, calc(100% - 24px));
  margin: 14px 0 0;
}

.login-stage {
  position: relative;
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;       /* mobile: card sits at the bottom as a sheet */
  align-items: center;
  overflow: hidden;
  isolation: isolate;
}

/* ── ambient aurora ──────────────────────────────────────────────────────────── */
.login-aurora {
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: var(--bg);
  overflow: hidden;
}
.login-aurora__blob {
  position: absolute;
  width: 60vmax;
  height: 60vmax;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}
.login-aurora__blob--gold {
  top: -22vmax;
  left: -14vmax;
  opacity: 0.5;
  background: radial-gradient(circle at 50% 50%,
    rgba(247, 166, 0, 0.55), rgba(247, 166, 0, 0) 68%);
}
.login-aurora__blob--green {
  bottom: -24vmax;
  right: -16vmax;
  opacity: 0.42;
  background: radial-gradient(circle at 50% 50%,
    rgba(32, 178, 108, 0.42), rgba(32, 178, 108, 0) 68%);
}
/* Softer over the light theme's pale background, in both explicit-light and auto. */
html[data-theme="light"] .login-aurora__blob--gold { opacity: 0.32; }
html[data-theme="light"] .login-aurora__blob--green { opacity: 0.26; }
@media (prefers-color-scheme: light) {
  html[data-theme="auto"] .login-aurora__blob--gold { opacity: 0.32; }
  html[data-theme="auto"] .login-aurora__blob--green { opacity: 0.26; }
}
/* faint grid so the field reads as "data", masked to a soft vignette */
.login-aurora__grid {
  position: absolute;
  inset: -2px;
  background-image:
    linear-gradient(to right, var(--border) 1px, transparent 1px),
    linear-gradient(to bottom, var(--border) 1px, transparent 1px);
  background-size: 44px 44px;
  opacity: 0.18;
  -webkit-mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 72%);
  mask-image: radial-gradient(circle at 50% 38%, #000 0%, transparent 72%);
}

/* ── glass card / mobile bottom sheet ────────────────────────────────────────── */
.login-card {
  position: relative;
  width: 100%;
  max-width: 520px;
  margin-top: auto;
  padding: 30px 22px calc(26px + env(safe-area-inset-bottom));
  border: 1px solid var(--border);
  border-bottom: 0;
  border-radius: 22px 22px 0 0;
  background: color-mix(in srgb, var(--panel) 86%, transparent);
  -webkit-backdrop-filter: blur(18px) saturate(1.2);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 -10px 44px -16px rgba(0, 0, 0, 0.5);
}

/* ── brand lockup ────────────────────────────────────────────────────────────── */
.login-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 6px; }
.login-brand__mark {
  font-size: 22px;
  line-height: 1;
  filter: drop-shadow(0 0 10px rgba(247, 166, 0, 0.55));
}
.login-brand__word {
  margin: 0;
  font-family: "Space Grotesk", Inter, sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--text);
}
.login-sub { margin: 0 0 22px; font-size: 13px; line-height: 1.5; color: var(--muted); }

/* ── fields ──────────────────────────────────────────────────────────────────── */
.login-form { display: block; }
.login-field { margin-bottom: 14px; }
.login-field__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.login-field__label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: var(--muted);
}
.login-forgot { font-size: 12px; font-weight: 600; }
.login-hint { margin: 6px 2px 0; font-size: 11px; color: var(--muted); }

.login-control {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 88%, transparent);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}
.login-control__icon { flex: none; margin-left: 12px; color: var(--muted); transition: color 0.16s ease; }
.login-control:focus-within {
  border-color: var(--gold);
  background: var(--panel-2);
  box-shadow: 0 0 0 3px rgba(247, 166, 0, 0.18);
}
.login-control:focus-within .login-control__icon { color: var(--gold); }

.login-input {
  flex: 1 1 auto;
  width: 100%;
  min-height: 46px;
  padding: 12px 14px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;          /* ≥16px keeps iOS from zooming the page on focus */
}
.login-input:focus { outline: none; }
.login-input::placeholder { color: var(--muted); opacity: 0.7; }

/* CSS-only show/hide password. Progressive enhancement: where :has() or
   -webkit-text-security is unsupported it simply stays masked (never breaks). */
.login-control--reveal { padding-right: 4px; }
.login-reveal__cb,
.login-reveal__sr {
  position: absolute;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0); clip-path: inset(50%);
  overflow: hidden;
}
.login-reveal {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  cursor: pointer;
  color: var(--muted);
  border-radius: 8px;
  transition: color 0.16s ease, background 0.16s ease;
}
.login-reveal:hover { color: var(--text); }
.login-reveal__off { display: none; }
.login-reveal__cb:focus-visible + .login-reveal { outline: 2px solid var(--gold); outline-offset: 2px; }
/* Gate BOTH the unmask and the eye-icon swap on -webkit-text-security support, so a
   browser that can't actually reveal the text (e.g. older Firefox) keeps the masked
   "eye" icon instead of flipping to "eye-off" while the password stays hidden. */
@supports (-webkit-text-security: none) {
  .login-control--reveal:has(.login-reveal__cb:checked) .login-input[type="password"] {
    -webkit-text-security: none;
  }
  .login-reveal__cb:checked + .login-reveal .login-reveal__on { display: none; }
  .login-reveal__cb:checked + .login-reveal .login-reveal__off { display: inline; }
}

/* ── primary submit ──────────────────────────────────────────────────────────── */
.login-submit {
  width: 100%;
  min-height: 50px;
  margin-top: 6px;
  border: 0;
  border-radius: var(--radius);
  background: var(--gold);
  color: #0B0E11;
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: 0 8px 22px -10px rgba(247, 166, 0, 0.65);
  transition: background 0.14s ease, transform 0.08s ease, box-shadow 0.14s ease;
}
.login-submit:hover { background: var(--gold-press); box-shadow: 0 10px 26px -10px rgba(247, 166, 0, 0.8); }
.login-submit:focus-visible { outline: 2px solid var(--text); outline-offset: 3px; }

/* ── divider ─────────────────────────────────────────────────────────────────── */
.login-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
  color: var(--muted);
  font-size: 12px;
}
.login-divider::before,
.login-divider::after { content: ""; flex: 1; height: 1px; background: var(--border); }

/* ── social (outline secondary) ──────────────────────────────────────────────── */
.login-social {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 48px;
  padding: 12px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--panel-2) 70%, transparent);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.08s ease;
}
.login-social:hover { border-color: var(--muted); background: var(--panel-2); color: var(--text); }
.login-social:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.login-social__g { flex: none; }

/* ── create-account / back link ──────────────────────────────────────────────── */
.login-create { margin: 16px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.login-create a { font-weight: 600; }

/* ── trust badges ────────────────────────────────────────────────────────────── */
.login-trust {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 7px 8px;
  margin: 22px 0 0;
  padding: 16px 0 0;
  list-style: none;
  border-top: 1px solid var(--border);
}
.login-trust__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: color-mix(in srgb, var(--panel-2) 60%, transparent);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.login-trust__item svg { flex: none; color: var(--green); opacity: 0.9; }

/* ── terms ───────────────────────────────────────────────────────────────────── */
.login-terms { margin: 14px 0 0; text-align: center; font-size: 11px; line-height: 1.5; color: var(--muted); }
.login-terms a { color: var(--muted); text-decoration: underline; text-underline-offset: 2px; }
.login-terms a:hover { color: var(--gold); }

/* ── desktop: centered floating glass card ───────────────────────────────────── */
@media (min-width: 600px) {
  .login-stage { justify-content: center; padding: 48px 24px; }
  .login-card {
    max-width: 400px;
    margin-top: 0;
    padding: 34px 30px;
    border-bottom: 1px solid var(--border);
    border-radius: 18px;
    background: color-mix(in srgb, var(--panel) 78%, transparent);
    box-shadow:
      0 1px 0 color-mix(in srgb, var(--text) 8%, transparent) inset,
      0 24px 60px -28px rgba(0, 0, 0, 0.55);
  }
}

/* ── micro-animations (only when motion is welcome) ──────────────────────────── */
@media (prefers-reduced-motion: no-preference) {
  .login-aurora__blob--gold { animation: login-drift-a 22s ease-in-out infinite alternate; }
  .login-aurora__blob--green { animation: login-drift-b 26s ease-in-out infinite alternate; }
  .login-card { animation: login-rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both; }
  .login-form .login-field { animation: login-fade 0.5s ease both; }
  .login-form .login-field:nth-child(2) { animation-delay: 0.05s; }
  .login-form .login-field:nth-child(3) { animation-delay: 0.1s; }
  .login-submit:active { transform: translateY(1px) scale(0.992); }
  .login-social:active { transform: translateY(1px); }
}
@keyframes login-drift-a {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(6vmax, 4vmax, 0) scale(1.12); }
}
@keyframes login-drift-b {
  from { transform: translate3d(0, 0, 0) scale(1.05); }
  to   { transform: translate3d(-5vmax, -3vmax, 0) scale(1); }
}
@keyframes login-rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes login-fade {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── reduced motion: kill all movement, keep the static composition ──────────── */
@media (prefers-reduced-motion: reduce) {
  .login-aurora__blob,
  .login-card,
  .login-form .login-field,
  .login-submit,
  .login-social { animation: none !important; transition: none !important; }
}
