/* ============================================================
   KANSARA — app.css
   Single production stylesheet. "Stone" skin (2026-09-07): the
   black-and-white report language applied to the instrument.
   Warm paper by day, obsidian by night. Georgia display, system
   sans body, monospace numbers. Hairlines, square corners, no
   shadows, no glass, no gradients, no font CDNs. One slate accent
   that rarely appears. Every selector the JS depends on is kept;
   only the skin changed. Token names and values are shared with
   slideshow/pipeline/report_house.css — change them together.
   The .tah-* Week-2 retro block inside index.html is self-styled
   and deliberately NOT defined here.
   ============================================================ */

/* ------------------------------------------------------------ reset */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ------------------------------------------------------------ tokens (house vocabulary) */
:root {
  color-scheme: light;
  --bg: #f4f2ed; --panel: #fbfaf7; --panel2: #eeebe4; --line: #dcd8cf; --line2: #e7e3db;
  --ink: #1d1c19; --dim: #5b5852; --dimmer: #8a867e; --faint: #b8b4ab; --warm: #0e0d0c;
  --good: #3b7a4b; --bad: #a4463c; --flag: #8a6a12; --acc: #4b6787;
  --good-soft: rgba(59,122,75,.09); --bad-soft: rgba(164,70,60,.09); --flag-soft: rgba(138,106,18,.10); --acc-soft: rgba(75,103,135,.10);
  --good-line: rgba(59,122,75,.40); --bad-line: rgba(164,70,60,.40); --flag-line: rgba(138,106,18,.40); --acc-line: rgba(75,103,135,.40);
  --scrim: rgba(29,28,25,.35); --veil: rgba(251,250,247,.6);

  /* chart series + ramps — literals on purpose: JS reads them with getComputedStyle */
  /* categorical series: validated (dataviz six checks) against #fbfaf7 — fixed
     order, never cycled. Her note 09-07: ink-on-ink series had no contrast. */
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100; --s-dim: #dcd8cf;
  --c1: #2a78d6; --c2: #eb6834; --c3: #1baf7a; --c4: #eda100; --c5: #e87ba4; --c6: #008300; --c7: #4a3aa7; --c8: #e34948;
  /* ordinal: one hue (series 1 blue), light→dark, steps 250→650 */
  --o1: #86b6ef; --o2: #5598e7; --o3: #2a78d6; --o4: #256abf; --o5: #1c5cab; --o6: #104281;
  --chart-grid: #e7e3db;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0e11; --panel: #14161b; --panel2: #191c22; --line: #262a33; --line2: #1d2028;
  --ink: #e8e6e1; --dim: #9aa0ab; --dimmer: #6d747f; --faint: #4a5059; --warm: #e8e4df;
  --good: #7fae7c; --bad: #c9736b; --flag: #c9a227; --acc: #8fa4c4;
  --good-soft: rgba(127,174,124,.10); --bad-soft: rgba(201,115,107,.10); --flag-soft: rgba(201,162,39,.10); --acc-soft: rgba(143,164,196,.12);
  --good-line: rgba(127,174,124,.40); --bad-line: rgba(201,115,107,.40); --flag-line: rgba(201,162,39,.40); --acc-line: rgba(143,164,196,.40);
  --scrim: rgba(0,0,0,.55); --veil: rgba(20,22,27,.6);
  --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --s-dim: #262a33;
  --c1: #3987e5; --c2: #d95926; --c3: #199e70; --c4: #c98500; --c5: #d55181; --c6: #008300; --c7: #9085e9; --c8: #e66767;
  --o1: #184f95; --o2: #256abf; --o3: #3987e5; --o4: #5598e7; --o5: #6da7ec; --o6: #86b6ef;
  --chart-grid: #1d2028;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0e11; --panel: #14161b; --panel2: #191c22; --line: #262a33; --line2: #1d2028;
    --ink: #e8e6e1; --dim: #9aa0ab; --dimmer: #6d747f; --faint: #4a5059; --warm: #e8e4df;
    --good: #7fae7c; --bad: #c9736b; --flag: #c9a227; --acc: #8fa4c4;
    --good-soft: rgba(127,174,124,.10); --bad-soft: rgba(201,115,107,.10); --flag-soft: rgba(201,162,39,.10); --acc-soft: rgba(143,164,196,.12);
    --good-line: rgba(127,174,124,.40); --bad-line: rgba(201,115,107,.40); --flag-line: rgba(201,162,39,.40); --acc-line: rgba(143,164,196,.40);
    --scrim: rgba(0,0,0,.55); --veil: rgba(20,22,27,.6);
    --s1: #e8e6e1; --s2: #8fa4c4; --s3: #c9a227; --s4: #7fae7c; --s-dim: #262a33;
    --o1: #2c313a; --o2: #4a5059; --o3: #6d747f; --o4: #9aa0ab; --o5: #c4c6c3; --o6: #e8e6e1;
    --chart-grid: #1d2028;
  }
}

/* ------------------------------------------------------------ app aliases
   Every name the existing selectors and JS emissions use, mapped onto the
   house vocabulary. New work writes the house token directly. */
:root {
  /* type */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --sans: var(--font);
  --mono: ui-monospace, SFMono-Regular, Menlo, monospace;
  --serif: Georgia, "Times New Roman", serif;

  /* ground + surfaces */
  --ground-1: var(--bg); --ground-2: var(--bg); --ground-3: var(--bg);
  --surface: var(--panel); --surface-2: var(--panel2); --surface-inset: var(--panel2);
  --glass: var(--panel); --glass-2: var(--panel2); --glass-line: var(--line);

  /* text */
  --ink-2: var(--dim); --ink-3: var(--dimmer); --ink-4: var(--faint);

  /* accent: the app's "accent" role is the ink itself; slate only in ramps */
  --acc-hover: var(--acc);
  --acc-soft-2: var(--acc-soft); --acc-ring: var(--acc-line);

  /* semantic */
  --ok: var(--good);     --ok-bg: var(--good-soft);
  --warn: var(--flag);   --warn-bg: var(--flag-soft);
  --err: var(--bad);     --err-bg: var(--bad-soft);
  --info: var(--acc);    --info-bg: var(--acc-soft);
  --purple: var(--acc);  --purple-bg: var(--acc-soft);

  /* radii — cut stone, not pills */
  --r-xs: 2px; --r-sm: 3px; --r: 3px; --r-lg: 4px; --pill: 3px;

  /* shadows — none. Depth is a hairline. */
  --sh-sm: none; --sh: none; --sh-md: none; --sh-lg: none;

  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --sidebar-w: 232px;
  --shell-max: 1440px;

  /* plot chrome */
  --grid: var(--line2);
  --axis: var(--line);
  --plot-band: var(--panel2);

  /* delta ink */
  --delta-up: var(--good);
  --delta-dn: var(--bad);
  --delta-flat: var(--flag);

  /* legacy names still emitted by older JS/markup */
  --font-display: var(--font);
  --font-serif: var(--serif);
  --font-body: var(--font);
  --font-mono: var(--mono);
  --black: var(--panel);
  --white: var(--ink);
  --gray-50: var(--ink); --gray-100: var(--ink); --gray-200: var(--ink);
  --gray-300: var(--dim); --gray-400: var(--dim);
  --gray-500: var(--dimmer); --gray-600: var(--dimmer);
  --gray-700: var(--line); --gray-800: var(--line2);
  --gray-900: var(--panel2); --gray-950: var(--panel2);
  --accent: var(--ink); --accent-hover: var(--ink); --primary: var(--ink);
  --success: var(--good); --error: var(--bad); --danger: var(--bad);
  --warning: var(--flag); --amber: var(--flag);
  --green: var(--good); --green-400: var(--good); --green-500: var(--good);
  --red: var(--bad); --red-400: var(--bad); --red-500: var(--bad);
  --purple-500: var(--acc);
  --bg-elev: var(--panel2); --bg-input: var(--panel);
  --border: var(--line); --text: var(--ink); --text-muted: var(--dimmer);
  --zaya: var(--acc); --lumis: var(--good); --vera: var(--flag);
  --running: var(--acc); --wip: var(--flag);
}

/* ------------------------------------------------------------ base */
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--faint); background-clip: content-box; }

a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ------------------------------------------------------------ layout shell */
.app { display: flex; min-height: 100vh; }
.main-area { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.main { max-width: var(--shell-max); width: 100%; margin: 0 auto; padding: 24px 28px 88px; }
.view { display: none; }
.view.active { display: block; animation: fade 0.22s var(--ease) both; }
.view-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 20px; }
.mode-panel { display: none; }
.mode-panel.active { display: block; }

/* JS visibility scoping hooks — intentionally no visual rules:
   .arc-only .sa-only .pov-only .home-scope-ig .home-scope-tk
   .p-personas-v1 .p-personas-v2 (display driven inline by JS) */

/* ------------------------------------------------------------ sidebar (paper, hairline) */
.sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  position: fixed; inset: 0 auto 0 0; z-index: 100;
  display: flex; flex-direction: column;
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow-y: auto; overscroll-behavior: contain;
}
.sidebar-logo { padding: 22px 18px 8px; }
.sidebar-logo-row { display: flex; align-items: baseline; gap: 10px; }
.sidebar-logo-mark { display: none; }
.sidebar-logo-text { font-family: var(--serif); font-size: 22px; line-height: 1; letter-spacing: -0.01em; color: var(--ink); }
.sidebar-logo-sub { font-family: var(--mono); font-size: 9px; text-transform: uppercase; letter-spacing: 0.14em; color: var(--dimmer); margin-top: 7px; }

.sidebar-find {
  display: block; width: calc(100% - 24px); margin: 8px 12px 2px;
  font-family: var(--font); font-size: 12.5px; color: var(--ink);
  background: var(--bg); border: 1px solid var(--line); border-radius: 3px; padding: 6px 9px;
}
.sidebar-find::placeholder { color: var(--faint); }
.sidebar-find:focus { outline: none; border-color: var(--dimmer); }

.sidebar-nav { padding: 4px 10px 20px; flex: 1; }
.sidebar-section-header {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--dimmer);
  padding: 16px 10px 6px;
}
.sidebar-section-header.clickable {
  display: flex; align-items: center; gap: 6px; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
}
.sidebar-section-header.clickable:hover { color: var(--ink); }
.sidebar-section-header .chev { transition: transform 0.2s var(--ease); display: inline-block; font-size: 8px; }
.sidebar-section-header[aria-expanded="false"] .chev { transform: rotate(-90deg); }
.sidebar-section-header:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--acc-line); border-radius: 2px; }
.sidebar-group[hidden] { display: none; }
.sidebar-subhead,
.sidebar-subheader {
  font-family: var(--mono); font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--dimmer); padding: 8px 10px 2px;
}

/* collapsible groups — chevron rotates open; state persisted by shared.js */
details.sidebar-group > summary {
  cursor: pointer; list-style: none;
  display: flex; align-items: center; gap: 7px; user-select: none;
  padding: 12px 10px 6px;
}
details.sidebar-group > summary::-webkit-details-marker { display: none; }
details.sidebar-group > summary::before {
  content: '\25B8'; font-size: 9px; color: var(--faint);
  transition: transform 0.16s var(--ease);
}
details.sidebar-group[open] > summary::before { transform: rotate(90deg); }
details.sidebar-group > summary:hover { color: var(--ink); }
details.sidebar-group > summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--acc-line); border-radius: 2px; }
details.sidebar-group .sidebar-item { padding-left: 22px; }
details.sidebar-group details.sidebar-group .sidebar-item { padding-left: 34px; }

.sidebar-item {
  display: flex; align-items: center; width: 100%;
  background: none; border: none; cursor: pointer; text-align: left;
  font-family: var(--font); font-size: 13px; color: var(--dim);
  padding: 6px 10px; border-radius: 3px; margin: 1px 0;
  transition: background 0.14s var(--ease), color 0.14s var(--ease);
}
/* THE 2PX RAIL — invisible on inactive items so text never shifts */
.sidebar-item::before {
  content: ""; width: 2px; height: 14px; border-radius: 1px;
  margin: 0 9px 0 -3px; flex: none; background: transparent;
}
.sidebar-item:hover { background: var(--panel2); color: var(--ink); }
.sidebar-item.active { background: var(--panel2); color: var(--ink); font-weight: 600; }
.sidebar-item.active::before { background: var(--ink); }
.sidebar-item:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--acc-line); }
.sidebar-item[hidden] { display: none; }
.sidebar-item .item-count {
  margin-left: auto; font-family: var(--mono); font-size: 9.5px; color: var(--faint);
  font-variant-numeric: tabular-nums;
}
.sidebar-nav.filtering details.sidebar-group { open: true; }
.sidebar-nav.filtering .sidebar-section-header:not(summary),
.sidebar-nav.filtering .sidebar-subhead { display: none; }

.sidebar-foot {
  padding: 12px 14px 16px; border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  font-family: var(--mono); font-size: 9.5px; color: var(--faint); letter-spacing: 0.06em;
}
.theme-toggle {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim); background: none; border: 1px solid var(--line); border-radius: 3px;
  padding: 5px 9px; cursor: pointer; display: inline-flex; align-items: center; gap: 7px;
}
.theme-toggle:hover { color: var(--ink); border-color: var(--dimmer); }
.theme-toggle .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink); display: inline-block; }

/* ------------------------------------------------------------ topbar (paper, hairline) */
.topbar {
  position: sticky; top: 0; z-index: 50; height: 48px; flex: none;
  display: flex; align-items: center; gap: 14px; padding: 0 28px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.topbar .crumb { font-family: var(--mono); font-size: 11.5px; color: var(--dimmer); letter-spacing: 0.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .crumb b { color: var(--ink); font-weight: 600; }
.topbar .crumb .sep { margin: 0 8px; color: var(--faint); }
.topbar .spacer { flex: 1; }
.cost-readout {
  font-family: var(--mono); font-size: 10.5px; color: var(--dimmer);
  font-variant-numeric: tabular-nums; letter-spacing: 0.03em;
  display: inline-flex; align-items: center; gap: 6px;
}
.cost-readout span { color: var(--faint); letter-spacing: 0.1em; text-transform: uppercase; font-size: 9px; }
.session-cost {
  font-family: var(--mono); font-size: 10.5px; color: var(--dimmer);
  letter-spacing: 0.03em; font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: baseline; gap: 6px; white-space: nowrap;
}
.session-cost span { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.health-badge {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 3px;
  background: transparent; border: 1px solid var(--line); color: var(--dimmer);
  display: inline-flex; align-items: center; gap: 6px;
}
.health-badge::before { content: "●"; font-size: 8px; }
.health-badge.ok { color: var(--good); }
.health-badge.err { color: var(--bad); }
.health-badge.warn { color: var(--flag); }

/* mobile nav toggle + scrim */
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  color: var(--ink); font-size: 19px; line-height: 1; padding: 4px 8px;
  margin-right: auto; border-radius: 3px;
}
.nav-toggle:hover { background: var(--panel2); }
.nav-toggle:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--acc-line); }
.sidebar-backdrop {
  display: none; position: fixed; inset: 0; z-index: 90;
  background: var(--scrim);
}
.sidebar-backdrop.show { display: block; }

/* ------------------------------------------------------------ product dropdown (legacy topbar switcher, hidden) */
.product-dropdown { position: relative; }
.product-dropdown-btn { display: flex; align-items: baseline; gap: 8px; padding: 4px 10px; background: none; border: 1px solid transparent; border-radius: 3px; cursor: pointer; }
.product-dropdown-btn:hover { border-color: var(--line); background: var(--panel2); }
.product-dropdown-name { font-family: var(--serif); font-size: 20px; font-weight: 400; color: var(--ink); }
.product-dropdown-sub, .product-dropdown-hint { font-family: var(--mono); font-size: 9px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.08em; }
@keyframes hint-pulse { 0%, 100% { color: var(--faint); } 50% { color: var(--dim); } }
.product-dropdown-hint.pulse { animation: hint-pulse 1.5s ease-in-out 2; }
.product-dropdown-chevron { font-size: 8px; color: var(--faint); }
.product-dropdown-menu { display: none; position: absolute; top: calc(100% + 4px); left: 0; min-width: 190px; border-radius: 3px; border: 1px solid var(--line); background: var(--panel); z-index: 100; overflow: hidden; }
.product-dropdown.open .product-dropdown-menu { display: block; }
.product-dropdown-item { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; cursor: pointer; }
.product-dropdown-item:hover { background: var(--panel2); }
.product-dropdown-item.active { background: var(--panel2); }
.product-dropdown-item-name { font-size: 13px; font-weight: 600; color: var(--dim); }
.product-dropdown-item.active .product-dropdown-item-name { color: var(--ink); }
.product-dropdown-item-sub { font-family: var(--mono); font-size: 8px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.product-dropdown-item-check { font-size: 12px; color: var(--ink); opacity: 0; }
.product-dropdown-item.active .product-dropdown-item-check { opacity: 1; }
.mode-toggle { display: none !important; }
.product-switcher { display: none !important; }


/* ------------------------------------------------------------ app accent = ink
   Inside the app the interactive accent is the ink itself; slate lives only in
   the chart ramp (--s2). Matches the theme blocks' specificity so it wins. */
:root, :root[data-theme="dark"], :root:not([data-theme="light"]) {
  --acc: var(--ink);
  --acc-soft: color-mix(in srgb, var(--ink) 9%, transparent);
  --acc-line: color-mix(in srgb, var(--ink) 40%, transparent);
  --line-2: var(--line2);
}

/* ------------------------------------------------------------ headings + labels */
.section-title { font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); line-height: 1.15; }
.section-sub { font-size: 12.5px; color: var(--ink-3); margin-top: 2px; max-width: 72ch; }
.view-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 4px; }
.view-head .spacer { flex: 1; }

.panel-label {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-3); margin: 26px 0 12px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.panel-label.compact { margin: 18px 0 8px; }
.panel-label .note { font-weight: 400; letter-spacing: 0.04em; color: var(--ink-4); text-transform: none; font-size: 10px; }
.panel-label .rule { flex: 1; height: 1px; background: var(--line); min-width: 20px; }

/* eyebrow — the in-card mono label (same recipe as kpi-label, reusable anywhere) */
.eyebrow {
  font-family: var(--mono); font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3);
}

/* small era annotations */
.era-tag { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
.pmx-era-note { color: var(--ink-4); }

/* ------------------------------------------------------------ buttons */
.btn {
  font-family: var(--font); font-size: 13px; font-weight: 600;
  padding: 8px 14px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
              box-shadow 0.2s var(--ease), transform 0.12s var(--ease), color 0.16s var(--ease);
}
.btn:hover { border-color: var(--ink-4); box-shadow: var(--sh-sm); }
.btn:active { transform: translateY(0) scale(0.98); transition-duration: 0.05s; }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.btn-sm { font-size: 12px; padding: 6px 11px; }
.btn-primary { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.btn-primary:hover { background: var(--warm); border-color: var(--warm); }
.btn-success { background: var(--ok); border-color: var(--ok); color: var(--bg); }
.btn-success:hover { filter: brightness(1.05); }
.btn-danger { background: var(--err-bg); border-color: rgba(196,69,63,0.32); color: var(--err); }
.btn-danger:hover { background: var(--err); border-color: var(--err); color: var(--bg); }
.btn-ghost { background: var(--surface-2); border-color: var(--line); color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface); color: var(--ink); }
.btn:disabled, .btn.is-running { cursor: progress; opacity: 0.85; }
.btn:disabled { cursor: not-allowed; opacity: 0.45; transform: none; box-shadow: none; }
.btn.is-running {
  opacity: 0.85;
  background-image: linear-gradient(100deg, transparent 20%, var(--panel2) 50%, transparent 80%);
  background-size: 200% 100%; animation: shimmer 1.1s linear infinite;
}

/* quiet text button (persona "clear", etc.) */
.btn-clear {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--ink-3); padding: 2px 6px;
  border-radius: var(--r-xs); transition: color 0.16s var(--ease);
}
.btn-clear:hover { color: var(--err); }
.btn-clear:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }

/* IG pipeline step button — small fog button */
.step-btn {
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 6px 12px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
  transition: background 0.16s var(--ease), border-color 0.16s var(--ease),
              box-shadow 0.2s var(--ease), transform 0.12s var(--ease);
}
.step-btn:hover:not(:disabled) { border-color: var(--ink-4); box-shadow: var(--sh-sm); }
.step-btn:active:not(:disabled) { transform: translateY(0) scale(0.98); }
.step-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.step-btn:disabled { opacity: 0.45; cursor: not-allowed; }

/* quick actions (fog) */
.quick-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 24px; }
.quick-action-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-family: var(--font); font-size: 13px; font-weight: 500;
  padding: 9px 15px; border-radius: var(--r-sm); cursor: pointer; box-shadow: var(--sh-sm);
  transition: background 0.16s var(--ease), transform 0.14s var(--ease), box-shadow 0.2s var(--ease);
}
.quick-action-btn:hover { box-shadow: var(--sh); }
.quick-action-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.qa-icon { color: var(--acc); font-size: 15px; display: inline-flex; }

/* disclosure link (inline "why" toggles) */
.disclose {
  font-family: var(--mono); font-size: 10.5px; color: var(--acc); background: none; border: none;
  cursor: pointer; padding: 2px 0; letter-spacing: 0.04em;
}
.disclose:hover { text-decoration: underline; }
.disclose:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); border-radius: 3px; }

/* library detail back link */
.detail-back {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  text-transform: uppercase; letter-spacing: 0.08em; cursor: pointer;
  background: none; border: none; margin-bottom: 18px; padding: 2px 0;
  border-radius: var(--r-xs); transition: color 0.16s var(--ease);
}
.detail-back:hover { color: var(--acc); }
.detail-back:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }

/* ------------------------------------------------------------ badges */
.badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: var(--pill); white-space: nowrap; border: none;
}
.badge-blue   { background: var(--info-bg);   color: var(--info); }
.badge-green  { background: var(--ok-bg);     color: var(--ok); }
.badge-yellow { background: var(--warn-bg);   color: var(--warn); }
.badge-gray   { background: var(--panel2); color: var(--ink-2); }
.badge-red    { background: var(--err-bg);    color: var(--err); }
.badge-purple { background: var(--purple-bg); color: var(--purple); }
.badge-orange { background: var(--flag-soft); color: var(--flag); }

/* status-badge — RUNTIME-COMPOSED: 'status-badge ' + statusClass.
   Base carries the gray tint; every statusClass in the JS gets a rule below. */
.status-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: var(--pill); white-space: nowrap; border: none;
  background: var(--panel2); color: var(--ink-2);
}

/* step-status — the pipeline chip, composed 'step-status status-{state}' */
.step-status {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 3px 8px; border-radius: var(--pill); white-space: nowrap; border: none;
  background: var(--panel2); color: var(--ink-2);
}

/* status tint map (works on .status-badge, .step-status and .lib-status):
   library.js: draft/slides_ready/overlaid/posted/tracked/failed
   metrics.js: posted/failed · pipeline/persona: pending/ready/running/complete/error */
.status-draft        { background: var(--info-bg);          color: var(--info); }
.status-slides_ready { background: var(--purple-bg);        color: var(--purple); }
.status-overlaid     { background: var(--acc-soft-2);       color: var(--acc); }
.status-posted       { background: var(--ok-bg);            color: var(--ok); }
.status-tracked      { background: var(--ok-bg);            color: var(--ok); }
.status-complete     { background: var(--ok-bg);            color: var(--ok); }
.status-failed       { background: var(--err-bg);           color: var(--err); }
.status-error        { background: var(--err-bg);           color: var(--err); }
.status-running      { background: var(--warn-bg);          color: var(--warn); }
.status-ready        { background: var(--info-bg);          color: var(--info); }
.status-pending      { background: var(--panel2);  color: var(--ink-3); }

/* state chip — 3px rail = state; recolor border-left-color per state */
.state-chip {
  display: inline-flex; align-items: center; font-family: var(--mono); font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r-xs); padding: 2px 8px;
}

/* persona/category chip — 7px dot = category */
.persona-chip {
  display: inline-flex; align-items: center; gap: 6px; font-family: var(--mono); font-size: 10px;
  font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 2px 9px 2px 7px;
}
.persona-chip .dot { width: 7px; height: 7px; border-radius: 50%; flex: none; display: block; }
.persona-chip .sec { color: var(--ink-4); font-weight: 400; }

/* analytics origin badges */
.pipeline-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 8.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: var(--pill);
  background: var(--acc-soft); color: var(--acc);
}
.manual-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 8.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-3);
}
.persona-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 8.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 1px 6px; border-radius: var(--pill);
}

/* content tags */
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 6px; }
.tag {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 1px 7px;
}

/* run-state dot (evolution cycle) */
.cycle-dot {
  width: 10px; height: 10px; border-radius: 50%; display: inline-block;
  background: var(--acc);
  box-shadow: 0 0 0 0 var(--acc-ring);
  animation: cycle-pulse 1.6s infinite;
}
@keyframes cycle-pulse {
  0%   { box-shadow: 0 0 0 0 var(--acc-ring); }
  70%  { box-shadow: 0 0 0 10px rgba(93,85,224,0); }
  100% { box-shadow: 0 0 0 0 rgba(93,85,224,0); }
}
.cycle-dot.done { background: var(--ok); animation: none; }
.cycle-dot.failed { background: var(--err); animation: none; }

/* ------------------------------------------------------------ chips, pills, segmented */
.chip {
  font-family: var(--font); font-size: 12px; color: var(--ink-2);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--pill);
  padding: 5px 12px; cursor: pointer;
  transition: background 0.14s var(--ease), color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.chip:hover { background: var(--surface-2); color: var(--ink); }
.chip.active, .chip[aria-pressed="true"] { background: var(--acc); border-color: var(--acc); color: var(--bg); font-weight: 600; }
.chip:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.chip .n { font-family: var(--mono); font-size: 10px; opacity: 0.75; margin-left: 5px; font-variant-numeric: tabular-nums; }

/* segmented control — the selected segment lifts OUT of the inset track.
   .seg is canonical; .pill-group/.pill and .period-row/.period-btn are exact
   aliases for markup that already uses those names. One idiom, three spellings. */
.seg, .pill-group, .period-row {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 2px; gap: 2px;
  width: fit-content; flex-wrap: wrap;
}
.seg button, .pill-group .pill, .period-btn {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3); background: none; border: none;
  padding: 5px 13px; border-radius: var(--pill); cursor: pointer;
  transition: background 0.16s var(--ease), color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.seg button:hover, .pill-group .pill:hover, .period-btn:hover { color: var(--ink); }
.seg button[aria-pressed="true"], .seg button.active,
.pill-group .pill[aria-pressed="true"], .pill-group .pill.active,
.period-btn.active {
  background: var(--surface); color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}
.seg button:focus-visible, .pill-group .pill:focus-visible, .period-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }

.switch { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; user-select: none; }
.switch input { width: 15px; height: 15px; accent-color: var(--acc); cursor: pointer; }

/* ------------------------------------------------------------ inputs + filters */
.input, .select-input, .library-search {
  font-family: var(--font); font-size: 13.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 12px; width: 100%;
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.select-input { cursor: pointer; width: auto; min-width: 140px; -webkit-appearance: none; appearance: none; }
.library-search { width: auto; min-width: 200px; }
.input::placeholder, .library-search::placeholder { color: var(--ink-4); }
.input:focus, .select-input:focus, .library-search:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-ring); }
textarea.input { resize: vertical; line-height: 1.6; }

.filter-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.filter-count { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.field-label { font-family: var(--mono); font-size: 9.5px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); }
.input-bar { display: flex; gap: 10px; align-items: center; margin-bottom: 16px; }
.input-bar .input { flex: 1; }
.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); }
.checkbox-row:hover { background: var(--surface-2); }
.checkbox-row input { accent-color: var(--acc); width: 15px; height: 15px; }
.tiktok-acct-cb { accent-color: var(--acc); width: 14px; height: 14px; }

/* pipeline control rows (labels above selects) */
.controls-row, .p-controls-row {
  display: flex; gap: 12px; align-items: flex-end; margin-bottom: 24px; flex-wrap: wrap;
}
.control-group label, .p-control-group label {
  display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 6px;
}

/* ------------------------------------------------------------ KPI tiles (analytics-density, 6→4→2 ladder) */
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 24px; }
.kpi-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 11px 13px 12px; box-shadow: var(--sh-sm);
  transition: box-shadow 0.25s var(--ease), transform 0.2s var(--ease), border-color 0.2s var(--ease);
  min-width: 0; display: flex; flex-direction: column;
}
/* deliberate shadow re-tier: many small tiles at --sh-sm with a 1px lift.
   Content cards keep the full --sh / -2px / --sh-md. This is the ONE exception. */
.kpi-card:hover { box-shadow: var(--sh); border-color: var(--line); }
.kpi-label {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); display: flex; align-items: baseline; gap: 6px;
}
.kpi-row { display: flex; align-items: baseline; gap: 8px; margin-top: 5px; flex-wrap: wrap; }
.kpi-value {
  font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: 0;
  font-variant-numeric: tabular-nums; color: var(--ink); line-height: 1.1; margin-top: 5px;
}
.kpi-row .kpi-value { margin-top: 0; }
.kpi-sub { font-size: 11px; color: var(--ink-3); margin-top: 4px; line-height: 1.4; }
.kpi-sub.derived { color: var(--ink-4); }
.kpi-sub .win { font-family: var(--mono); font-size: 9px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-4); }
/* sparkline slot reserved on EVERY tile, pinned to the card floor */
.kpi-spark { margin-top: auto; padding-top: 7px; height: 22px; }

/* pending strip (fog) */
.pending-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pending-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 13px 16px; display: flex;
  align-items: center; justify-content: space-between; box-shadow: var(--sh-sm);
}
.pending-label { font-size: 12.5px; color: var(--ink-2); }
.pending-count {
  font-family: var(--mono); font-weight: 700; font-size: 16px;
  color: var(--acc); font-variant-numeric: tabular-nums;
}

/* ------------------------------------------------------------ delta chip (color-coded numbers) */
/* a 3px rail + glyph + mono tabular ink. Direction never rides color alone. */
.delta {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums; color: var(--ink-2);
  padding-left: 6px; border-left: 3px solid var(--ink-4); line-height: 1.3;
}
.delta .g { font-size: 8px; line-height: 1; }
.delta.up   { color: var(--delta-up);   border-left-color: var(--delta-up); }
.delta.dn   { color: var(--delta-dn);   border-left-color: var(--delta-dn); }
.delta.flat { color: var(--delta-flat); border-left-color: var(--delta-flat); }
.delta-lg { font-size: 12px; padding-left: 9px; border-left-width: 3px; }
.delta .vs { color: var(--ink-4); font-weight: 400; letter-spacing: 0.06em; font-size: 9px; text-transform: uppercase; }

/* ------------------------------------------------------------ hero number (exactly one per view) */
.hero { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; }
.hero-num {
  font-family: var(--serif); font-size: clamp(38px, 3.2vw, 50px); font-weight: 400;
  letter-spacing: -0.01em; line-height: 0.95; color: var(--ink);
  font-variant-numeric: proportional-nums;
}
.hero-unit {
  font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  color: var(--ink-3); padding-bottom: 5px;
}
.hero-side { display: flex; flex-direction: column; gap: 3px; padding-bottom: 4px; }
.hero-note { font-size: 12.5px; color: var(--ink-2); margin-top: 10px; max-width: 62ch; }

/* ------------------------------------------------------------ chart cards */
.chart-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh); padding: 14px 16px 8px; min-width: 0; position: relative;
}
.chart-card.lead { padding: 18px 20px 10px; }
.chart-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-head .spacer { flex: 1; min-width: 8px; }
.chart-title { font-size: 13px; font-weight: 650; color: var(--ink); }
/* legacy markup puts the title directly in the card (no .chart-head wrapper) */
.chart-card > .chart-title { margin-bottom: 10px; }
.chart-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-3); letter-spacing: 0.04em; margin-top: 2px; }
.chart-foot {
  font-family: var(--mono); font-size: 9.5px; color: var(--ink-4); letter-spacing: 0.05em;
  padding: 4px 0 6px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center;
}
.chart-foot .warnmark { color: var(--warn); }
.plot-host { width: 100%; min-width: 0; position: relative; }

/* legacy plot well — keeps its 200px height role */
.chart-wrap { position: relative; height: 200px; min-width: 0; }
.chart-wrap canvas { max-width: 100%; }

/* legacy two-up chart grid */
.charts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 24px; }

/* small multiples + lede */
.sm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: 12px; align-items: start; }
.lede-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; }

/* legend (fog chips, 3px rail key; doubles as series toggle) */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.legend-item {
  display: inline-flex; align-items: center; gap: 7px; background: none; border: none;
  font-family: var(--font); font-size: 11.5px; color: var(--ink-2); cursor: pointer;
  padding: 3px 2px; border-radius: var(--r-xs);
  transition: color 0.16s var(--ease), opacity 0.16s var(--ease);
}
.legend-key { width: 3px; height: 13px; border-radius: var(--pill); flex: none; }
.legend-item:hover { color: var(--ink); }
.legend-item.off { color: var(--ink-4); }
.legend-item.off .legend-key { background: var(--s-dim) !important; }
.legend-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.legend-item .lv { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* shared tooltip node (one per page) */
#viz-tip {
  position: fixed; z-index: 340; pointer-events: none; opacity: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  box-shadow: var(--sh-md); padding: 9px 11px; min-width: 152px; max-width: 260px;
  transition: opacity 0.12s var(--ease);
}
#viz-tip.on { opacity: 1; }
.tip-head { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-4); margin-bottom: 6px; }
.tip-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tip-key { width: 10px; height: 2px; border-radius: var(--pill); flex: none; }
.tip-name { font-size: 11px; color: var(--ink-3); flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tip-val { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
.tip-note { font-size: 10.5px; color: var(--ink-4); margin-top: 5px; font-style: italic; }

/* chart-shaped skeleton — a loading chart occupies its own space */
.plot-skel { height: 190px; position: relative; overflow: hidden; border-radius: var(--r-xs);
  background:
    linear-gradient(var(--line-2) 1px, transparent 1px) 0 24px / 100% 42px,
    linear-gradient(90deg, var(--surface-2), var(--surface-2));
}
.plot-skel::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, transparent 20%, var(--panel2) 50%, transparent 80%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}

/* legacy skeleton system (shared.js startSkel/endSkel) */
.skel {
  display: inline-block; vertical-align: middle; border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--line-2) 25%, var(--surface-2) 37%, var(--line-2) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.4s ease infinite;
}
@keyframes skel-shimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.chart-wrap.skel-chart { position: relative; }
.chart-wrap.skel-chart canvas { visibility: hidden; }
.chart-wrap.skel-chart::before {
  content: ''; position: absolute; inset: 0; border-radius: var(--r-xs);
  background: linear-gradient(90deg, var(--line-2) 25%, var(--surface-2) 37%, var(--line-2) 63%);
  background-size: 400% 100%;
  animation: skel-shimmer 1.4s ease infinite;
}

/* correlation pills (under multi-series charts) */
.corr-strip { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.corr-pill {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.04em; color: var(--ink-2);
  background: var(--surface-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r-xs); padding: 3px 8px; font-variant-numeric: tabular-nums;
}

/* bullet micro-viz in a numeric cell — both halves FIXED WIDTH */
.bullet-wrap { display: flex; align-items: center; gap: 9px; justify-content: flex-end; }
.bullet-track { width: 54px; height: 3px; border-radius: var(--pill); background: var(--acc-soft-2); flex: none; overflow: hidden; }
.bullet-fill { height: 3px; border-radius: var(--pill); background: var(--acc); display: block; }
.bullet-wrap .v { min-width: 4.6em; text-align: right; flex: none; }

/* ------------------------------------------------------------ cards */
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.cards-grid.wide    { grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.cards-grid.reading { grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; align-items: start; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--sh); min-width: 0;
  display: flex; flex-direction: column;
  transition: box-shadow 0.25s var(--ease), transform 0.25s var(--ease), border-color 0.2s var(--ease);
}
.card:hover { box-shadow: var(--sh-md); border-color: var(--line); }
.card-head { display: flex; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 6px; }
.card-head .spacer { flex: 1; min-width: 8px; }
.card-title { font-size: 14px; font-weight: 650; color: var(--ink); line-height: 1.35; }
.card-meta { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); }
.card-row { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; }
.card-body { font-size: 13px; color: var(--ink-2); line-height: 1.6; margin-top: 8px; }
.card-foot { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line-2); }
.cards-grid.wide .card-foot { margin-top: auto; }  /* actions line up across a stretched row */
.card-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.card-thumbs { display: flex; gap: 6px; margin: 12px 0; }
.card-thumb { width: 46px; height: 46px; border-radius: var(--r-xs); object-fit: cover; border: 1px solid var(--line); }
.card-thumb-more { width: 46px; height: 46px; border-radius: var(--r-xs); background: var(--surface-inset); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* App Store competitor card — "ours" is state: it rides the 3px rail */
.asc-card.ours { border-left: 3px solid var(--acc); }

/* ------------------------------------------------------------ tables */
.table-wrap {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); box-shadow: var(--sh-sm); overflow: hidden;
}
.table-scroll { overflow: auto; max-height: 440px; }
table { width: 100%; border-collapse: collapse; }
thead th {
  text-align: left; font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
  padding: 10px 12px; white-space: nowrap;
  position: sticky; top: 0; background: var(--panel2); z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}
tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line-2); font-size: 13px; color: var(--ink); vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }

/* dense variant — numbers that must line up */
.table-dense thead th { padding: 8px 10px; font-size: 9.5px; }
.table-dense tbody td { padding: 6px 10px; font-size: 12.5px; line-height: 1.45; vertical-align: middle; }
.table-dense tbody tr { transition: background 0.14s var(--ease); }
.table-dense tbody tr:hover { background: var(--surface-2); }
td.num, th.num { font-family: var(--mono); font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
th.num { font-size: 9.5px; }
td.num.muted { color: var(--ink-4); }
td.mono { font-family: var(--mono); font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
td.mono.wrap { white-space: normal; line-height: 1.4; max-width: 210px; }
/* Competitor Accounts: the notes column is prose; give it room and let the table scroll instead of the page */
.comp-accounts { min-width: 1180px; }
.comp-accounts td.mono.wrap { max-width: 360px; }
td.mono .note { display: block; color: var(--ink-4); font-size: 10px; letter-spacing: 0.02em; }

/* 2px --acc-ring = today, on the most recent row of a time-ordered table */
.table-dense tbody tr.is-today td { box-shadow: inset 0 2px 0 -1px var(--acc-ring), inset 0 -2px 0 -1px var(--acc-ring); }
.table-dense tbody tr.is-today td:first-child { box-shadow: inset 0 2px 0 -1px var(--acc-ring), inset 0 -2px 0 -1px var(--acc-ring), inset 2px 0 0 -1px var(--acc-ring); color: var(--acc); }
.table-dense tbody tr.is-today td:last-child { box-shadow: inset 0 2px 0 -1px var(--acc-ring), inset 0 -2px 0 -1px var(--acc-ring), inset -2px 0 0 -1px var(--acc-ring); }

/* expandable rows */
tbody tr.expandable { cursor: pointer; transition: background 0.14s var(--ease); }
tbody tr.expandable:hover { background: var(--surface-2); }
tr.expandable:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--acc-ring); }
tbody tr.clickable-row { cursor: pointer; transition: background 0.14s var(--ease); }
tbody tr.clickable-row:hover td { background: var(--surface-2); }
tr.expanded > td { background: var(--surface-2); }
.row-caret { display: inline-block; width: 10px; color: var(--ink-4); font-size: 9px; transition: transform 0.16s var(--ease); }
tr.expandable[aria-expanded="true"] .row-caret { transform: rotate(90deg); color: var(--acc); }

/* detail rows.
   ⚠ BEHAVIOR CONTRACT: Kansara's togglePostDetail() INSERTS/REMOVES
   .detail-row nodes and never adds .open — so bare .detail-row must stay
   visible. Only .source-detail-row (fog markup) uses the class toggle. */
.source-detail-row { display: none; }
.detail-row.open, .source-detail-row.open { display: table-row; }
.detail-row > td, .source-detail-row.open > td { background: var(--surface-2); }
.detail-grid, .source-meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; padding: 6px 2px; }
.detail-field-label { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); }
.detail-field-value { font-size: 13px; color: var(--ink); margin-top: 2px; word-break: break-word; }
.detail-full { grid-column: 1 / -1; }

/* legacy cost table */
.cost-table { width: 100%; border-collapse: collapse; }
.cost-table th {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
  padding: 8px 10px; text-align: left; white-space: nowrap;
  position: sticky; top: 0; background: var(--panel2); z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}
.cost-table td {
  font-family: var(--mono); font-size: 11.5px; color: var(--ink-2);
  padding: 7px 10px; border-bottom: 1px solid var(--line-2);
  font-variant-numeric: tabular-nums;
}
.cost-table tr:last-child td { border-bottom: none; }
.cost-table tbody tr { transition: background 0.14s var(--ease); }
.cost-table tr:hover td { background: var(--surface-2); }

/* legacy analytics table */
.ig-table { width: 100%; border-collapse: collapse; }
.ig-table th {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3);
  padding: 8px 8px; text-align: left; white-space: nowrap;
  position: sticky; top: 0; background: var(--panel2); z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line);
}
.ig-table td {
  font-size: 12px; color: var(--ink-2); padding: 8px 8px;
  border-bottom: 1px solid var(--line-2); font-variant-numeric: tabular-nums;
  vertical-align: middle;
}
.ig-table tbody tr { transition: background 0.14s var(--ease); }
.ig-table tr:hover td { background: var(--surface-2); }
.ig-table tr.detail-row td { padding: 0; border-bottom: 1px solid var(--line); background: var(--surface-2); }
.ig-table tr.detail-row .detail-inner { padding: 14px 20px; }
.detail-inner { padding: 14px 20px; }

/* expanded-post metric cells (inside detail rows) */
.detail-metric {
  background: var(--surface); border: 1px solid var(--line-2);
  border-radius: var(--r-sm); padding: 10px 12px; text-align: center; min-width: 0;
}
.dm-value, .detail-metric .dm-value {
  font-family: var(--mono); font-size: 17px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.01em;
}
.dm-label, .detail-metric .dm-label {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3); margin-top: 2px;
}
.detail-metric-label {
  font-family: var(--mono); font-size: 9.5px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 4px;
}
.detail-metric-value {
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.detail-metrics-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }

/* engagement mini-bars inside detail rows */
.detail-bar-row { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.detail-bar-label { font-size: 10.5px; color: var(--ink-3); min-width: 70px; }
.detail-bar { height: 8px; border-radius: var(--pill); min-width: 2px; transition: width 0.3s var(--ease); }
.detail-bar-value { font-family: var(--mono); font-size: 10.5px; color: var(--ink-3); min-width: 40px; font-variant-numeric: tabular-nums; }

/* brand weekly reports table rows */
.arc-r-open > td { background: var(--surface-2); }
.arc-r-detail > td { background: var(--surface-2); }

/* evolution posts comparison table */
.evo-posts-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.evo-posts-table th {
  text-align: left; padding: 7px 8px; font-family: var(--mono); font-size: 9.5px;
  text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-3); font-weight: 600;
  position: sticky; top: 0; background: var(--panel2); z-index: 2;
  box-shadow: inset 0 -1px 0 var(--line); cursor: pointer; user-select: none;
  transition: color 0.14s var(--ease);
}
.evo-posts-table th:hover { color: var(--ink); }
.evo-posts-table th .sort-arrow { margin-left: 4px; font-size: 8px; color: var(--acc); }
.sort-arrow { font-size: 8px; color: var(--acc); }
.evo-posts-table td { padding: 6px 8px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.evo-posts-table tbody tr { transition: background 0.14s var(--ease); }
.evo-posts-table tr:hover { background: var(--surface-2); }
.evo-posts-table .var-cell { color: var(--acc); font-family: var(--mono); font-size: 10.5px; }
.evo-posts-table .metric-cell { font-family: var(--mono); font-size: 11.5px; font-variant-numeric: tabular-nums; }
.metric-cell { font-variant-numeric: tabular-nums; }
.evo-posts-table .cb-cell { width: 24px; text-align: center; }
.cb-cell input { accent-color: var(--acc); }

/* prose tables (markdown renderers) opt out of the sticky machinery */
.mkt-md thead th, .evo-markdown thead th, .chat-bubble thead th { position: static; box-shadow: none; z-index: auto; }

/* ------------------------------------------------------------ calendar header cells (home campaign calendar) */
.cal-header-cell {
  background: var(--surface-2); padding: 8px; text-align: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
}
.cal-gutter-head { font-size: 9px; color: var(--ink-4); }
/* the calendar page hides the unscheduled-content picker (campaign schedule
   only; Campaign 2 posting is manual). Remove to restore the browser. */
#cal-days + div { display: none !important; }

/* ------------------------------------------------------------ library: slideshow cards + gallery */
.gallery-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }
.library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
#arc-library-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }

.slide-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; cursor: pointer; box-shadow: var(--sh-sm); min-width: 0;
  transition: box-shadow 0.25s var(--ease), transform 0.22s var(--ease), border-color 0.2s var(--ease);
}
.slide-card:hover { box-shadow: var(--sh-md); border-color: var(--line); }
.slide-card-images { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line-2); }
.slide-card-images img {
  width: 100%; aspect-ratio: 1; object-fit: cover; display: block;
  filter: grayscale(0.25); transition: filter 0.2s var(--ease);
}
.slide-card:hover .slide-card-images img { filter: grayscale(0); }
.slide-card-body { padding: 13px 15px; }
.slide-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.slide-card-id { font-family: var(--mono); font-size: 9px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; }
.slide-card-hook {
  font-size: 12.5px; color: var(--ink); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 6px;
}
.slide-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 9px 15px; border-top: 1px solid var(--line-2);
}
.slide-card-date { font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.slide-card-cost { font-family: var(--mono); font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* research (TikTok trend discovery) */
.research-card { cursor: default; }
.research-thumb { position: relative; aspect-ratio: 9 / 16; background: var(--surface-inset); overflow: hidden; }
.research-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
/* CDN-blocked thumbnails show the slide count instead */
.research-thumb.research-noimg::after {
  content: attr(data-count);
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ink-3);
}
.research-imgcount {
  position: absolute; top: 6px; right: 6px;
  font-family: var(--mono); font-size: 10px; padding: 1px 7px;
  background: var(--panel); color: var(--ink); border: 1px solid var(--line); border-radius: var(--pill);
  font-variant-numeric: tabular-nums;
}
.research-stats {
  display: flex; flex-wrap: wrap; gap: 10px;
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  font-variant-numeric: tabular-nums; margin-bottom: 8px;
}
.research-views { color: var(--acc); font-weight: 700; }
.research-caption {
  font-size: 12.5px; color: var(--ink); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.research-ocr-text {
  margin-top: 10px; padding: 8px 10px;
  background: var(--surface-2); border-left: 3px solid var(--acc);
  border-radius: 0 var(--r-xs) var(--r-xs) 0;
  font-size: 11.5px; line-height: 1.5; color: var(--ink-2);
  white-space: pre-wrap; max-height: 160px; overflow-y: auto;
}

/* library detail view */
.detail-header { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.detail-title { font-family: var(--serif); font-style: italic; font-size: 26px; letter-spacing: -0.01em; color: var(--ink); }
.detail-slides { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-bottom: 22px; }
.detail-slide-wrap { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: var(--r-sm); }
.detail-slide-wrap img { width: 100%; display: block; }
.detail-slide-label {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(42,40,51,0.72);
  font-family: var(--mono); font-size: 9px; color: var(--bg);
  text-transform: uppercase; letter-spacing: 0.08em;
  padding: 4px 8px; text-align: center;
}
.detail-section { margin-bottom: 20px; }
.detail-label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 6px;
}
.detail-text { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.detail-text-muted { font-size: 12px; color: var(--ink-3); line-height: 1.5; }

/* ------------------------------------------------------------ pipeline (slideshow workflow) */
.pipeline-layout { display: grid; grid-template-columns: 1fr 220px; gap: 32px; align-items: start; }
.pipeline-steps { position: relative; }

.step-wrapper { position: relative; padding-left: 60px; margin-bottom: 10px; }
.step-node {
  position: absolute; left: 0; top: 2px;
  width: 44px; height: 44px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 15px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-3);
  z-index: 2; transition: all 0.2s var(--ease); box-shadow: var(--sh-sm);
}
.step-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--r); padding: 14px 16px; box-shadow: var(--sh-sm);
  min-height: 48px; display: flex; flex-direction: column; justify-content: center;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease), opacity 0.2s var(--ease);
}

/* step states — RUNTIME-COMPOSED: 'step-wrapper step-{state}'.
   State rides the node ring + the card's 3px rail. */
.step-pending .step-node { opacity: 0.5; }
.step-pending .step-card { opacity: 0.55; }
.step-ready .step-node { border-color: var(--ink-4); color: var(--ink-2); }
.step-ready .step-card { opacity: 1; }
.step-running .step-node { border-color: var(--acc); color: var(--acc); box-shadow: inset 0 0 0 1px var(--line); }
.step-running .step-card { border-left-color: var(--acc); box-shadow: var(--sh); }
.step-complete .step-node { background: var(--acc); border-color: var(--acc); color: var(--bg); }
.step-complete .step-card { border-left-color: var(--acc); }
.step-error .step-node { border-color: var(--err); color: var(--err); background: var(--err-bg); }
.step-error .step-card { border-left-color: var(--err); }

.step-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.step-title { font-size: 15px; font-weight: 650; color: var(--ink); }
.step-desc { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.step-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; }
.step-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

.step-result { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); display: none; }
.step-result.visible { display: block; animation: rise 0.3s var(--ease) both; }

.step-error-msg {
  display: none; margin-top: 12px; padding: 10px 14px;
  background: var(--err-bg); border: 1px solid rgba(196,69,63,0.3); border-left: 3px solid var(--err);
  border-radius: var(--r-sm); color: var(--err); font-size: 12px;
}
.step-error-msg.visible { display: block; }

/* IG-mode simple step rows */
.pipeline-step {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--sh-sm);
}
.step-number {
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px; border-radius: 50%; flex: none;
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-3);
  margin-right: 8px;
}

/* fog step-progress idiom (for swept workflows) */
.step-progress { display: flex; align-items: center; margin: 4px 0 22px; }
.step-num {
  width: 30px; height: 30px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-size: 12px; font-weight: 600;
  background: var(--surface); border: 1.5px solid var(--line); color: var(--ink-3);
  transition: all 0.2s var(--ease);
}
.step-label { font-size: 11px; color: var(--ink-3); }
.step-connector { flex: 1; height: 1.5px; background: var(--line); margin: 0 6px; transition: background 0.2s var(--ease); }
.step-connector.done { background: var(--acc); }

/* result display inside steps */
.result-section { margin-bottom: 12px; }
.result-label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 4px;
}
.result-text { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.result-text-sm { font-size: 11.5px; color: var(--ink-3); line-height: 1.5; }
.result-inset { background: var(--surface-2); border: 1px solid var(--line-2); border-radius: var(--r-sm); padding: 14px 16px; }
.result-img { width: 100%; max-height: 320px; object-fit: contain; background: var(--surface-inset); border-radius: var(--r-xs); }
.result-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-2); margin-bottom: 10px;
}

/* content picker drawer */
.step-picker {
  display: none; margin-top: 12px; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-sm);
}
.step-picker.open { display: block; animation: rise 0.2s var(--ease) both; }
.picker-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.picker-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
}
.picker-close {
  background: none; border: none; color: var(--ink-3); cursor: pointer;
  font-size: 16px; line-height: 1; padding: 2px 6px; border-radius: var(--r-xs);
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}
.picker-close:hover { color: var(--ink); background: var(--surface); }
.picker-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; max-height: 300px; overflow-y: auto; }
.picker-item {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xs);
  padding: 10px; cursor: pointer;
  transition: border-color 0.14s var(--ease), box-shadow 0.14s var(--ease);
}
.picker-item:hover { border-color: var(--acc); box-shadow: var(--sh-sm); }
.picker-item:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.picker-item-id { font-family: var(--mono); font-size: 9px; color: var(--ink-4); text-transform: uppercase; letter-spacing: 0.06em; }
.picker-item-text {
  font-size: 11.5px; color: var(--ink-2); margin-top: 3px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.picker-item-img { width: 100%; height: 80px; object-fit: cover; margin-bottom: 6px; background: var(--surface-inset); border-radius: var(--r-xs); }
.picker-empty {
  font-family: var(--mono); font-size: 10.5px; color: var(--ink-3);
  padding: 14px; text-align: center; text-transform: uppercase; letter-spacing: 0.06em;
}

/* pipeline cost sidebar */
.pipeline-sidebar { position: sticky; top: 76px; }
.sidebar-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--sh-sm);
}
.sidebar-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3);
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line-2);
}
.sidebar-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; padding: 4px 0; }
.sidebar-row-label { color: var(--ink-3); }
.sidebar-row-value { font-family: var(--mono); font-size: 11.5px; color: var(--ink); font-variant-numeric: tabular-nums; }
.sidebar-row-value.cost { color: var(--ink); font-weight: 600; }
.sidebar-divider { border: none; border-top: 1px solid var(--line-2); margin: 8px 0; }
.sidebar-total {
  display: flex; justify-content: space-between; align-items: baseline;
  padding-top: 10px; margin-top: 10px; border-top: 1px solid var(--line);
}
.sidebar-total-label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-2);
}
.sidebar-total-value {
  font-family: var(--mono); font-size: 19px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}

/* pipeline complete banner */
.pipeline-complete-card {
  display: none; background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--ok); border-radius: var(--r);
  padding: 24px; text-align: center; margin-top: 12px; box-shadow: var(--sh);
}
.pipeline-complete-card.visible { display: block; animation: rise 0.35s var(--ease) both; }
.pipeline-complete-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; color: var(--ok); margin-bottom: 6px; }
.pipeline-complete-sub { font-size: 12px; color: var(--ink-3); }

/* pending-jobs toast (pipeline.js showPjToast) */
#pj-toast {
  position: fixed; bottom: 26px; right: 26px; z-index: 10000;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-4);
  border-radius: var(--r); box-shadow: var(--sh-md); padding: 12px 16px;
  font-size: 12.5px; color: var(--ink); min-width: 220px; max-width: 360px;
  display: none;
}
#pj-toast.show { display: block; animation: rise 0.24s var(--ease) both; }
#pj-toast.success { border-left-color: var(--ok); }
#pj-toast.error { border-left-color: var(--err); }

/* pending-jobs edit modal (pipeline.js) */
#pj-modal {
  position: fixed; inset: 0; z-index: 9999; display: none;
  align-items: center; justify-content: center; padding: 24px;
  background: var(--scrim);
  }
#pj-modal.show { display: flex; animation: fade 0.2s var(--ease) both; }
.pj-modal-body {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  padding: 24px 28px; width: 90%; max-width: 600px; max-height: 85vh; overflow-y: auto;
  animation: sheet 0.3s var(--ease) both;
}
.pj-modal-title { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); margin-bottom: 16px; }
.pj-modal-field { margin-bottom: 12px; }
.pj-modal-label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 4px;
}
.pj-modal-input, .pj-modal-textarea {
  width: 100%; font-family: var(--font); font-size: 13px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 8px 12px;
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.pj-modal-input:focus, .pj-modal-textarea:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-ring); }
.pj-modal-textarea { resize: vertical; min-height: 60px; line-height: 1.6; }
.pj-modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }

/* ------------------------------------------------------------ persona pipeline */
.persona-row { display: flex; gap: 10px; margin-bottom: 24px; flex-wrap: wrap; }
.persona-card {
  flex: 1; min-width: 160px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; cursor: pointer; text-align: left;
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--sh-sm);
  font-family: var(--font);
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease), transform 0.14s var(--ease);
}
.persona-card:hover { border-color: var(--ink-4); box-shadow: var(--sh); }
.persona-card:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.persona-card.active,
.persona-card.selected {
  border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--line);
}
.persona-name { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.persona-name.zaya { color: var(--zaya); }
.persona-name.lumis { color: var(--lumis); }
.persona-name.vera { color: var(--vera); }
.persona-sub {
  font-family: var(--mono); font-size: 9.5px; color: var(--ink-3);
  margin-top: 2px; text-transform: uppercase; letter-spacing: 0.08em;
}
.persona-tags { display: flex; gap: 4px; margin-top: 10px; flex-wrap: wrap; }
.persona-tag {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 2px 7px;
}

/* persona history bits */
.p-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; }
.s-pill {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-2);
}
.s-pill.done { background: var(--ok-bg); color: var(--ok); }
.s-pill.proc { background: var(--purple-bg); color: var(--purple); }
.s-pill.fail { background: var(--err-bg); color: var(--err); }

/* persona reference-image tiles (mostly inline-styled by persona.js) */
.p-ref-tile { border-radius: var(--r-xs); }
.p-ref-tile img { border-radius: var(--r-xs); }
.p-ref-del, .p-ref-zoom { border-radius: var(--r-xs); }

/* persona library cards */
.lib-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  overflow: hidden; box-shadow: var(--sh-sm); min-width: 0;
  transition: box-shadow 0.25s var(--ease), transform 0.22s var(--ease), border-color 0.2s var(--ease);
}
.lib-card:hover { box-shadow: var(--sh-md); border-color: var(--line); }
.lib-card-img {
  width: 100%; height: 200px; object-fit: cover; display: block;
  background: var(--surface-inset);
  filter: grayscale(0.25); transition: filter 0.2s var(--ease);
}
.lib-card:hover .lib-card-img { filter: grayscale(0); }
.lib-card-body { padding: 13px 15px; }
.lib-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; }
.lib-card-persona { font-size: 13px; font-weight: 700; text-transform: capitalize; color: var(--ink); }
.lib-card-persona.zaya { color: var(--zaya); }
.lib-card-persona.lumis { color: var(--lumis); }
.lib-card-persona.vera { color: var(--vera); }
.lib-status {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-2);
}
.lib-card-hook {
  font-size: 12.5px; color: var(--ink); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-bottom: 6px;
}
.lib-card-body-text {
  font-size: 11.5px; color: var(--ink-3); line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
}
.lib-card-type {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line-2);
  border-radius: var(--pill); padding: 2px 7px;
}
.lib-card-footer {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 15px; border-top: 1px solid var(--line-2);
}
.lib-card-date { font-family: var(--mono); font-size: 10px; color: var(--ink-4); }
.lib-card-actions { display: flex; gap: 6px; }

/* persona analytics empty */
.ana-empty {
  text-align: center; padding: 44px 20px; color: var(--ink-3);
  font-family: var(--mono); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em;
}

/* persona media */
.mode-personas video { background: var(--surface-inset); border-radius: var(--r-xs); }

/* ------------------------------------------------------------ brand 5-pillar selector */
.arc-pillars { display: grid; grid-template-columns: repeat(5, 1fr); gap: 10px; margin-bottom: 16px; }
.arc-pillar {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 18px 12px 14px; cursor: pointer; text-align: center;
  overflow: hidden; box-shadow: var(--sh-sm);
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease), transform 0.14s var(--ease);
}
.arc-pillar::before {
  /* decorative top stripe in the pillar's realm color (category, not state) */
  content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--line); opacity: 0.7; transition: opacity 0.15s var(--ease);
}
.arc-pillar:hover { border-color: var(--ink-4); box-shadow: var(--sh); }
.arc-pillar:hover::before { opacity: 1; }
.arc-pillar:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.arc-pillar.active { border-color: var(--acc); box-shadow: inset 0 0 0 1px var(--line); }
.arc-pillar.active::before { opacity: 1; height: 4px; }
.arc-pillar-icon { font-size: 22px; line-height: 1; margin-bottom: 8px; opacity: 0.85; }
.arc-pillar-name {
  font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--ink);
  letter-spacing: 0.05em; text-transform: uppercase;
}
.arc-pillar-sub { font-size: 10.5px; color: var(--ink-3); margin-top: 4px; letter-spacing: 0.02em; }
/* per-realm stripe colors (brand category hues, kept) */
.arc-pillar-void::before       { background: var(--acc); }
.arc-pillar-mirror::before     { background: var(--line); }
.arc-pillar-bridge::before     { background: var(--flag); }
.arc-pillar-archetypes::before { background: var(--acc); }
.arc-pillar-world::before      { background: var(--dim); opacity: 0.4; }
.arc-pillar-world { opacity: 0.55; cursor: not-allowed; }
.arc-pillar-world:hover { border-color: var(--line); box-shadow: var(--sh-sm); transform: none; }

/* ------------------------------------------------------------ evolution */
.evo-status-msg { font-size: 11px; color: var(--ink-3); margin-left: 8px; display: inline-flex; align-items: center; gap: 6px; }
.evo-status-msg.success { color: var(--ok); }
.evo-status-msg.error { color: var(--err); }

.evo-section-header {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
  margin-bottom: 12px; display: flex; align-items: center; gap: 10px;
}

.evo-strategy-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 18px 20px; box-shadow: var(--sh);
}
.evo-strategy-version { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.evo-strategy-version-num {
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  color: var(--ink); letter-spacing: -0.02em; font-variant-numeric: tabular-nums;
}
.evo-strategy-version-badge {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  padding: 3px 8px; border-radius: var(--pill);
  background: var(--ok-bg); color: var(--ok);
}
.evo-rationale {
  font-size: 13px; color: var(--ink-2); line-height: 1.65;
  margin-bottom: 16px; padding-bottom: 16px; border-bottom: 1px solid var(--line-2);
}

.evo-weights-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.evo-weight-group-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-3); margin-bottom: 10px;
}
.evo-weight-item { margin-bottom: 6px; }
.evo-weight-item-label {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--ink-2); margin-bottom: 2px;
  font-variant-numeric: tabular-nums;
}
.evo-weight-item-track { height: 5px; background: var(--surface-inset); border-radius: var(--pill); overflow: hidden; }
.evo-weight-item-fill { height: 100%; border-radius: var(--pill); background: var(--acc); transition: width 0.4s var(--ease); }

/* legacy weight bars (strategy view) */
.weight-bar-container { margin-bottom: 8px; }
.weight-bar-label {
  display: flex; justify-content: space-between; gap: 8px;
  font-size: 11px; color: var(--ink-2); margin-bottom: 3px;
  font-variant-numeric: tabular-nums;
}
.weight-bar-track { height: 5px; background: var(--surface-inset); border-radius: var(--pill); position: relative; overflow: hidden; }
.weight-bar-fill { height: 100%; background: var(--acc); border-radius: var(--pill); transition: width 0.3s var(--ease); }

.evo-posting-times { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.evo-time-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.evo-time-pill {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 3px 9px; border-radius: var(--r-xs);
  background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2);
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}

/* memory stats */
.evo-memory-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.evo-memory-stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px 14px; text-align: center; box-shadow: var(--sh-sm);
}
.evo-memory-stat-value {
  font-family: var(--mono); font-size: 20px; font-weight: 700;
  color: var(--ink); font-variant-numeric: tabular-nums; letter-spacing: -0.02em;
}
.evo-memory-stat-label {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-3); margin-top: 4px;
}

/* lessons */
.lesson-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 13px 16px; margin-bottom: 6px; box-shadow: var(--sh-sm);
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.lesson-card:hover { border-color: var(--line); box-shadow: var(--sh); }
.evo-lesson-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--r); padding: 13px 16px; margin-bottom: 6px; box-shadow: var(--sh-sm);
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.evo-lesson-card:hover { box-shadow: var(--sh); }
.evo-lesson-card.high-conviction { border-left-color: var(--acc); }
.evo-lesson-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.evo-lesson-category-badge {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--acc);
  display: flex; align-items: center; gap: 4px;
}
.evo-lesson-evidence { font-family: var(--mono); font-size: 10px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.evo-lesson-insight-text { font-size: 13px; color: var(--ink-2); line-height: 1.55; margin-bottom: 8px; }

.evo-confidence-row { display: flex; align-items: center; gap: 8px; }
.evo-confidence-track { flex: 1; height: 4px; background: var(--surface-inset); border-radius: var(--pill); overflow: hidden; }
.evo-confidence-fill { height: 100%; border-radius: var(--pill); transition: width 0.3s var(--ease); background: var(--ink-4); }
.evo-confidence-fill.low  { background: var(--err); }
.evo-confidence-fill.mid  { background: var(--warn); }
.evo-confidence-fill.high { background: var(--ok); }
.evo-confidence-label {
  font-family: var(--mono); font-size: 10px; font-weight: 600; min-width: 32px;
  text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2);
}
.evo-confidence-label.low  { color: var(--err); }
.evo-confidence-label.mid  { color: var(--warn); }
.evo-confidence-label.high { color: var(--ok); }

.evo-category-breakdown { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.evo-category-chip {
  font-family: var(--mono); font-size: 9.5px; padding: 2px 8px;
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-xs); color: var(--ink-3);
}
.evo-category-chip span { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

/* analysis reports (collapsible) */
.evo-report-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  margin-bottom: 8px; overflow: hidden; box-shadow: var(--sh-sm);
}
.evo-report-header {
  padding: 12px 16px; display: flex; align-items: center; justify-content: space-between;
  gap: 10px; cursor: pointer; user-select: none;
  transition: background 0.14s var(--ease);
}
.evo-report-header:hover { background: var(--surface-2); }
.evo-report-title { font-size: 13px; font-weight: 650; color: var(--ink); }
.evo-report-date {
  font-family: var(--mono); font-size: 9.5px; color: var(--ink-3);
  padding: 2px 8px; border: 1px solid var(--line); border-radius: var(--pill);
  letter-spacing: 0.04em; font-variant-numeric: tabular-nums;
}
.evo-report-chevron { width: 16px; height: 16px; color: var(--ink-4); transition: transform 0.2s var(--ease); }
.evo-report-chevron.open { transform: rotate(180deg); }
.evo-report-body { padding: 0 16px; max-height: 0; overflow: hidden; transition: max-height 0.4s var(--ease), padding 0.3s var(--ease); }
.evo-report-body.open { max-height: none; padding: 0 16px 16px; overflow: visible; }
.evo-report-text { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; margin-bottom: 12px; white-space: pre-wrap; }
.evo-report-text.evo-markdown { white-space: normal; }
.evo-report-full { font-size: 12.5px; color: var(--ink-2); line-height: 1.65; }
.evo-report-list-title {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3);
  margin-top: 12px; margin-bottom: 6px;
}
.evo-report-list { list-style: none; padding: 0; }
.evo-report-list li { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; padding: 4px 0 4px 12px; position: relative; }
.evo-report-list li::before {
  content: ''; position: absolute; left: 0; top: 11px;
  width: 4px; height: 4px; background: var(--acc); border-radius: 50%;
}

/* markdown prose (evolution reports) */
.evo-markdown h1, .evo-markdown h2, .evo-markdown h3 { color: var(--ink); margin: 16px 0 8px; font-weight: 700; letter-spacing: -0.01em; }
.evo-markdown h1 { font-size: 16px; }
.evo-markdown h2 { font-size: 14px; border-bottom: 1px solid var(--line-2); padding-bottom: 4px; }
.evo-markdown h3 { font-size: 12.5px; }
.evo-markdown p { margin: 6px 0; }
.evo-markdown ul, .evo-markdown ol { padding-left: 20px; margin: 6px 0; }
.evo-markdown li { margin: 3px 0; color: var(--ink-2); }
.evo-markdown table { width: 100%; border-collapse: collapse; margin: 8px 0; font-size: 11px; }
.evo-markdown th, .evo-markdown td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; }
.evo-markdown th { background: var(--surface-2); color: var(--ink-2); font-weight: 600; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; }
.evo-markdown td { color: var(--ink-2); }
.evo-markdown strong { color: var(--ink); }
.evo-markdown code { background: var(--surface-inset); padding: 1px 5px; border-radius: 4px; font-family: var(--mono); font-size: 11px; }
.evo-markdown blockquote { border-left: 3px solid var(--acc); padding-left: 12px; color: var(--ink-2); margin: 8px 0; }
.evo-markdown hr { border: none; border-top: 1px solid var(--line-2); margin: 12px 0; }

/* auto insights */
.evo-insight-pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  padding: 3px 9px; margin: 0 4px 4px 0;
  background: var(--surface-2); border: 1px solid var(--line); border-left-width: 3px;
  border-radius: var(--r-xs); color: var(--ink-2); font-variant-numeric: tabular-nums;
}
.evo-insight-pill.above, .evo-insight-pill.up   { border-left-color: var(--delta-up); color: var(--delta-up); }
.evo-insight-pill.below, .evo-insight-pill.down { border-left-color: var(--delta-dn); color: var(--delta-dn); }

/* variable tests — status rides the 3px rail */
.evo-test-card {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: var(--r); padding: 13px 16px; margin-bottom: 8px; box-shadow: var(--sh-sm);
}
.evo-test-card.active { border-left-color: var(--info); }
.evo-test-card.running { border-left-color: var(--warn); }
.evo-test-card.concluded, .evo-test-card.done { opacity: 0.72; }
.evo-test-header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 8px; }
.evo-test-variable { font-size: 13.5px; font-weight: 650; color: var(--ink); text-transform: capitalize; }
.evo-test-change { font-size: 11.5px; color: var(--ink-2); }
.evo-test-change .from { color: var(--err); }
.evo-test-change .to { color: var(--ok); }
.evo-test-hypothesis { font-size: 11.5px; color: var(--ink-3); font-style: italic; margin-bottom: 8px; }
.evo-test-metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; font-size: 11.5px; font-variant-numeric: tabular-nums; }
.evo-test-metrics .label {
  font-family: var(--mono); font-size: 9px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-3);
}
.evo-test-status {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-2);
}
.evo-test-status.active { background: var(--info-bg); color: var(--info); }
.evo-test-status.running { background: var(--warn-bg); color: var(--warn); }
.evo-test-status.concluded, .evo-test-status.done { background: var(--ok-bg); color: var(--ok); }

/* compare view */
.evo-compare-diff { color: var(--delta-flat); font-weight: 600; }
.evo-compare-metric-up { color: var(--delta-up); }
.evo-compare-metric-down { color: var(--delta-dn); }

/* new test form */
.evo-form-row { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; flex-wrap: wrap; }
.evo-form-row label {
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); min-width: 70px;
}
.evo-form-row select, .evo-form-row input {
  font-family: var(--font); font-size: 12.5px; color: var(--ink);
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 10px;
  transition: border-color 0.16s var(--ease), box-shadow 0.2s var(--ease);
}
.evo-form-row select:focus, .evo-form-row input:focus { outline: none; border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-ring); }

/* ------------------------------------------------------------ marketing markdown reader */
.mkt-md { font-family: var(--font); font-size: 13.5px; line-height: 1.75; max-width: 860px; color: var(--ink); }
.mkt-md h1, .mkt-md h2 { font-weight: 700; color: var(--ink); letter-spacing: -0.01em; }
.mkt-md h1 { font-size: 18px; margin: 18px 0 8px; }
.mkt-md h2 { font-size: 15px; margin: 16px 0 6px; }
.mkt-md h3, .mkt-md h4 { font-size: 13px; margin: 14px 0 4px; font-weight: 650; }
.mkt-md p { margin: 6px 0; }
.mkt-md ul, .mkt-md ol { margin: 6px 0; padding-left: 22px; }
.mkt-md li { margin: 3px 0; }
.mkt-md a { color: var(--acc); }
.mkt-md code { background: var(--surface-inset); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 11px; }
.mkt-md blockquote { border-left: 3px solid var(--line); padding-left: 12px; color: var(--ink-3); margin: 8px 0; }
.mkt-md table { border-collapse: collapse; margin: 10px 0; }
.mkt-md th, .mkt-md td { border: 1px solid var(--line); padding: 5px 10px; font-size: 11.5px; text-align: left; }
.mkt-md th { color: var(--ink-3); text-transform: uppercase; font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.05em; background: var(--surface-2); }
.mkt-md hr { border: none; border-top: 1px solid var(--line-2); margin: 14px 0; }

/* ------------------------------------------------------------ chat popup (research assistant) */
#chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9998;
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--acc); color: var(--bg); border: none; font-size: 20px; cursor: pointer;
  box-shadow: var(--sh-md);
  transition: transform 0.15s var(--ease), background 0.15s var(--ease), box-shadow 0.2s var(--ease);
}
#chat-fab:hover { background: var(--acc-hover); transform: scale(1.08); box-shadow: var(--sh-lg); }
#chat-fab:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
#chat-fab.chat-open { display: none; }

.chat-popup {
  display: none; position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  width: 560px; height: 620px; min-width: 380px; min-height: 340px;
  max-width: 96vw; max-height: 92vh;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); box-shadow: var(--sh-lg);
  flex-direction: column; overflow: hidden;
}
.chat-popup.open { display: flex; animation: rise 0.24s var(--ease) both; }

/* resize grips — popup is docked bottom-right, corners resize toward it */
.chat-resize { position: absolute; width: 16px; height: 16px; z-index: 3; }
.chat-resize.tl { top: 0; left: 0; cursor: nwse-resize; }
.chat-resize.tr { top: 0; right: 0; cursor: nesw-resize; }
.chat-resize.bl { bottom: 0; left: 0; cursor: nesw-resize; }
.chat-resize.tl::after {
  content: ''; position: absolute; top: 4px; left: 4px; width: 8px; height: 8px;
  border-top: 2px solid var(--ink-4); border-left: 2px solid var(--ink-4);
  border-radius: 2px 0 0 0;
}

.chat-popup-header {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 16px; border-bottom: 1px solid var(--line-2);
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3);
  background: var(--surface-2);
}
.chat-clear-btn {
  background: none; border: none; cursor: pointer;
  font-family: var(--mono); font-size: 10px; color: var(--ink-3);
  padding: 2px 6px; border-radius: var(--r-xs);
  transition: color 0.14s var(--ease), background 0.14s var(--ease);
}
.chat-clear-btn:hover { color: var(--err); background: var(--surface); }
.chat-clear-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }

.chat-popup-messages {
  flex: 1; overflow-y: auto; padding: 14px 16px;
  font-size: 13px; line-height: 1.7; min-height: 250px;
  display: flex; flex-direction: column; gap: 10px;
}

.chat-bubble {
  max-width: 92%; padding: 10px 14px; border-radius: var(--r);
  word-wrap: break-word; overflow-wrap: break-word; white-space: pre-wrap;
  animation: rise 0.24s var(--ease) both;
}
.chat-bubble.user { align-self: flex-end; background: var(--acc); color: var(--bg); border-bottom-right-radius: var(--r-xs); }
.chat-bubble.assistant { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: var(--r-xs); }
.chat-bubble.assistant strong { color: var(--ink); }
.chat-bubble.assistant table { font-size: 11px; border-collapse: collapse; margin: 6px 0; width: 100%; }
.chat-bubble.assistant th, .chat-bubble.assistant td { padding: 3px 6px; border-bottom: 1px solid var(--line-2); text-align: left; }
.chat-bubble.assistant th { font-weight: 600; font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); }
.chat-bubble.typing {
  align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-3); border-bottom-left-radius: var(--r-xs); font-style: italic;
}
.chat-typing-dots span { animation: chatDot 1.2s infinite; display: inline-block; }
.chat-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.chat-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes chatDot {
  0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
  30% { opacity: 1; transform: translateY(-3px); }
}
.chat-bubble.error { align-self: flex-start; background: none; border: none; color: var(--err); padding: 4px 0; font-size: 11.5px; }

/* live activity log while the assistant works */
.chat-bubble.chat-activity { font-style: normal; max-width: 96%; border-style: dashed; }
.chat-activity-label { font-size: 11px; color: var(--ink-3); font-style: italic; }
.chat-activity-steps { display: flex; flex-direction: column; gap: 5px; }
.chat-activity-step {
  display: flex; align-items: flex-start; gap: 6px;
  font-size: 11px; line-height: 1.4; color: var(--ink-2);
  animation: chatStepIn 0.2s var(--ease);
}
.chat-act-icon { flex: 0 0 auto; }
.chat-act-desc { color: var(--ink-2); }
.chat-act-text { color: var(--ink-3); font-style: italic; }
.chat-act-cmd {
  display: block; margin-top: 2px; padding: 3px 6px;
  background: var(--surface-inset); border-radius: var(--r-xs);
  font-family: var(--mono); font-size: 10px; color: var(--ink-2);
  white-space: pre-wrap; word-break: break-all;
}
.chat-activity-step.tool { flex-wrap: wrap; }
.chat-activity-step.tool .chat-act-cmd { flex-basis: 100%; }
.chat-activity-now { margin-top: 6px; font-size: 11px; color: var(--ink-3); font-style: italic; }
.chat-activity-steps:empty + .chat-activity-now { margin-top: 0; }
@keyframes chatStepIn {
  from { opacity: 0; transform: translateY(2px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* saved chat list */
.chat-list-item {
  padding: 10px 14px; border-bottom: 1px solid var(--line-2); cursor: pointer;
  transition: background 0.12s var(--ease);
}
.chat-list-item:hover { background: var(--surface-2); }
.chat-list-item:last-child { border-bottom: none; }
.chat-list-title { font-size: 12.5px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-4); margin-top: 2px; display: flex; gap: 8px; font-variant-numeric: tabular-nums; }
.chat-list-empty { padding: 40px 20px; text-align: center; color: var(--ink-3); font-size: 12.5px; }

.chat-popup-input { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line-2); background: var(--surface); }

/* ------------------------------------------------------------ modal (fog overlay recipe) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 300; display: none;
  align-items: flex-start; justify-content: center; padding: 48px 20px;
  background: var(--scrim);
  }
.modal-overlay.open { display: flex; animation: fade 0.2s var(--ease) both; }
.modal {
  background: var(--surface); border-radius: var(--r-lg);
  box-shadow: var(--sh-lg); max-width: 760px; width: 100%;
  max-height: calc(100vh - 96px); overflow-y: auto; padding: 28px 32px 32px;
  position: relative; animation: sheet 0.3s var(--ease) both;
}
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 14px; }
.modal-title { font-family: var(--serif); font-size: 21px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); }
.modal-close {
  font-family: var(--mono); font-size: 11px; color: var(--ink-3);
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--pill); padding: 5px 12px; cursor: pointer;
}
.modal-close:hover { color: var(--ink); border-color: var(--ink-4); }
.modal-close:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--acc-ring); }
.modal-actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 18px; }

/* ------------------------------------------------------------ toast */
#toast {
  position: fixed; bottom: 26px; right: 26px; z-index: 400;
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--ink-4);
  border-radius: var(--r); box-shadow: var(--sh-md); padding: 13px 18px;
  min-width: 240px; max-width: 360px;
  transform: translateY(16px); opacity: 0; pointer-events: none;
  transition: transform 0.28s var(--ease), opacity 0.28s var(--ease);
}
#toast.show { transform: translateY(0); opacity: 1; }
#toast.success { border-left-color: var(--ok); }
#toast.error { border-left-color: var(--err); }
#toast.info { border-left-color: var(--info); }
.toast-title { font-size: 13.5px; font-weight: 650; color: var(--ink); }
.toast-message { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

/* ------------------------------------------------------------ empty state + loading */
.empty-state { text-align: center; padding: 48px 20px; color: var(--ink-3); font-size: 12.5px; }
.empty-state-icon { font-size: 30px; opacity: 0.5; margin-bottom: 10px; }
.empty-title { font-size: 15px; color: var(--ink-2); font-weight: 650; }
.empty-sub { font-size: 12.5px; margin-top: 6px; max-width: 46ch; margin-left: auto; margin-right: auto; line-height: 1.6; }
.empty-tag { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-4); margin-bottom: 14px; }
/* a not-built or filtered-to-nothing view still owes the reader its shape */
.empty-plan { max-width: 420px; margin: 20px auto 0; text-align: left; }
.empty-plan-row {
  display: flex; align-items: baseline; gap: 10px; padding: 7px 0;
  border-top: 1px solid var(--line-2); font-size: 12.5px; color: var(--ink-2);
}
.empty-plan-row:first-child { border-top: none; }
.empty-plan-row .k { font-family: var(--mono); font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-4); width: 74px; flex: none; }

.loading-overlay {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--veil);
  border-radius: inherit; z-index: 5;
}
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(140,138,156,0.25); border-top-color: currentColor;
  border-radius: 50%; animation: spin 0.7s linear infinite;
}
.spinner-lg { width: 24px; height: 24px; border-width: 2.5px; }
.loading-overlay .spinner { width: 26px; height: 26px; border-width: 2.5px; color: var(--acc); border-top-color: var(--acc); }

/* ------------------------------------------------------------ teardowns (ORPHANED — teardowns.js not loaded;
   styled so a future re-wire lands on fog, not on nothing) */
.td-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 14px 16px; margin-bottom: 10px; box-shadow: var(--sh-sm);
}
.td-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.td-title { font-size: 14px; font-weight: 650; color: var(--ink); }
.td-meta { font-family: var(--mono); font-size: 10px; color: var(--ink-3); }
.td-caption { font-size: 12.5px; color: var(--ink-2); line-height: 1.55; }
.td-body { font-size: 13px; color: var(--ink-2); line-height: 1.6; margin-top: 8px; }
.td-verdict { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.td-gate { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-3); }
.td-chip {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 9.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 8px; border-radius: var(--pill);
  background: var(--panel2); color: var(--ink-2);
}
.td-caret { display: inline-block; width: 10px; color: var(--ink-4); font-size: 9px; }
.td-btnrow { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.td-btn {
  font-family: var(--font); font-size: 12px; font-weight: 600;
  padding: 6px 11px; border-radius: var(--r-sm); cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
}
.td-btn:hover { border-color: var(--ink-4); }
.td-btn-accent { background: var(--acc); border-color: var(--acc); color: var(--bg); }
.td-action { display: flex; align-items: baseline; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line-2); }
.td-action-main { font-size: 12.5px; color: var(--ink); }
.td-action-note { font-size: 11px; color: var(--ink-3); }
.td-action-text { font-size: 12.5px; color: var(--ink-2); }
.td-exec-one { font-size: 12px; color: var(--ink-2); }
.td-kill { color: var(--err); }
.td-killed, .td-action.td-killed { opacity: 0.5; text-decoration: line-through; }
.td-localdot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }

/* ------------------------------------------------------------ motion */
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise { from { opacity: 0; transform: translateY(9px); } to { opacity: 1; transform: translateY(0); } }
@keyframes sheet { from { opacity: 0; transform: scale(0.965) translateY(8px); } to { opacity: 1; transform: scale(1) translateY(0); } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.35; } }
.fade-up { animation: rise 0.3s var(--ease) both; }

/* staggered entrance, CAPPED at the first row — the rest simply appear */
.view.active .kpi-grid > *, .view.active .sm-grid > *,
.view.active .cards-grid > *, .view.active .pending-summary > * { animation: rise 0.42s var(--ease) both; }
.view.active .kpi-grid > *:nth-child(2), .view.active .sm-grid > *:nth-child(2),
.view.active .cards-grid > *:nth-child(2), .view.active .pending-summary > *:nth-child(2) { animation-delay: 0.035s; }
.view.active .kpi-grid > *:nth-child(3), .view.active .sm-grid > *:nth-child(3),
.view.active .cards-grid > *:nth-child(3), .view.active .pending-summary > *:nth-child(3) { animation-delay: 0.07s; }
.view.active .kpi-grid > *:nth-child(4), .view.active .sm-grid > *:nth-child(4),
.view.active .cards-grid > *:nth-child(4), .view.active .pending-summary > *:nth-child(4) { animation-delay: 0.105s; }
.view.active .kpi-grid > *:nth-child(5), .view.active .sm-grid > *:nth-child(5),
.view.active .cards-grid > *:nth-child(5) { animation-delay: 0.14s; }
.view.active .kpi-grid > *:nth-child(6), .view.active .cards-grid > *:nth-child(6) { animation-delay: 0.175s; }
.view.active .kpi-grid > *:nth-child(n+7), .view.active .sm-grid > *:nth-child(n+6),
.view.active .cards-grid > *:nth-child(n+7) { animation: none; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001s !important; animation-delay: 0s !important; transition-duration: 0.001s !important; }
}

/* ------------------------------------------------------------ responsive */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 1320px) {
  .main { padding: 22px 22px 88px; }
}
@media (max-width: 1140px) {
  .sm-grid { grid-template-columns: repeat(auto-fit, minmax(290px, 1fr)); }
}
@media (max-width: 900px) {
  .kpi-grid, .pending-summary { grid-template-columns: repeat(2, 1fr); }
  .sm-grid { grid-template-columns: minmax(0, 1fr); }
  .sm-grid > .span-2 { grid-column: auto !important; }
  .cards-grid.reading { grid-template-columns: 1fr; }
  #toast { left: 16px; right: 16px; max-width: none; }
  .pipeline-layout { grid-template-columns: 1fr; }
  .pipeline-sidebar { display: none; }
  .charts-grid { grid-template-columns: 1fr; }
  .arc-pillars { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 800px) {
  .evo-weights-grid { grid-template-columns: 1fr; }
  .evo-memory-stats { grid-template-columns: 1fr; }
  .detail-metrics-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.24s var(--ease); }
  .sidebar.open { transform: translateX(0); }
  .main-area { margin-left: 0; }
  .main { padding: 20px 16px 72px; }
  .topbar { padding: 0 16px; }
  .nav-toggle { display: block; }
  .chat-popup { width: 96vw; right: 2vw; bottom: 12px; }
  .detail-slides { grid-template-columns: repeat(2, 1fr); }
}

/* ============================================================ BRAND INSPO
   Research > Brand Inspo — mood board for the main account feed. */
.bi-add {
  display: flex; gap: 8px; align-items: center;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); padding: 10px 12px; margin-bottom: 16px;
  box-shadow: var(--sh-sm);
}
.bi-add input {
  flex: 1; min-width: 0; border: 1px solid var(--line); border-radius: var(--r-sm);
  background: var(--surface-2); color: var(--ink); font-family: var(--font);
  font-size: 13px; padding: 8px 10px; outline: none;
  transition: border-color 200ms var(--ease), box-shadow 200ms var(--ease);
}
.bi-add input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-ring); }
.bi-add input::placeholder { color: var(--ink-4); }
.bi-add input#bi-note { flex: 0 1 260px; }

.bi-board { columns: 4 230px; column-gap: 14px; }
.bi-card {
  break-inside: avoid; margin-bottom: 14px; position: relative;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); overflow: hidden; box-shadow: var(--sh-sm);
  transition: box-shadow 200ms var(--ease), transform 200ms var(--ease);
}
.bi-card:hover { box-shadow: var(--sh-md); }
.bi-card img { display: block; width: 100%; background: var(--surface-inset); }
.bi-card-body { padding: 10px 12px 11px; }
.bi-kind {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.13em; color: var(--ink-4);
  margin-bottom: 3px;
}
.bi-title { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; }
.bi-title a { color: inherit; }
.bi-domain { font-family: var(--mono); font-size: 10px; color: var(--ink-3); margin-top: 2px; word-break: break-all; }
.bi-note { font-size: 12px; color: var(--ink-2); margin-top: 6px; line-height: 1.5; }
.bi-del {
  position: absolute; top: 8px; right: 8px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: var(--pill); cursor: pointer;
  background: var(--veil); color: var(--ink-3);
  font-size: 12px; line-height: 1; opacity: 0; box-shadow: var(--sh-sm);
  transition: opacity 200ms var(--ease), color 200ms var(--ease);
}
.bi-card:hover .bi-del { opacity: 1; }
.bi-del:hover { color: var(--err); }
.bi-account-glyph {
  height: 84px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(158deg, var(--acc-soft) 0%, var(--surface-2) 100%);
  font-family: var(--serif); font-style: italic; font-size: 30px; color: var(--acc);
}

/* ============================================================ CAMPAIGN DOCS
   Campaign Home Base — collapsible per-campaign doc lists. */
.doc-group {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r); margin-bottom: 10px; overflow: hidden;
}
.doc-group summary {
  display: flex; align-items: center; gap: 10px; cursor: pointer;
  padding: 10px 14px; list-style: none; user-select: none;
}
.doc-group summary::-webkit-details-marker { display: none; }
.doc-group summary:hover { background: var(--surface-2); }
.doc-group[open] > summary { border-bottom: 1px solid var(--line-2); }
.doc-group-title {
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--ink-2);
  border-left: 3px solid var(--acc); padding-left: 8px;
}
.doc-count { font-family: var(--mono); font-size: 10px; color: var(--ink-4); margin-left: auto; }
.doc-list { display: flex; flex-direction: column; padding: 6px; }
.doc-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  text-align: left; background: none; border: none; border-radius: var(--r-sm);
  cursor: pointer; padding: 7px 9px; font-family: var(--font);
  transition: background 150ms var(--ease);
}
.doc-row:hover { background: var(--acc-soft); }
.doc-kind {
  flex: 0 0 112px; font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-4);
}
.doc-row .doc-title { font-size: 13px; color: var(--ink); line-height: 1.4; }

/* ============================================================ COMPETITOR LANDSCAPE */
.cl-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 14px; }
.cl-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  padding: 16px; box-shadow: var(--sh-sm); display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow 200ms var(--ease);
}
.cl-card:hover { box-shadow: var(--sh-md); }
.cl-count {
  font-family: var(--mono); font-size: 28px; font-weight: 600; line-height: 1;
  color: var(--ink); font-variant-numeric: tabular-nums;
}
.cl-names { font-size: 12px; color: var(--ink-2); line-height: 1.55; }
.cl-card .btn { align-self: flex-start; margin-top: auto; }

/* IA stubs */
.stub-note { max-width: 560px; text-align: left; }

/* ============================================================ DARK ADS LIBRARY (la-) */
.la-upload-zone {
  margin-top: 14px; padding: 26px 20px; text-align: center; cursor: pointer;
  border: 1.5px dashed var(--line); border-radius: var(--r); background: var(--surface);
  color: var(--ink-3);
  transition: border-color 150ms var(--ease), background 150ms var(--ease), color 150ms var(--ease);
}
.la-upload-zone:hover, .la-upload-zone.la-drag { border-color: var(--acc); background: var(--acc-soft); color: var(--ink); }
.la-upload-title { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.la-upload-zone:hover .la-upload-title, .la-upload-zone.la-drag .la-upload-title { color: var(--ink); }
.la-upload-sub { font-size: 12px; margin-top: 3px; }
.la-error-card { margin-top: 14px; border-left: 3px solid var(--warn); }
.la-filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.la-filter-label {
  font-family: var(--mono); font-size: 9px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-4);
}
.la-grid { margin-top: 14px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.la-card {
  position: relative; display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-sm); transition: box-shadow 200ms var(--ease);
}
.la-card:hover { box-shadow: var(--sh-md); }
/* Ads are 9:16. A 150px-tall cover-cropped box showed a horizontal slice out
   of the middle of each one, which is most of the creative missing -- the
   headline at the top and the CTA at the bottom were both cut off, and those
   are the parts you look at. Portrait box, contain so nothing is cropped at
   any aspect ratio. */
.la-thumb {
  display: block; width: 100%; aspect-ratio: 9 / 16; height: auto;
  object-fit: contain;
  background: var(--surface-2); border-bottom: 1px solid var(--line);
}
.la-body { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px 12px; }
.la-label {
  font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.35; cursor: text;
  border-radius: var(--r-xs); padding: 1px 4px; margin: -1px -4px;
}
.la-label:hover { background: var(--acc-soft); }
.la-label-empty { color: var(--ink-4); font-weight: 400; font-style: italic; }
.la-label-input { font-size: 13px; padding: 3px 8px; }
.la-meta-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.la-meta-row .chip { padding: 3px 10px; font-size: 11px; text-decoration: none; }
.la-add { border-style: dashed; color: var(--ink-4); }
.la-add:hover { color: var(--acc); border-color: var(--acc); }
.la-campaign-select { height: 26px; font-size: 11px; padding: 0 6px; min-width: 0; }
.la-foot {
  font-family: var(--mono); font-size: 10px; color: var(--ink-4);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.la-del {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; line-height: 22px;
  border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink-3);
  font-size: 15px; cursor: pointer; opacity: 0;
  transition: opacity 150ms var(--ease), color 150ms var(--ease), border-color 150ms var(--ease);
}
.la-card:hover .la-del { opacity: 1; }
.la-del:hover { color: var(--err); border-color: var(--err); }
.la-progress-row {
  display: flex; align-items: center; gap: 10px; margin-top: 10px; padding: 8px 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  font-size: 12px; color: var(--ink-2);
}
.la-progress-name { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.la-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.la-bar-fill { height: 100%; width: 0%; background: var(--acc); transition: width 200ms var(--ease); }
.la-progress-pct { font-family: var(--mono); font-size: 10px; color: var(--ink-4); min-width: 32px; text-align: right; }
.la-progress-err { border-color: var(--err); }
.la-progress-fail { color: var(--err); flex: 1; }

/* ── Dark Ads · Reports (dr-) ── the ledger reuses doc-group/doc-row wholesale;
   only the open-in-reader row highlight is new. */
.dr-row-active { background: var(--acc-soft); }

/* ---- rh-: Product Metrics retention heatmap (PRODUCT-METRICS, append-only) ---- */
.rh-heat { width: 100%; border-collapse: separate; border-spacing: 2px; }
.rh-heat thead th {
  padding: 8px 10px 6px; font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3); text-align: left; font-weight: 600;
}
.rh-heat thead th.rh-num { text-align: right; }
.rh-heat tbody td { padding: 6px 10px; font-size: 12.5px; line-height: 1.45; border-radius: 4px; vertical-align: middle; }
.rh-week { color: var(--ink-2); white-space: nowrap; }
.rh-new { font-family: var(--mono); text-align: right; color: var(--ink-2); }
/* value cells: neutral by default (null / no tint), mono so columns scan */
.rh-cell { font-family: var(--mono); text-align: right; color: var(--ink-3); }
.rh-cell.rh-ok   { background: var(--ok-bg);   color: var(--ok);   font-weight: 600; }
.rh-cell.rh-warn { background: var(--warn-bg); color: var(--warn); font-weight: 600; }
.rh-cell.rh-err  { background: var(--err-bg);  color: var(--err);  font-weight: 600; }
.rh-legend { margin-top: 8px; font-size: 10.5px; color: var(--ink-4); display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.rh-key { padding: 1px 6px; border-radius: 999px; font-family: var(--mono); font-size: 10px; }
.rh-key.rh-ok   { background: var(--ok-bg);   color: var(--ok); }
.rh-key.rh-warn { background: var(--warn-bg); color: var(--warn); }
.rh-key.rh-err  { background: var(--err-bg);  color: var(--err); }

/* ---- Library restructure (fog3): review queue + merged ranked grid ---- */
.la-sec-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; margin: 22px 0 0; }
.la-sec-head .section-sub { font-size: 11px; }
.la-note { font-size: 11px; color: var(--warn); font-family: var(--mono); }
.la-review-card { border-left: 3px solid var(--warn); }
.la-verdict { display: flex; gap: 8px; align-items: center; margin-top: 2px; }
.la-verdict .btn { flex: 1; justify-content: center; }
/* Notes on a creative. A verdict is one bit; this is where the reason goes.
   Present on the review queue and on the approved shelf, because a note
   written before Approve has to survive it. */
.la-comments { margin-top: 8px; border-top: 1px solid var(--line); padding-top: 7px; }
.la-c-toggle {
  background: none; border: none; padding: 0; cursor: pointer;
  color: var(--ink-3); font-size: 11px; font-family: inherit;
}
.la-c-toggle:hover { color: var(--ink-1); }
.la-c-panel { margin-top: 7px; display: flex; flex-direction: column; gap: 7px; }
.la-c-item {
  background: var(--surface-2); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 6px 8px;
}
.la-c-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.la-c-who { font-size: 11px; font-weight: 600; color: var(--ink-1); }
.la-c-when {
  font-size: 10px; color: var(--ink-4); display: flex; gap: 5px;
  align-items: center; flex-shrink: 0;
}
.la-c-del {
  background: none; border: none; padding: 0; line-height: 1;
  color: var(--ink-4); font-size: 13px; cursor: pointer;
}
.la-c-del:hover { color: var(--ink-1); }
/* pre-wrap so a note written as two lines stays two lines */
.la-c-body {
  font-size: 12px; color: var(--ink-2); line-height: 1.5;
  white-space: pre-wrap; word-break: break-word; margin-top: 2px;
}
.la-c-form { display: flex; flex-direction: column; gap: 5px; }
.la-c-send { display: flex; gap: 5px; }
.la-c-author, .la-c-input {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 5px 8px; font-size: 11px; color: var(--ink-1); font-family: inherit;
  min-width: 0;
}
.la-c-input { flex: 1; }
.la-c-author { width: 100%; }
.la-c-author:focus, .la-c-input:focus { outline: none; border-color: var(--ink-4); }
.la-rank {
  position: absolute; top: 6px; left: 6px; padding: 2px 7px; border-radius: var(--r-sm);
  background: var(--surface); border: 1px solid var(--line); color: var(--ink-2);
  font-family: var(--mono); font-size: 10px; font-weight: 700;
}
.la-label-fixed { cursor: default; }
.la-label-fixed:hover { background: none; }
.la-label-fixed a { color: inherit; text-decoration: none; }
.la-label-fixed a:hover { text-decoration: underline; }
.la-thumb-ph {
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--ink-4);
  font-family: var(--mono); font-size: 10px; letter-spacing: .06em; text-transform: uppercase;
}
.la-thumb-dead { visibility: hidden; }
.la-m-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px;
  padding-top: 8px; border-top: 1px solid var(--line);
}
.la-m-cell { min-width: 0; }
.la-m-val { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--ink); white-space: nowrap; }
.la-m-lbl { font-size: 9px; letter-spacing: .07em; text-transform: uppercase; color: var(--ink-4); margin-top: 1px; }
.la-m-dim { color: var(--ink-4); font-weight: 400; }
.la-m-empty {
  display: block; font-family: var(--mono); font-size: 10px; color: var(--ink-4);
  letter-spacing: .05em; text-transform: uppercase;
}

/* ===== FLM — Founder-led Marketing · Metrics (flmMetrics.js) ===== */
.flm-cap {
  display: inline-block; max-width: 320px; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; vertical-align: bottom; cursor: pointer; color: var(--ink-2);
}
.flm-cap.open { white-space: normal; max-width: none; overflow: visible; text-overflow: clip; }
.flm-dim { color: var(--ink-4); }

/* Research docs embed competitor screenshots; keep them inside the reader
   column and readable rather than full-bleed. */
.mkt-md img, .doc-body img {
    max-width: 300px;
    max-height: 420px;
    width: auto;
    height: auto;
    border-radius: 8px;
    border: 1px solid var(--gray-700);
    display: block;
    margin: 10px 0 16px;
}

/* Creative thumbnails inside report tables: portrait ad frames, so cap the
   height rather than the width or a 1080x1920 fills the row. */
.mkt-md table img, .doc-body table img {
    max-width: 40px;
    max-height: 64px;
    width: auto;
    border-radius: 4px;
    border: 1px solid var(--gray-700);
    display: block;
    margin: 0;
}

/* Thumbnails inline in a list item (the cutting / starting decision lists)
   sit beside the text rather than breaking the line. */
.mkt-md li img, .doc-body li img {
    max-width: 28px;
    max-height: 46px;
    width: auto;
    border-radius: 3px;
    border: 1px solid var(--gray-700);
    display: inline-block;
    vertical-align: middle;
    margin: 0 6px 0 0;
}


/* ============================================================ STONE — reports library + reader (reports.js) */
.rpt-head { display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; margin-bottom: 18px; }
.rpt-title { font-family: var(--serif); font-weight: 400; font-size: 30px; line-height: 1.1; color: var(--ink); letter-spacing: -0.01em; }
.rpt-sub { font-size: 13px; color: var(--dimmer); margin-top: 7px; max-width: 64ch; line-height: 1.5; }
.rpt-tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin: 0 0 26px; }
.rpt-filter {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.1em; text-transform: uppercase;
  color: var(--dim); background: none; border: 1px solid var(--line); border-radius: 3px;
  padding: 6px 10px; cursor: pointer; transition: color 0.14s var(--ease), border-color 0.14s var(--ease);
}
.rpt-filter:hover { color: var(--ink); border-color: var(--dimmer); }
.rpt-filter.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.rpt-filter .n { opacity: 0.6; margin-left: 5px; font-variant-numeric: tabular-nums; }
.rpt-search {
  margin-left: auto; font-family: var(--font); font-size: 13px; color: var(--ink);
  background: var(--panel); border: 1px solid var(--line); border-radius: 3px; padding: 7px 10px; min-width: 240px;
}
.rpt-search::placeholder { color: var(--faint); }
.rpt-search:focus { outline: none; border-color: var(--dimmer); }
.rpt-group { margin: 0 0 36px; }
.rpt-group-head { display: flex; align-items: baseline; gap: 12px; border-top: 1px solid var(--line); padding-top: 14px; margin-bottom: 4px; }
.rpt-group-head h2 { font-family: var(--serif); font-weight: 400; font-size: 21px; line-height: 1.2; color: var(--ink); margin: 0; }
.rpt-group-head .n { font-family: var(--mono); font-size: 11px; color: var(--dimmer); font-variant-numeric: tabular-nums; }
.rpt-group-head .why { margin-left: auto; font-size: 12px; color: var(--dimmer); max-width: 56ch; text-align: right; line-height: 1.45; }
.rpt-row {
  display: grid; grid-template-columns: 92px minmax(0, 1fr) auto; gap: 18px; align-items: start;
  padding: 15px 0; border-top: 1px solid var(--line2); cursor: pointer; text-decoration: none; color: inherit;
}
.rpt-group .rpt-row:first-of-type { border-top: 0; }
.rpt-row:hover { text-decoration: none; }
.rpt-row:hover .rpt-row-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-color: var(--dimmer); }
.rpt-row-date { font-family: var(--mono); font-size: 11.5px; color: var(--dimmer); padding-top: 5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.rpt-row-title { font-family: var(--serif); font-weight: 400; font-size: 18px; line-height: 1.3; color: var(--ink); }
.rpt-row-blurb { font-size: 13px; color: var(--dim); margin-top: 5px; line-height: 1.55; max-width: 80ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.rpt-row-tags { margin-top: 8px; display: flex; gap: 5px; flex-wrap: wrap; }
.rpt-tag { font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dimmer); border: 1px solid var(--line); border-radius: 2px; padding: 2px 6px; }
.rpt-row-open { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dimmer); padding-top: 6px; white-space: nowrap; }
.rpt-row.missing { opacity: 0.55; cursor: default; }
.rpt-row.missing .rpt-row-open { color: var(--bad); }
.rpt-row.undescribed .rpt-row-blurb { color: var(--dimmer); font-style: italic; }
.rpt-empty { padding: 40px 0; color: var(--dimmer); font-size: 13px; }

.rdr-head { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; min-height: 34px; }
.rdr-back { font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); text-decoration: none; white-space: nowrap; }
.rdr-back:hover { color: var(--ink); text-decoration: none; }
.rdr-title { font-family: var(--serif); font-weight: 400; font-size: 20px; line-height: 1.2; color: var(--ink); }
.rdr-meta { font-family: var(--mono); font-size: 11px; color: var(--dimmer); white-space: nowrap; }
.rdr-nav { margin-left: auto; display: flex; gap: 6px; }
.rdr-nav a, .rdr-nav button {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--dim); background: none; border: 1px solid var(--line); border-radius: 3px;
  padding: 5px 9px; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.rdr-nav a:hover, .rdr-nav button:hover { color: var(--ink); border-color: var(--dimmer); text-decoration: none; }
.rdr-nav button:disabled { opacity: 0.35; cursor: default; }
.rdr-frame { width: 100%; height: calc(100vh - 48px - 24px - 46px - 24px); border: 1px solid var(--line); border-radius: 3px; background: var(--bg); display: block; }
.rdr-md { max-width: 900px; padding: 8px 0 60px; font-size: 15.5px; line-height: 1.62; color: var(--ink); }
.rdr-md h1 { font-family: var(--serif); font-weight: 400; font-size: 34px; line-height: 1.15; margin: 0 0 10px; }
.rdr-md h2 { font-family: var(--serif); font-weight: 400; font-size: 24px; margin: 44px 0 6px; padding-top: 20px; border-top: 1px solid var(--line); }
.rdr-md h3 { font-size: 14px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--dim); margin: 28px 0 10px; font-weight: 600; }
.rdr-md p { margin: 0 0 14px; }
.rdr-md ul, .rdr-md ol { margin: 0 0 14px; padding-left: 22px; }
.rdr-md li { margin-bottom: 6px; }
.rdr-md table { border-collapse: collapse; width: 100%; font-size: 13.5px; margin: 14px 0; background: var(--panel); border: 1px solid var(--line); }
.rdr-md th { background: var(--panel2); text-align: left; padding: 9px 12px; font-size: 11px; letter-spacing: 0.07em; text-transform: uppercase; color: var(--dim); border-bottom: 1px solid var(--line); }
.rdr-md td { padding: 8px 12px; border-bottom: 1px solid var(--line2); vertical-align: top; }
.rdr-md code { font-family: var(--mono); font-size: 0.88em; background: var(--panel2); padding: 1.5px 5px; border-radius: 3px; }
.rdr-md pre { background: var(--panel); border: 1px solid var(--line); padding: 12px 14px; overflow-x: auto; font-family: var(--mono); font-size: 12.5px; border-radius: 3px; }
.rdr-md blockquote { margin: 18px 0; padding: 8px 0 8px 18px; border-left: 2px solid var(--line); color: var(--dim); font-style: italic; }
.rdr-md a { color: var(--acc); }
.rdr-md hr { border: 0; border-top: 1px solid var(--line); margin: 30px 0; }

/* ============================================================ STONE — craft fixes */
/* Product Metrics era pills: eight pills must wrap, never clip (measured 2026-09-01) */
#pmx-era-pills { white-space: normal !important; display: inline-flex; flex-wrap: wrap; gap: 4px; }
/* charts: the shared tooltip node follows the theme */
#viz-tip { background: var(--panel); border: 1px solid var(--line); color: var(--ink); box-shadow: none; }

/* workspace profile (workspaceProfile.js): brand copy stays invisible, its
   space kept, until the workspace profile resolves; no wrong brand flashes */
html:not(.ws-ready) [data-ws-text],
html:not(.ws-ready) [data-ws-href] { visibility: hidden; }
[data-ws-href][hidden], option[data-ws-value][hidden] { display: none !important; }
