/* Gateway — Monochrome dual-theme (light default, dark on toggle)
 *
 * The canonical token set (all :root + [data-theme="dark"] variables)
 * lives in tokens.css. Every call site that loaded gateway.css
 * directly continues to work because of the @import below — loading
 * gateway.css still pulls in the tokens. New call sites that only need
 * the token definitions (e.g. a standalone widget) can link tokens.css
 * alone.
 *
 * ORDER MATTERS: @import must be the first rule (CSS spec) apart from
 * @charset. @font-face therefore comes *after* @import even though it's
 * logically an asset declaration. */
@import url("/_gateway_static/tokens.css");

/* Self-hosted Inter variable — subset to basic Latin + symbols/arrows/box.
   Full file (352 KB) lives at /_gateway_static/fonts/full/ for fallback.
   Swap display avoids invisible text during the tiny load window. */
@font-face {
  font-family: "Inter";
  src: url("/_gateway_static/fonts/Inter-Variable-subset.woff2") format("woff2-variations"),
       url("/_gateway_static/fonts/Inter-Variable-subset.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

html { color-scheme: light dark; }



* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  /* Body face is now editorial serif (Source Serif 4) site-wide. Nav
     chrome, logo, buttons, and dashboard data tables override back to
     --font-ui (Inter) via component selectors. */
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  /* 100vh crops when iOS Safari's URL bar retracts; 100dvh is the
     stable dynamic viewport. Keep both so older browsers that don't
     know dvh fall back to vh. See BROWSER_COMPAT.md §5. */
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.5;
}

::selection {
  background: var(--bg-overlay);
  color: var(--text-primary);
}

a { color: var(--text-secondary); text-decoration: none; transition: color 0.15s ease; }
a:hover { color: var(--text-primary); text-decoration: none; }
/* a.landing-primary-cta override moved to pages/landing.css 2026-05-14 */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: var(--radius-full); }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ── Header ─────────────────────────────────────────────────────── */

.gw-header {
  background: var(--bg-overlay);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 50;
}

.gw-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.03em;
}

.gw-brand-logo {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  background: var(--cta-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cta-text);
  font-weight: 700;
  font-size: var(--text-base);
}

.gw-nav {
  display: flex;
  align-items: center;
  gap: 24px;
}

.gw-nav a {
  color: var(--text-secondary);
  font-weight: 500;
  font-size: var(--text-base);
}

.gw-nav a.active { color: var(--text-primary); }

.gw-user-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: var(--radius-xl);
  background: var(--surface-hover);
  border: 1px solid var(--border);
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Layout ─────────────────────────────────────────────────────── */

.gw-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
}

.gw-page-title {
  font-size: var(--text-3xl);
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.gw-page-sub {
  color: var(--text-secondary);
  font-size: 15px;
  margin-bottom: 40px;
}

/* ── Auth card (login / signup) ─────────────────────────────────── */

.auth-wrap {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
}

.auth-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  width: 100%;
  max-width: 420px;
}

.auth-logo {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-lg);
  background: var(--cta-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--cta-text);
  font-weight: 700;
  font-size: 22px;
  margin-bottom: 24px;
}

.auth-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin-bottom: 8px;
}

.auth-sub {
  color: var(--text-secondary);
  font-size: var(--text-base);
  margin-bottom: 32px;
}

.auth-form label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
  margin-top: 16px;
}

.auth-form input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-base);
  background: var(--surface);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.auth-form input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.auth-form input:focus-visible {
  outline: 2px solid var(--ring, var(--text-primary));
  outline-offset: 2px;
}

.auth-submit {
  width: 100%;
  margin-top: 24px;
  padding: 12px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--cta-bg);
  color: var(--cta-text);
  font-family: inherit;
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.2s;
}

.auth-submit:hover {
  transform: translateY(-1px);
}

.auth-error {
  margin-top: 16px;
  padding: 10px 14px;
  background: var(--red-bg);
  color: var(--red);
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
}

.auth-footer {
  margin-top: 24px;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--text-secondary);
}

/* ── Dashboard cards grid ───────────────────────────────────────── */

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-6, 24px);
  width: 100%;
  max-width: none;
  padding: var(--space-8, 32px) var(--space-6, 24px);
}
@media (min-width: 720px) {
  .dash-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}
@media (min-width: 1100px) {
  .dash-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Whole card is a click target; the foot just shows the open affordance.
   Anchor reset undoes default link styling so the inside reads as a
   regular card, not a row of blue underlined text. */
.dash-card {
  display: flex;
  flex-direction: column;
  background: var(--surface);
  /* Bumped from --border (= --border-default #cccccc) to --border-strong
     (#b0b0b0 light / #383838 dark) so cards have a clearly visible
     edge instead of fading into the page. */
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  padding: var(--space-6, 24px);
  transition: transform 0.15s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
}

.dash-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent);
  opacity: 0.85;
}

.dash-card:hover,
.dash-card:focus-visible {
  transform: translateY(-2px);
  border-color: var(--border-strong, var(--text-tertiary));
  text-decoration: none;
}

.dash-card:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dash-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.dash-accent-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.badge {
  font-size: 10px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-active {
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
}

.badge-locked {
  background: transparent;
  color: var(--text-tertiary);
  border: 1px solid var(--border);
}

.dash-card-title {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin: 0 0 6px;
}

.dash-card-desc {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 14px;
  min-height: 38px;
}

.dash-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  font-size: 12px;
}

.dash-card-price {
  color: var(--text-tertiary);
  font-variant-numeric: tabular-nums;
}

.dash-card-action {
  font-weight: 600;
  color: var(--text-primary);
  letter-spacing: -0.005em;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: gap 0.15s ease;
}

/* ── Unified empty-state row ───────────────────────────────────────
 * Single utility for the dozen-plus places that say "No X yet" in
 * lists / tables / admin panels. Replaces inline
 *   style="text-align:center;padding:24px;color:var(--text-tertiary);font-size:var(--text-sm)"
 * blocks scattered across admin.html, predictions.html, saved.html,
 * signal-search.html, etc. Two flavors:
 *   .empty-state-row  — dense, fits inside a card / list (24 px
 *                       padding, 13 px text)
 *   .empty-state      — full-bleed, illustrated, used on standalone
 *                       pages (already declared elsewhere with the
 *                       icon glyph + title/body)
 * Both share the same monochrome treatment so the voice feels one.
 */
.empty-state-row {
  text-align: center;
  padding: 24px 16px;
  color: var(--text-tertiary, var(--text-muted));
  font-size: var(--text-sm);
  line-height: 1.5;
}
.empty-state-row__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 4px;
}
.empty-state-row__body {
  font-size: var(--text-sm);
  margin: 0;
}
.empty-state-row__cta {
  margin-top: 14px;
  display: inline-block;
}

.dash-card:hover .dash-card-action {
  gap: 6px;
}

.dash-card--locked {
  background: var(--bg-base);
}

.dash-card--locked .dash-card-action {
  color: var(--text-secondary);
}

.dash-card--locked:hover .dash-card-action {
  color: var(--text-primary);
}

/* ── Billing rows ───────────────────────────────────────────────── */

.billing-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.billing-row {
  display: grid;
  grid-template-columns: 1fr 100px auto;
  gap: 16px;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
  transition: background 0.15s;
}

.billing-row:last-child { border-bottom: none; }
.billing-row:hover { background: var(--surface-hover); }

.billing-row-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.billing-row-accent {
  width: 4px;
  height: 40px;
  border-radius: 2px;
  flex-shrink: 0;
}

.billing-row-title {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
}

.billing-row-desc {
  font-size: 12px;
  color: var(--text-secondary);
}

.billing-row-status {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
}

.billing-row-actions form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn {
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform 0.1s, box-shadow 0.2s, background 0.15s;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: var(--cta-text);
}

.btn-primary-outline {
  background: transparent;
  color: var(--accent);
  border-color: var(--accent);
}

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: var(--border);
}

.btn-danger:hover {
  background: var(--red-bg);
  border-color: var(--red);
}

/* ── Notice banner (placeholder billing) ────────────────────────── */

.notice {
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  margin-bottom: 24px;
  font-size: var(--text-sm);
  color: var(--accent);
  display: flex;
  align-items: center;
  gap: 10px;
}

.notice strong { font-weight: 600; }

/* Landing page styles (.landing-*, .enquire-cta, .client-login-link,
 * .mobile-menu-toggle, .mobile-close-btn) live in pages/landing.css —
 * extracted 2026-05-14 to keep the shared bundle lean for logged-in
 * users who never see /landing. */

/* ── Auth body (shared by login + signup) ───────────────────────── */

.auth-body {
  background:
    radial-gradient(900px 500px at 80% 20%, var(--bg-overlay), transparent 60%),
    radial-gradient(700px 400px at 10% 90%, var(--bg-overlay), transparent 60%),
    var(--bg);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: 'Inter', -apple-system, sans-serif;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-decoration: none !important;
  margin-bottom: 28px;
}

.auth-brand:hover { text-decoration: none; }

.auth-reassure {
  max-width: 420px;
  margin-top: 28px;
  font-size: var(--text-sm);
  color: var(--text-muted);
  text-align: center;
  line-height: 1.6;
}

.auth-reassure code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  background: var(--surface-hover);
  padding: 1px 6px;
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
}

.auth-wrap {
  flex-direction: column;
}

.auth-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ── Hub hero (dashboards page) ─────────────────────────────────── */

.hub-hero {
  margin-bottom: 32px;
}

.hub-hero-eyebrow {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 12px;
}

.gw-main-narrow {
  max-width: 760px;
}

/* ── Settings page ──────────────────────────────────────────────── */

.settings-card {
  background: var(--surface);
  border: 1px solid var(--border-strong, var(--border));
  border-radius: var(--radius);
  padding: 32px;
  margin-bottom: 32px;
}

.settings-section {
  margin-bottom: 24px;
}

.settings-section-title {
  font-size: 17px;
  font-weight: 600;
  margin-bottom: 6px;
}

.settings-section-desc {
  font-size: var(--text-base);
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 16px;
}

.settings-section-desc code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: var(--text-sm);
  background: var(--surface-hover);
  padding: 2px 6px;
  border-radius: var(--radius-xs);
}

.settings-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.settings-select {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: var(--text-base);
  background: var(--surface);
  color: var(--text-primary);
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.settings-select:focus-visible {
  outline: 2px solid var(--ring, var(--text-primary));
  outline-offset: 2px;
}

.settings-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.settings-actions .btn-primary {
  padding: 12px 24px;
  font-size: var(--text-base);
  background: var(--cta-bg);
  border: none;
}

.settings-hints {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.settings-hint {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
}

.settings-hint-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: 4px;
}

.settings-hint-body {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  line-height: 1.5;
}

.notice-success {
  background: var(--green-bg);
  border-color: var(--green);
  color: var(--green);
}

/* ════════════════════════════════════════════════════════════════
   SECONDARY SURFACES — shared components for /settings and /admin.
   Adopted by settings-side forms and admin-side tables so the
   secondary screens share the dashboard-grade polish.
   ════════════════════════════════════════════════════════════════ */

/* Label-left / input-right field row. Stacks on mobile. Each field
   should wrap its <label>/<input> pair in .field-row. */
.field-row {
  display: grid;
  grid-template-columns: minmax(160px, 200px) 1fr;
  gap: 24px;
  align-items: start;
  padding: 18px 0;
  /* Bumped from --border-ghost (#ebebeb) to --border-subtle (#e0e0e0)
     so the row separator is actually visible against the card bg. */
  border-top: 1px solid var(--border-subtle, var(--border-ghost));
}
.field-row:first-child { border-top: 0; padding-top: 0; }
.field-row .field-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--text-primary);
  padding-top: 10px;
}
.field-row .field-helper {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-top: 4px;
  line-height: 1.45;
}
.field-row .field-control { min-width: 0; }
.field-row .field-control input[type="text"],
.field-row .field-control input[type="email"],
.field-row .field-control input[type="password"],
.field-row .field-control input[type="number"],
.field-row .field-control input[type="url"],
.field-row .field-control select,
.field-row .field-control textarea {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  font: inherit;
  font-size: var(--text-base);
  background: var(--bg-base);
  color: var(--text-primary);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.field-row .field-control input:focus,
.field-row .field-control select:focus,
.field-row .field-control textarea:focus {
  outline: none;
  border-color: var(--text-primary);
  box-shadow: 0 0 0 3px var(--interactive-ghost);
}
.field-row .field-control input:focus-visible,
.field-row .field-control select:focus-visible,
.field-row .field-control textarea:focus-visible {
  outline: 2px solid var(--ring, var(--text-primary));
  outline-offset: 2px;
}
.field-row .field-control textarea { min-height: 80px; resize: vertical; }

@media (max-width: 720px) {
  .field-row { grid-template-columns: 1fr; gap: 6px; }
  .field-row .field-label { padding-top: 0; }
}

/* Destructive action group — visually separated from normal settings
   so users have to reach for it. Still monochrome, but with a stronger
   divider and a red-accent button. */
.settings-danger {
  margin-top: 40px;
  padding-top: 24px;
  border-top: 2px solid var(--border-default);
}
.settings-danger .settings-section-title { color: var(--text-primary); }
.settings-danger .btn-danger,
.btn-danger {
  background: var(--bg-base);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.12s, background 0.12s;
}
.btn-danger:hover {
  border-color: var(--text-primary);
  background: var(--interactive-ghost);
}
.btn-danger:active { background: var(--interactive-ghost-hover); }

/* Sticky save bar — appears at the bottom of long settings forms. */
.save-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-base);
  border-top: 1px solid var(--border-default);
  padding: 14px 0;
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  z-index: 2;
}
.save-bar .save-bar-status {
  margin-right: auto;
  align-self: center;
  font-size: 12px;
  color: var(--text-tertiary);
}

/* ── Admin-side utilities ──────────────────────────────────────── */

/* Admin table — dense, mono-numeric, with consistent row actions.
   Usage:
     <div class="admin-card">
       <table class="admin-table"><thead>…</thead><tbody>…</tbody></table>
     </div> */
.admin-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-strong, var(--border-default));
  border-radius: var(--radius-sm);
  overflow: hidden;
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.admin-table th,
.admin-table td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border-ghost);
  vertical-align: middle;
}
.admin-table thead th {
  background: var(--bg-raised);
  font-weight: 500;
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  border-bottom: 1px solid var(--border-subtle);
}
.admin-table tbody tr:hover { background: var(--bg-raised); }
.admin-table tbody tr:last-child td { border-bottom: 0; }
.admin-table td.num,
.admin-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}
.admin-table td.actions,
.admin-table th.actions { text-align: right; white-space: nowrap; width: 1%; }
.admin-table .empty-cell {
  text-align: center;
  padding: 32px;
  color: var(--text-tertiary);
  font-size: var(--text-sm);
}

/* Filter bar — same height + layout across every admin page. */
.admin-filter-bar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 16px;
  padding: 10px 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
}
.admin-filter-bar input[type="search"],
.admin-filter-bar input[type="text"],
.admin-filter-bar select {
  padding: 7px 10px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  background: var(--bg-base);
  color: var(--text-primary);
  font: inherit;
  font-size: var(--text-sm);
}
.admin-filter-bar input[type="search"] { flex: 1 1 240px; min-width: 180px; }
.admin-filter-bar .filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  font-size: 12px;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
}
.admin-filter-bar .filter-chip:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}
.admin-filter-bar .filter-chip.active {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--interactive-ghost);
}
.admin-filter-bar .filter-spacer { flex: 1; }

/* Copyable identifier — click to copy to clipboard. Pairs with a
   tiny snippet of JS below (admin.html and others wire it up). */
.copyable-id {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  padding: 2px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.12s, color 0.12s;
  user-select: none;
}
.copyable-id:hover {
  border-color: var(--border-default);
  color: var(--text-primary);
}
.copyable-id.copied {
  border-color: var(--text-primary);
  color: var(--text-primary);
  background: var(--interactive-ghost);
}

/* Admin section header + subheader — shared with status + users pages. */
.admin-section {
  margin-bottom: 32px;
}
.admin-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}
.admin-section-head h2 {
  font-size: var(--text-base);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-secondary);
  margin: 0;
}
.admin-section-head .admin-section-count {
  font-size: 12px;
  color: var(--text-tertiary);
}

/* Stat tile — used on admin home + metrics pages. Monochrome KPI. */
.stat-tile {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  padding: 16px 18px;
}
.stat-tile .stat-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}
.stat-tile .stat-value {
  font-size: var(--text-2xl);
  font-weight: 600;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
}
.stat-tile .stat-trend {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: 4px;
}
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

/* Landing-only nav + CTA (.enquire-cta, .client-login-link,
 * .mobile-menu-toggle, .landing-nav-mobile-*, .mobile-close-btn) moved
 * to pages/landing.css 2026-05-14. */

/* ── Smooth theme transitions ───────────────────────────────────── */

body,
body * {
  transition:
    background-color 0.18s ease,
    border-color 0.18s ease,
    color 0.12s ease,
    box-shadow 0.18s ease;
}

/* Suppress transition where it causes jank or visual glitches */
input, textarea, select,
code, pre, canvas, img, svg,
[data-no-transition] { transition: none !important; }

/* Suppress all transitions during page load to prevent flash */
html.theme-loading * { transition: none !important; }

/* ── Theme toggle button ────────────────────────────────────────── */

/* Subtle corner toggle — intentionally understated. Low opacity until
 * the cursor is near it, so it never competes with page content. */
#theme-toggle {
  position: fixed;
  bottom: 18px;
  left: 14px;
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  padding: 0;
  cursor: pointer;
  color: var(--text-tertiary);
  opacity: 0.35;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: opacity 0.2s ease, border-color 0.18s ease, color 0.18s ease, transform 0.1s ease;
}

#theme-toggle:hover {
  opacity: 1;
  border-color: var(--border-default);
  color: var(--text-secondary);
}

#theme-toggle:active { transform: scale(0.94); }

#theme-toggle:focus-visible {
  opacity: 1;
  outline: 1px solid var(--text-tertiary);
  outline-offset: 2px;
}

#theme-toggle-icon {
  width: 13px;
  height: 13px;
  pointer-events: none;
}

@media (max-width: 640px) {
  #theme-toggle {
    bottom: 12px;
    left: 10px;
  }
}

@media print {
  #theme-toggle { display: none !important; }
}

/* ── Semantic utility classes ───────────────────────────────────── */

/* Credibility scores */
.cred-high    { color: var(--semantic-high); }
.cred-mid     { color: var(--semantic-mid); }
.cred-low     { color: var(--semantic-low); }
.cred-unrated { color: var(--semantic-none); font-style: italic; }

/* EV scores */
.ev-positive { color: var(--semantic-high); font-weight: 600; }
.ev-negative { color: var(--semantic-low); font-weight: 400; }
.ev-neutral  { color: var(--semantic-mid); }

/* Risk badges */
.risk-flagged {
  color: var(--semantic-low);
  background: var(--semantic-low-bg);
  border: 1px solid var(--semantic-low-border);
}
.risk-clean {
  color: var(--semantic-high);
  background: var(--semantic-high-bg);
  border: 1px solid var(--semantic-high-border);
}

/* Status badges */
.status-active {
  color: var(--semantic-high);
  background: var(--semantic-high-bg);
  border: 1px solid var(--semantic-high-border);
}
.status-inactive {
  color: var(--semantic-none);
  background: var(--semantic-none-bg);
  border: 1px solid var(--semantic-none-border);
}
.status-warning {
  color: var(--semantic-mid);
  background: var(--semantic-mid-bg);
  border: 1px solid var(--semantic-mid-border);
}

/* Error states */
.error-text { color: var(--error-text); }
.error-banner {
  color: var(--error-text);
  background: var(--error-bg);
  border: 1px solid var(--error-border);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
}

/* Probability display */
.prob-market        { color: var(--text-tertiary); }
.prob-edge-positive { color: var(--semantic-high); }
.prob-edge-negative { color: var(--semantic-low); }
.prob-edge-neutral  { color: var(--text-tertiary); }

/* Tier badges */
.tier-trader     { color: var(--text-secondary); background: var(--bg-inset); border: 1px solid var(--border-default); }
.tier-pro        { color: var(--text-primary);   background: var(--bg-raised); border: 1px solid var(--border-strong); }
.tier-enterprise { color: var(--interactive-text); background: var(--interactive-bg); }

/* ── Responsive ─────────────────────────────────────────────────── */

@media (max-width: 720px) {
  .gw-header { padding: 14px 20px; }
  .gw-main { padding: 32px 20px; }
  .gw-page-title { font-size: 26px; }
  .billing-row {
    grid-template-columns: 1fr;
    gap: 12px;
  }
  .billing-row-actions form { flex-wrap: wrap; }
  .settings-hints { grid-template-columns: 1fr; }
  .gw-nav { gap: 14px; }
  .gw-nav .gw-user-pill { display: none; }
  /* Landing responsive overrides moved to pages/landing.css */
}


/* ══════════════════════════════════════════════════════════════════════
 * Accessibility (WCAG 2.1 AA) + mobile responsive — session append
 * ══════════════════════════════════════════════════════════════════════
 *
 * Appended as a single block so it's easy to diff. Sits at the end of the
 * file so its rules win the cascade over anything defined earlier.
 */

/* Skip-to-content link injected by render_page. Visible on focus only so
 * keyboard users can jump past the sidebar/nav, but doesn't clutter the
 * visual layout. */
.narve-skip-link {
  position: absolute;
  top: -44px;  /* hidden off-screen until focused */
  left: 12px;
  z-index: calc(var(--z-overlay) + 10);
  padding: 10px 16px;
  background: var(--accent, #fff);
  color: var(--bg, #0d0d0d);
  font-weight: 600;
  font-size: var(--text-sm);
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: top 0.15s ease-out;
}
.narve-skip-link:focus-visible {
  top: 12px;
  outline: 3px solid var(--accent, #fff);
  outline-offset: 2px;
}

/* Focus ring on any interactive element. Uses :focus-visible so the ring
 * appears for keyboard users but not for mouse clicks. */
*:focus-visible {
  outline: 2px solid var(--text-primary, #fff);
  outline-offset: 2px;
  border-radius: var(--radius-xs);
}
button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline-offset: 3px;
}

/* "Last updated X min ago (cached)" ribbon — rendered by
 * narve.cached.renderRibbon() when a response was served from the SW
 * cache. Muted so it reads as a subtitle, not an error. */
.narve-cached-ribbon {
  font-size: var(--text-xs);
  color: var(--text-tertiary, #9ca3af);
  margin: 0 0 8px;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
}

/* Offline banner — shown by narve-app.js when navigator.onLine goes false.
 * Monochrome per design system (no amber/red); muted surface + subtle
 * top border so it's legible without stealing attention. */
.narve-offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: calc(var(--z-overlay, 50) + 20);
  padding: 8px 16px;
  background: var(--bg-surface, #141414);
  color: var(--text-secondary, #aaa);
  border-bottom: 1px solid var(--border-default, #2a2a2a);
  font-size: 12px;
  text-align: center;
  font-family: var(--font-ui);
  letter-spacing: 0.01em;
}
@media (prefers-color-scheme: light) {
  .narve-offline-banner {
    background: var(--bg-surface);
    color: var(--text-primary);
    border-bottom-color: var(--border-default);
  }
}

/* Screen-reader-only text. Use on icon-only buttons that need a visible
 * label for AT users but no visible text for sighted users. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Respect reduced-motion preference. Kills every animation/transition for
 * users who asked for it in their OS settings. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Ensure tap targets hit WCAG's 44x44px minimum on touch devices.
 * Desktop users keep their smaller click targets. */
@media (hover: none) and (pointer: coarse) {
  button,
  .btn,
  .btn-primary,
  .btn-primary-outline,
  .btn-danger,
  a.admin-row,
  .admin-tab,
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 44px;
    min-width: 44px;
  }
  input[type="checkbox"],
  input[type="radio"] {
    min-height: 22px;
    min-width: 22px;
  }
}

/* Form inputs hit 16px minimum — below that, iOS Safari zooms the page on
 * focus. 16px on desktop is fine visually. */
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="search"],
input[type="url"],
input[type="tel"],
textarea,
select {
  font-size: max(16px, 1rem);
}

/* ── Mobile breakpoints ──────────────────────────────────────────────── */

@media (max-width: 768px) {
  /* Sidebar collapses — render_page-injected drawer toggle handles the
   * open/close logic; here we just make room for it. */
  .sidebar,
  .narve-sidebar {
    position: fixed;
    top: 0; bottom: 0; left: 0;
    width: 280px;
    transform: translateX(-100%);
    transition: transform 0.2s ease-out;
    z-index: var(--z-modal);
    background: var(--surface, #141414);
  }
  .sidebar.open,
  .narve-sidebar.open {
    transform: translateX(0);
  }
  .content-area,
  .main-content {
    margin-left: 0 !important;
    padding: 14px;
  }

  /* Tables with lots of columns become card-like on narrow screens. */
  table.mobile-cards,
  .feed-table.mobile-cards {
    display: block;
  }
  table.mobile-cards thead {
    display: none;
  }
  table.mobile-cards tbody tr {
    display: block;
    background: var(--surface, #141414);
    border: 1px solid var(--border, rgba(255,255,255,0.08));
    border-radius: var(--radius-md);
    padding: 12px 14px;
    margin-bottom: 10px;
  }
  table.mobile-cards tbody td {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 4px 0;
    border: 0;
  }
  table.mobile-cards tbody td::before {
    content: attr(data-label);
    opacity: 0.55;
    font-size: var(--text-xs);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  /* Detail panel becomes a full-screen overlay on mobile. */
  .detail-panel,
  .side-panel {
    position: fixed !important;
    inset: 0;
    width: 100% !important;
    z-index: var(--z-modal);
    border-radius: 0;
  }

  /* Tab nav scrolls horizontally instead of wrapping. */
  .admin-tabs,
  .narve-tabs {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    gap: 8px;
    padding-bottom: 6px;
  }
  .admin-tabs::-webkit-scrollbar,
  .narve-tabs::-webkit-scrollbar {
    display: none;
  }
  .admin-tab,
  .narve-tab {
    flex-shrink: 0;
  }
}

@media (max-width: 640px) {
  /* Hero + landing hero numbers stack, big decorative animations disabled.
   * .landing-hero rules moved to pages/landing.css 2026-05-14. */
  .prerelease-hero {
    text-align: center;
  }
  .prerelease-hero h1 {
    font-size: 34px !important;
    line-height: 1.15;
  }
  /* Floating decorative number animations are heavy on low-end phones. */
  .floating-number,
  .hero-anim-layer {
    display: none;
  }
}

@media (max-width: 375px) {
  /* iPhone SE + smallest Android widths. No horizontal scroll allowed. */
  body { overflow-x: hidden; }
  .wrap, .adm-wrap, .content-area {
    padding-left: 14px !important;
    padding-right: 14px !important;
  }
  .stat-grid {
    grid-template-columns: 1fr 1fr !important;
  }
  h1 { font-size: 26px !important; }
}

/* ── Intelligence chat: input pinned bottom on mobile ─────────────── */

@media (max-width: 768px) {
  .intelligence-chat-wrap {
    padding-bottom: 88px;
  }
  .intelligence-chat-input {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    padding: 10px 14px env(safe-area-inset-bottom, 10px);
    background: var(--bg, #0d0d0d);
    border-top: 1px solid var(--border, rgba(255,255,255,0.08));
    z-index: 50;
  }
  .intelligence-suggested-prompts {
    display: flex;
    overflow-x: auto;
    gap: 8px;
    scrollbar-width: none;
    padding-bottom: 6px;
  }
  .intelligence-suggested-prompts::-webkit-scrollbar {
    display: none;
  }
}

/* ── Form labels always visually associated with inputs ─────────────── */

label[for] { cursor: pointer; }
label[for] + input,
label[for] + select,
label[for] + textarea {
  margin-top: 4px;
}

/* ── Role="alert" + aria-live styling hooks (no visual — behaviour) ── */
[role="alert"], [aria-live="polite"], [aria-live="assertive"] {
  /* No forced visual styling. AT hooks only. */
}


/* ═══════════════════════════════════════════════════════════════════
   DASHBOARD CONSISTENCY LAYER
   ═══════════════════════════════════════════════════════════════════
   Baseline rules that every dashboard tab (feed, best-bets, markets,
   sources, intelligence, predictions, watchlist, portfolio) inherits
   unless the page explicitly overrides. Per-tab styles live inline in
   each template; this layer enforces the consistency checklist:
   - type scale, hover timing, focus ring, click state
   - tabular numerals for numeric values
   - ellipsis + line-clamp utilities for long strings
   - shared layout primitives (.app-shell, .sidebar, .main-content,
     .nav-item, .page-title, .content-area, .status-bar, .breadcrumb)
   =================================================================== */

:root {
  /* Shared tab geometry. Tabs reference these instead of hardcoding. */
  --dash-sidebar-w:      240px;
  --dash-detail-panel-w: 360px;
  --dash-status-bar-h:    28px;
  --dash-table-row-h:     44px;
  --dash-transition:     0.15s ease;
  --dash-transition-fast:0.12s ease;
}

/* ── App shell ──────────────────────────────────────────────────────── */
.app-shell {
  display: grid;
  grid-template-columns: var(--dash-sidebar-w) 1fr;
  grid-template-rows: 1fr var(--dash-status-bar-h);
  grid-template-areas: "sidebar main" "sidebar status";
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg-base);
  color: var(--text-primary);
}

/* ── Sidebar ────────────────────────────────────────────────────────── */
.sidebar {
  grid-area: sidebar;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-5) var(--space-3);
  background: var(--bg-surface);
  /* Bumped from --border-subtle (#e0e0e0) to --border-default (#cccccc)
     so the sidebar clearly separates from the main content area
     instead of melting into the page on light theme. */
  border-right: 1px solid var(--border-default, var(--border-subtle));
  min-height: 100vh;
  min-height: 100dvh;
  position: sticky;
  top: 0;
  transition: width 0.18s ease;
}
.sidebar-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-2) var(--space-4);
  border-bottom: 1px solid var(--border-ghost);
  margin-bottom: var(--space-2);
  position: relative;
}
.sidebar-logo-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  color: inherit;
  flex: 1;
  min-width: 0;
}
/* Logo image: source asset is a white square with a black brand mark.
   Per spec: stay white for the white theme (no filter — asset shows
   as-is, the white edges blend into the light surface and only the
   black brand mark reads), invert for the dark theme (white square
   flips to black + brand mark flips to white, again the chip blends
   into the dark surface and only the mark reads). The result is a
   theme-adaptive monogram with no visible "chip" rectangle in either
   mode. */
.sidebar-logo-img {
  width: 22px;
  height: 22px;
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  filter: var(--logo-filter, none);
}
[data-theme="dark"] .sidebar-logo-img {
  filter: var(--logo-filter, invert(1));
}

/* Generic brand-logo class — same chain as .sidebar-logo-img so the
   logo behaves identically in headers, auth flows, gate, landing,
   etc. */
.brand-logo {
  border-radius: var(--radius-xs);
  flex-shrink: 0;
  filter: var(--logo-filter, none);
}
[data-theme="dark"] .brand-logo {
  filter: var(--logo-filter, invert(1));
}
.sidebar-logo-text {
  font-weight: 600;
  font-size: var(--text-base);
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
/* Toggle button collapses the sidebar to icon-only mode. The chevron
   rotates 180° in collapsed state (CSS-only, no JS sync needed). */
.sidebar-toggle {
  background: transparent;
  border: 1px solid var(--border-ghost);
  color: var(--text-tertiary);
  border-radius: var(--radius-sm);
  width: 26px;
  height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  flex-shrink: 0;
}
/* Two SVG icons inside the toggle: hamburger (bars) when the sidebar
   is expanded, close (X) when collapsed. CSS swaps which is shown so
   we don't need any JS beyond the existing toggle handler. */
.sidebar-toggle__icon { display: none; }
.sidebar-toggle__icon--bars { display: inline; }
:root[data-sidebar="collapsed"] .sidebar-toggle__icon--bars { display: none; }
:root[data-sidebar="collapsed"] .sidebar-toggle__icon--close { display: inline; }
.sidebar-toggle:hover {
  background: var(--interactive-ghost);
  color: var(--text-primary);
  border-color: var(--border-default);
}
.sidebar-toggle:focus-visible {
  outline: 2px solid var(--accent, var(--text-primary));
  outline-offset: 2px;
}

/* ── Collapsed-sidebar mode ────────────────────────────────────────────
   When <html data-sidebar="collapsed">, the sidebar shrinks to icons
   only. Text labels disappear, but icons remain clickable and a tooltip
   (the <a title=…>) shows on hover. */
:root[data-sidebar="collapsed"] .app-shell {
  grid-template-columns: 56px 1fr;
}
:root[data-sidebar="collapsed"] .sidebar {
  padding: var(--space-5) 8px;
  align-items: stretch;
}
:root[data-sidebar="collapsed"] .sidebar-logo {
  padding: 0 0 var(--space-3);
  justify-content: center;
}
/* Hide the logo image + wordmark in collapsed mode — only the
   sandwich/close toggle remains, so the rail isn't trying to cram
   a misformed mini-logo into 56 px. */
:root[data-sidebar="collapsed"] .sidebar-logo-link {
  display: none;
}
:root[data-sidebar="collapsed"] .sidebar-logo-text,
:root[data-sidebar="collapsed"] .nav-item-label,
:root[data-sidebar="collapsed"] .nav-section-header,
:root[data-sidebar="collapsed"] .sidebar-user-name,
:root[data-sidebar="collapsed"] .sidebar-user-tier {
  display: none;
}
:root[data-sidebar="collapsed"] .nav-item {
  justify-content: center;
  padding: 10px 4px;
}
:root[data-sidebar="collapsed"] .sidebar-user {
  justify-content: center;
  padding: var(--space-3) 4px;
}
:root[data-sidebar="collapsed"] .sidebar-toggle {
  /* No rotate now — we swap the SVG icons via display, so the toggle
     button stays steady and just changes glyph. */
  margin: 0 auto;
}
:root[data-sidebar="collapsed"] #pinned-views,
:root[data-sidebar="collapsed"] #first-week-goals-mount {
  display: none !important;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}
.nav-section-header {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-tertiary);
  padding: var(--space-3) var(--space-2) var(--space-1);
}
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  color: var(--text-secondary);
  text-decoration: none;
  transition: background var(--dash-transition-fast), color var(--dash-transition-fast);
}
.nav-item:hover {
  background: var(--interactive-ghost);
  color: var(--text-primary);
}
.nav-item.active {
  background: var(--interactive-ghost-hover);
  color: var(--text-primary);
  font-weight: 500;
}
.nav-item-icon {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}
.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-2);
  border-top: 1px solid var(--border-ghost);
  margin-top: auto;
  color: var(--text-secondary);
  transition: background var(--dash-transition-fast);
  border-radius: var(--radius-sm);
}
.sidebar-user:hover { background: var(--interactive-ghost); color: var(--text-primary); }
.sidebar-user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--interactive-bg);
  color: var(--interactive-text);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--text-xs); font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user-name {
  font-size: var(--text-sm);
  font-weight: 500;
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user-tier {
  font-size: 10px;
  color: var(--text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* ── Main content ───────────────────────────────────────────────────── */
.main-content {
  grid-area: main;
  /* Original tight gutter — no inflated horizontal padding, no top
     border. Content sits flush with the rail divider; the framed
     .content-area inside provides its own visual structure. */
  padding: var(--space-4) var(--page-pad) var(--page-pad);
  max-width: 100%;
  overflow-x: hidden;
}
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}
.breadcrumb-item { color: inherit; }
.breadcrumb-item.current { color: var(--text-secondary); }
.breadcrumb-separator { color: var(--text-quaternary); }
.page-header {
  margin-bottom: var(--space-5);
  padding-bottom: var(--space-4);
  /* Bumped to --border-default so the title block clearly separates
     from the page body — the previous --border-ghost was effectively
     invisible on a near-white surface. */
  border-bottom: 1px solid var(--border-default, var(--border-ghost));
}
.page-title {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin: 0 0 var(--space-2);
}
.page-subtitle {
  font-size: var(--text-base);
  color: var(--text-secondary);
  margin: 0;
  max-width: 640px;
  line-height: 1.6;
}
/* Page-level content frame. Every page that uses the canonical
   .content-area now has a visibly bordered viewport instead of
   sections floating loose against the page bg. The .settings-card /
   .admin-card / .dash-card children inside still have their own
   borders — that's the intended nested-card look (rail → page frame
   → individual cards).

   Same treatment is also applied to .ss-container (signal-search),
   .admin-body's direct content wrapper, and any other page-content
   shell — the goal is ONE coherent framed window per page no matter
   which template generation it came from. */
.content-area,
.ss-container > .ss-frame,
.page-frame {
  display: flex;
  flex-direction: column;
  gap: var(--section-gap);
  background: var(--surface);
  border: 2px solid var(--text-primary, #111);
  border-radius: 14px;
  padding: clamp(20px, 2.5vw, 32px);
  /* Frame fills the padded main-content (left-aligned, NOT centered).
     Just keeps a top + bottom margin from neighbouring blocks. */
  margin: var(--space-3) 0 var(--space-5);
}
/* Pages that intentionally render full-width grids (the dashboards
   tile grid, the landing-page hero) opt out via .content-area--bare. */
.content-area--bare {
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

/* ── Status bar ─────────────────────────────────────────────────────── */
.status-bar {
  grid-area: status;
  display: flex;
  align-items: center;
  gap: var(--space-3);
  height: var(--dash-status-bar-h);
  padding: 0 var(--space-4);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  font-size: var(--text-xs);
  color: var(--text-tertiary);
}
.status-item { display: inline-flex; align-items: center; gap: 4px; }
.status-separator { color: var(--text-quaternary); }
.status-spacer { flex: 1; }
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  display: inline-block;
}
.status-dot.running { background: var(--text-primary); }

/* ── Detail panel (when a tab has a right-hand detail column) ──────── */
.detail-panel {
  width: var(--dash-detail-panel-w);
  flex-shrink: 0;
  border-left: 1px solid var(--border-subtle);
  padding: var(--space-4);
  background: var(--bg-surface);
  overflow-y: auto;
}

/* ── Tables: consistent row height + right-aligned numeric columns ──── */
.app-shell table,
.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--text-sm);
}
.app-shell table th,
.app-shell table td,
.dash-table th,
.dash-table td {
  height: var(--dash-table-row-h);
  padding: 0 var(--space-3);
  text-align: left;
  border-bottom: 1px solid var(--border-ghost);
}
.app-shell table th,
.dash-table th {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  background: var(--bg-surface);
  position: sticky;
  top: 0;
}
.app-shell table td.num, .app-shell table th.num,
.dash-table td.num, .dash-table th.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.app-shell table tr:hover td,
.dash-table tr:hover td {
  background: var(--interactive-ghost);
}

/* ── Utilities: numeric alignment, truncation, line clamping ──────── */
.nums,
.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}
.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.clamp-1 { display: -webkit-box; -webkit-line-clamp: 1; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-2 { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ── Focus ring: 2px outline, --text-primary, 2px offset ────────────── */
.app-shell *:focus-visible,
button:focus-visible,
a.nav-item:focus-visible,
a.btn:focus-visible,
.dash-table tr:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
/* Remove browser default focus for elements we're replacing */
.app-shell *:focus { outline: none; }

/* ── Click state: subtle scale-down ─────────────────────────────────── */
.app-shell button:active,
.app-shell a.btn:active,
.app-shell .nav-item:active {
  transform: scale(0.98);
}

/* ── Link transitions baseline (tabs only — avoid stomping landing) ── */
.app-shell a {
  transition: color var(--dash-transition-fast);
}

/* ── Stat cards (used on /predictions, /dashboards, subproduct hubs) ─ */
.stat-card {
  padding: var(--space-3) var(--space-4);
  background: var(--bg-surface);
  border: 1px solid var(--border-ghost);
  border-radius: var(--radius-sm);
  transition: border-color var(--dash-transition-fast);
}
.stat-card:hover { border-color: var(--border-subtle); }
.stat-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  margin-bottom: var(--space-1);
}
.stat-value {
  font-size: var(--text-xl);
  font-weight: 500;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
  letter-spacing: -0.01em;
  line-height: 1.2;
}

/* ── Mobile: collapse the sidebar + status bar ──────────────────────── */
@media (max-width: 860px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr var(--dash-status-bar-h);
    grid-template-areas: "main" "main" "status";
  }
  .sidebar {
    display: none;
  }
  .main-content {
    padding: var(--space-3) var(--space-4) var(--space-5);
  }
  .page-title { font-size: 22px; }
}

/* ── Command palette (⌘K) ──────────────────────────────────────────────────
   Monochrome, keyboard-first, Linear-ish. Backdrop blur + centered modal.
   All layout is token-driven so the palette tracks the rest of the app when
   tokens.css changes.
*/

.narve-cmdp-lock { overflow: hidden; }

.narve-cmdp-backdrop {
  position: fixed; inset: 0;
  display: none;
  align-items: flex-start;
  justify-content: center;
  padding-top: 13vh;
  background: var(--bg-overlay);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1000;
  font-family: var(--font-ui);
}
.narve-cmdp-backdrop.open { display: flex; }

@keyframes narve-cmdp-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0)    scale(1); }
}

.narve-cmdp {
  width: min(640px, 94vw);
  max-height: 70vh;
  background: var(--bg-raised, #141414);
  border: 1px solid var(--border-default, #2a2a2a);
  border-radius: 14px;
  box-shadow: 0 24px 64px var(--border-ghost);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  color: var(--text-primary, #fff);
  animation: narve-cmdp-in 140ms cubic-bezier(0.16, 1, 0.3, 1);
}
@media (prefers-reduced-motion: reduce) {
  .narve-cmdp { animation: none; }
}

/* Focus rings — visible only for keyboard users (focus-visible), so
   mouse clicks don't get a halo. Matches the peer-feature a11y pass. */
.narve-cmdp-input:focus-visible,
.narve-cmdp-pill:focus-visible {
  outline: 2px solid var(--text-primary, #fff);
  outline-offset: 2px;
}

.narve-cmdp-input {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text-primary, #fff);
  padding: 18px 22px;
  font-size: var(--text-md);
  font-family: var(--font-ui);
  border-bottom: 1px solid var(--border-subtle, #222);
  caret-color: var(--text-primary, #fff);
}
.narve-cmdp-input::placeholder {
  color: var(--text-tertiary, #777);
  font-family: var(--font-ui);
}

.narve-cmdp-results {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 6px 0;
  scrollbar-width: thin;
}
.narve-cmdp-results::-webkit-scrollbar { width: 8px; }
.narve-cmdp-results::-webkit-scrollbar-thumb {
  background: var(--border-default, #2a2a2a);
  border-radius: var(--radius-xs);
}

.narve-cmdp-group {
  padding: 4px 0 6px;
}
.narve-cmdp-group-label {
  padding: 10px 22px 4px;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-tertiary, #777);
}

.narve-cmdp-row {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 8px 22px;
  cursor: pointer;
  color: var(--text-secondary, #ccc);
  font-size: 13.5px;
  line-height: 1.3;
}
.narve-cmdp-row.selected,
.narve-cmdp-row:focus-visible {
  background: var(--bg-hover, rgba(255, 255, 255, 0.04));
  color: var(--text-primary, #fff);
}
.narve-cmdp-glyph {
  color: var(--text-tertiary, #777);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  text-align: center;
}
.narve-cmdp-row.selected .narve-cmdp-glyph {
  color: var(--text-primary, #fff);
}
.narve-cmdp-title {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* FTS snippet() highlights — monochrome "matched term" emphasis. No
   yellow highlighter; we're inverting the contrast to make the match
   pop against the row's foreground without adding colour. */
.narve-cmdp-title mark,
.narve-cmdp-sub mark {
  background: var(--text-primary, #fff);
  color: var(--bg-base, #0a0a0a);
  border-radius: 2px;
  padding: 0 2px;
  font-weight: 600;
}
.narve-cmdp-row.selected .narve-cmdp-title mark,
.narve-cmdp-row.selected .narve-cmdp-sub mark {
  background: var(--bg-base, #0a0a0a);
  color: var(--text-primary, #fff);
  box-shadow: inset 0 0 0 1px var(--text-primary, #fff);
}
.narve-cmdp-sub {
  font-size: 11.5px;
  color: var(--text-tertiary, #777);
  font-family: var(--font-mono);
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 280px;
}

.narve-cmdp-hint {
  padding: 24px 22px;
  color: var(--text-tertiary, #777);
  font-size: var(--text-sm);
  text-align: center;
}
.narve-cmdp-error { color: var(--text-primary); font-weight: 600; }

.narve-cmdp-footer {
  display: flex;
  gap: 16px;
  padding: 10px 22px;
  border-top: 1px solid var(--border-subtle, #222);
  font-size: var(--text-xs);
  color: var(--text-tertiary, #777);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}
.narve-cmdp-footer kbd {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 4px;
  border: 1px solid var(--border-default, #2a2a2a);
  border-radius: var(--radius-xs);
  background: var(--bg-surface, #0a0a0a);
  color: var(--text-secondary, #ccc);
  font-family: var(--font-mono);
  font-size: 10px;
}

/* Tight-fit on narrow viewports — keeps the palette usable on mobile.  */
@media (max-width: 480px) {
  .narve-cmdp-backdrop { padding-top: 8vh; }
  .narve-cmdp { max-height: 84vh; }
  .narve-cmdp-sub { max-width: 140px; }
}

/* ── Palette trigger pill ──────────────────────────────────────────────────
   Floating ⌘K button. Positioned bottom-left so it doesn't fight the
   notification bell (top-right) or the impersonation banner (top).
   Stays out of the way; one click / tap opens the palette.
*/
.narve-cmdp-pill {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px 7px 10px;
  background: var(--bg-raised, #141414);
  border: 1px solid var(--border-default, #2a2a2a);
  border-radius: var(--radius-full);
  color: var(--text-secondary, #ccc);
  font-family: var(--font-ui);
  font-size: 12.5px;
  cursor: pointer;
  z-index: 900;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.narve-cmdp-pill:hover,
.narve-cmdp-pill:focus-visible {
  background: var(--bg-hover, rgba(255, 255, 255, 0.04));
  border-color: var(--border-strong, #3a3a3a);
  color: var(--text-primary, #fff);
  outline: none;
}
.narve-cmdp-pill-icon {
  font-size: var(--text-base);
  line-height: 1;
  color: var(--text-tertiary, #777);
}
.narve-cmdp-pill:hover .narve-cmdp-pill-icon {
  color: var(--text-primary, #fff);
}
.narve-cmdp-pill-label {
  /* Hidden on narrow screens — icon + kbd alone are still obvious. */
  display: inline;
}
.narve-cmdp-pill-kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border-default, #2a2a2a);
  border-radius: var(--radius-xs);
  background: var(--bg-surface, #0a0a0a);
  /* WCAG 1.4.3 — kbd pill sits on --bg-surface; --text-tertiary (#858585)
   * passed on plain white but failed on the surface tint. Use
   * --text-secondary so the pill text stays ≥ 4.5:1 against the surface
   * in both light + dark themes. */
  color: var(--text-secondary, #333);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.02em;
}
@media (max-width: 480px) {
  .narve-cmdp-pill {
    bottom: 16px;
    left: auto;
    right: 16px;
    padding: 8px 10px;
  }
  .narve-cmdp-pill-label { display: none; }
  .narve-cmdp-pill-kbd   { display: none; }
}
@media print {
  .narve-cmdp-pill { display: none; }
}


/* ══════════════════════════════════════════════════════════════════════
   COMMUNITY TAKES
   ══════════════════════════════════════════════════════════════════════
   Scope is `.takes-*` + `.take-*`. All colour/spacing via existing tokens.
   Split across three concerns: (1) the section toolbar, (2) the
   per-take row, (3) the post + report modals. */

/* ── Section toolbar (filter + sort + post) ────────────────────────── */

.takes-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
  align-items: center;
  margin-top: var(--space-3);
  padding-bottom: var(--space-3);
  border-bottom: 1px solid var(--border-ghost);
}

.takes-toolbar-group {
  display: flex;
  gap: var(--space-1);
  align-items: center;
}

.takes-toolbar-label {
  font-size: var(--text-xs);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.takes-toolbar-group--sort { margin-left: auto; }

/* Both filter + sort buttons share this look — a subtle background on
   the active state, a visible focus ring on keyboard nav. */
.takes-filter-btn,
.takes-sort-btn {
  padding: 4px 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--dash-transition-fast),
              border-color var(--dash-transition-fast),
              color var(--dash-transition-fast);
}
.takes-filter-btn:hover,
.takes-sort-btn:hover {
  color: var(--text-primary);
  background: var(--interactive-ghost);
}
.takes-filter-btn.active,
.takes-sort-btn.active {
  background: var(--bg-raised);
  color: var(--text-primary);
  font-weight: 500;
}
.takes-filter-btn:focus-visible,
.takes-sort-btn:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 2px;
}

/* Mobile: stop the sort group floating right once the toolbar wraps.
   Both groups left-align in a vertical stack instead. */
@media (max-width: 600px) {
  .takes-toolbar { gap: var(--space-3); }
  .takes-toolbar-group--sort { margin-left: 0; }
}

/* ── Per-take row ──────────────────────────────────────────────────── */

.take-row {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-ghost);
}

.take-author-handle { font-weight: 600; }
.take-author-cred {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-left: var(--space-1);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  cursor: help;  /* signals the title tooltip */
}

.take-resolved {
  font-size: var(--text-xs);
  margin-left: var(--space-2);
  font-weight: 500;
}
.take-resolved-correct { color: var(--semantic-high); }
.take-resolved-wrong   { color: var(--semantic-low);  }

.take-reasoning {
  margin-top: var(--space-2);
  font-size: var(--text-base);
  line-height: 1.5;
  white-space: pre-wrap;
  color: var(--text-primary);
}

.take-shadow-note {
  font-size: var(--text-xs);
  color: var(--text-tertiary);
  margin-top: var(--space-2);
  padding: var(--space-2);
  background: var(--bg-raised);
  border-left: 2px solid var(--border-default);
  border-radius: var(--radius-sm);
}

/* Vote buttons — same size whether the user can vote or not, so the
   row's vertical rhythm doesn't shift for non-paid / anon viewers. */
.take-vote,
.take-vote-static {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  height: 28px;
  padding: 0 10px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  color: var(--text-secondary);
}
.take-vote {
  background: transparent;
  border: 1px solid var(--border-default);
  cursor: pointer;
  transition: background var(--dash-transition-fast),
              color var(--dash-transition-fast);
}
.take-vote:hover { color: var(--text-primary); background: var(--interactive-ghost); }
.take-vote.is-active {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--text-primary);
}
.take-vote:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 2px;
}
.take-vote[aria-pressed="true"] { font-weight: 600; }
.take-vote-static {
  border: 1px solid transparent;
  color: var(--text-tertiary);
}

/* ── Post + report modals ─────────────────────────────────────────── */

.take-modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--bg-overlay);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-4);
}

.take-modal {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md, 12px);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;  /* sticky footer anchors inside here */
}

.take-modal-body {
  padding: var(--space-5);
  overflow-y: auto;
}

/* Sticky action row — keeps Cancel / Post visible even when reasoning
   scrolls past them. Critical because the textarea is the whole point
   of the modal. */
.take-modal-actions {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: var(--space-2);
  justify-content: flex-end;
  padding: var(--space-3) var(--space-5);
  background: var(--bg-surface);
  border-top: 1px solid var(--border-ghost);
}

@media (max-width: 480px) {
  .take-modal { max-height: 100vh; border-radius: 0; }
  .take-modal-overlay { padding: 0; }
}

/* ── Loading skeleton for the list ────────────────────────────────── */

.takes-skeleton-row {
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--border-ghost);
}
.takes-skeleton-row > div {
  height: 12px;
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    var(--bg-raised) 0%,
    var(--bg-overlay) 50%,
    var(--bg-raised) 100%);
  background-size: 200% 100%;
  animation: takesSkelShimmer 1.4s ease-in-out infinite;
}
.takes-skeleton-row > div + div { margin-top: var(--space-2); }
.takes-skeleton-row-1 { width: 35%; }
.takes-skeleton-row-2 { width: 100%; }
.takes-skeleton-row-3 { width: 88%; }

@keyframes takesSkelShimmer {
  0%   { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
  .takes-skeleton-row > div { animation: none; }
}


/* ══════════════════════════════════════════════════════════════════════
   SHARED BREADCRUMB
   New canonical class. Coexists with the legacy `.breadcrumb` already
   used in 29 templates; new templates + auto-injected breadcrumbs
   from render_page(breadcrumb=…) emit `.nv-breadcrumb`.
   ══════════════════════════════════════════════════════════════════════ */

.nv-breadcrumb {
  font-size: 12px;
  color: var(--text-tertiary);
  margin-bottom: var(--space-3);
}

.nv-breadcrumb ol {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  align-items: center;
}

.nv-breadcrumb li {
  display: inline-flex;
  align-items: center;
}

.nv-breadcrumb li:not(:first-child)::before {
  content: "/";
  margin-right: var(--space-2);
  color: var(--text-quaternary);
}

.nv-breadcrumb a {
  color: var(--text-tertiary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.nv-breadcrumb a:hover,
.nv-breadcrumb a:focus-visible {
  color: var(--text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.nv-breadcrumb a:focus-visible {
  outline: 1px solid var(--text-primary);
  outline-offset: 2px;
  border-radius: 2px;
}

.nv-breadcrumb [aria-current="page"] {
  color: var(--text-secondary);
  font-weight: 500;
}

@media (max-width: 480px) {
  .nv-breadcrumb { font-size: var(--text-xs); }
  .nv-breadcrumb ol { gap: var(--space-1); }
  .nv-breadcrumb li:not(:first-child)::before { margin-right: var(--space-1); }
}
