/* ============================================================================
   Operator Engine — design system
   Hand-written. One accent: deep teal. Light + dark, WCAG AA.
   ========================================================================== */

/* ── Brand ramp (Payva violet) ────────────────────────────────────────────
   Payva's brand violet. Used sparingly; text never rides the raw hue at small
   sizes — semantic --accent-ink (#5B21B6+) is WCAG-AA on light surfaces. */
:root {
  --brand-50:  #f5f3ff;
  --brand-100: #ede9fe;
  --brand-200: #ddd6fe;
  --brand-300: #c4b5fd;
  --brand-400: #a78bfa;
  --brand-500: #8b5cf6;
  --brand-600: #7c3aed;
  --brand-700: #6d28d9;
  --brand-800: #5b21b6;
  --brand-900: #4c1d95;
  /* deep brand darks for bars/heroes */
  --brand-ink:   #1c0d3a;  /* heading ink on light */
  --brand-dark:  #1e0b3b;  /* topbar / hero background */
  --brand-dark2: #2a0e4f;

  /* ── Type scale (1.20 minor third) ── */
  --font-sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    Helvetica, Arial, "Apple Color Emoji", sans-serif;
  --font-mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-md: 0.9375rem;
  --fs-lg: 1.0625rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.875rem;
  --fs-3xl: 2.5rem;

  /* ── Spacing scale (4px base) ── */
  --sp-1: 4px;  --sp-2: 8px;  --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* ── Radius ── */
  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-pill: 999px;

  /* ── Motion ── */
  --ease: cubic-bezier(0.2, 0.6, 0.2, 1);
}

/* ── Light theme (default) ── */
:root,
:root[data-theme="light"] {
  --bg:          #f7f6fb;
  --surface:     #ffffff;
  --surface-2:   #f3f1fb;
  --surface-3:   #ebe7f7;
  --border:      #e6e2f2;
  --border-strong: #d6cfe9;

  --text:        #1c0d3a;
  --text-muted:  #59527a;
  --text-subtle: #8a83a6;

  --accent:      #6d28d9;              /* Payva violet */
  --accent-hover:#7c3aed;
  --accent-ink:  #5b21b6;             /* violet text on light (AA) */
  --accent-weak: var(--brand-100);
  --on-accent:   #ffffff;

  --good:   #157347;  --good-weak:   #e3f4ea;
  --warn:   #9a6a00;  --warn-weak:   #f8efd7;
  --danger: #b3261e;  --danger-weak: #fbe6e4;

  --shadow-sm: 0 1px 2px rgba(28, 13, 58, 0.06),
               0 1px 1px rgba(28, 13, 58, 0.04);
  --shadow-md: 0 2px 4px rgba(28, 13, 58, 0.05),
               0 6px 16px rgba(28, 13, 58, 0.07);
  --shadow-lg: 0 12px 32px rgba(28, 13, 58, 0.12);
  --ring: 0 0 0 3px rgba(109, 40, 217, 0.24);

  color-scheme: light;
}

/* ── Dark theme ── */
:root[data-theme="dark"] {
  --bg:          #0d0819;
  --surface:     #171029;
  --surface-2:   #1e1636;
  --surface-3:   #281d47;
  --border:      #2f2450;
  --border-strong: #3f3168;

  --text:        #ece9f6;
  --text-muted:  #aca3c8;
  --text-subtle: #7f76a0;

  --accent:      #a78bfa;             /* brighter violet reads on dark */
  --accent-hover:#c4b5fd;
  --accent-ink:  #c4b5fd;
  --accent-weak: rgba(167, 139, 250, 0.15);
  --on-accent:   #1c0d3a;

  --good:   #4ec98a;  --good-weak:   rgba(78, 201, 138, 0.16);
  --warn:   #e2b24d;  --warn-weak:   rgba(226, 178, 77, 0.16);
  --danger: #f2796b;  --danger-weak: rgba(242, 121, 107, 0.16);

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 2px 6px rgba(0, 0, 0, 0.35), 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.55);
  --ring: 0 0 0 3px rgba(167, 139, 250, 0.32);

  color-scheme: dark;
}

/* Auto dark when the OS prefers it and the user hasn't chosen manually. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) {
    --bg:#0d0819; --surface:#171029; --surface-2:#1e1636; --surface-3:#281d47;
    --border:#2f2450; --border-strong:#3f3168;
    --text:#ece9f6; --text-muted:#aca3c8; --text-subtle:#7f76a0;
    --accent:#a78bfa; --accent-hover:#c4b5fd;
    --accent-ink:#c4b5fd; --accent-weak:rgba(167,139,250,0.15);
    --on-accent:#1c0d3a;
    --good:#4ec98a; --good-weak:rgba(78,201,138,0.16);
    --warn:#e2b24d; --warn-weak:rgba(226,178,77,0.16);
    --danger:#f2796b; --danger-weak:rgba(242,121,107,0.16);
    --shadow-sm:0 1px 2px rgba(0,0,0,.4);
    --shadow-md:0 2px 6px rgba(0,0,0,.35),0 8px 24px rgba(0,0,0,.4);
    --shadow-lg:0 16px 40px rgba(0,0,0,.55);
    --ring:0 0 0 3px rgba(167,139,250,.32);
    color-scheme: dark;
  }
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--fs-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
a { color: inherit; text-decoration: none; }
h1, h2, h3, p { margin: 0; }
button { font-family: inherit; cursor: pointer; }

/* ── Layout shell ── */
.app { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: var(--sp-4);
  height: 60px; padding: 0 var(--sp-6);
  background: color-mix(in srgb, var(--brand-dark) 92%, transparent);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--brand-dark2);
  color: #f5f3ff;
}
/* Payva-branded topbar: light content on deep violet, both themes */
.topbar .wordmark { color: #f5f3ff; }
.topbar .wordmark small { color: #c4b5fd; }
.topbar .who { color: #c4b5fd; }
.topbar .who strong { color: #f5f3ff; }
.topbar .iconbtn { border-color: rgba(255,255,255,0.16); color: #ddd6fe; }
.topbar .iconbtn:hover { background: rgba(255,255,255,0.10); color: #fff; }
.payva-tag {
  display: inline-flex; align-items: center; padding: 3px 10px;
  border-radius: var(--r-pill); font-size: var(--fs-xs); font-weight: 700;
  letter-spacing: 0.02em; color: #ede9fe;
  background: rgba(255,255,255,0.10); border: 1px solid rgba(255,255,255,0.16);
}
.wordmark {
  display: flex; align-items: center; gap: var(--sp-3);
  font-weight: 650; font-size: var(--fs-lg); letter-spacing: -0.01em;
}
.wordmark .mark {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(150deg, var(--brand-400), var(--brand-700));
  box-shadow: var(--shadow-sm);
}
.wordmark .mark svg { width: 17px; height: 17px; }
.wordmark small {
  display: block; font-size: 10.5px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; color: var(--text-subtle);
}

.topbar .spacer { flex: 1; }
.topbar .who { font-size: var(--fs-sm); color: #c4b5fd; }

.iconbtn {
  display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: var(--r-md);
  background: transparent; border: 1px solid var(--border); color: var(--text-muted);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.iconbtn:hover { background: var(--surface-2); color: var(--text); }
.iconbtn svg { width: 18px; height: 18px; }
[data-theme="dark"] .sun, :root:not([data-theme]) .sun { display: none; }
[data-theme="dark"] .moon, :root:not([data-theme]) .moon { display: block; }
.moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme]) .sun { display: none; }
  :root:not([data-theme]) .moon { display: block; }
}

.shell { flex: 1; display: grid; grid-template-columns: 224px 1fr; }
.sidebar {
  border-right: 1px solid var(--border);
  padding: var(--sp-6) var(--sp-4);
  background: var(--surface);
}
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3); border-radius: var(--r-md);
  color: var(--text-muted); font-weight: 500; font-size: var(--fs-md);
  transition: background 0.15s var(--ease), color 0.15s var(--ease);
}
.nav a svg { width: 18px; height: 18px; opacity: 0.85; }
.nav a:hover { background: var(--surface-2); color: var(--text); }
.nav a.active {
  background: var(--accent-weak); color: var(--accent-ink); font-weight: 600;
}
.nav a.active svg { opacity: 1; }
.nav .group-label {
  font-size: var(--fs-xs); letter-spacing: 0.07em; text-transform: uppercase;
  color: var(--text-subtle); padding: var(--sp-3) var(--sp-3) var(--sp-2);
}

.main { padding: var(--sp-8) var(--sp-10); min-width: 0; }
.page-head { margin-bottom: var(--sp-6); }
.page-head h1 { font-size: var(--fs-2xl); letter-spacing: -0.02em; font-weight: 680; }
.page-head p { color: var(--text-muted); margin-top: var(--sp-2); font-size: var(--fs-md); }

/* ── Cards ── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); box-shadow: var(--shadow-sm);
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-5) var(--sp-6); border-bottom: 1px solid var(--border);
}
.card-head h2 { font-size: var(--fs-lg); font-weight: 620; letter-spacing: -0.01em; }
.card-head .hint { font-size: var(--fs-sm); color: var(--text-subtle); }
.card-body { padding: var(--sp-6); }

/* ── KPI tiles ── */
.kpi-row {
  display: grid; gap: var(--sp-4); margin-bottom: var(--sp-6);
  grid-template-columns: repeat(4, 1fr);
}
.tile {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-lg); padding: var(--sp-5); box-shadow: var(--shadow-sm);
  position: relative; overflow: hidden;
}
.tile::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--accent); opacity: 0.85;
}
.tile .label {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-muted); font-weight: 500;
}
.tile .label svg { width: 15px; height: 15px; color: var(--accent-ink); }
.tile .value {
  margin-top: var(--sp-3); font-size: var(--fs-3xl); font-weight: 700;
  letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums;
}
.tile .value .unit { font-size: var(--fs-xl); color: var(--text-muted); font-weight: 600; }
.tile .sub { margin-top: var(--sp-2); font-size: var(--fs-sm); color: var(--text-subtle); }

.grid-2 { display: grid; grid-template-columns: 1.15fr 0.85fr; gap: var(--sp-6); }
@media (max-width: 1080px) {
  .grid-2 { grid-template-columns: 1fr; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

/* ── Bar chart (inline SVG) ── */
.chart { width: 100%; }
.chart .bar { transition: opacity 0.15s var(--ease); }
.chart .bar:hover { opacity: 0.82; }
.chart-legend {
  display: flex; align-items: center; gap: var(--sp-2);
  font-size: var(--fs-sm); color: var(--text-muted); margin-top: var(--sp-3);
}
.chart-legend .swatch {
  width: 10px; height: 10px; border-radius: 3px; background: var(--accent);
}

/* ── Table ── */
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
table.data th, table.data td {
  text-align: left; padding: var(--sp-3) var(--sp-4); white-space: nowrap;
}
table.data thead th {
  position: sticky; top: 0; background: var(--surface-2);
  font-size: var(--fs-xs); letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); font-weight: 600; border-bottom: 1px solid var(--border);
}
table.data thead th a { display: inline-flex; align-items: center; gap: 4px; color: inherit; }
table.data thead th a:hover { color: var(--text); }
table.data thead th .arrow { color: var(--accent-ink); }
table.data tbody td { border-bottom: 1px solid var(--border); color: var(--text); }
table.data tbody tr:hover td { background: var(--surface-2); }
table.data td.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td .domain { font-weight: 600; }
table.data td .muted { color: var(--text-subtle); }
.disq-row td { opacity: 0.72; }

/* score cell mini-meter */
.scorecell { display: flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; }
.scorecell .meter {
  width: 54px; height: 6px; border-radius: var(--r-pill);
  background: var(--surface-3); overflow: hidden;
}
.scorecell .meter i { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.scorecell .n { font-weight: 650; min-width: 26px; text-align: right; }

/* ── Badges / pills ── */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-pill);
  font-size: var(--fs-xs); font-weight: 600; line-height: 1.6;
  border: 1px solid var(--border-strong); color: var(--text-muted);
  background: var(--surface-2);
}
.badge .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.platform { color: var(--accent-ink); background: var(--accent-weak); border-color: transparent; }
.badge.via { color: var(--text-muted); }
.badge.label-course      { color: var(--good); background: var(--good-weak); border-color: transparent; }
.badge.label-info_product{ color: var(--accent-ink); background: var(--accent-weak); border-color: transparent; }
.badge.label-agency,
.badge.label-vendor      { color: var(--warn); background: var(--warn-weak); border-color: transparent; }
.badge.label-noise       { color: var(--text-subtle); }
.pill-disq {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: var(--r-pill); font-size: var(--fs-xs);
  font-weight: 700; color: var(--danger); background: var(--danger-weak);
}

/* ── Buttons / forms ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  padding: 10px var(--sp-5); border-radius: var(--r-md); font-weight: 600;
  font-size: var(--fs-md); border: 1px solid transparent;
  transition: background 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.btn-primary { background: var(--accent); color: var(--on-accent); width: 100%; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.field { margin-bottom: var(--sp-4); }
.field label {
  display: block; font-size: var(--fs-sm); font-weight: 600;
  color: var(--text-muted); margin-bottom: 6px;
}
.field input {
  width: 100%; padding: 11px var(--sp-4); font-size: var(--fs-md);
  color: var(--text); background: var(--surface); font-family: inherit;
  border: 1px solid var(--border-strong); border-radius: var(--r-md);
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }

/* ── Banners / empty states ── */
.banner {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-sm); margin-bottom: var(--sp-6);
}
.banner svg { width: 18px; height: 18px; flex: none; }
.banner.warn { background: var(--warn-weak); color: var(--warn); }
.empty {
  text-align: center; padding: var(--sp-12) var(--sp-6); color: var(--text-muted);
}
.empty .art {
  width: 52px; height: 52px; margin: 0 auto var(--sp-4);
  display: grid; place-items: center; border-radius: var(--r-lg);
  background: var(--accent-weak); color: var(--accent-ink);
}
.empty .art svg { width: 26px; height: 26px; }
.empty h3 { font-size: var(--fs-lg); color: var(--text); margin-bottom: var(--sp-2); }
.empty p { max-width: 380px; margin: 0 auto; }

/* ── Login ── */
.login-wrap {
  min-height: 100vh; display: grid; place-items: center; padding: var(--sp-6);
  background:
    radial-gradient(900px 500px at 15% -10%, var(--accent-weak), transparent 60%),
    var(--bg);
}
.login-card {
  width: 100%; max-width: 388px; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); padding: var(--sp-8);
}
.login-card .brand {
  display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-6);
}
.login-card h1 { font-size: var(--fs-xl); letter-spacing: -0.02em; }
.login-card .lede { color: var(--text-muted); font-size: var(--fs-sm); margin-bottom: var(--sp-6); }
.login-card .err {
  background: var(--danger-weak); color: var(--danger);
  padding: 10px var(--sp-4); border-radius: var(--r-md);
  font-size: var(--fs-sm); font-weight: 500; margin-bottom: var(--sp-4);
}
.login-foot { margin-top: var(--sp-5); text-align: center; font-size: var(--fs-xs); color: var(--text-subtle); }

/* ── Detail pages (business / creator) ── */
.crumb {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); color: var(--text-muted);
  margin-bottom: var(--sp-4); font-weight: 500;
}
.crumb svg { width: 15px; height: 15px; }
.crumb:hover { color: var(--accent-ink); }

/* clickable rows: link fills the cell, chevron reveals on hover */
table.data td a.rowlink { color: inherit; display: inline-flex; align-items: center; gap: 6px; }
table.data td a.rowlink:hover { color: var(--accent-ink); }
table.data td a.rowlink .go {
  width: 14px; height: 14px; opacity: 0; color: var(--accent-ink);
  transition: opacity 0.15s var(--ease), transform 0.15s var(--ease);
  transform: translateX(-3px);
}
table.data tr.linkrow:hover a.rowlink .go { opacity: 1; transform: translateX(0); }
table.data tr.linkrow:hover td { background: var(--surface-2); }

/* key/value description lists inside cards */
dl.kv { display: grid; grid-template-columns: 150px 1fr; gap: var(--sp-3) var(--sp-4); margin: 0; }
dl.kv dt { color: var(--text-subtle); font-weight: 600; font-size: var(--fs-sm); }
dl.kv dd { margin: 0; color: var(--text); font-size: var(--fs-sm); }
.mono { font-family: var(--font-mono); font-size: var(--fs-sm); }
.rationale { font-size: var(--fs-md); line-height: 1.6; color: var(--text); }
.rationale.muted { color: var(--text-muted); }
.note-src { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: var(--sp-3); }

/* creator/operator kind badges */
.badge.kind-creator  { color: var(--accent-ink); background: var(--accent-weak); border-color: transparent; }
.badge.kind-operator { color: var(--warn); background: var(--warn-weak); border-color: transparent; }

/* evidence list */
.ev-list { list-style: none; margin: 0; padding: 0; }
.ev-item { padding: var(--sp-4) 0; border-bottom: 1px solid var(--border); }
.ev-item:first-child { padding-top: 0; }
.ev-item:last-child { border-bottom: none; padding-bottom: 0; }
.ev-src { display: flex; align-items: center; gap: var(--sp-3); }
.ev-src .note-src { margin-top: 0; }
.ev-snip { color: var(--text-muted); font-size: var(--fs-sm); margin-top: 8px; line-height: 1.55; }
.ev-url {
  display: inline-block; margin-top: 8px; color: var(--accent-ink);
  font-size: var(--fs-sm); word-break: break-all; font-family: var(--font-mono);
}
.ev-url:hover { text-decoration: underline; }

.cost-total {
  display: flex; align-items: baseline; justify-content: space-between;
  padding-top: var(--sp-4); margin-top: var(--sp-2);
  border-top: 1px dashed var(--border-strong);
  font-size: var(--fs-sm); color: var(--text-muted);
}
.cost-total b { font-size: var(--fs-lg); color: var(--text); font-variant-numeric: tabular-nums; }

@media (max-width: 760px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: var(--sp-6) var(--sp-5); }
  .kpi-row { grid-template-columns: 1fr 1fr; }
}

/* ============================================================================
   Payva prospecting additions — filters, signal badges, insight charts
   ========================================================================== */

/* ── Filter bar ── */
.filterbar {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--sp-3);
  margin-bottom: var(--sp-5);
}
.filterbar .search {
  display: flex; align-items: center; gap: var(--sp-2);
  padding: 0 var(--sp-3); min-width: 240px; flex: 1 1 260px; max-width: 420px;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.filterbar .search:focus-within { border-color: var(--accent); box-shadow: var(--ring); }
.filterbar .search svg { width: 16px; height: 16px; color: var(--text-subtle); flex: none; }
.filterbar .search input {
  border: none; outline: none; background: transparent; color: var(--text);
  font-family: inherit; font-size: var(--fs-sm); padding: 9px 0; width: 100%;
}
.chip-select, .chip-num {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); padding: 7px var(--sp-3);
  transition: border-color .15s var(--ease), background .15s var(--ease);
}
.chip-select { cursor: pointer; appearance: none; -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238a83a6' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 9px center;
}
.chip-select:hover, .chip-num:hover { border-color: var(--accent); }
.chip-select:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.chip-num span { color: var(--text-muted); }
.chip-num input {
  width: 52px; border: none; outline: none; background: transparent;
  color: var(--text); font-family: inherit; font-size: var(--fs-sm);
  font-variant-numeric: tabular-nums;
}
.chip-check {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: var(--fs-sm); font-weight: 500; color: var(--text);
  background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--r-pill); padding: 7px var(--sp-3);
}
.chip-check input { accent-color: var(--accent); }
.filterbar-spacer { flex: 1 1 auto; }
.btn-sm { padding: 7px var(--sp-3); font-size: var(--fs-sm); border-radius: var(--r-pill); }

/* ── Signal badges ── */
.badge-strip { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-2); margin-top: var(--sp-3); }
.badge.tier { font-weight: 700; }
.badge.tier-1 { color: #fff; background: var(--accent); border-color: transparent; }
.badge.tier-2 { color: var(--accent-ink); background: var(--accent-weak); border-color: transparent; }
.badge.tier-3 { color: var(--text-muted); background: var(--surface-3); border-color: transparent; }
.badge.mode-profitable { color: var(--good); background: var(--good-weak); border-color: transparent; }
.badge.mode-testing    { color: var(--warn); background: var(--warn-weak); border-color: transparent; }
.badge.mode-unknown    { color: var(--text-subtle); }
.badge.integ.ok  { color: var(--accent-ink); background: var(--accent-weak); border-color: transparent; }
.badge.integ.no  { color: var(--text-subtle); background: var(--surface-2); }
.badge.integ.ok .dot { background: var(--accent); }

/* ── Payva-fit meter cell (colored by level) ── */
.fitcell { display: inline-flex; align-items: center; gap: var(--sp-2); justify-content: flex-end; }
.fitcell .meter {
  width: 56px; height: 6px; border-radius: var(--r-pill);
  background: var(--surface-3); overflow: hidden;
}
.fitcell .meter i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.fitcell .meter.fit-hi  i { background: var(--good); }
.fitcell .meter.fit-mid i { background: var(--accent); }
.fitcell .meter.fit-lo  i { background: var(--warn); }
.fitcell .n { font-weight: 650; min-width: 24px; text-align: right; font-variant-numeric: tabular-nums; }

/* ── Ranked list (top financeable creators) ── */
.rank-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.rank-list li {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--border);
}
.rank-list li:last-child { border-bottom: none; }
.rank-n {
  flex: none; width: 22px; height: 22px; border-radius: 6px;
  display: grid; place-items: center; font-size: var(--fs-xs); font-weight: 700;
  color: var(--accent-ink); background: var(--accent-weak);
}
.rank-main { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.rank-name { font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-name:hover { color: var(--accent-ink); }
.rank-sub { font-size: var(--fs-xs); color: var(--text-subtle); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank-sub .badge { padding: 0 6px; }
.rank-fit { flex: none; }

/* ── Horizontal-bar lists (portfolio breadth, integration fit) ── */
.hbar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.hbar-list li { display: grid; grid-template-columns: 132px 1fr 34px; align-items: center; gap: var(--sp-3); }
.hbar-label { font-size: var(--fs-sm); color: var(--text); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.hbar-label:hover { color: var(--accent-ink); }
.hbar-label.cap { text-transform: capitalize; }
.hbar-label .tick { color: var(--accent-ink); font-weight: 700; }
.hbar-track { height: 10px; border-radius: var(--r-pill); background: var(--surface-3); overflow: hidden; }
.hbar-track i { display: block; height: 100%; border-radius: inherit; background: var(--accent); }
.hbar-track i.ok { background: var(--accent); }
.hbar-val { font-size: var(--fs-sm); font-weight: 650; text-align: right; font-variant-numeric: tabular-nums; color: var(--text); }

/* ── Donut (mode split, freshness) ── */
.donut-wrap { display: flex; align-items: center; gap: var(--sp-6); flex-wrap: wrap; }
.donut { width: 140px; height: 140px; flex: none; }
.donut-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-sm); color: var(--text-muted); }
.donut-legend li { display: flex; align-items: center; gap: var(--sp-2); }
.donut-legend .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.donut-legend b { color: var(--text); margin-left: auto; padding-left: var(--sp-4); font-variant-numeric: tabular-nums; }
.donut-legend .donut-foot { display: block; margin-top: var(--sp-2); font-size: var(--fs-xs); color: var(--text-subtle); max-width: 220px; }

/* ── Explore tabs ── */
.explore-tabs { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-5); }
.explore-tab {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: var(--sp-6); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color .15s var(--ease), box-shadow .15s var(--ease), transform .15s var(--ease);
}
.explore-tab:hover { border-color: var(--accent); box-shadow: var(--shadow-md); transform: translateY(-2px); }
.et-icon {
  flex: none; width: 48px; height: 48px; border-radius: var(--r-md);
  display: grid; place-items: center; color: var(--on-accent);
  background: linear-gradient(150deg, var(--brand-400), var(--brand-800));
}
.et-icon svg { width: 24px; height: 24px; }
.et-body { display: flex; flex-direction: column; gap: 4px; flex: 1; min-width: 0; }
.et-title { font-size: var(--fs-xl); font-weight: 680; letter-spacing: -0.01em; color: var(--text); }
.et-desc { font-size: var(--fs-sm); color: var(--text-muted); }
.et-metric { flex: none; text-align: right; }
.et-metric b { display: block; font-size: var(--fs-2xl); font-weight: 700; letter-spacing: -0.02em; color: var(--accent-ink); font-variant-numeric: tabular-nums; }
.et-metric small { font-size: var(--fs-xs); color: var(--text-subtle); text-transform: uppercase; letter-spacing: 0.06em; }
@media (max-width: 760px) {
  .explore-tabs { grid-template-columns: 1fr; }
  .explore-tab { flex-wrap: wrap; }
}

/* ── Active-filter chips ──────────────────────────────────────────────────── */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: 999px;
  background: var(--surface-2); border: 1px solid var(--border);
  font-size: var(--fs-xs); color: var(--text-muted);
}
.chip b { font-weight: 620; color: var(--text); }
.chip a {
  display: grid; place-items: center; width: 16px; height: 16px;
  border-radius: 50%; color: var(--text-subtle); text-decoration: none;
  font-size: 13px; line-height: 1;
}
.chip a:hover { background: var(--accent); color: var(--on-accent); }

/* ── Pagination ───────────────────────────────────────────────────────────── */
.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 16px; border-top: 1px solid var(--border);
}
.pager-range, .pager-page { font-size: var(--fs-sm); color: var(--text-muted); font-variant-numeric: tabular-nums; }
.pager-btns { display: inline-flex; align-items: center; gap: 8px; }
.btn.is-disabled { opacity: .45; pointer-events: none; }

/* ── Estimated volume band + duplicate-cluster hint ───────────────────────── */
.volband {
  display: inline-block; font-variant-numeric: tabular-nums;
  font-weight: 620; color: var(--accent-ink); white-space: nowrap;
}
.volband small { font-weight: 500; color: var(--text-subtle); }
.cluster-hint {
  display: inline-block; margin-top: 4px; font-size: var(--fs-xs);
  color: var(--text-subtle); text-decoration: none; border-bottom: 1px dotted currentColor;
}
.cluster-hint:hover { color: var(--accent); }

/* ── Respect a reduced-motion preference: kill meter/donut animation ──────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .meter i, .donut circle, .gauge-fill { transition: none !important; }
}

/* ── Depth-vs-breadth coverage banner ─────────────────────────────────────── */
.coverage {
  display: flex; align-items: flex-start; gap: 14px;
  padding: 12px 16px; margin: 0 0 14px;
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.coverage-bar {
  flex: none; position: relative; width: 120px; height: 8px; margin-top: 6px;
  border-radius: 999px; background: var(--border); overflow: hidden;
}
.coverage-bar i {
  position: absolute; inset: 0 auto 0 0; display: block; border-radius: 999px;
  background: linear-gradient(90deg, var(--brand-400), var(--brand-800));
}
.coverage-text { font-size: var(--fs-sm); color: var(--text-muted); line-height: 1.5; }
.coverage-text strong { color: var(--text); font-weight: 650; }
.coverage-text .muted { display: block; margin-top: 3px; color: var(--text-subtle); font-size: var(--fs-xs); }
@media (max-width: 720px) { .coverage { flex-direction: column; gap: 8px; } .coverage-bar { width: 100%; } }

/* ── Provenance chips: how do we know this? ───────────────────────────────── */
.prov {
  display: inline-block; margin-left: 6px; padding: 1px 6px;
  border-radius: 999px; font-size: 10px; font-weight: 650;
  text-transform: uppercase; letter-spacing: 0.04em; vertical-align: middle;
  border: 1px solid transparent; cursor: help;
}
.prov-observed  { background: #dcfce7; color: #14532d; border-color: #86efac; }
.prov-extracted { background: #e0f2fe; color: #0c4a6e; border-color: #7dd3fc; }
.prov-inferred  { background: #fef3c7; color: #713f12; border-color: #fcd34d; }
.prov-estimated { background: #ede9fe; color: #4c1d95; border-color: #c4b5fd; }
.prov-derived   { background: var(--surface-2); color: var(--text-muted); border-color: var(--border); }
[data-theme="dark"] .prov-observed  { background: #14532d33; color: #86efac; border-color: #16653480; }
[data-theme="dark"] .prov-extracted { background: #0c4a6e33; color: #7dd3fc; border-color: #07598580; }
[data-theme="dark"] .prov-inferred  { background: #713f1233; color: #fcd34d; border-color: #92400e80; }
[data-theme="dark"] .prov-estimated { background: #4c1d9533; color: #c4b5fd; border-color: #5b21b680; }

.prov-table td { vertical-align: top; font-size: var(--fs-sm); }
.verify-line { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: var(--fs-sm); }

/* ── CRM bar ──────────────────────────────────────────────────────────────── */
.crm-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 14px; margin: 0 0 var(--sp-6);
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface-2);
}
.crm-form { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.crm-state { font-size: var(--fs-sm); color: var(--text-muted); }
.stage {
  display: inline-block; padding: 2px 9px; border-radius: 999px;
  font-size: var(--fs-xs); font-weight: 650; text-transform: capitalize;
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
}
.stage-new { background: var(--surface-2); }
.stage-researching { background: #e0f2fe; color: #0c4a6e; border-color: #7dd3fc; }
.stage-contacted { background: #fef3c7; color: #713f12; border-color: #fcd34d; }
.stage-in_conversation { background: #ede9fe; color: #4c1d95; border-color: #c4b5fd; }
.stage-won { background: #dcfce7; color: #14532d; border-color: #86efac; }
.stage-lost { background: #fee2e2; color: #7f1d1d; border-color: #fca5a5; }

/* ── Pipeline board ───────────────────────────────────────────────────────── */
.board {
  display: grid; grid-template-columns: repeat(6, minmax(200px, 1fr));
  gap: 12px; padding: 16px; overflow-x: auto;
}
.board-col { display: flex; flex-direction: column; gap: 10px; min-width: 200px; }
.board-col-head { display: flex; align-items: center; justify-content: space-between; }
.board-count { font-size: var(--fs-xs); color: var(--text-subtle); font-variant-numeric: tabular-nums; }
.board-card {
  border: 1px solid var(--border); border-radius: var(--r-md);
  background: var(--surface); padding: 10px 12px;
  display: flex; flex-direction: column; gap: 6px;
  box-shadow: var(--shadow-sm);
}
.bc-title { font-weight: 640; color: var(--text); text-decoration: none; word-break: break-word; }
.bc-title:hover { color: var(--accent); }
.bc-sub { font-size: var(--fs-xs); color: var(--text-muted); }
.bc-meta { display: flex; gap: 8px; flex-wrap: wrap; font-size: var(--fs-xs); }
.bc-move { display: flex; gap: 6px; margin: 0; }
.bc-move .chip-select { flex: 1; min-width: 0; }
.bc-owner { font-size: var(--fs-xs); color: var(--text-subtle); }
.board-empty {
  border: 1px dashed var(--border); border-radius: var(--r-md);
  padding: 14px; text-align: center; font-size: var(--fs-xs); color: var(--text-subtle);
}
@media (max-width: 1100px) { .board { grid-template-columns: repeat(3, minmax(200px, 1fr)); } }
@media (max-width: 700px)  { .board { grid-template-columns: 1fr; } }

/* ── Notes & activity timeline ────────────────────────────────────────────── */
.note-form { display: flex; gap: 8px; align-items: flex-start; margin-bottom: 14px; }
.note-form textarea {
  flex: 1; padding: 8px 10px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text); font: inherit; font-size: var(--fs-sm); resize: vertical;
}
.note-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: var(--ring); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { border-left: 2px solid var(--border); padding: 0 0 0 12px; }
.timeline.compact li { border-left-color: var(--surface-2); }
.tl-body { font-size: var(--fs-sm); color: var(--text); }
.tl-meta { font-size: var(--fs-xs); color: var(--text-subtle); margin-top: 2px; }
.tl-sub {
  margin: 18px 0 8px; font-size: var(--fs-xs); text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--text-subtle);
}

/* ── Offer intelligence facts ─────────────────────────────────────────────── */
.factgroup { margin-bottom: 18px; }
.fact-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 6px; flex-wrap: wrap; }
.fact-title { font-weight: 650; color: var(--text); font-size: var(--fs-sm); }
.fact-why { font-size: var(--fs-xs); color: var(--text-subtle); }
.factlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.factlist > li { padding-left: 10px; border-left: 2px solid var(--border); }
.fact-ev {
  font-size: var(--fs-xs); color: var(--text-subtle);
  font-style: italic; margin-top: 2px; line-height: 1.5;
}
