/* ===========================================================================
   theme.css — the BuildAPI visual system (2026 redesign).

   Loaded LAST on every page (after main / dashboard / home / motion CSS) and
   BEFORE the admin-set brand colour, so a brand colour still wins.

   Rules this file keeps, so a restyle cannot break the product:
   - restyles existing classes and tokens only — no markup, id, class or form
     field is renamed or required;
   - changes look, never structure: no display / position / grid changes to
     anything a script or a test relies on;
   - one accent (the brand colour), one cool neutral family, one light source;
   - every animation is transform/opacity and stops for reduced motion.
   =========================================================================== */

/* ---- Tokens ---------------------------------------------------------------- */
/* ---- Fonts: Geist and Geist Mono, served from this site -----------------------
   SIL Open Font License 1.1 (assets/fonts/OFL-*.txt). Self-hosted so no visitor's
   browser contacts a third party, and no extra connection delays first paint.
   File names carry the font version: a new version is a new URL (the files
   are cached for a year). Latin and Latin Extended only, as before. */
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/geist-v5-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist'; font-style: normal; font-weight: 400 700; font-display: swap;
  src: url('../fonts/geist-v5-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/geist-mono-v6-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: 'Geist Mono'; font-style: normal; font-weight: 400 600; font-display: swap;
  src: url('../fonts/geist-mono-v6-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }

:root {
  /* Neutrals: one cool slate family, tinted toward the accent hue. */
  --background: #f8fafc;
  --foreground: #0b1220;
  --card: #ffffff;
  --muted: #eef2f7;
  --muted-foreground: #5b6578;
  --border: #e3e8f0;
  --hairline: rgba(15, 23, 42, .08);
  --ink-soft: #334155;

  /* One accent. The admin's brand colour overrides --primary after this file. */
  --primary: #3b5bfd;
  --primary-foreground: #ffffff;
  --accent-soft: color-mix(in oklab, var(--primary) 10%, white);
  --accent-line: color-mix(in oklab, var(--primary) 34%, white);
  --accent-glow: color-mix(in oklab, var(--primary) 22%, transparent);
  /* The purple "second colour" is retired: anything that used it now uses the accent. */
  --secondary: var(--primary);

  /* Dark surfaces: deep navy, never pure black. */
  --night: #0a0f1c;
  --night-2: #0f1628;
  --night-line: rgba(148, 163, 214, .14);

  /* Shape, depth, motion. */
  --radius: 10px;
  --card-radius: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .05), 0 1px 1px rgba(15, 23, 42, .03);
  --shadow-md: 0 1px 2px rgba(15, 23, 42, .04), 0 8px 24px -12px rgba(30, 41, 80, .18);
  --shadow-lg: 0 2px 4px rgba(15, 23, 42, .04), 0 24px 48px -20px rgba(30, 41, 80, .28);
  --ring: 0 0 0 3px var(--accent-glow);
  --ease-out: cubic-bezier(.22, 1, .36, 1);
  --ease-spring: cubic-bezier(.34, 1.4, .64, 1);

  --font-sans: 'Geist', ui-sans-serif, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --mono: var(--font-mono);
}

/* ---- Base ------------------------------------------------------------------ */
html { -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; text-rendering: optimizeLegibility; }
body {
  font-family: var(--font-sans);
  font-feature-settings: 'ss01', 'cv11';
  letter-spacing: -0.006em;
  background-color: var(--background);
  /* A faint dot grid: depth without noise. */
  background-image: radial-gradient(rgba(15, 23, 42, .045) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--foreground);
}
h1, h2, h3, h4, .dash-h1, .mk-h1, .mk-h2 { letter-spacing: -0.025em; text-wrap: balance; }
h1, .dash-h1, .mk-h1 { font-weight: 650; }
p, li { text-wrap: pretty; }
code, pre, kbd, samp, .mk-code, .hc-tag, .term-body, .term-title, .otp-input { font-family: var(--font-mono) !important; }
::selection { background: var(--accent-glow); color: var(--foreground); }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: 6px; }
a { transition: color .18s ease; }

/* Numbers that sit in columns or tiles line up. */
table, .stat-card, .bento-value, .pf-stat, .cp-tile, .scan-grade, .d-table, .mini-badge { font-variant-numeric: tabular-nums; }

/* ---- Buttons --------------------------------------------------------------- */
.btn, .btn-primary, .btn-secondary, .btn-danger, .btn-ghost, .btn-outline {
  border-radius: 10px;
  font-weight: 560;
  letter-spacing: -0.005em;
  transition: transform .18s var(--ease-spring), box-shadow .25s var(--ease-out), background-color .2s ease, border-color .2s ease, color .2s ease, opacity .2s ease;
}
.btn-primary {
  background: var(--primary);
  border-color: color-mix(in oklab, var(--primary) 80%, black);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .18), 0 1px 2px rgba(15, 23, 42, .12), 0 6px 16px -8px var(--accent-glow);
}
.btn-primary:hover { opacity: 1; background: color-mix(in oklab, var(--primary) 90%, white); box-shadow: inset 0 1px 0 rgba(255, 255, 255, .22), 0 10px 24px -10px color-mix(in oklab, var(--primary) 55%, transparent); }
.btn-outline, .btn-secondary {
  background: var(--card); border-color: var(--border); color: var(--foreground);
  box-shadow: var(--shadow-sm);
}
.btn-outline:hover, .btn-secondary:hover { background: var(--card); border-color: var(--accent-line); color: var(--foreground); box-shadow: var(--shadow-md); }
.btn-ghost:hover { background: var(--muted); }
.btn-danger { box-shadow: inset 0 1px 0 rgba(255, 255, 255, .15), 0 6px 16px -10px rgba(220, 38, 38, .5); }
.btn:active, .btn-primary:active, .btn-outline:active, .btn-secondary:active { transform: translateY(1px) scale(.985); }
.btn:focus-visible, .btn-primary:focus-visible, .btn-outline:focus-visible { box-shadow: var(--ring); }

/* ---- Forms ----------------------------------------------------------------- */
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"],
input[type="url"], input[type="tel"], input[type="date"], select, textarea {
  font-family: var(--font-sans);
  border-radius: 10px !important;
  border-color: var(--border);
  background-color: #fff;
  transition: border-color .18s ease, box-shadow .2s var(--ease-out), background-color .18s ease;
}
input:hover:not(:disabled):not([type="checkbox"]):not([type="radio"]), select:hover:not(:disabled), textarea:hover:not(:disabled) { border-color: #cdd5e2; }
input:focus:not([type="checkbox"]):not([type="radio"]), select:focus, textarea:focus {
  outline: none; border-color: var(--primary) !important; box-shadow: var(--ring) !important;
}
input[type="checkbox"], input[type="radio"] { accent-color: var(--primary); }
.form-group label, label { font-weight: 550; }
.field-hint { color: var(--muted-foreground); }
.form-error { border-radius: 12px; }

/* ---- Cards and surfaces ------------------------------------------------------ */
/* Shape and depth for every card; colour stays with each card's own variant
   (a coloured bento tile or stat card keeps its background). */
.d-card, .mk-card, .stat-card, .card, .feature-card, .auth-card, .bento-tile, .d-table-wrap, .bl-card, .cm-thread {
  border-radius: var(--card-radius);
  border-color: var(--hairline);
  box-shadow: var(--shadow-md);
}
.d-card, .mk-card, .card, .feature-card, .auth-card, .d-table-wrap, .bl-card, .cm-thread { border: 1px solid var(--hairline); }
.d-card, .mk-card, .stat-card, .feature-card { position: relative; isolation: isolate; }
/* A soft light that follows the cursor across a card (set by theme.js). */
.d-card::before, .mk-card::before, .stat-card::before, .feature-card::before {
  content: ''; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: -1; opacity: 0;
  background: radial-gradient(420px circle at var(--mx, 50%) var(--my, 0%), var(--accent-soft), transparent 45%);
  transition: opacity .35s ease;
}
.d-card:hover::before, .mk-card:hover::before, .stat-card:hover::before, .feature-card:hover::before { opacity: 1; }
.d-card:hover, .mk-card:hover, .stat-card:hover, .feature-card:hover { box-shadow: var(--shadow-lg); border-color: color-mix(in oklab, var(--primary) 18%, var(--hairline)); }

/* Dark panels: deep navy with a quiet accent glow. */
.d-card-dark, .bento-dark {
  background: radial-gradient(600px 260px at 100% 0%, color-mix(in oklab, var(--primary) 30%, transparent), transparent 60%), linear-gradient(180deg, var(--night-2), var(--night)) !important;
  border: 1px solid var(--night-line) !important;
  border-radius: var(--card-radius);
}

/* ---- Tables ---------------------------------------------------------------- */
table th { font-family: var(--font-mono); font-size: .7rem !important; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--muted-foreground) !important; }
.d-table tbody tr:hover, table.pf tbody tr:hover, table.cp tr:hover { background: color-mix(in oklab, var(--primary) 3%, white) !important; }

/* ---- Badges and pills -------------------------------------------------------- */
.mini-badge, .status-pill, .role-badge, .vbadge, .scan-pill, .as-st, .ack-badge, .feature-badge {
  border-radius: 6px !important;
  font-family: var(--font-mono);
  letter-spacing: 0;
  font-weight: 500;
}

/* ---- Dashboard shell ---------------------------------------------------------- */
.dash-body { background: transparent; }
.dash-sidebar {
  background: rgba(255, 255, 255, .78);
  backdrop-filter: saturate(160%) blur(14px); -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-right: 1px solid var(--hairline);
}
.dash-brand { letter-spacing: -0.02em; }
.nav-item {
  border-radius: 9px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: background-color .18s ease, color .18s ease, transform .2s var(--ease-out);
}
.nav-item:hover { background: var(--muted); color: var(--foreground); }
.nav-item.active {
  background: var(--accent-soft) !important;
  color: color-mix(in oklab, var(--primary) 82%, black) !important;
  box-shadow: inset 0 0 0 1px color-mix(in oklab, var(--primary) 16%, transparent);
}
.nav-item.active::before {
  content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: var(--primary);
}
.dash-header {
  background: rgba(248, 250, 252, .72) !important;
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--hairline) !important;
}
.dash-search { border-radius: 10px; border-color: var(--border); background: rgba(255, 255, 255, .8); }
.org-avatar { background: linear-gradient(135deg, var(--primary), color-mix(in oklab, var(--primary) 60%, #0ea5e9)) !important; }
.user-menu-dropdown, .org-switch-menu, .nav-dropdown-menu {
  border-radius: 14px !important; border: 1px solid var(--hairline) !important; box-shadow: var(--shadow-lg) !important;
  animation: theme-pop .18s var(--ease-out) both;
}
.dash-h1 { font-size: 1.7rem; }
.dash-sub { color: var(--muted-foreground); }
.dash-readonly-note { border: 1px solid var(--hairline); background: var(--card) !important; box-shadow: var(--shadow-sm); }
.status-live { font-family: var(--font-mono); }

/* Tabs used across the dashboard. */
.as-tabs a, .tab-btn, .scan-tab, .settings-tab { border-radius: 9px; transition: background-color .18s ease, color .18s ease, box-shadow .2s ease; }
.as-tabs a.on, .tab-btn.active, .scan-tab.active, .settings-tab.active { box-shadow: var(--shadow-sm), inset 0 0 0 1px var(--hairline); }

/* Modals. */
.modal { border-radius: 18px !important; border: 1px solid var(--hairline); box-shadow: 0 30px 80px -24px rgba(15, 23, 42, .45) !important; animation: theme-pop .22s var(--ease-out) both; }

/* ---- Public site ------------------------------------------------------------- */
.site-header { transition: background-color .25s ease, box-shadow .25s ease, border-color .25s ease; }
.site-header:not(.site-header--overlay) {
  background: rgba(246, 248, 251, .75) !important;
  backdrop-filter: saturate(180%) blur(16px); -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--hairline);
}
.nav-link { font-weight: 500; color: var(--ink-soft); }
.nav-link:hover { color: var(--foreground); }

/* Home hero: deep navy with one accent light, not a purple-blue wash. */
.hx {
  background:
    radial-gradient(900px 520px at 12% -12%, color-mix(in oklab, var(--primary) 38%, transparent), transparent 62%),
    radial-gradient(700px 480px at 100% 10%, rgba(14, 165, 233, .14), transparent 60%),
    linear-gradient(180deg, #070b15 0%, var(--night) 55%, #0b1222 100%) !important;
}
.hx h1 .grad {
  background: linear-gradient(100deg, #ffffff 0%, color-mix(in oklab, var(--primary) 45%, white) 60%, #7dd3fc 100%) !important;
  -webkit-background-clip: text !important; background-clip: text !important;
}
.hx-cta .btn-primary { background: var(--primary) !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .2), 0 14px 34px -12px color-mix(in oklab, var(--primary) 70%, transparent) !important; }
.glass {
  background: linear-gradient(180deg, rgba(20, 28, 50, .82), rgba(12, 18, 36, .9)) !important;
  border-color: var(--night-line) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 30px 70px -30px rgba(0, 0, 0, .7) !important;
}
.metrics { background: radial-gradient(800px 300px at 20% 0%, color-mix(in oklab, var(--primary) 55%, transparent), transparent 70%), linear-gradient(180deg, var(--night-2), var(--night)) !important; }
.flow { background: transparent !important; }
.ind2-card .glow { background: radial-gradient(circle, color-mix(in oklab, var(--primary) 45%, transparent), transparent 70%) !important; }
.hero-blob-b { background: radial-gradient(circle, #0ea5e9, transparent 70%) !important; }

/* Marketing type. */
.mk-h1 { font-size: clamp(2.2rem, 4.4vw, 3.6rem); line-height: 1.05; }
.mk-lead { color: var(--muted-foreground); max-width: 62ch; }
.mk-code { background: var(--night) !important; border: 1px solid var(--night-line); border-radius: 14px !important; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04); }

/* Auth pages. */
.auth-card { box-shadow: var(--shadow-lg); }

/* ---- Motion ------------------------------------------------------------------ */
@keyframes theme-pop { from { opacity: 0; transform: translateY(-4px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes theme-fade-up { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
/* Sections on the public site rise into view as they are reached (theme.js adds .is-in). */
.theme-reveal { opacity: 0; transform: translateY(18px); transition: opacity .7s var(--ease-out), transform .7s var(--ease-out); }
.theme-reveal.is-in { opacity: 1; transform: none; }

/* A barely-there grain over everything, so flat colour reads as material. */
body::after {
  content: ''; position: fixed; inset: 0; pointer-events: none; z-index: 2147480000; opacity: .028;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

@media (prefers-reduced-motion: reduce) {
  .theme-reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
  .d-card::before, .mk-card::before, .stat-card::before, .feature-card::before { display: none; }
  .user-menu-dropdown, .org-switch-menu, .nav-dropdown-menu, .modal { animation: none !important; }
}
@media print {
  body { background: #fff !important; }
  body::after { display: none; }
}

/* Phone width: the setup card's next-step button drops under its step
   instead of being squeezed (it clipped to "erify ownership"). */
@media (max-width: 560px) {
  .setup-step { flex-wrap: wrap; }
  .setup-step .go { margin-left: 38px; white-space: nowrap; }
}

/* ---- Accessibility: text contrast (WCAG AA, 4.5:1) ------------------------------
   Muted text from the shared stylesheets that fell short on light surfaces.
   Dashboard inline colours are raised in dash-colors.css (generated). */
.docs-nav-title, .docs-dim, .usage-meta, .bl-filter span, .bl-card-meta, .bl-nav span, .bl-credit,
.cm-side-title, .cm-thread-sub, .cm-thread-stats, .cm-post-time, .lg-toc-title,
.ar-nav-title, .ar-table thead th, .ar-type, .ar-req, .ar-label { color: #5d708c; }
.bl-filter.active span { color: #fff; }
.faq-answer p, .docs-nav-cta p, .docs-cta p, .mk-card p, .mk-list li { color: #56657a; }
.d-banner p { color: #1d4ed8; }
.sec-eyebrow { color: #4f46e5; }
.bento-delta.is-up { color: #047857; }
.bento-delta.is-down { color: #c81e1e; }
/* .docs-nav a outranked .btn-primary: the docs sidebar's call to action had
   slate text on blue (1.5:1), and went pale grey on hover. */
.docs-nav a.btn-primary, .docs-nav a.btn-primary:hover { color: #fff; border-left: 0; }
.docs-nav a.btn-primary:hover { background: color-mix(in oklab, var(--primary) 90%, white); }

/* Keyboard users can jump past the navigation; the link shows only when focused. */
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 10000; padding: 10px 16px; border-radius: 10px;
  background: var(--primary); color: #fff !important; font-weight: 600; text-decoration: none; box-shadow: var(--shadow-lg); transition: top .15s ease; }
.skip-link:focus, .skip-link:focus-visible { top: 12px; outline: 2px solid #fff; outline-offset: 2px; }
#content:focus { outline: none; }

/* Inline form validation (signup-validate.js): a message only when there is one,
   a quiet tick of colour on a field that is right. */
.field-error:empty, .field-error[hidden] { display: none; }
.field-error { color: #c81e1e; }
.form-group input.is-valid, .form-group select.is-valid { border-color: #16a34a; }
/* On a phone, two fields side by side leave neither room ("Select your…"). */
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* Appearance switch in the user menu (System / Light / Dark). */
.theme-switch { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 12px; font-size: .8rem; color: var(--muted-foreground); }
.theme-switch > div { display: inline-flex; padding: 2px; border-radius: 8px; background: var(--muted); }
.theme-switch button { border: 0; background: transparent; color: var(--ink-soft); font: inherit; font-size: .76rem; font-weight: 550; padding: 4px 8px; border-radius: 6px; cursor: pointer; }
.theme-switch button[aria-pressed="true"] { background: var(--card); color: var(--foreground); box-shadow: var(--shadow-sm); }

/* ---- Dark mode (dashboard only: System, Light or Dark, chosen in the user menu) --
   The public site keeps its own look. Inline colours on dashboard pages are
   handled by dash-colors.css (generated by tools/gen-dash-colors.py). */
/* Dark rules key off html.theme-dark, set before first paint by the inline
   script in includes/dashboard.php from the viewer's choice (System follows
   the OS, live). Without JavaScript the dashboard stays light. */
html.theme-dark { color-scheme: dark; }
html.theme-switching *, html.theme-switching *::before, html.theme-switching *::after { transition: none !important; }
  html.theme-dark {
    --background: #0b1020;
    --foreground: #e6eaf3;
    --card: #121a2e;
    --muted: #1a2338;
    --muted-foreground: #95a0b8;
    --border: #26314a;
    --hairline: rgba(148, 163, 214, .14);
    --ink-soft: #c3cbdc;
    --accent-soft: color-mix(in oklab, var(--primary) 18%, #121a2e);
    --accent-line: color-mix(in oklab, var(--primary) 45%, #121a2e);
    --accent-glow: color-mix(in oklab, var(--primary) 35%, transparent);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-md: 0 1px 2px rgba(0, 0, 0, .3), 0 10px 28px -14px rgba(0, 0, 0, .6);
    --shadow-lg: 0 2px 4px rgba(0, 0, 0, .3), 0 26px 50px -20px rgba(0, 0, 0, .7);
    background: var(--background);
  }
  html.theme-dark body {
    background-color: var(--background);
    background-image: radial-gradient(rgba(148, 163, 214, .06) 1px, transparent 1px);
    color: var(--foreground);
  }
  html.theme-dark body::after { display: none; }
  html.theme-dark .dash-sidebar { background: rgba(15, 21, 38, .86); }
  html.theme-dark .dash-header { background: rgba(11, 16, 32, .72) !important; }
  html.theme-dark .dash-search { background: rgba(18, 26, 46, .8); color: var(--foreground); }
  html.theme-dark .nav-item.active { color: color-mix(in oklab, var(--primary) 55%, white) !important; }
  html.theme-dark .dash-body h1, html.theme-dark .dash-body h2, html.theme-dark .dash-body h3, html.theme-dark .dash-body h4, html.theme-dark .dash-h1 { color: var(--foreground); }
  html.theme-dark .dash-body .d-card, html.theme-dark .dash-body .card, html.theme-dark .dash-body .stat-card:not(.bento-lead):not(.bento-dark), html.theme-dark .dash-body .bento-tile:not(.bento-lead):not(.bento-dark), html.theme-dark .dash-body .d-table-wrap, html.theme-dark .user-menu-dropdown, html.theme-dark .org-switch-menu, html.theme-dark .nav-dropdown-menu, html.theme-dark .modal-content, html.theme-dark .modal, html.theme-dark .dialog, html.theme-dark .cm-thread {
    background-color: var(--card) !important; color: var(--foreground);
  }
  html.theme-dark .dash-body table td { border-color: var(--border); }
  html.theme-dark .d-table tbody tr:hover, html.theme-dark table.pf tbody tr:hover, html.theme-dark table.cp tr:hover { background: color-mix(in oklab, var(--primary) 8%, var(--card)) !important; }
  html.theme-dark input[type="text"], html.theme-dark input[type="email"], html.theme-dark input[type="password"], html.theme-dark input[type="number"], html.theme-dark input[type="search"], html.theme-dark input[type="url"], html.theme-dark input[type="tel"], html.theme-dark input[type="date"], html.theme-dark select, html.theme-dark textarea {
    background-color: #0e1528 !important; color: var(--foreground) !important; border-color: var(--border) !important;
  }
  html.theme-dark input:hover:not(:disabled):not([type="checkbox"]):not([type="radio"]) { border-color: #3a4766; }
  html.theme-dark .btn-outline, html.theme-dark .btn-secondary, html.theme-dark .btn-ghost { color: var(--foreground); }
  html.theme-dark .dash-body code, html.theme-dark .dash-body pre { background-color: #0e1528; color: #c9d4ec; }
  html.theme-dark .dash-body [style*="color:var(--primary)"], html.theme-dark .dash-body [style*="color: var(--primary)"] { color: color-mix(in oklab, var(--primary) 50%, white) !important; }
  html.theme-dark .dash-body a:not(.btn):not(.nav-item), html.theme-dark .dash-body .plan-more, html.theme-dark .dash-body .locked-plan-price { color: color-mix(in oklab, var(--primary) 50%, white); }
  html.theme-dark /* Components shared with the public site (main.css), html.theme-dark dark on the dashboard only. */
  .dash-body .d-banner p { color: color-mix(in oklab, var(--primary) 35%, white); }
  html.theme-dark .dash-body .usage-meta, html.theme-dark .dash-body .docs-nav-title, html.theme-dark .dash-body .docs-dim { color: var(--muted-foreground); }
  html.theme-dark .dash-body .form-error { color: #fca5a5; background: rgba(220, 38, 38, .14); }
  html.theme-dark .dash-body .form-success { color: #86efac; background: rgba(22, 163, 74, .14); }
  html.theme-dark .dash-body .form-warning { color: #fcd34d; background: rgba(217, 119, 6, .14); }
  html.theme-dark .dash-body .form-info { color: #93c5fd; background: rgba(37, 99, 235, .14); }
  html.theme-dark .dash-body .bento-delta.is-up { color: #34d399; }
  html.theme-dark .dash-body .bento-delta.is-down { color: #f87171; }
  html.theme-dark .dash-body .faq-answer p, html.theme-dark .dash-body .docs-nav-cta p, html.theme-dark .dash-body .docs-cta p, html.theme-dark .dash-body .docs-dim, html.theme-dark .dash-body .docs-nav-title { color: var(--muted-foreground); }
  html.theme-dark .dash-body .docs-body p, html.theme-dark .dash-body .docs-list, html.theme-dark .dash-body .docs-table td, html.theme-dark .dash-body .docs-table th, html.theme-dark .dash-body .docs-nav a, html.theme-dark .dash-body .mk-card p, html.theme-dark .dash-body .mk-list li { color: var(--ink-soft); }
  html.theme-dark .dash-body .docs-nav a:hover { background: var(--muted); color: var(--foreground); }
  html.theme-dark .dash-body .docs-note, html.theme-dark .dash-body .docs-cta, html.theme-dark .dash-body .docs-nav-cta, html.theme-dark .dash-body .docs-table th, html.theme-dark .dash-body .mk-tag { background: var(--muted); border-color: var(--border); }
  html.theme-dark .dash-body .docs-table-wrap { border-color: var(--border); }
  html.theme-dark .dash-body .docs-table td { border-bottom-color: var(--border); }
  html.theme-dark .dash-body .docs-body code { background: #0e1528; }

/* ---- Dark mode on the public site ----------------------------------------------
   The page colours come from colors.css; these are the pieces drawn with tokens
   or translucent white that need their own dark value. */
html.theme-dark .site-footer { background: #070b16; }
html.theme-dark .site-header:not(.site-header--overlay), html.theme-dark .site-header.scrolled { background: rgba(11, 16, 32, .78) !important; border-bottom-color: var(--hairline) !important; }
html.theme-dark .site-header .nav-link, html.theme-dark .site-header .nav-dropdown-trigger { color: var(--ink-soft); }
html.theme-dark .site-header .nav-link:hover, html.theme-dark .site-header .nav-dropdown-trigger:hover { color: var(--foreground); }
html.theme-dark .theme-switch > div { background: rgba(148, 163, 214, .12); }
/* Text the light-mode AA rules above darkened, and accent-coloured text, read
   on dark here as they do on the dashboard. */
html.theme-dark .docs-nav-title, html.theme-dark .docs-dim, html.theme-dark .usage-meta, html.theme-dark .bl-filter span,
html.theme-dark .bl-card-meta, html.theme-dark .bl-nav span, html.theme-dark .bl-credit, html.theme-dark .cm-side-title,
html.theme-dark .cm-thread-sub, html.theme-dark .cm-thread-stats, html.theme-dark .cm-post-time, html.theme-dark .lg-toc-title,
html.theme-dark .ar-nav-title, html.theme-dark .ar-baseurl span, html.theme-dark .ar-table thead th, html.theme-dark .ar-type,
html.theme-dark .ar-req, html.theme-dark .ar-label { color: var(--muted-foreground); }
html.theme-dark .faq-answer p, html.theme-dark .docs-nav-cta p, html.theme-dark .docs-cta p, html.theme-dark .mk-card p,
html.theme-dark .mk-list li, html.theme-dark .docs-body p, html.theme-dark .docs-list, html.theme-dark .docs-table td { color: var(--ink-soft); }
html.theme-dark .sec-eyebrow { color: color-mix(in oklab, var(--primary) 45%, white); }
/* Text links inside running copy only — not buttons, logos or cards that are links. */
html.theme-dark :is(p, li, td, dd, label, small, .field-hint, .auth-alt, .auth-links) > a:not([class*="btn"]):not([class*="cta"]),
html.theme-dark .plan-more, html.theme-dark .link-cta { color: color-mix(in oklab, var(--primary) 50%, white); }
html.theme-dark [style*="color:var(--primary)"], html.theme-dark [style*="color: var(--primary)"] { color: color-mix(in oklab, var(--primary) 50%, white) !important; }
html.theme-dark .bento-delta.is-up { color: #34d399; }
html.theme-dark .bento-delta.is-down { color: #f87171; }
html.theme-dark .form-error { color: #fca5a5; background: rgba(220, 38, 38, .14); }
html.theme-dark .form-success { color: #86efac; background: rgba(22, 163, 74, .14); }
html.theme-dark .form-warning { color: #fcd34d; background: rgba(217, 119, 6, .14); }
html.theme-dark .form-info { color: #93c5fd; background: rgba(37, 99, 235, .14); }
/* Tints mixed with white (not literal colours, so colors.css cannot see them). */
html.theme-dark .plans-mark { background: color-mix(in oklch, var(--primary) 22%, var(--card)); }
html.theme-dark .plan-toggle-light .plan-toggle-badge { background: color-mix(in oklch, var(--primary) 26%, var(--card)); color: var(--foreground); }
html.theme-dark .plan-tick { background: color-mix(in oklch, var(--primary) 20%, var(--card)); }
html.theme-dark .bl-filter.active span { color: #fff; }
/* Outline buttons in dark panels stay see-through (the redesign gave every
   outline button a card-white fill, which put white text on white). */
.mk-card.dark .btn-outline, .mk-section.dark .btn-outline, .sec-dark .btn-outline, .hx .btn-outline { background: transparent; }
/* The appearance switch sits on the dark footer in both modes. */
.site-footer .theme-switch { color: #9aa5bd; padding: 0; }
.site-footer .theme-switch > div { background: rgba(255, 255, 255, .08); }
.site-footer .theme-switch button { color: #c3cbdc; }
.site-footer .theme-switch button[aria-pressed="true"] { background: rgba(255, 255, 255, .16); color: #fff; box-shadow: none; }
