/* ─────────────────────────────────────────────────────────────
   Outly design tokens + shared components.
   Dark-first; a light theme follows the OS (and data-theme).
   One accent gradient (violet → mint) marks primary actions;
   warm amber is reserved for evidence (the "why" behind a lead).
   ───────────────────────────────────────────────────────────── */

@font-face { font-family: "Geist"; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/geist.woff2") format("woff2"); }
@font-face { font-family: "Geist Mono"; font-weight: 100 900; font-display: swap;
  src: url("/static/fonts/geist-mono.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-weight: 200 800; font-display: swap;
  src: url("/static/fonts/newsreader.woff2") format("woff2"); }

:root {
  --bg: #07080c; --bg-2: #0b0d14; --surface: #10131c; --surface-2: #161a26; --surface-3: #1d2231;
  --line: rgba(255,255,255,.08); --line-2: rgba(255,255,255,.14);
  --text: #eef0f6; --muted: #a2a9bc; --faint: #6f778c;
  --accent: #8b7bff; --accent-2: #3ee6c4; --accent-ink: #0b0a1a;
  --warm: #ffb547; --danger: #ff6b6b; --good: #3ee6c4; --info: #6cb6ff;
  --grad: linear-gradient(120deg, #8b7bff 0%, #6f9bff 45%, #3ee6c4 100%);
  --glow: 0 0 0 1px rgba(139,123,255,.35), 0 10px 40px -10px rgba(139,123,255,.55);
  --shadow: 0 1px 0 rgba(255,255,255,.04) inset, 0 20px 50px -24px rgba(0,0,0,.8);
  --radius: 14px; --radius-sm: 10px; --radius-lg: 22px;
  --font: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Geist Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --serif: "Newsreader", Georgia, serif;
  --ease: cubic-bezier(.2,.7,.2,1);
  color-scheme: dark;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f7f7fb; --bg-2: #f0f1f7; --surface: #ffffff; --surface-2: #f6f7fb; --surface-3: #eceef5;
    --line: rgba(14,18,40,.09); --line-2: rgba(14,18,40,.16);
    --text: #12162a; --muted: #4f5672; --faint: #7d849c;
    --accent: #6a55ff; --accent-2: #0fb894; --accent-ink: #ffffff;
    --warm: #c27a00; --danger: #d63c3c; --good: #0b9a7b; --info: #2a7de1;
    --glow: 0 0 0 1px rgba(106,85,255,.25), 0 10px 30px -12px rgba(106,85,255,.45);
    --shadow: 0 1px 2px rgba(14,18,40,.06), 0 18px 40px -26px rgba(14,18,40,.35);
    color-scheme: light;
  }
}
:root[data-theme="light"] {
  --bg: #f7f7fb; --bg-2: #f0f1f7; --surface: #ffffff; --surface-2: #f6f7fb; --surface-3: #eceef5;
  --line: rgba(14,18,40,.09); --line-2: rgba(14,18,40,.16);
  --text: #12162a; --muted: #4f5672; --faint: #7d849c;
  --accent: #6a55ff; --accent-2: #0fb894; --accent-ink: #ffffff;
  --warm: #c27a00; --danger: #d63c3c; --good: #0b9a7b; --info: #2a7de1;
  --glow: 0 0 0 1px rgba(106,85,255,.25), 0 10px 30px -12px rgba(106,85,255,.45);
  --shadow: 0 1px 2px rgba(14,18,40,.06), 0 18px 40px -26px rgba(14,18,40,.35);
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; background: var(--bg); color: var(--text); font: 400 16px/1.6 var(--font);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
::selection { background: rgba(139,123,255,.35); }
h1, h2, h3, h4 { margin: 0; line-height: 1.12; letter-spacing: -.02em; font-weight: 620; }
p { margin: 0; }
.serif { font-family: var(--serif); font-weight: 420; letter-spacing: -.01em; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.grad-text { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }

/* Buttons */
.btn {
  --b: var(--surface-2);
  display: inline-flex; align-items: center; justify-content: center; gap: .5em;
  min-height: 44px; padding: 0 1.15em; border-radius: 999px; border: 1px solid var(--line-2);
  background: var(--b); color: var(--text); font: 550 15px/1 var(--font); cursor: pointer;
  transition: transform .2s var(--ease), box-shadow .2s var(--ease), background .2s, border-color .2s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: var(--line-2); background: var(--surface-3); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--grad); color: var(--accent-ink); border-color: transparent; box-shadow: var(--glow); }
.btn-primary:hover { background: var(--grad); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--text); background: var(--surface-2); }
.btn-danger { background: transparent; border-color: rgba(255,107,107,.45); color: var(--danger); }
.btn-danger:hover { background: rgba(255,107,107,.1); }
.btn-sm { min-height: 34px; padding: 0 .9em; font-size: 13.5px; }
.btn-lg { min-height: 52px; padding: 0 1.5em; font-size: 16px; }
.btn[disabled], .btn.is-busy { opacity: .55; pointer-events: none; }
.btn .arrow { transition: transform .25s var(--ease); }
.btn:hover .arrow { transform: translateX(3px); }

/* Forms */
.field { display: grid; gap: 6px; }
.field + .field { margin-top: 14px; }
.label { font-size: 13.5px; font-weight: 560; color: var(--text); }
.help { font-size: 13px; color: var(--faint); }
.input, .textarea, .select {
  width: 100%; min-height: 44px; padding: 10px 14px; border-radius: var(--radius-sm);
  border: 1px solid var(--line-2); background: var(--bg-2); color: var(--text);
  font: 400 15px/1.45 var(--font); transition: border-color .15s, box-shadow .15s;
}
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(139,123,255,.22); }
.input::placeholder, .textarea::placeholder { color: var(--faint); }
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-size: 14.5px; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.chip-choice { display: inline-flex; }
.chip-choice input { position: absolute; opacity: 0; pointer-events: none; }
.chip-choice span {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px;
  border: 1px solid var(--line-2); background: var(--surface-2); font-size: 14px; cursor: pointer;
  transition: all .18s var(--ease);
}
.chip-choice input:checked + span { border-color: var(--accent); background: rgba(139,123,255,.16); color: var(--text); box-shadow: inset 0 0 0 1px var(--accent); }
.chip-choice input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Cards, chips, alerts */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px;
  font: 520 12.5px/1.6 var(--font); border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.chip-warm { color: var(--warm); border-color: color-mix(in srgb, var(--warm) 40%, transparent); background: color-mix(in srgb, var(--warm) 10%, transparent); }
.chip-good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); background: color-mix(in srgb, var(--good) 10%, transparent); }
.chip-bad { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, transparent); background: color-mix(in srgb, var(--danger) 10%, transparent); }
.chip-info { color: var(--info); border-color: color-mix(in srgb, var(--info) 40%, transparent); background: color-mix(in srgb, var(--info) 10%, transparent); }
.chip-accent { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, transparent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
a.chip:hover { border-color: currentColor; }
.alert { padding: 12px 16px; border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: var(--surface-2); font-size: 14.5px; }
.alert-bad { border-color: color-mix(in srgb, var(--danger) 45%, transparent); background: color-mix(in srgb, var(--danger) 9%, transparent); }
.alert-good { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: color-mix(in srgb, var(--good) 9%, transparent); }
.alert-warm { border-color: color-mix(in srgb, var(--warm) 45%, transparent); background: color-mix(in srgb, var(--warm) 9%, transparent); }

/* Brand mark */
.brand { display: inline-flex; align-items: center; gap: 10px; font-weight: 650; letter-spacing: -.02em; font-size: 18px; }
.brand-mark { width: 28px; height: 28px; }

/* Auth pages */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 40px 16px; position: relative; isolation: isolate; }
.auth-wrap::before {
  content: ""; position: absolute; inset: 0; z-index: -1;
  background: radial-gradient(600px 400px at 20% 10%, rgba(139,123,255,.18), transparent 70%),
              radial-gradient(500px 380px at 85% 90%, rgba(62,230,196,.12), transparent 70%);
}
.auth-card { width: 100%; max-width: 420px; padding: 34px 30px; }
.auth-card h1 { font-size: 26px; margin: 22px 0 6px; }
.auth-card .sub { color: var(--muted); font-size: 15px; margin-bottom: 22px; }
.auth-card .btn { width: 100%; margin-top: 18px; }
.auth-foot { margin-top: 18px; text-align: center; font-size: 13.5px; color: var(--faint); }
.secret-box { font: 500 15px/1.5 var(--mono); letter-spacing: .08em; padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-2); border: 1px dashed var(--line-2); word-break: break-all; user-select: all; }
.qr { display: block; width: 220px; height: 220px; margin: 4px auto 18px; padding: 10px; border-radius: var(--radius-sm); background: #fff; image-rendering: pixelated; }
details.more summary { cursor: pointer; color: var(--accent); font-size: 14px; margin-bottom: 10px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

/* data-show-if toggles [hidden]; component display rules must not override it. */
[hidden] { display: none !important; }
