:root{
  /* dark mode (default) */
  --background:#1A1A2E; --foreground:#F8F6F1; --card:#2D2D44; --card-2:#26263C;
  --primary:#C9A96E; --primary-foreground:#1A1A2E; --antique:#A88B5C; --badge-gold-fg:#C9A96E;
  --muted:#2D2D44; --muted-foreground:#A6ABB8; --faint:#7D8294;
  --border:rgba(248,246,241,.10); --border-strong:rgba(248,246,241,.16);
  --ring:#C9A96E; --radius:8px;
  --destructive:#DC3545; --success:#6FBF73; --danger-fg:rgb(240,166,172); --blush:#E8D4D0; --violet:#C9A0E0; --blue-fg:#9CD2FF;
  --media-bg:rgb(17,17,17); --glow:rgba(45,45,68,.50);
  --gold-tint:rgba(201,169,110,.16); --green-tint:rgba(111,191,115,.16); --red-tint:rgba(220,53,69,.18);
  color-scheme: dark;
}
:root[data-theme="light"]{
  --background:#F8F6F1; --foreground:#1A1A2E; --card:#FFFFFF; --card-2:#F0EDE6;
  --antique:#A88B5C; --badge-gold-fg:#9A7B43;
  --muted:#F0EDE6; --muted-foreground:#6B7280; --faint:#9CA3AF;
  --border:#E8E4DC; --border-strong:#D8D2C6;
  --success:#2E7D32; --danger-fg:rgb(192,36,52); --violet:#8B5C9E; --blue-fg:#2E6FA8;
  --media-bg:#ECEAE4; --glow:rgba(201,169,110,.20);
  --gold-tint:rgba(201,169,110,.32); --green-tint:rgba(46,125,50,.12); --red-tint:rgba(220,53,69,.10);
  color-scheme: light;
}
*{ box-sizing:border-box; }
/* Paint the app background on the ROOT too, not only <body>. <body> is only as tall as its content,
   so on a short page (an empty scout, a small form) the viewport area BELOW it fell through to the
   browser's own canvas — a grey band, because color-scheme:dark makes the UA canvas dark-grey. */
html{ background:var(--background); }
body{ font-family:'Inter',system-ui,-apple-system,'Segoe UI',sans-serif; margin:0; min-height:100vh;
      background:var(--background); color:var(--foreground); -webkit-font-smoothing:antialiased; }
a{ color:var(--primary); text-decoration:none; }
a:hover{ color:var(--antique); }
::selection{ background:rgba(201,169,110,.3); }
.wordmark{ font-family:Georgia,serif; font-weight:600; letter-spacing:.2px; }
.wordmark .dot{ color:var(--primary); }
.sub{ color:var(--muted-foreground); font-weight:400; font-family:'Inter',sans-serif; }
input,select,textarea{ font-family:inherit; background:var(--card); color:var(--foreground);
      border:1px solid var(--border-strong); border-radius:6px; padding:7px 10px; font-size:13px; }
/* The dropdown POPUP is a separate surface: it takes the platform default (white) while inheriting
   `color` from the select — which in the dark theme is a near-white --foreground. That is white text
   on a white background, on every page with a <select>. Naming both here fixes all of them at once. */
option,optgroup{ background:var(--card); color:var(--foreground); }
input:focus,select:focus,textarea:focus{ outline:none; border-color:var(--ring);
      box-shadow:0 0 0 2px rgba(201,169,110,.45); }
/* The `hidden` attribute must actually hide.
 *
 * `[hidden]{display:none}` is a USER-AGENT rule, so ANY author rule that sets `display` beats
 * it on specificity — `.dropzone{display:flex}` plus `hidden` leaves the element on screen.
 * That is not a theoretical footgun: on /console it left the "Drop a plan…" overlay, an empty
 * toast, a stray "edited" badge and a `0` counter permanently visible, and — worst — parked an
 * empty `position:absolute; inset:0` container on top of the log, swallowing every click that
 * landed on a row. Declaring it here once means no page has to remember. */
[hidden] { display: none !important; }

button{ font-family:inherit; background:var(--card); color:var(--foreground);
      border:1px solid var(--border-strong); border-radius:6px; padding:8px 16px; font-size:13px;
      font-weight:500; cursor:pointer; transition:background .15s,color .15s,border-color .15s; }
button:hover{ background:var(--card-2); }
button:disabled{ opacity:.5; cursor:default; }
button.primary{ background:var(--primary); color:var(--primary-foreground); border-color:var(--primary); font-weight:600; }
button.primary:hover{ background:var(--antique); border-color:var(--antique); }
button.primary:disabled{ background:var(--card); color:var(--faint); border-color:var(--border); }
::-webkit-scrollbar{ width:10px; height:10px; }
::-webkit-scrollbar-thumb{ background:var(--card); border-radius:6px; }
::-webkit-scrollbar-track{ background:transparent; }
/* brand logo mark — shared across every page header (data-URI injected per page) */
.brand-logo{ width:26px; height:26px; border-radius:6px; flex:0 0 auto; display:block; }

/* ── the ONE topbar, shared by every page ──────────────────────────────────────
 * Every page's <header> used to hand-roll its own chrome AND its own nav in its own
 * page.css — different links, classes, orders, sizes; some pages had no nav at all and
 * /stats had no header. The chrome is defined ONCE here; the destination list is built and
 * injected by ds/nav.js from a single canonical array, marked `aria-current` on the active
 * page. A new page gets the identical, complete bar for free — it can never drift again, so
 * page.css must NOT re-declare header / .hd-nav / .navlink / .hd-right / .wordmark. */
header{
  position:sticky; top:0; z-index:40;
  display:flex; align-items:center; flex-wrap:wrap; gap:9px 15px;
  padding:10px 20px; margin:0;
  background:var(--card-2); border-bottom:1px solid var(--border);
}
header .wordmark{ font-size:16px; line-height:1.2; margin:0; white-space:nowrap; }
header .wordmark .dot{ margin:0 1px; }
/* the right cluster: any page-specific controls, then the injected nav, then a user chip */
.hd-right{ margin-left:auto; display:flex; align-items:center; flex-wrap:wrap; gap:8px 12px; }
.hd-nav{ display:flex; align-items:center; flex-wrap:wrap; gap:2px 4px; }
.navlink{
  display:inline-flex; align-items:center; gap:5px; white-space:nowrap;
  padding:6px 8px 5px; border-bottom:2px solid transparent;
  color:var(--muted-foreground); font:500 13px 'Inter',sans-serif;
  transition:color .15s, border-color .15s;
}
.navlink:hover{ color:var(--foreground); }
.navlink[aria-current="page"]{ color:var(--primary); border-bottom-color:var(--primary); }
.navlink .nav-plus{ width:12px; height:12px; flex:0 0 auto; }
.navlink .nav-badge{ /* console error pill; shown/filled by ds/nav.js */ }
.whoami{ color:var(--faint); font-size:12px; white-space:nowrap; }
/* theme toggle (injected on every page, bottom-right) */
#themeToggle{ position:fixed; right:16px; bottom:16px; z-index:40; width:auto; min-width:0; margin:0;
      display:flex; align-items:center; gap:7px; padding:8px 13px; border-radius:9999px;
      background:var(--card); color:var(--foreground); border:1px solid var(--border-strong);
      box-shadow:0 6px 20px rgba(0,0,0,.22); cursor:pointer;
      font:500 12.5px 'Inter',sans-serif; user-select:none; transition:background .15s,border-color .15s; }
#themeToggle:hover{ border-color:var(--primary); }
#themeToggle .tg-ico{ font-size:14px; line-height:1; color:var(--primary); }
