/* Congress Tracker: local app styles. No build step. */

:root {
  --bg: #0b0e14;
  --surface: #121620;
  --surface-2: #181d29;
  --surface-3: #1e2432;
  --border: #242b3a;
  --border-strong: #313a4d;
  --text: #e6e9ef;
  --text-2: #b3bac7;
  --muted: #7d8699;
  --accent: #4c8dff;
  --accent-2: rgba(76, 141, 255, .14);
  --accent-ink: #9cc0ff;
  --ok: #26c281;
  --ok-bg: rgba(38, 194, 129, .12);
  --warn: #f0a93b;
  --warn-bg: rgba(240, 169, 59, .12);
  --bad: #f25c5c;
  --bad-bg: rgba(242, 92, 92, .12);
  --doc-bg: #07090d;
  --buy: #26c281;
  --buy-bg: rgba(38, 194, 129, .13);
  --sell: #f25c5c;
  --sell-bg: rgba(242, 92, 92, .13);
  --radius: 6px;
  --radius-sm: 4px;
  --shadow: none;
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, .55);
  --font: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: "JetBrains Mono", "Cascadia Mono", "Consolas", ui-monospace, monospace;
  --appbar-h: 46px;
  --split: 56%;
  --zoom: 1;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code, .mono { font-family: var(--mono); font-size: .92em; }
button, input, select, textarea { font: inherit; color: inherit; }

/* ----------------------------------------------------------------------------- app bar ---- */
.appbar {
  height: var(--appbar-h);
  display: flex; align-items: center; gap: 28px;
  padding: 0 18px;
  background: #07090d;
  border-bottom: 1px solid var(--border);
  color: var(--text-2);
  position: sticky; top: 0; z-index: 20;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 650; letter-spacing: .2px; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 36px; height: 36px; border-radius: 8px; object-fit: cover; display: block;
  box-shadow: 0 0 0 2px rgba(255,255,255,.18);
}
.tabs { display: flex; gap: 4px; height: 100%; }
.tab {
  display: flex; align-items: center; padding: 0 12px; height: 100%;
  color: #a5abc3; font-weight: 500; border-bottom: 2px solid transparent;
}
.tab:hover { color: #fff; text-decoration: none; }
.tab.is-active { color: #fff; border-bottom-color: #818cf8; }
.appbar-right { margin-left: auto; }
/* the search on every page: people and tickers as you type */
.gsearch { position: relative; flex: 0 1 300px; min-width: 160px; margin-left: auto; }
.gsearch + .appbar-right { margin-left: 0; }
.gsearch input { width: 100%; height: 30px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); }
.gsearch input:focus { outline: none; border-color: var(--accent); }
.gsearch-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; min-width: 320px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 6px 0; max-height: 70vh; overflow: auto; z-index: 40; }
.gsearch-list h6 { margin: 6px 12px 2px; font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: .5px; }
.gsearch-list a { display: flex; align-items: baseline; gap: 8px; padding: 6px 12px; color: var(--text); }
.gsearch-list a:hover, .gsearch-list a.is-on { background: var(--accent-2); text-decoration: none; }
.gsearch-list a .tk { min-width: 52px; font-weight: 650; font-family: var(--mono); }
.gsearch-list a span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gsearch-list a small { color: var(--muted); white-space: nowrap; }
.gsearch-list .empty { padding: 8px 12px; color: var(--muted); }
.counts { display: flex; gap: 8px; }
.count-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,255,255,.07); color: #1a213c; font-size: 12.5px;
}
.count-chip:hover { background: rgba(255,255,255,.13); text-decoration: none; }
.count-chip b { color: #fff; font-weight: 650; }
.count-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); }
.count-chip.status-needs_review .dot { background: #f59e0b; }
.count-chip.status-parsed .dot { background: #34d399; }
.count-chip.status-failed .dot { background: #f87171; }
.count-chip.status-pending .dot { background: #93c5fd; }

/* ------------------------------------------------------------------------- empty state ---- */
.empty-state { max-width: 520px; margin: 12vh auto; text-align: center; color: var(--text-2); }
.empty-state h1 { font-size: 22px; color: var(--text); margin: 18px 0 6px; }
.empty-icon {
  width: 56px; height: 56px; margin: 0 auto; border-radius: 16px;
  background: linear-gradient(135deg, var(--accent-2), #0e1748);
  box-shadow: inset 0 0 0 1px #0e1748;
}

/* ------------------------------------------------------------------------ review layout ---- */
.page-review { overflow: hidden; }
.page-review main { height: calc(100vh - var(--appbar-h) - var(--banner-h, 0px)); overflow: hidden; }
.review {
  height: 100%;
  display: grid;
  grid-template-columns: var(--split) 6px 1fr;
  grid-template-rows: minmax(0, 1fr);   /* panes fill the height and scroll inside */
  min-height: 0;
}

/* document pane */
.doc-pane { display: flex; flex-direction: column; min-width: 0; background: var(--doc-bg); }
.doc-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 8px 12px; background: var(--surface); color: var(--text-2);
  border-bottom: 1px solid var(--border);
}
.tool-group { display: flex; align-items: center; gap: 6px; }
.tool-group.muted { color: #8c93a6; font-size: 12.5px; }
.icon-btn, .text-btn {
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text);
  height: 28px; border-radius: 6px; cursor: pointer;
}
.icon-btn { width: 28px; font-size: 16px; line-height: 1; }
.text-btn { padding: 0 10px; font-size: 12.5px; display: inline-flex; align-items: center; }
.icon-btn:hover, .text-btn:hover { background: var(--surface-3); border-color: var(--accent); text-decoration: none; }
.zoom-label { min-width: 46px; text-align: center; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.doc-scroll { flex: 1; overflow: auto; padding: 22px 0 40px; }
.pages {
  width: calc(min(100%, 900px) * var(--zoom));
  margin: 0 auto; padding: 0 22px;
  display: flex; flex-direction: column; gap: 22px;
}
.page {
  position: relative; margin: 0; background: var(--surface);
  border-radius: 3px; box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.page img { display: block; width: 100%; height: 100%; border-radius: 3px; user-select: none; }
.page figcaption {
  position: absolute; right: 8px; bottom: -18px;
  color: #8c93a6; font-size: 11px;
}
.overlay { position: absolute; inset: 0; }
.hl {
  position: absolute; padding: 0; cursor: pointer;
  border: 1.5px solid transparent; border-radius: 4px; background: transparent;
  transition: background .12s, border-color .12s, box-shadow .12s;
}
.hl:hover { border-color: rgba(79, 70, 229, .45); background: rgba(79, 70, 229, .05); }
.hl.has-issues { border-color: rgba(198, 40, 40, .55); background: rgba(198, 40, 40, .05); }
.hl.has-warnings { border-color: rgba(217, 119, 6, .5); background: rgba(217, 119, 6, .05); }
.hl.is-invalid { border-style: dashed; border-color: rgba(100,100,100,.5); background: rgba(0,0,0,.04); }
.hl.is-active {
  border-color: var(--accent); background: rgba(79, 70, 229, .10);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, .15);
}
.html-doc { width: 100%; height: calc(100vh - 150px); border: 0; background: var(--surface); border-radius: 3px; }
.page.scan img { height: auto; }
.html-report { padding: 28px 30px 34px; color: #a4b4cc; font-size: 13px; }
.html-report h1 { font-size: 19px; margin: 0 0 4px; font-family: Georgia, "Times New Roman", serif; }
.html-report h2 { font-size: 14px; margin: 0 0 6px; font-weight: 600; color: #aab4c5; }
.html-report .filed { margin: 0 0 16px; color: #6b7280; font-size: 12.5px; }
.html-report table { width: 100%; border-collapse: collapse; }
.html-report th { text-align: left; font-size: 11.5px; color: #6b7280; border-bottom: 2px solid #1e2638; padding: 6px 8px; }
.html-report td { border-bottom: 1px solid #1c253a; padding: 7px 8px; vertical-align: top; }
.html-row { cursor: pointer; transition: background .12s; }
.html-row:hover { background: rgba(79, 70, 229, .05); }
.html-row.has-issues { box-shadow: inset 3px 0 0 rgba(198, 40, 40, .7); }
.html-row.is-flagged { box-shadow: inset -3px 0 0 #a855f7; }
.html-row.is-active { background: rgba(79, 70, 229, .12); outline: 2px solid var(--accent); outline-offset: -2px; }

.splitter { cursor: col-resize; background: var(--border); position: relative; }
.splitter::after {
  content: ""; position: absolute; top: 50%; left: 1px; width: 4px; height: 36px;
  margin-top: -18px; border-radius: 2px; background: var(--border-strong);
}
.splitter:hover, .splitter.is-dragging { background: #111845; }

/* right panel */
.panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.navbar {
  padding: 10px 16px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border); box-shadow: var(--shadow);
  position: relative; z-index: 5;
}
.nav-row { display: flex; align-items: center; gap: 8px; }
.nav-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text); font-weight: 550;
}
.nav-btn:hover { background: var(--surface-2); text-decoration: none; }
.nav-btn.is-disabled { opacity: .4; pointer-events: none; }
.nav-btn span { font-size: 18px; line-height: 1; margin-top: -2px; }
.position { min-width: 86px; text-align: center; color: var(--text-2); font-variant-numeric: tabular-nums; }
.position b { color: var(--text); }
.jump { margin-left: auto; position: relative; width: min(300px, 45%); }
.jump input, .filters input, .filters select {
  height: 32px; width: 100%; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface);
}
.jump input:focus, .filters input:focus, .filters select:focus,
.fields input:focus, .fields select:focus, .fields textarea:focus {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}
.search-results { position: absolute; top: 36px; right: 0; width: 360px; z-index: 30; }
.results-list {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); overflow: hidden; max-height: 60vh; overflow-y: auto;
}
.result {
  display: grid; grid-template-columns: 1fr auto; gap: 1px 10px;
  padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text);
}
.result:last-child { border-bottom: 0; }
.result:hover, .result.is-focused { background: var(--accent-2); text-decoration: none; }
.result-name { font-weight: 600; }
.result-meta { color: var(--text-2); font-size: 12px; grid-column: 1; }
.result-id { color: var(--muted); font-size: 11px; grid-row: 1 / 3; grid-column: 2; align-self: center; }
.result.empty { color: var(--muted); display: block; }
.filters { display: flex; gap: 8px; margin-top: 10px; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--muted); font-weight: 550; min-width: 110px; }
.filters label.grow { flex: 1; }
.filters .clear { font-size: 12.5px; padding-bottom: 7px; }

.panel-scroll { flex: 1; overflow-y: auto; padding: 16px 16px 24px; }

/* filing header card */
.filing-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow); margin-bottom: 14px;
}
.filing-top { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; }
.filer { font-size: 19px; line-height: 1.25; margin: 0 0 6px; letter-spacing: -.2px; }
.filing-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--text-2); font-size: 12.5px; }
.filing-meta .mono { color: var(--muted); }
.pills { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; max-width: 45%; }
.pill {
  display: inline-flex; align-items: center; height: 22px; padding: 0 9px;
  border-radius: 999px; font-size: 11.5px; font-weight: 650; text-transform: capitalize;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.pill.status-parsed { background: var(--ok-bg); color: var(--ok); border-color: #163832; }
.pill.status-needs_review { background: var(--warn-bg); color: var(--warn); border-color: #3c2f1a; }
.pill.status-failed { background: var(--bad-bg); color: var(--bad); border-color: #39151d; }
.pill.status-pending { background: #0e2448; color: #1d4ed8; border-color: #0e2248; }
.pill.reviewed { background: var(--accent-2); color: var(--accent-ink); border-color: #0e1648; text-transform: none; }
.pill.tier, .pill.quality { text-transform: none; }
.status-text.status-needs_review { color: var(--warn); }
.status-text.status-parsed { color: var(--ok); }
.status-text.status-failed { color: var(--bad); }

.issue-box, .ok-box { margin-top: 12px; border-radius: var(--radius-sm); padding: 9px 12px; font-size: 13px; }
.issue-box { background: var(--bad-bg); color: #e48b8b; border: 1px solid #39151d; }
.issue-box ul { margin: 4px 0 0; padding-left: 18px; }
.ok-box { background: var(--ok-bg); color: #79f7d3; border: 1px solid #163832; }
.warn-box { margin-top: 8px; border-radius: var(--radius-sm); padding: 8px 12px; font-size: 12.5px;
  background: var(--warn-bg); color: #fcc374; border: 1px solid #3c2f1a; }

/* row cards */
.rows { display: flex; flex-direction: column; gap: 10px; }
.row-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); transition: border-color .12s, box-shadow .12s;
  scroll-margin-top: 12px;
}
.row-card:hover { border-color: var(--border-strong); }
.row-card.is-active { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .14); }
.row-card.has-issues { border-left: 3px solid var(--bad); }
.row-card.is-invalid { opacity: .6; background: repeating-linear-gradient(-45deg, #fff, #fff 8px, #1d2138 8px, #1d2138 16px); }
.row-card.has-warnings { border-left: 3px solid #f0a53a; }
.row-card.is-edited:not(.has-issues) { border-left: 3px solid var(--accent); }
.row-card.is-dirty { border-color: var(--warn); box-shadow: 0 0 0 3px rgba(180, 83, 9, .12); }
.row-card.is-new { border: 1.5px dashed var(--accent); }
.row-head { display: flex; align-items: center; gap: 10px; padding: 11px 14px 0; }
.row-num {
  flex: none; width: 24px; height: 24px; border-radius: 7px; display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--border); font-size: 12px; font-weight: 650; color: var(--text-2);
}
.row-title { flex: 1; min-width: 0; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-badges { display: flex; gap: 5px; flex: none; }
.badge {
  display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 5px;
  font-size: 11px; font-weight: 650; border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2);
}
.badge.ticker { font-family: var(--mono); background: #0e2748; color: #1e40af; border-color: #0e2348; }
.badge.option { background: #1e1248; color: #6d28d9; border-color: #1b1248; }
.badge.etf { background: #0f2a2a; color: #2dd4bf; border-color: #134040; margin-left: 4px; cursor: help; }
.badge.etf.lev { background: #3c2b1a; color: #f0a93b; border-color: #4a341a; }
.etf-line { margin: 2px 0 6px; color: var(--text-2); }
.badge.edited { background: var(--accent-2); color: var(--accent-ink); border-color: #0e1648; }
.badge.ocr { background: #3c2b1a; color: #f09b7f; border-color: #3c2a1a; }
.badge.held { background: #3c121a; color: #b91c1c; border-color: #3c121a; }
.badge.invalid { background: #1e2138; color: #555; }
.badge.page-link { cursor: pointer; }
.badge.page-link:hover { border-color: var(--accent); color: var(--accent); }

.fields {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 9px 10px;
  padding: 11px 14px 4px;
}
.f { display: flex; flex-direction: column; gap: 3px; font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; min-width: 0; }
.f.span-2 { grid-column: span 2; }
.f.span-4 { grid-column: span 4; }
.fields input, .fields select, .fields textarea {
  width: 100%; min-width: 0; height: 32px; padding: 0 8px;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text);
  font-size: 13.5px; font-weight: 450; text-transform: none; letter-spacing: 0;
}
.fields textarea { height: auto; padding: 6px 8px; resize: vertical; line-height: 1.4; }
.fields input:hover, .fields select:hover, .fields textarea:hover { border-color: var(--border-strong); }
.fields .upper { text-transform: uppercase; }
.f.bad { color: var(--bad); }
.f.bad input, .f.bad select, .f.bad textarea { border-color: #eaa5a5; background: #3c121a; }
.f.odd { color: var(--warn); }
.f.odd input, .f.odd select { border-color: #f1c98a; background: #3c301a; }

.details { display: grid; grid-template-columns: max-content 1fr; gap: 3px 12px; margin: 6px 14px 2px; font-size: 12.5px; }
.details dt { color: var(--muted); }
.details dd { margin: 0; color: var(--text-2); }
.row-issues { margin: 8px 14px 0; padding: 7px 10px 7px 26px; border-radius: var(--radius-sm); background: var(--bad-bg); color: #e48b8b; font-size: 12.5px; }
.row-warnings { margin: 8px 14px 0; padding: 7px 10px 7px 26px; border-radius: var(--radius-sm); background: var(--warn-bg); color: #fcc374; font-size: 12.5px; }
.was { margin: 8px 14px 0; font-size: 12px; color: var(--muted); }
.row-foot { display: flex; align-items: center; gap: 8px; padding: 10px 14px 12px; }
.spacer { flex: 1; }

.no-rows {
  background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius);
  padding: 18px; color: var(--text-2);
}
.no-rows b { display: block; color: var(--text); margin-bottom: 4px; }
#new-row-slot:not(:empty) { margin-top: 10px; }

/* spot check */
.check-banner {
  background: var(--surface); border: 1px solid #0e1648; border-radius: var(--radius);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .07), var(--shadow);
  padding: 14px 16px; margin-bottom: 14px;
  position: sticky; top: -16px; z-index: 4;   /* stays in view while the rows scroll */
}
.check-banner.verdict-ok { border-color: #163832; box-shadow: 0 0 0 3px rgba(4, 120, 87, .07), var(--shadow); }
.check-banner.verdict-wrong { border-color: #39151d; box-shadow: 0 0 0 3px rgba(198, 40, 40, .07), var(--shadow); }
.check-top { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.check-kicker { font-size: 12px; color: var(--muted); }
.check-kicker b { color: var(--accent-ink); }
.check-q { margin: 3px 0 2px; font-size: 17px; letter-spacing: -.2px; }
.check-hint { margin: 0; color: var(--text-2); font-size: 12.5px; }
.verdict-pill.ok { background: var(--ok-bg); color: var(--ok); border-color: #163832; text-transform: none; }
.verdict-pill.wrong { background: var(--bad-bg); color: var(--bad); border-color: #39151d; text-transform: none; }
.check-dots { display: flex; flex-wrap: wrap; gap: 5px; margin: 12px 0; }
.dot-link {
  width: 26px; height: 26px; border-radius: 7px; display: grid; place-items: center;
  font-size: 11.5px; font-weight: 650; color: var(--text-2);
  background: var(--surface-2); border: 1px solid var(--border);
}
.dot-link:hover { text-decoration: none; border-color: var(--accent); }
.dot-link.ok { background: var(--ok-bg); color: var(--ok); border-color: #163832; }
.dot-link.wrong { background: var(--bad-bg); color: var(--bad); border-color: #39151d; }
.dot-link.is-current { box-shadow: 0 0 0 2px var(--accent); }
.check-form { display: flex; gap: 8px; flex-wrap: wrap; }
.check-note {
  flex: 1; min-width: 220px; height: 34px; padding: 0 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
}
.check-note:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.check-actions { display: flex; gap: 8px; }
.btn-ok { background: var(--ok); border-color: var(--ok); color: #fff; height: 34px; }
.btn-ok:hover { background: #79f7d3; }
.btn-wrong { background: var(--surface); border-color: #eaa5a5; color: var(--bad); height: 34px; }
.btn-wrong:hover { background: var(--bad-bg); }
.check-mode-note { color: var(--muted); font-size: 12.5px; padding-bottom: 8px; }

/* flags */
.badge.flagged { background: #241248; color: #7e22ce; border-color: #241248; }
.row-card.is-flagged { border-right: 3px solid #a855f7; }
.hl.is-flagged { outline: 2px dashed rgba(168, 85, 247, .6); outline-offset: 2px; }
.flag-note {
  margin: 8px 14px 0; padding: 7px 10px; border-radius: var(--radius-sm);
  background: #251248; color: #6b21a8; font-size: 12.5px; border: 1px solid #241248;
}
.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; margin-left: 8px; font-size: 12.5px; }
.link-btn:hover { text-decoration: underline; }
.flag-form { display: flex; gap: 8px; padding: 0 14px 12px; }
.flag-form[hidden] { display: none; }
.flag-form input {
  flex: 1; height: 32px; padding: 0 10px; border: 1px solid #241248; border-radius: var(--radius-sm);
}
.flag-form input:focus { outline: none; border-color: #a855f7; box-shadow: 0 0 0 3px rgba(168, 85, 247, .15); }
.btn-flag { background: #9333ea; border-color: #9333ea; color: #fff; }
.btn-flag:hover { background: #7e22ce; }
.btn-accept { background: var(--ok); border-color: var(--ok); color: #fff; }
.btn-accept:hover { filter: brightness(0.92); }

/* buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 32px; padding: 0 13px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-weight: 550; cursor: pointer;
}
.btn:hover { background: var(--surface-2); }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #4338ca; }
.btn-ghost { border-color: transparent; background: transparent; color: var(--text-2); height: 28px; padding: 0 9px; }
.btn-ghost:hover { background: var(--surface-2); }
.btn-ghost.danger:hover { color: var(--bad); background: var(--bad-bg); }
.actions {
  display: flex; align-items: center; gap: 8px; padding: 10px 16px;
  background: var(--surface); border-top: 1px solid var(--border);
}

.htmx-request.btn, .htmx-request .btn-primary { opacity: .7; cursor: progress; }

/* toast */
.toast {
  position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #9cadd4; color: #fff; padding: 9px 16px; border-radius: 999px;
  font-size: 13px; box-shadow: var(--shadow-lg); opacity: 0; transition: .2s; z-index: 50;
}
.toast.is-shown { opacity: 1; transform: translateX(-50%); }

@media (max-width: 1100px) {
  .fields { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .f.span-4 { grid-column: span 2; }
}

/* ------------------------------------------------------------------------ missing tab ---- */
.missing { max-width: 1280px; margin: 0 auto; padding: 22px 24px 60px; }
.page-head h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.3px; }
.page-head p { margin: 0 0 18px; color: var(--text-2); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 16px 18px; margin-bottom: 16px; }
.coverage { overflow-x: auto; }
.cov { border-collapse: separate; border-spacing: 4px; }
.cov th { font-size: 12px; color: var(--muted); font-weight: 600; text-align: center; }
.cov th[scope=row] { text-align: left; color: var(--text); font-size: 13px; padding-right: 10px; white-space: nowrap; }
.cov .info { color: var(--muted); cursor: help; margin-left: 4px; }
.cell { position: relative; display: block; min-width: 62px; padding: 6px 6px 8px; border-radius: 7px;
  text-align: center; font-size: 12px; color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); overflow: hidden; }
.cell:hover { text-decoration: none; border-color: var(--accent); }
.cell b { color: var(--text); font-size: 13px; }
.cell i { position: absolute; left: 0; bottom: 0; height: 3px; background: #34d399; }
.cell.full { background: var(--ok-bg); border-color: #163832; }
.cell.part { background: #3c361a; border-color: #3c321a; }
.cell.none { background: #3b131b; border-color: #39151d; }
.cell.unknown { color: var(--muted); background: transparent; border-style: dashed; }
.legend { margin: 10px 0 0; font-size: 12px; color: var(--muted); display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 3px; vertical-align: -1px; border: 1px solid var(--border); }
.sw.full { background: var(--ok-bg); } .sw.part { background: #3c361a; } .sw.none { background: #3b131b; }
.sw.unknown { border-style: dashed; }
.reason-chips { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.chip { display: inline-flex; gap: 6px; align-items: center; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; }
.chip:hover { text-decoration: none; border-color: var(--accent); }
.chip.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip b { font-weight: 650; }
.inline-search input { height: 30px; padding: 0 10px; border: 1px solid var(--border-strong); border-radius: 999px; }
.list-head { margin-bottom: 10px; color: var(--text-2); }
.gaps { width: 100%; border-collapse: collapse; font-size: 13px; }
.gaps th { text-align: left; font-size: 11.5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); }
.gaps td { padding: 7px 8px; border-bottom: 1px solid #1b253b; }
.gaps tr:hover td { background: var(--surface-2); }
.nowrap { white-space: nowrap; }
.reason { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2); border: 1px solid var(--border); }
.reason-not_downloaded { background: #0e2448; color: #1d4ed8; border-color: #0e2248; }
.reason-form201 { background: #3b1332; color: #ed82ad; border-color: #3c1234; }
.reason-agency_only { background: #2b2e2b; color: #57534e; }
.reason-scan_unread { background: #3c2b1a; color: #f09b7f; border-color: #3c2a1a; }
.reason-deferred { background: #161248; color: #5b21b6; border-color: #161248; }
.pager { display: flex; gap: 14px; justify-content: center; margin-top: 12px; color: var(--muted); }
.empty { color: var(--muted); }
.how h2 { font-size: 15px; margin: 0 0 8px; }
.how dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; font-size: 13px; }
.how dt { font-weight: 600; } .how dd { margin: 0; color: var(--text-2); }

.snapshot-banner { background: #3c361a; color: #efa880; border-bottom: 1px solid #fcd34d;
  padding: 7px 18px; font-size: 12.5px; }
body:has(.snapshot-banner) { --banner-h: 33px; }
body:has(.source-banner) { --banner-h: 33px; }
body:has(.snapshot-banner):has(.source-banner) { --banner-h: 66px; }
.source-banner { background: #3c311a; color: #fcc374; border-bottom: 1px solid #3c2f1a;
  padding: 7px 18px; font-size: 12.5px; display: flex; gap: 18px; flex-wrap: wrap; }
.source-banner a { margin-left: auto; }

/* data tab: sources */
.section-links { font-size: 13px; color: var(--muted); margin-top: -8px; margin-bottom: 14px; }
.section-title { font-size: 17px; margin: 4px 0 2px; letter-spacing: -.2px; }
.section-sub { margin: 0 0 12px; color: var(--text-2); font-size: 13px; }
#missing { margin-top: 26px; scroll-margin-top: 70px; }
#sources { scroll-margin-top: 70px; }
.sources { width: 100%; border-collapse: collapse; font-size: 13px; }
.sources th { text-align: left; font-size: 11.5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.sources td { padding: 9px 8px; border-bottom: 1px solid #1b253b; vertical-align: top; }
.src-name { min-width: 170px; }
.src-name a { font-weight: 600; }
.src-name code { display: block; margin-top: 4px; font-size: 11px; color: var(--muted); }
.src-note { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.src-note.warn { color: var(--warn); }
.src-planned td, .src-pending td { color: var(--text-2); }
.check { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650;
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text-2); white-space: nowrap; }
.check-on_time { background: var(--ok-bg); color: var(--ok); border-color: #163832; }
.check-overdue { background: var(--warn-bg); color: var(--warn); border-color: #3c2f1a; }
.check-never { background: var(--bad-bg); color: var(--bad); border-color: #39151d; }
.check-pending { background: #161248; color: #5b21b6; border-color: #161248; }

/* =========================================================================== Phase 3 pages == */
.page-wrap { max-width: 1320px; margin: 0 auto; padding: 22px 24px 60px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.card-head h2, .rail-card h2 { font-size: 15px; margin: 0; letter-spacing: -.1px; }
.footnote { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.notice { padding: 9px 14px; border-radius: var(--radius-sm); margin-bottom: 14px; font-size: 13px; }
.notice.warn { background: var(--warn-bg); color: #fcc374; border: 1px solid #3c2f1a; }
.notice.ok { background: var(--ok-bg); color: #79f7d3; border: 1px solid #163832; }

/* stat cards */
.stat-cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat-cards.six { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.stat-card { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
a.stat-card:hover { border-color: var(--accent); text-decoration: none; }
.stat-card.is-on { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .12); }
.stat-card.warn .stat-value { color: var(--warn); }
.stat-label { font-size: 11.5px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; }
.stat-value { font-size: 24px; font-weight: 700; letter-spacing: -.5px; font-variant-numeric: tabular-nums; }
.stat-sub { font-size: 12px; color: var(--text-2); }
.side-buy-text { color: var(--buy); }
.side-sell-text { color: var(--sell); }

/* feed layout */
.feed-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.feed-rail { position: sticky; top: calc(var(--appbar-h) + 16px); display: flex; flex-direction: column; gap: 16px; }
.feed-rail .card { margin: 0; }
.rail-sub { margin: 4px 0 10px; font-size: 12px; color: var(--muted); }
.rail-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 7px 0; border-top: 1px solid #1b253b; color: var(--text); font-size: 13px; }
.rail-row:first-of-type { border-top: 0; }
.rail-row:hover { text-decoration: none; background: var(--surface-2); }
.rail-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.rail-row.two-line .rail-name { display: flex; flex-direction: column; }
.rail-row.two-line .rail-name b { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.rail-row.two-line small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.rail-num { font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.rail-foot { margin: 8px 0 0; font-size: 11.5px; color: var(--muted); text-align: right; }

/* charts */
.chart-card { margin-bottom: 16px; }
.chart-box { position: relative; height: 260px; }
.chart-box.short { height: 180px; }
.legend-inline { font-size: 12px; color: var(--muted); display: inline-flex; gap: 6px; align-items: center; }
.legend-inline i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 6px; }
.sw-buy { background: var(--buy); } .sw-sell { background: var(--sell); }
.seg { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 5px 11px; font-size: 12.5px; cursor: pointer; color: var(--text-2); }
.seg button + button { border-left: 1px solid var(--border); }
.seg button:hover { background: var(--surface-2); }
.seg button.is-on { background: var(--accent); color: #fff; }
.chart-controls { display: flex; gap: 8px; flex-wrap: wrap; }
.placeholder-chart { height: 120px; display: grid; place-items: center; text-align: center; padding: 0 30px;
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius-sm); color: var(--text-2); font-size: 13px;
  background: repeating-linear-gradient(-45deg, var(--surface), var(--surface) 10px, var(--surface-2) 10px, var(--surface-2) 20px); }
.placeholder-chart p { margin: 0; max-width: 720px; }

/* filter bar */
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.filterbar select, .filterbar input[type=search] { height: 32px; padding: 0 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface); }
.filterbar input[type=search] { flex: 1; min-width: 180px; }
.filterbar select:focus, .filterbar input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
.filterbar .clear { font-size: 12.5px; }
.period-chips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.chip-radio { position: relative; }
.chip-radio input { position: absolute; inset: 0; opacity: 0; pointer-events: none; margin: 0; }
.chip-radio span { display: inline-flex; gap: 5px; align-items: center; height: 30px; padding: 0 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text-2); font-size: 12.5px; cursor: pointer; }
.chip-radio span small { color: var(--muted); }
.chip-radio input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip-radio input:checked + span small { color: #0e1648; }
.chip-radio input:focus-visible + span { box-shadow: 0 0 0 3px rgba(79, 70, 229, .25); }

/* trade list */
.trades { --cols: 96px minmax(0, 1.1fr) minmax(0, 1.9fr) 68px 104px 92px 44px 74px 12px; font-size: 13px; }
.trades.no-person { --cols: 96px minmax(0, 2.6fr) 68px 104px 92px 44px 74px 12px; }
.trade-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.t-since { font-weight: 600; }
.trade-head, .trade-row { display: grid; grid-template-columns: var(--cols); gap: 10px; align-items: center; }
.trade-head { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.trade { border-bottom: 1px solid #1b253b; }
.trade-row { padding: 8px 10px; cursor: pointer; list-style: none; }
.trade-row::-webkit-details-marker { display: none; }
.trade-row:hover { background: var(--surface-2); }
.trade[open] > .trade-row { background: var(--accent-2); }
.t-date { color: var(--text-2); white-space: nowrap; }
.t-date .est { color: var(--muted); font-style: normal; margin-left: 1px; }
.new-badge { display: inline-block; margin-left: 4px; padding: 0 5px; border-radius: 4px; font-size: 10.5px;
  background: var(--accent); color: #fff; vertical-align: 1px; }
.t-who { display: flex; flex-direction: column; min-width: 0; }
.t-who a { font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.t-who a:hover { color: var(--accent); }
.t-who small { font-size: 11.5px; color: var(--muted); }
.t-asset { display: flex; gap: 6px; align-items: center; min-width: 0; }
.t-asset .badge { flex: none; }
.t-asset-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
a.badge.ticker:hover { text-decoration: none; border-color: #1e40af; }
.side { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 650; white-space: nowrap; }
.side-buy { background: var(--buy-bg); color: var(--buy); }
.side-sell { background: var(--sell-bg); color: var(--sell); }
.side-exchange { background: #0e2448; color: #1d4ed8; }
.side-unknown { background: #1e2138; color: #666; }
.t-amt { font-weight: 600; white-space: nowrap; }
.t-traded { color: var(--text-2); white-space: nowrap; }
.t-lag { color: var(--text-2); }
.t-lag.late { color: var(--warn); font-weight: 650; }
.t-more { color: var(--muted); transition: transform .15s; }
.trade[open] .t-more { transform: rotate(90deg); }
.trade-more { padding: 4px 10px 12px 130px; background: var(--accent-2); }
.trade-more dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 14px; margin: 0; font-size: 12.5px; }
.trade-more dt { color: var(--muted); } .trade-more dd { margin: 0; color: var(--text); }
.no-trades { color: var(--muted); padding: 20px 10px; }

/* tables (people, tickers, health) */
.grid-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-table th { text-align: left; font-size: 11.5px; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; font-weight: 600; }
.grid-table td { padding: 8px; border-bottom: 1px solid #1b253b; vertical-align: middle; }
.grid-table tr:hover td { background: var(--surface-2); }
.grid-table th.num { text-align: right; }
.muted-cell { color: var(--text-2); font-size: 12.5px; }
.clip { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-link { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; color: var(--text); }
.person-link:hover { color: var(--accent); text-decoration: none; }
.branch-tag { display: inline-block; padding: 0 7px; margin-right: 5px; border-radius: 5px; font-size: 11px; font-weight: 650; border: 1px solid; }
.branch-house { color: #1d4ed8; } .branch-tag.branch-house { background: #0e2448; border-color: #0e2248; }
.branch-senate { color: #7c3aed; } .branch-tag.branch-senate { background: #1e1248; border-color: #1b1248; }
.branch-executive { color: #b45309; } .branch-tag.branch-executive { background: #3c2f1a; border-color: #3c2f1a; }
.ratio { display: inline-flex; width: 90px; height: 8px; border-radius: 4px; overflow: hidden; background: #1c253a; vertical-align: middle; }
.ratio i { display: block; height: 100%; }
.ratio-buy { background: var(--buy); } .ratio-sell { background: var(--sell); }

/* avatars (a stable colour per name until photos arrive) */
.avatar { --h: 230; display: inline-grid; place-items: center; flex: none; border-radius: 50%; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, hsl(var(--h) 60% 55%), hsl(calc(var(--h) + 40) 60% 42%)); text-transform: uppercase; }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 132px; height: 132px; font-size: 44px; margin: 4px auto 6px; display: grid; box-shadow: var(--shadow-lg); }

/* person / ticker: wiki-style top */
.person-head h1 { margin: 0 0 3px; font-size: 26px; letter-spacing: -.5px; }
.person-head p { margin: 0 0 16px; color: var(--text-2); }
.ticker-big { font-family: var(--mono); color: #1e40af; background: #0e2748; border: 1px solid #0e2348; padding: 0 8px; border-radius: 7px; margin-right: 6px; }
.wiki-top { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; align-items: start; margin-bottom: 16px; }
.wiki-top .card { margin: 0; }
.pie-wrap { display: grid; grid-template-columns: 250px minmax(0, 380px); gap: 28px; align-items: center; justify-content: center; }
.chart-box.pie { height: 250px; }
.pie-legend { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 5px; font-size: 13px; }
.pie-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.pie-legend i { width: 12px; height: 12px; border-radius: 3px; }
.pie-legend a, .pie-legend span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text); }
.pie-legend b { font-variant-numeric: tabular-nums; color: var(--text-2); font-weight: 600; }
.infobox { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 16px 16px 12px; text-align: center; }
.infobox h2 { font-size: 16px; margin: 6px 0 10px; }
.infobox dl { display: grid; grid-template-columns: 95px 1fr; gap: 6px 10px; margin: 0; text-align: left; font-size: 12.5px;
  border-top: 1px solid var(--border); padding-top: 10px; }
.infobox dt { color: var(--muted); font-weight: 600; } .infobox dd { margin: 0; }
.infobox dd small { color: var(--text-2); }
.infobox .later { color: var(--muted); font-style: italic; }
.photo-note { margin: 0; font-size: 11px; color: var(--muted); }
.ticker-tile { width: 132px; height: 92px; margin: 4px auto 6px; display: grid; place-items: center; border-radius: 16px;
  font: 700 30px var(--mono); color: #1e40af; background: linear-gradient(135deg, #0e2748, #0e2248); border: 1px solid #0e2348; }

/* health */
.job-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; margin-bottom: 16px; }
.job-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; border-top: 3px solid var(--border-strong); }
.job-card header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.job-card h3 { margin: 0; font-size: 14.5px; }
.job-state { font-size: 11.5px; font-weight: 650; color: var(--muted); }
.job-card.state-ok { border-top-color: #34d399; } .job-card.state-ok .job-state { color: var(--ok); }
.job-card.state-running { border-top-color: var(--accent); } .job-card.state-running .job-state { color: var(--accent); }
.job-card.state-cooling, .job-card.state-failed { border-top-color: #f0a53a; }
.job-card.state-cooling .job-state, .job-card.state-failed .job-state { color: var(--warn); }
.job-card dl { display: grid; grid-template-columns: 78px 1fr; gap: 4px 10px; margin: 0; font-size: 12.5px; }
.job-card dt { color: var(--muted); } .job-card dd { margin: 0; }
.job-msg { overflow-wrap: anywhere; }
.job-card form { margin-top: auto; }
.pill.health-ok { background: var(--ok-bg); color: var(--ok); border-color: #163832; }
.pill.health-cooling_down, .pill.health-degraded { background: var(--warn-bg); color: var(--warn); border-color: #3c2f1a; }
.job-card.state-queued { border-top-color: var(--accent-ink); } .job-card.state-queued .job-state { color: var(--accent-ink); }
.health-summary { display: flex; flex-wrap: wrap; gap: 10px 28px; align-items: flex-start; margin-bottom: 14px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.health-summary > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.health-summary span { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.health-summary b { font-size: 18px; font-variant-numeric: tabular-nums; }
.health-summary b.summary-small { font-size: 13px; font-weight: 600; padding-top: 3px; }
.health-summary .summary-wide { flex: 1 1 260px; }
.health-summary small { font-size: 11.5px; }
.ok-text { color: var(--ok); }
.cat-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; margin-bottom: 16px; }
.cat-tile { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; background: var(--surface);
  border: 1px solid var(--border); border-top: 3px solid var(--border-strong); border-radius: var(--radius); }
.cat-tile:hover { border-color: var(--border-strong); }
.cat-tile.is-open { background: var(--surface-2); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.cat-tile.state-ok { border-top-color: #34d399; } .cat-tile.state-ok .job-state { color: var(--ok); }
.cat-tile.state-running, .cat-tile.state-queued { border-top-color: var(--accent); }
.cat-tile.state-running .job-state, .cat-tile.state-queued .job-state { color: var(--accent); }
.cat-tile.state-cooling, .cat-tile.state-failed { border-top-color: #f0a53a; }
.cat-tile.state-cooling .job-state, .cat-tile.state-failed .job-state { color: var(--warn); }
.cat-open { display: flex; flex-direction: column; gap: 5px; flex: 1; color: inherit; }
.cat-open:hover { text-decoration: none; }
.cat-open header { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.cat-open h3 { margin: 0; font-size: 14.5px; }
.cat-open p { margin: 0; font-size: 12.5px; color: var(--text-2); }
.cat-recent { display: flex; flex-direction: column; gap: 1px; font-variant-numeric: tabular-nums; }
.cat-recent small { color: var(--muted); font-size: 11px; }
.cat-toggle { margin-top: auto; padding-top: 4px; font-size: 12px; color: var(--accent-ink); font-weight: 600; }
.cat-tile .if-open, .cat-tile.is-open .if-closed { display: none; }
.cat-tile.is-open .if-open { display: inline; }
.page-health .muted { color: var(--muted); }
table.periods { border-collapse: collapse; font-size: 12px; font-variant-numeric: tabular-nums; width: 100%; }
table.periods th, table.periods td { padding: 2px 0 2px 8px; text-align: right; font-weight: 500; }
table.periods thead th { color: var(--muted); font-size: 11px; font-weight: 600; border-bottom: 1px solid var(--border); }
table.periods tbody th { text-align: left; padding-left: 0; color: var(--text-2); font-weight: 500; }
table.periods td { color: var(--text); font-weight: 650; }
table.periods tr.warn-row td, table.periods tr.warn-row th { color: var(--warn); }
#health-history > .card-head .muted-cell { margin-right: auto; }
.job-about { margin: -2px 0 0; font-size: 12px; color: var(--text-2); line-height: 1.4; }
.cat-tile form .btn { width: 100%; }
.cat-panel { padding: 14px 16px 2px; margin-bottom: 16px; border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--bg); }
.cat-panel > .card-head .muted-cell { flex: 1; }
.cat-hint { padding: 18px 0; text-align: center; }

@media (max-width: 1100px) {
  .feed-grid, .wiki-top { grid-template-columns: 1fr; }
  .feed-rail { position: static; }
  .stat-cards, .stat-cards.six { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pie-wrap { grid-template-columns: 1fr; }
}
main.is-loading { opacity: .55; transition: opacity .15s; pointer-events: none; }
.range { display: block; font-size: 11px; color: var(--muted); font-weight: 400; white-space: nowrap; }

/* Phase 4: party, sector, photos, unmatched queue */
.party { display: inline-grid; place-items: center; min-width: 18px; height: 16px; padding: 0 3px; border-radius: 4px;
  font-size: 10.5px; font-weight: 700; color: #fff; margin-left: 4px; vertical-align: 1px; background: #6b7280; }
.party-D { background: #2563eb; } .party-R { background: #dc2626; } .party-I { background: #7c3aed; }
.party.big { height: 24px; min-width: 26px; font-size: 14px; vertical-align: 4px; margin-left: 8px; }
.t-who small .party { margin: 0 3px 0 0; }
.sector-tag { flex: none; font-size: 10.5px; color: var(--muted); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
.member-photo { display: block; width: 150px; height: 183px; object-fit: cover; margin: 4px auto 8px; border-radius: 12px;
  box-shadow: var(--shadow-lg); background: var(--surface-2); }
img.avatar.photo { object-fit: cover; background: var(--surface-2); }
.rank { text-transform: capitalize; color: var(--accent-ink); font-weight: 600; }
.notice-link { display: block; margin: -6px 0 16px; padding: 10px 14px; border-radius: var(--radius-sm);
  background: var(--warn-bg); color: #fcc374; border: 1px solid #3c2f1a; font-size: 13px; }
.notice-link:hover { text-decoration: none; border-color: var(--warn); }
.resolve-form { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.resolve-form input { height: 30px; padding: 0 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); width: 90px; }
.resolve-form .btn { height: 30px; padding: 0 10px; }
td.resolved { color: var(--ok); background: var(--ok-bg); }
td.resolved.warn { color: var(--warn); background: var(--warn-bg); }
.grid-table.unmatched td { vertical-align: top; }
.notice.ai { display: flex; gap: 16px; align-items: center; justify-content: space-between; background: #161248;
  color: #ad87e8; border: 1px solid #161248; }
.ai-sugg { margin-bottom: 4px; }
.ai-tag { display: inline-block; font-size: 10px; font-weight: 700; color: #fff; background: #7c3aed; border-radius: 4px; padding: 0 5px; margin-right: 4px; }
.ai-sugg small { display: block; color: #6d28d9; }
.btn-ai { background: #161248; border-color: #181248; color: #5b21b6; }
.btn-ai:hover { background: #171248; }
.not-listed { color: var(--warn); font-style: normal; font-size: 11.5px; }

/* Review: rows to review ------------------------------------------------------------------ */
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; flex-basis: 100%; }
.filterbar label { display: inline-flex; gap: 6px; align-items: center; font-size: 12.5px; color: var(--muted); }
.empty-note { padding: 24px; color: var(--muted); text-align: center; }
.review-queue td { vertical-align: top; }
.review-queue .q-report { width: 170px; }
.review-queue .q-read { min-width: 620px; }
.review-queue .q-crop { display: block; width: 100%; min-width: 600px; margin-bottom: 6px; cursor: zoom-in;
  border: 1px solid var(--border-strong); border-radius: 4px; background: var(--surface); }
.review-queue .q-fields { font-size: 13px; }
.review-queue .q-asset { color: var(--muted); }
.review-queue .q-why { width: 200px; font-size: 12.5px; }
.review-queue .q-err { color: #b91c1c; margin-top: 3px; }
.review-queue .q-actions { white-space: nowrap; text-align: right; }
.review-queue .q-actions .btn { margin-left: 4px; }
.review-queue tr.q-done td { color: var(--muted); font-size: 12.5px; background: var(--ok-bg); }
.badge.src-house, .badge.src-senate, .badge.src-oge, .badge.src-whitehouse { font-size: 10.5px; }

/* Data: files map ------------------------------------------------------------------------- */
.status-legend { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 12px; }
.status-chip { display: inline-flex; gap: 7px; align-items: center; padding: 5px 11px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface); font-size: 12.5px; color: inherit; }
.status-chip:hover { text-decoration: none; border-color: var(--accent); }
.status-chip.is-on { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(79, 70, 229, .25); }
.status-chip b { font-weight: 650; }
.sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; flex: none; }
.files-map td { padding: 3px 4px; }
.files-map tr.is-on th a { color: var(--accent); font-weight: 650; }
.stack { display: flex; flex-direction: column; gap: 3px; min-width: 54px; padding: 4px 5px; border-radius: 6px;
  border: 1px solid transparent; color: inherit; font-size: 11.5px; text-align: center; }
.stack:hover { text-decoration: none; border-color: var(--border-strong); }
.stack.is-on { border-color: var(--accent); background: rgba(79, 70, 229, .06); }
.stack.empty { color: var(--muted); }
.stack .bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: #18293e; }
.stack .bar i { display: block; min-width: 2px; }
.files-head { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.files-head .inline-search { margin-left: auto; }
.file-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 6px; }
.file-tile { display: flex; flex-direction: column; gap: 2px; padding: 6px 9px; border-radius: 6px;
  border: 1px solid var(--border); border-left: 5px solid var(--c); background: color-mix(in srgb, var(--c) 12%, var(--surface));
  color: inherit; font-size: 12.5px; min-width: 0; }
.file-tile:hover { text-decoration: none; border-color: var(--c); }
.file-tile .ft-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.file-tile .ft-meta { color: var(--muted); font-size: 11.5px; }
.how dt { display: flex; gap: 7px; align-items: center; }

/* Prices -------------------------------------------------------------------------------- */
.price-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.price-line { display: flex; gap: 10px; align-items: baseline; margin-top: 4px; }
.price-now { font-size: 26px; font-weight: 700; letter-spacing: -.01em; }
.price-chg, .range-chg { font-size: 13.5px; font-weight: 600; color: var(--text-2); }
.up { color: #75fad1 !important; }
.down { color: #dc2626 !important; }
.price-chart { height: 320px; }
.live-stocks td.num.up, .live-stocks td.num.down { font-weight: 600; }
.pnl-card { margin-bottom: 16px; }
.pnl-grid { display: grid; grid-template-columns: 1fr 1fr 1.1fr; gap: 16px; align-items: start; }
.pnl-big { display: flex; flex-direction: column; gap: 2px; }
.pnl-big b { font-size: 26px; font-weight: 700; }
.pnl-big > span:not(.stat-label) { font-weight: 600; }
.pnl-big small { color: var(--muted); font-size: 12px; }
.pnl-parts { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; margin: 0; font-size: 13px; }
.pnl-parts dt { color: var(--muted); }
.pnl-parts dd { margin: 0; font-weight: 600; text-align: right; }
.pnl-tickers { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.pnl-chip { padding: 3px 9px; border-radius: 999px; border: 1px solid var(--border); font-size: 12px; color: inherit; }
.pnl-chip:hover { text-decoration: none; border-color: var(--accent); }
@media (max-width: 1100px) { .pnl-grid { grid-template-columns: 1fr; } }
.clusters-card { margin-bottom: 16px; }
.clusters td { vertical-align: middle; }
.clusters td.clip { max-width: 260px; }
.quiet-tag { display: inline-block; margin-left: 6px; padding: 1px 7px; border-radius: 999px; font-size: 10.5px;
  font-weight: 600; color: #f3a97d; background: #3c361a; border: 1px solid #fde68a; }

/* Positions (profile) --------------------------------------------------------------------- */
.pos-head, .pos-row { display: grid; gap: 10px; align-items: center;
  grid-template-columns: minmax(200px, 2fr) 120px 56px 90px 90px 70px 96px 96px 110px; }
.pos-head { padding: 0 10px 6px; font-size: 11.5px; font-weight: 600; color: var(--muted); border-bottom: 1px solid var(--border); }
.pos-row { padding: 8px 10px; cursor: pointer; list-style: none; font-size: 13px; }
.pos-row::-webkit-details-marker { display: none; }
.pos-row:hover { background: var(--surface-2); }
.pos { border-bottom: 1px solid var(--border); }
.pos[open] > .pos-row { background: var(--accent-2); }
.pos-body { padding: 8px 14px 14px; }
.pos-row small { display: block; font-size: 11px; }
.held-pill { background: #0e4029; color: #8ae5ad; border-color: #0f3f2a; }
.closed-pill { background: #18293e; color: #aab5c5; border-color: #19273c; }
.pos-events .pos-now td { background: var(--ok-bg); }
.stat-value.small { font-size: 16px; }
.pager-bar { display: flex; gap: 6px; align-items: center; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.pager-bar button, .pager-bar a { min-width: 32px; height: 30px; padding: 0 8px; border: 1px solid var(--border-strong);
  border-radius: 6px; background: var(--surface); cursor: pointer; font-size: 12.5px; color: inherit; display: inline-grid; place-items: center; }
.pager-bar .is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.pager-bar input { width: 56px; height: 30px; border: 1px solid var(--border-strong); border-radius: 6px; padding: 0 6px; }
.pager-bar .gap { color: var(--muted); }
.t-gain { display: block; font-size: 10.5px; font-weight: 600; }

/* ================================================================ professional tables (st) === */
body { font-size: 13px; }
.card, .stat-card, .infobox, .rail-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.st-bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 0 0 8px; position: relative; }
.st-bar input[type=search], .st-bar select, .st-bar input[type=number] {
  height: 28px; padding: 0 8px; background: var(--surface-2); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); color: var(--text); font-size: 12.5px; }
.st-bar .st-search { width: 200px; }
.st-bar .st-min { display: inline-flex; gap: 5px; align-items: center; color: var(--muted); font-size: 12px; }
.st-bar .st-min input { width: 76px; }
.st-count { margin-left: auto; color: var(--muted); font-size: 12px; }
.st-gear { width: 28px; height: 28px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  background: var(--surface-2); color: var(--text-2); cursor: pointer; font-size: 15px; line-height: 1; }
.st-gear:hover { color: var(--text); border-color: var(--accent); }
.st-panel { position: absolute; right: 0; top: 34px; z-index: 30; width: 260px; padding: 10px;
  background: var(--surface-3); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.st-panel-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.st-reset { background: none; border: 0; color: var(--accent-ink); cursor: pointer; font-size: 12px; }
.st-cols { list-style: none; margin: 0; padding: 0; max-height: 320px; overflow: auto; }
.st-cols li { display: flex; gap: 8px; align-items: center; padding: 4px 6px; border-radius: 4px; cursor: grab; font-size: 12.5px; }
.st-cols li:hover { background: var(--surface-2); }
.st-grip { color: var(--muted); letter-spacing: -2px; }
.st-hint { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

table.st { width: 100%; border-collapse: collapse; font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.st thead th { position: sticky; top: var(--appbar-h); z-index: 2; background: var(--surface-2);
  color: var(--muted); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .04em;
  text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
  cursor: pointer; user-select: none; }
table.st thead th:hover { color: var(--text); }
table.st thead th.num, table.st td.num { text-align: right; }
table.st thead th.st-sorted { color: var(--accent-ink); }
table.st thead th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
table.st thead th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
table.st tbody td { padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
table.st tbody tr:not(.st-detail):hover > td { background: var(--surface-2); }
table.st tbody tr.st-open > td { background: var(--accent-2); }
table.st tbody tr:has(+ .st-detail) { cursor: pointer; }
table.st tr.st-detail > td { padding: 10px 14px 14px; background: var(--bg); white-space: normal; }
table.st td.num { font-family: var(--mono); font-size: 12px; }
table.st td .sub { display: block; color: var(--muted); font-size: 11px; font-family: var(--font); }
table.st .up, .up { color: var(--buy) !important; }
table.st .down, .down { color: var(--sell) !important; }
.tk { display: inline-block; min-width: 46px; padding: 1px 6px; border-radius: 3px; background: var(--accent-2);
  color: var(--accent-ink); font: 600 11.5px var(--mono); text-align: center; }
.tk:hover { text-decoration: none; background: var(--accent); color: #fff; }
.who { display: inline-flex; gap: 8px; align-items: center; }
.who img, .who .avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; flex: none; }
.who .where { color: var(--muted); font-size: 11px; cursor: help; }
.side-tag { display: inline-block; min-width: 44px; padding: 1px 6px; border-radius: 3px; font-size: 11px; font-weight: 600; text-align: center; }
.side-tag.buy { background: var(--buy-bg); color: var(--buy); }
.side-tag.sell { background: var(--sell-bg); color: var(--sell); }
.side-tag.exchange { background: var(--surface-3); color: var(--text-2); }
.perf { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 12.5px; }
.perf th, .perf td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
.perf thead th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.perf tbody th { text-align: left; color: var(--text-2); font-weight: 500; white-space: nowrap; }
.perf td { text-align: right; font-family: var(--mono); font-size: 12px; }
.perf tr.perf-vs td, .perf tr.perf-vs th { border-top: 1px solid var(--border-strong); font-weight: 600; }
.seg.tabs button { font-weight: 600; }
.state { display: inline-block; padding: 1px 7px; border-radius: 3px; font-size: 11px; font-weight: 600; }
.state.held { background: var(--buy-bg); color: var(--buy); }
.state.closed { background: var(--surface-3); color: var(--muted); }
.sub-inline { color: var(--muted); font-size: 11px; margin-left: 6px; }
table.st-inner { background: var(--surface); }
table.st-inner thead th { position: static; }
tr.row-now > td { background: var(--ok-bg); }
.late { color: var(--warn) !important; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }
.trade-more-dl { display: grid; grid-template-columns: max-content 1fr; gap: 3px 16px; margin: 0; font-size: 12.5px; }
.trade-more-dl dt { color: var(--muted); }
.trade-more-dl dd { margin: 0; }
.pie-legend li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto 44px; gap: 8px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); font-size: 12.5px; }
.pie-legend li > a, .pie-legend li > span:not(.pie-amt) { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pie-legend .pie-amt { color: var(--muted); font-family: var(--mono); font-size: 11.5px; }
.pie-legend b { text-align: right; font-family: var(--mono); font-size: 12px; }
.pie-legend i { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.wiki-left { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.wiki-left .card { margin-bottom: 0; }
.appbar a { color: var(--text-2); }
.appbar .tab.is-active, .appbar a.is-active { color: var(--text); }

/* ticker price card: tabs, drag-to-measure box */
.price-card:has([data-pane="price-chart"][hidden]) .price-ranges,
.price-card:has([data-pane="price-chart"][hidden]) .price-line { display: none; }
.price-head .tabs { margin-bottom: 8px; }
.price-chart, .perf-plot { position: relative; cursor: crosshair; user-select: none; touch-action: pan-y; }
.measure {
  position: absolute; z-index: 3; pointer-events: none; display: flex; flex-direction: column; gap: 1px;
  padding: 6px 10px; border-radius: var(--radius-sm); background: rgba(7, 9, 13, .92);
  border: 1px solid var(--border-strong); font-size: 12px; color: var(--text-2); white-space: nowrap;
  font-variant-numeric: tabular-nums; box-shadow: var(--shadow-lg);
}
.measure b { font-size: 13.5px; color: var(--text); }
.measure.up b { color: var(--buy); }
.measure.down b { color: var(--sell); }

/* feed rail: ticker + a bar for how many bought */
.rail-bar { flex: 1; height: 6px; background: var(--surface-3); border-radius: 3px; overflow: hidden; margin: 0 10px; }
.rail-bar i { display: block; height: 100%; background: var(--buy); opacity: .75; }
.quiet-tag { margin-right: 6px; }

/* st look on tables without the column engine (forms, long text): wrap, no sort cursor */
table.st:not([data-st]) thead th { cursor: default; }
table.st:not([data-st]) thead th:hover { color: var(--muted); }
table.st.grid-table tbody td, table.st.sources tbody td { white-space: normal; }
table.st.sources tbody td, table.st.unmatched tbody td, table.st.review-queue tbody td { vertical-align: top; }
table.st .clip-short { display: inline-block; max-width: 160px; overflow: hidden; text-overflow: ellipsis; vertical-align: middle; white-space: nowrap; }
table.trades-table td[data-col="who"] a { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
table.trades-table tbody td, table.trades-table thead th { padding-left: 8px; padding-right: 8px; }

/* wide tables scroll sideways inside their card */
.st-scroll { overflow-x: auto; max-width: 100%; }
.st-scroll > table.st thead th { position: static; }
.st-scroll::-webkit-scrollbar { height: 8px; }
.st-scroll::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 4px; }
/* multi-level sorting */
table.st thead th[data-rank]:not([data-rank=""])::after { content: " " attr(data-rank); font-size: 9px; }
table.st thead th[data-rank]:not([data-rank=""])[data-dir="desc"]::after { content: " ▼" attr(data-rank); }
table.st thead th[data-rank]:not([data-rank=""])[data-dir="asc"]::after { content: " ▲" attr(data-rank); }
table.st thead th.st-nosort { cursor: default; }
table.st thead th.st-nosort:hover { color: var(--muted); }
.st-sorts { list-style: none; margin: 0 0 8px; padding: 0; counter-reset: lvl; }
.st-sorts li { display: flex; align-items: center; gap: 6px; padding: 4px 6px; font-size: 12.5px; }
.st-sorts li[data-i]::before { counter-increment: lvl; content: counter(lvl); color: var(--muted); font-size: 11px; width: 12px; }
.st-sorts li span { flex: 1; }
.st-sorts button { background: var(--surface-2); border: 1px solid var(--border-strong); color: var(--text-2);
  border-radius: 4px; font-size: 11px; padding: 2px 6px; cursor: pointer; }
.st-sorts button:hover { border-color: var(--accent); color: var(--text); }
.st-add { width: 100%; margin-bottom: 4px; }
.st-panel-head.st-gap { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--border); }
.st-panel { max-height: 70vh; overflow: auto; }
.date-range { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; }
.date-range input[type=date], .st-min input[type=date] { color-scheme: dark; }
.st-min input[type=date] { width: 128px; }

/* top bar: "Since" year + month */
.since-pick { display: flex; align-items: center; gap: 6px; margin-left: auto; margin-right: 12px;
  font-size: 12px; color: var(--muted); }
.since-pick select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); height: 28px; padding: 0 6px; font-size: 12.5px; color-scheme: dark; }
.since-pick select:disabled { opacity: .45; }
.since-pick.is-set select { border-color: var(--accent); }
.since-pick.is-set span { color: var(--accent-ink); font-weight: 600; }
.since-pick + .appbar-right { margin-left: 0; }

/* watchlist star */
.star { background: none; border: 0; cursor: pointer; color: var(--muted); font-size: 16px; line-height: 1;
  padding: 2px 4px; border-radius: 4px; }
.star:hover { color: #f5c542; background: var(--surface-2); }
.star.is-on { color: #f5c542; }
.star.big { font-size: 14px; font-weight: 600; border: 1px solid var(--border-strong); padding: 4px 10px;
  vertical-align: middle; margin-left: 8px; color: var(--text-2); }
.star.big.is-on { border-color: #f5c542; color: #f5c542; background: rgba(245, 197, 66, .08); }
table.st td[data-col="star"] { width: 28px; padding-right: 0; }
.watch-add { display: flex; gap: 6px; }
.watch-add input { width: 260px; background: var(--surface-2); border: 1px solid var(--border-strong);
  color: var(--text); border-radius: var(--radius-sm); height: 30px; padding: 0 10px; }
.btn-primary { background: var(--accent); color: #fff; border: 0; border-radius: var(--radius-sm);
  height: 30px; padding: 0 14px; font-weight: 600; cursor: pointer; }
.chip-toggle input { display: none; }
.chip-toggle span { display: inline-block; padding: 5px 12px; border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.chip-toggle input:checked + span { border-color: #f5c542; color: #f5c542; background: rgba(245, 197, 66, .08); }

/* profile performance chart */
.perf-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.perf-nums { display: flex; gap: 16px; align-items: baseline; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.perf-nums b { font-family: var(--mono); font-size: 13px; }
.perf-nums .pn-main { font-size: 13px; color: var(--text); }
.perf-nums .pn-main b { font-size: 17px; }
.perf-nums small { font-family: var(--mono); margin-left: 4px; }
.perf-nums .sw { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 5px; }
.sw-spy { background: #9aa3b5; }
.sw-qqq { background: repeating-linear-gradient(90deg, #b18cff 0 5px, transparent 5px 8px); }
.perf-chart .chart-box { height: 260px; }

/* From [year] [month] lists (tables and trade filter bars) */
.st-ym select, .ym-pick select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); height: 28px; padding: 0 6px; font-size: 12.5px; color-scheme: dark; }
.st-ym select:disabled, .ym-pick select:disabled { opacity: .45; }
.ym-pick { display: inline-flex; gap: 6px; align-items: center; color: var(--muted); font-size: 12.5px; }

/* ticker chart: follow one trader */
.trade-pick { display: flex; gap: 10px; align-items: center; margin: 0 0 6px; font-size: 12px; }
.trade-pick select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); height: 28px; padding: 0 6px; font-size: 12.5px; max-width: 280px; color-scheme: dark; }

.picking-card .perf td.verdict { text-align: left; font-family: var(--font); }
.warn-text { color: var(--warn); font-weight: 600; }
.measure[hidden] { display: none !important; }   /* display:flex above would otherwise keep it visible */
[hidden] { display: none !important; }            /* hidden always wins over a display rule */

/* price chart: which traders' arrows show, and the lag view */
.trade-pick { flex-wrap: wrap; }
.who-menu { position: relative; }
.who-menu summary { list-style: none; cursor: pointer; padding: 4px 10px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); user-select: none; }
.who-menu summary::-webkit-details-marker { display: none; }
.who-menu summary::after { content: " ▾"; color: var(--muted); }
.who-menu[open] summary { border-color: var(--accent); }
.who-panel { position: absolute; top: calc(100% + 4px); left: 0; z-index: 30; width: 380px; max-width: 90vw;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); padding: 8px; }
.who-actions { display: flex; gap: 6px; align-items: center; margin-bottom: 6px; }
.who-actions button { padding: 3px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-3); cursor: pointer; }
.who-actions button:hover { border-color: var(--accent); }
.who-list { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow: auto; }
.who-list li label { display: flex; gap: 8px; align-items: baseline; padding: 4px 4px; border-radius: var(--radius-sm); cursor: pointer; }
.who-list li label:hover { background: var(--surface-3); }
.who-list .who-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who-list small { color: var(--muted); white-space: nowrap; }
.lag-toggle { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; color: var(--text-2); }

/* the top bar's ⚙ view settings (Since + switches), in a menu so the bar stays uncluttered */
.view-menu { position: relative; margin-left: auto; margin-right: 0; }
.view-menu + .gsearch { margin-left: 10px; }
.view-menu summary { list-style: none; cursor: pointer; display: flex; gap: 6px; align-items: center; height: 30px;
  padding: 0 10px; border-radius: var(--radius); border: 1px solid var(--border-strong); background: var(--surface);
  color: var(--text-2); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.view-menu summary::-webkit-details-marker { display: none; }
.view-menu.is-set summary { border-color: var(--accent); color: var(--accent-ink); }
.view-menu.is-set summary span { font-weight: 600; }
.view-panel { position: absolute; top: calc(100% + 6px); right: 0; width: 340px; z-index: 40; padding: 12px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: var(--shadow-lg); color: var(--text); font-size: 13px; }
.view-row { display: flex; gap: 8px; align-items: flex-start; padding: 7px 0; border-bottom: 1px solid var(--border); cursor: pointer; }
.view-row:first-child { align-items: center; cursor: default; }
.view-row b { width: 48px; }
.view-row input[type=checkbox] { margin-top: 3px; }
.view-row span small { display: block; color: var(--muted); font-size: 11.5px; }
.view-note { margin: 8px 0 0; color: var(--muted); font-size: 11.5px; }
.st-fav { display: flex; gap: 6px; align-items: center; margin: 8px 0 2px; cursor: pointer; }
.st-fav small { color: var(--muted); }
/* option rows: the price columns are the underlying stock's, shown in italics */
tr.is-option td[data-col="p_trade"], tr.is-option td[data-col="p_now"], tr.is-option td[data-col="trade_pct"],
tr.is-option td[data-col="since"], tr.is-option td[data-col="pre_pct"], tr.is-option td[data-col="p_report"] { font-style: italic; opacity: .8; }
.folder-now { margin: 4px 0 8px; font-size: 13px; color: var(--text-2); display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* profile: what they own */
.holdings-top { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(300px, 1.3fr); gap: 20px; margin-bottom: 12px; }
@media (max-width: 900px) { .holdings-top { grid-template-columns: 1fr; } }
.holdings-total .stat-value { font-size: 26px; display: block; margin: 2px 0; }
.kind-bars { list-style: none; margin: 12px 0 0; padding: 0; font-size: 12.5px; }
.kind-bars li { display: grid; grid-template-columns: 150px 1fr 64px 36px; gap: 8px; align-items: center; padding: 3px 0; }
.kind-bars li span { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kind-bars li i { display: block; height: 8px; border-radius: 4px; background: var(--accent); opacity: .75; }
.kind-bars li b { text-align: right; font-weight: 600; }
.kind-bars li small { color: var(--muted); text-align: right; }
.nw-chart { height: 190px; }
.basis { font-size: 12px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--text-2); white-space: nowrap; }
.basis-report { background: var(--ok-bg); color: var(--ok); }
.basis-report--trades { background: var(--accent-2); color: var(--accent-ink); }
.basis-trades-only { background: var(--warn-bg); color: var(--warn); }
.debts { margin: 6px 0 4px; font-size: 13px; } .debts summary { cursor: pointer; color: var(--text-2); } .debts ul { margin: 6px 0 0 18px; padding: 0; }

/* Review → Holdings check: the original on the left, what was read on the right */
.hc-top { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; }
.hc-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(560px, 1.1fr); height: calc(100vh - var(--appbar-h)); }
.hc-doc { overflow: auto; background: var(--doc-bg); border-right: 1px solid var(--border); padding: 8px; }
.hc-doc iframe { width: 100%; height: 100%; border: 0; background: #fff; }
.hc-page { position: relative; margin-bottom: 10px; }
.hc-page img { width: 100%; display: block; background: #fff; }
.hc-pno { position: absolute; top: 4px; right: 6px; font-size: 11px; color: #333; background: rgba(255,255,255,.8); padding: 0 4px; border-radius: 3px; }
.hc-side { overflow: auto; padding: 12px 16px 40px; }
.hc-side h1 { font-size: 20px; margin: 6px 0 2px; }
.hc-report { margin: 10px 0; display: grid; gap: 6px; }
.hc-report textarea { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px; }
.hc-progress { display: flex; justify-content: space-between; align-items: center; font-size: 12.5px; color: var(--text-2); }
.hc-rows { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.hc-rows th { text-align: left; color: var(--muted); font-weight: 600; padding: 4px 6px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg); }
.hc-rows td { padding: 4px 6px; border-bottom: 1px solid var(--border); vertical-align: top; }
.hc-part td { background: var(--surface-2); font-weight: 650; color: var(--accent-ink); }
.hc-row.is-group td { color: var(--text-2); }
.hc-row.v-ok td { background: var(--ok-bg); }
.hc-row.v-wrong td { background: var(--bad-bg); }
.hc-v { border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text-2); border-radius: 4px; width: 26px; height: 22px; cursor: pointer; margin-left: 3px; }
.hc-v.ok:hover, .v-ok .hc-v.ok { border-color: var(--ok); color: var(--ok); }
.hc-v.wrong:hover, .v-wrong .hc-v.wrong { border-color: var(--bad); color: var(--bad); }
.hc-note { width: 100%; background: var(--surface-2); color: var(--text); border: 1px solid var(--bad); border-radius: 4px; padding: 4px 6px; }
.btn.small { padding: 3px 10px; font-size: 12.5px; }
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); cursor: pointer; font-weight: 600; }
.btn:hover { border-color: var(--accent); text-decoration: none; }

/* page tabs (profile, ticker page): big boxes like a dashboard's sections */
.page-tabs { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin: 4px 0 16px; }
.page-tabs button { padding: 11px 10px; border-radius: var(--radius); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-2); font-weight: 600; cursor: pointer; text-align: center; }
.page-tabs button small { color: var(--muted); font-weight: 500; margin-left: 4px; }
.page-tabs button:hover { border-color: var(--accent); color: var(--text); }
.page-tabs button.is-on { background: var(--accent-2); border-color: var(--accent); color: #fff; box-shadow: inset 0 -2px 0 var(--accent); }
.ptab-pane[hidden] { display: none !important; }

/* fold a block to its title */
.card-fold { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 13px; width: 20px;
  padding: 0; margin-right: 4px; line-height: 1; flex: 0 0 auto; }
.card-fold:hover { color: var(--text); }
.card.is-folded > :not(.card-head) { display: none !important; }
.card.is-folded > .card-head { margin-bottom: 0; }
.card.is-folded > .card-head > :not(.card-fold):not(h2):not(:nth-child(2)) { display: none; }
.card.is-folded > .card-head > h2 ~ * { display: none; }
.card-head > h2 .card-fold { vertical-align: 1px; }

/* a table inside a folder row scrolls sideways on its own: it takes no width of its own
   (width 0; min-width 100%), so it never stretches the table around it (which cut it off,
   with the only scrollbar at the very bottom of the outer table) */
table.st tr.st-detail > td .st-scroll { width: 0; min-width: 100%; }
table.st tr.st-detail > td { max-width: 0; }
tr[data-before-since] > td { opacity: .55; }
.folder-note { margin: 0 0 8px; font-size: 12.5px; color: var(--warn); }

/* ---------------------------------------------------------------- Simulator ---------------- */
/* an (i) that explains a word: hover or focus shows the text */
.tip { position: relative; display: inline-grid; place-items: center; width: 15px; height: 15px; margin-left: 3px;
  border: 1px solid var(--border-strong); border-radius: 50%; font: italic 700 10px/1 Georgia, serif; color: var(--muted);
  cursor: help; vertical-align: 1px; flex: none; }
.tip:hover, .tip:focus { color: var(--text); border-color: var(--accent); outline: none; }
.tip::after { content: attr(data-tip); position: absolute; z-index: 50; left: 50%; bottom: calc(100% + 8px); transform: translateX(-50%);
  width: max-content; max-width: 280px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); color: var(--text); font: 400 12px/1.45 var(--font);
  text-align: left; white-space: normal; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s; }
.tip:hover::after, .tip:focus::after { opacity: 1; visibility: visible; }

.sim-page { min-width: 0; }
.sim-page .card { min-width: 0; }
.sim-note { padding: 12px 16px; margin-bottom: 14px; }
.sim-note > summary { cursor: pointer; list-style: none; display: flex; gap: 10px; align-items: baseline; }
.sim-note > summary::-webkit-details-marker { display: none; }
.sim-note > summary::before { content: "▸"; color: var(--muted); }
.sim-note[open] > summary::before { content: "▾"; }
.sim-note ul { margin: 10px 0 2px; padding-left: 20px; display: grid; gap: 6px; font-size: 13px; color: var(--text-2); max-width: 1000px; }
.sim-note b { color: var(--text); }

/* the chart */
.sim-chart-card { margin-bottom: 14px; }
.sim-chart-tools { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.sim-status.is-busy::before { content: ""; display: inline-block; width: 9px; height: 9px; margin-right: 6px; border-radius: 50%;
  border: 2px solid var(--accent); border-right-color: transparent; animation: sim-spin .8s linear infinite; vertical-align: -1px; }
@keyframes sim-spin { to { transform: rotate(360deg); } }
.sim-legend { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.sim-leg { display: inline-flex; gap: 6px; align-items: center; padding: 3px 9px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 12px; cursor: pointer; max-width: 100%; }
.sim-leg:hover { border-color: var(--border-strong); }
.sim-leg.is-off { opacity: .45; }
.sim-leg.is-off .sim-sw { background: transparent !important; }
.sim-sw { display: inline-block; flex: none; width: 14px; height: 3px; border-radius: 2px; background: var(--c); vertical-align: middle; margin-right: 6px; }
.sim-sw.actual { background: repeating-linear-gradient(90deg, var(--c) 0 5px, transparent 5px 8px); }
.sim-sw.index { background: repeating-linear-gradient(90deg, var(--c) 0 2px, transparent 2px 4px); }
.sim-show .sim-sw, .sim-strat .sim-sw { width: 12px; height: 12px; border-radius: 3px; margin: 0; }
.sim-chart { height: 440px; user-select: none; }
.sim-chart canvas { cursor: crosshair; touch-action: pan-y; }
.sim-unzoom { position: absolute; right: 8px; top: 6px; }
.sim-tipbox, .sim-measure { position: absolute; z-index: 10; min-width: 200px; max-width: 340px; padding: 8px 10px; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 12px; }
.sim-tipbox[hidden] { display: none; }
.sim-measure { display: block !important; }
.sim-measure[hidden] { display: none !important; }
.sim-measure > span, .sim-tip-day { display: block; color: var(--muted); margin-bottom: 4px; }
.sim-tip-row { display: grid; grid-template-columns: auto 1fr auto; gap: 6px; align-items: center; padding: 1px 0; }
.sim-tip-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--text-2); }
.sim-tip-row b { font-variant-numeric: tabular-nums; }
.sim-tip-m { margin-top: 5px; padding-top: 5px; border-top: 1px solid var(--border); color: var(--text-2); }
.sim-chart-foot { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; align-items: center; margin: 6px 0 12px; font-size: 12.5px; }
.sim-check { display: inline-flex; gap: 6px; align-items: center; font-size: 13px; cursor: pointer; }
.sim-check.small { font-size: 11.5px; color: var(--text-2); margin-top: 3px; }
.sim-board-head { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; margin-bottom: 6px; font-size: 13px; }
.sim-scoreboard { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.sim-scoreboard th, .sim-scoreboard td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.sim-scoreboard th { font-size: 11.5px; color: var(--muted); font-weight: 600; }
.sim-scoreboard .num { text-align: right; }
.sim-scoreboard tr.is-off { opacity: .45; }
.sim-scoreboard tr.strategy td:nth-child(2) a { color: var(--text); font-weight: 600; }
.sim-tag { display: inline-block; padding: 0 6px; border-radius: 3px; font-size: 10.5px; font-weight: 600; background: var(--surface-3); color: var(--muted); }
.sim-tag.actual { background: rgba(255, 176, 32, .14); color: #ffb020; }

/* shared settings */
.sim-shared { margin-bottom: 14px; }
.sim-shared-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 14px 22px; }
.sim-shared-grid .sim-fees-group { grid-column: span 2; }
@media (max-width: 700px) { .sim-shared-grid .sim-fees-group { grid-column: auto; } }
.sim-group { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.sim-group h3, .sim-sgroup h3 { margin: 0 0 2px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); display: flex; align-items: center; }
.sim-group h3 + * { margin-top: 0; }
.sim-group .sim-chips + h3 { margin-top: 10px; }
.sim-field { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; align-items: center; font-size: 13px; }
.sim-field > span:first-child { color: var(--text-2); display: flex; align-items: center; }
.sim-field small { grid-column: 2; color: var(--muted); font-size: 11.5px; margin-top: -4px; }
.sim-inline { display: inline-flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; }
.sim-inline[hidden], .sim-field[hidden], [data-show][hidden], [data-sshow][hidden] { display: none !important; }
.sim-indent { margin-left: 24px; }
.sim-page input[type="number"], .sim-page input[type="date"], .sim-page input[type="search"], .sim-page input:not([type]),
.sim-page select { background: var(--surface-2); color: var(--text); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  padding: 5px 7px; font: inherit; font-size: 13px; min-width: 0; max-width: 100%; }
.sim-page input:focus, .sim-page select:focus { outline: none; border-color: var(--accent); }
.sim-page input[type="number"] { width: 90px; }
.sim-page input[type="date"] { width: 150px; }
.sim-page input[type="checkbox"] { accent-color: var(--accent); }
.sim-fees { border-collapse: collapse; font-size: 12.5px; }
.sim-fees th, .sim-fees td { padding: 3px 6px 3px 0; text-align: left; white-space: nowrap; }
.sim-fees thead th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.sim-fees tbody th { color: var(--text-2); font-weight: 600; padding-right: 10px; }
.sim-page .sim-fees input[type="number"] { width: 78px; }
.sim-fee-example { margin: 2px 0 0; font-size: 12px; }
.sim-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-check { display: inline-flex; gap: 5px; align-items: center; padding: 3px 9px; border: 1px solid var(--border-strong);
  border-radius: 999px; font-size: 12px; cursor: pointer; background: var(--surface-2); }
.chip-check:has(input:checked) { border-color: var(--accent); background: var(--accent-2); }
.chip { display: inline-flex; gap: 4px; align-items: center; padding: 2px 4px 2px 9px; border-radius: 999px; font-size: 12px;
  background: rgba(255, 176, 32, .12); border: 1px solid rgba(255, 176, 32, .4); margin: 0 4px 4px 0; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 11px; padding: 0 4px; }
.chip button:hover { color: var(--bad); }
.sim-search { position: relative; display: block; min-width: 0; }
.sim-search input { width: 100%; }
.sim-suggest { position: absolute; z-index: 30; left: 0; right: 0; top: calc(100% + 2px); max-height: 260px; overflow: auto; background: var(--surface);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.sim-suggest[hidden] { display: none; }
.sim-suggest a { display: flex; justify-content: space-between; gap: 8px; padding: 6px 9px; color: var(--text); font-size: 13px; }
.sim-suggest a:hover { background: var(--accent-2); text-decoration: none; }
.sim-suggest small { color: var(--muted); }
.sim-suggest .muted-cell { display: block; padding: 6px 9px; }

/* strategies */
.sim-new { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.sim-new .sim-search { width: 260px; max-width: 100%; }
.sim-new-more { position: relative; }
.sim-new-more > summary { list-style: none; }
.sim-new-more > summary::-webkit-details-marker { display: none; }
.sim-menu { position: absolute; right: 0; top: calc(100% + 4px); z-index: 30; display: flex; flex-direction: column; min-width: 200px; padding: 4px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); }
.sim-menu button { text-align: left; background: none; border: 0; color: var(--text); padding: 7px 10px; border-radius: 3px; cursor: pointer; font: inherit; font-size: 13px; }
.sim-menu button:hover { background: var(--accent-2); }
.sim-list { display: flex; flex-direction: column; gap: 8px; }
.sim-empty { padding: 10px 2px; }
.sim-strat { border: 1px solid var(--border); border-left: 3px solid var(--c); border-radius: var(--radius-sm); background: var(--surface-2); min-width: 0; }
.sim-strat.is-open { border-color: var(--border-strong); border-left-color: var(--c); }
.sim-srow { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto auto; gap: 12px; align-items: center; padding: 8px 12px; }
.sim-show { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.sim-sname { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; background: none; border: 0; padding: 0;
  color: var(--text); cursor: pointer; text-align: left; font: inherit; }
.sim-sname b { font-size: 14px; }
.sim-sname:hover b { color: var(--accent-ink); }
.sim-people { display: flex; align-items: center; gap: 0; min-width: 0; max-width: 100%; }
.sim-people img, .sim-people .avatar { width: 22px; height: 22px; border-radius: 50%; object-fit: cover; border: 2px solid var(--surface-2); margin-right: -5px; flex: none; font-size: 9px; }
.sim-people small { margin-left: 11px; color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.sim-snums { display: flex; gap: 18px; font-variant-numeric: tabular-nums; }
.sim-snums span { display: flex; flex-direction: column; align-items: flex-end; }
.sim-snums small { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sim-snums b { font-size: 14px; }
.sim-chev { background: none; border: 1px solid var(--border-strong); color: var(--text-2); border-radius: var(--radius-sm); width: 28px; height: 28px; cursor: pointer; }
.sim-chev:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 760px) {
  .sim-srow { grid-template-columns: auto minmax(0, 1fr) auto auto; }
  .sim-snums { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
}
.sim-folder { padding: 4px 12px 14px; border-top: 1px solid var(--border); background: var(--surface); min-width: 0; }
.sim-folder[hidden] { display: none; }
.sim-ftabs { margin: 10px 0 12px; max-width: 100%; overflow-x: auto; }
.sim-fbody { min-width: 0; }
.sim-fsum { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; margin-bottom: 4px; }
.sim-fsum > div { display: flex; flex-direction: column; gap: 1px; padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); min-width: 0; }
.sim-fsum small { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.sim-fsum b { font-size: 17px; font-variant-numeric: tabular-nums; }
.sim-fsum > div > span { font-size: 11.5px; color: var(--text-2); }
.sim-plain { border-collapse: collapse; font-size: 13px; }
.sim-plain td { padding: 5px 12px 5px 0; border-bottom: 1px solid var(--border); }
.sim-sform { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px 22px; }
.sim-sgroup { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.sim-sgroup.sim-wide { grid-column: span 2; }
@media (max-width: 700px) { .sim-sgroup.sim-wide { grid-column: auto; } }
.sim-sname-in { width: 100%; font-weight: 600; }
.sim-colors { display: flex; gap: 6px; flex-wrap: wrap; }
.sim-color { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--surface); padding: 0; cursor: pointer; }
.sim-color.is-on { box-shadow: 0 0 0 2px var(--text); }
.sim-sactions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.sim-rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sim-rules li { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; padding: 7px 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); }
.sim-rules li.muted-cell { display: block; }
.sim-rules img, .sim-rules .avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; font-size: 11px; }
.sim-rules b { display: block; font-size: 13px; }
.sim-rules small { display: block; font-size: 11.5px; color: var(--muted); overflow-wrap: anywhere; }
.sim-rules button { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 14px; padding: 2px 4px; }
.sim-rules button:hover { color: var(--text); }
.sim-rule-form { display: flex; flex-direction: column; gap: 8px; padding: 12px; background: var(--surface-2); border: 1px solid var(--accent); border-radius: var(--radius-sm); }
.sim-rule-form[hidden] { display: none; }
.sim-rule-form .uf-tickers { width: 100%; }
.uf-sectors { display: flex; flex-wrap: wrap; gap: 4px; }
.sim-more { border-top: 1px solid var(--border); padding-top: 8px; }
.sim-more > summary { cursor: pointer; font-size: 12.5px; color: var(--accent-ink); list-style: none; margin-bottom: 8px; }
.sim-more > summary::-webkit-details-marker { display: none; }
.sim-more > summary::before { content: "▸ "; }
.sim-more[open] > summary::before { content: "▾ "; }
.sim-more[open] { display: flex; flex-direction: column; gap: 8px; }
.sim-exit { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; padding: 4px 0; }
.sim-exit > .sim-check { min-width: 130px; font-weight: 600; }
.btn.danger:hover { border-color: var(--bad); color: var(--bad); }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { filter: brightness(1.1); }
@media (max-width: 560px) { .sim-field { grid-template-columns: 1fr; gap: 3px; } .sim-field small { grid-column: 1; } .sim-chart { height: 320px; } }
@media (max-width: 560px) { .sim-menu { right: auto; left: 0; } .sim-new, .sim-new .sim-search { width: 100%; } }
.sim-bench-group { display: flex; flex-direction: column; gap: 4px; }
.sim-bench-group > small { font-size: 11.5px; color: var(--text-2); }
.ft-pager { display: flex; gap: 8px; align-items: center; justify-content: center; margin-top: 10px; }
table.st.ft thead th { cursor: pointer; user-select: none; }
table.st.ft thead th[data-dir="asc"]::after { content: " ▲"; font-size: 9px; }
table.st.ft thead th[data-dir="desc"]::after { content: " ▼"; font-size: 9px; }
.ft-box .st-bar select { max-width: 220px; }
.sim-trash { background: none; border: 1px solid transparent; color: var(--muted); border-radius: var(--radius-sm); width: 28px; height: 28px; cursor: pointer; display: grid; place-items: center; }
.sim-trash:hover { color: var(--bad); border-color: var(--bad); background: var(--bad-bg); }
.sim-scoreboard .sim-fixed { background: rgba(255, 255, 255, .025); }
/* with the script on, the (i) text shows in one floating box (sim.js), never clipped by a scrolling table */
body.tip-js .tip::after { display: none; }
.tip-bubble { position: fixed; z-index: 1000; max-width: 300px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-3);
  border: 1px solid var(--border-strong); box-shadow: var(--shadow-lg); color: var(--text); font: 400 12px/1.45 var(--font); pointer-events: none; }
.tip-bubble[hidden] { display: none; }

/* beats-the-market "why" folder (_beat_explain.html) */
.beat-explain h3 { margin: 0 0 6px; font-size: 13px; }
.beat-say { margin: 0 0 8px; padding-left: 18px; line-height: 1.5; }
.beat-say li { margin: 2px 0; }
.beat-verdict { margin: 0 0 10px; }

/* Messages tab (alerts/): a status strip, numbered steps, rules written as sentences */
.m-wrap { max-width: 1080px; }
.page-messages input:not([type=checkbox]):not([type=radio]), .page-messages select {
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface-2); color: var(--text); vertical-align: middle; }
.page-messages input:focus, .page-messages select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-2); }
.page-messages input[type=time] { width: 110px; color-scheme: dark; }
.page-messages code { background: var(--surface-2); padding: 1px 6px; border-radius: 4px; font-size: 12.5px; }
.m-strip { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; padding: 14px 18px; margin: 0 0 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); }
.m-stat { display: flex; align-items: center; gap: 10px; }
.m-stat b { display: block; font-size: 14px; }
.m-stat small { color: var(--muted); font-size: 12px; }
.m-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--muted); flex: none; }
.m-dot.on { background: var(--ok); box-shadow: 0 0 0 4px var(--ok-bg); }
.m-dot.off { background: #d9a441; box-shadow: 0 0 0 4px rgba(217, 164, 65, .14); }
.m-big { font-size: 22px; font-weight: 700; min-width: 18px; text-align: center; }
.m-actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.m-actions form, .m-pause { display: flex; gap: 6px; align-items: center; margin: 0; }
.m-card { margin-bottom: 16px; padding: 18px 20px; }
.m-head { display: flex; gap: 14px; align-items: flex-start; margin-bottom: 14px; }
.m-head h2 { margin: 2px 0 4px; font-size: 16px; }
.m-head p { margin: 0; color: var(--text-2); font-size: 13px; }
.m-step { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 700;
  font-size: 13px; background: var(--accent-2); color: var(--accent-ink); }
.m-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.m-indent { margin-left: 42px; }
.m-steps { margin: 0 0 10px 42px; padding-left: 18px; line-height: 1.9; color: var(--text-2); }
.m-key { width: 360px; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; }
.m-more { margin-top: 10px; }
.m-more summary { cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px; }
.m-people { display: grid; gap: 8px; margin: 0 0 14px 42px; }
.m-person { display: grid; grid-template-columns: minmax(150px, 1.2fr) minmax(140px, 1fr) minmax(220px, 2fr) auto; gap: 12px;
  align-items: center; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); }
.m-who b { display: block; }
.m-who small { color: var(--muted); }
.m-invite { display: flex; gap: 6px; align-items: center; }
.m-invite input { flex: 1; min-width: 0; font-size: 12px; }
.m-person-actions { display: flex; gap: 2px; justify-content: flex-end; }
.m-person-actions form { margin: 0; }
.m-add { margin-left: 42px; }
.m-add input { width: 200px; }
.m-tag { display: inline-block; font-size: 11px; padding: 1px 7px; border-radius: 10px; margin-left: 6px;
  background: var(--accent-2); color: var(--accent-ink); vertical-align: middle; font-weight: 500; }
.m-rule { display: flex; gap: 14px; padding: 13px 0; border-top: 1px solid var(--border); margin-left: 42px; }
.m-rule h3 { margin: 3px 0 6px; font-size: 14px; }
.m-rule p { margin: 0 0 4px; line-height: 2.3; color: var(--text-2); }
.m-rule small { color: var(--muted); font-size: 12px; }
.m-off { opacity: .55; }
.m-num { width: 64px; text-align: center; }
.m-url { width: 240px; }
.m-money { display: inline-flex; align-items: center; height: 32px; padding-left: 9px; border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm); background: var(--surface-2); color: var(--muted); vertical-align: middle; }
.page-messages .m-money input { border: 0; height: 30px; width: 96px; text-align: right; background: transparent; padding: 0 9px 0 3px; }
.page-messages .m-money input:focus { box-shadow: none; }
.m-check { display: inline-flex; gap: 6px; align-items: center; margin-right: 14px; white-space: nowrap; color: var(--text); }
.m-switch { position: relative; flex: none; width: 38px; height: 22px; margin-top: 2px; cursor: pointer; }
.m-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.m-switch i { position: absolute; inset: 0; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-strong); transition: .15s; }
.m-switch i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: .15s; }
.m-switch input:checked + i { background: var(--ok); border-color: var(--ok); }
.m-switch input:checked + i::after { left: 18px; background: #fff; }
.m-switch input:disabled + i { opacity: .5; }
.m-switch-space { flex: none; width: 38px; }
.m-save { position: sticky; bottom: 0; z-index: 5; display: flex; justify-content: flex-end; align-items: center; gap: 14px;
  padding: 12px 20px; margin: -8px 0 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: 0 -6px 18px rgba(0, 0, 0, .35); }
.m-tiers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin: 0 0 10px 42px; }
.m-tier { padding: 12px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-2); display: grid; gap: 3px; }
.m-tier span { color: var(--text-2); font-size: 13px; }
.m-tier small { color: var(--muted); }
.m-card > p.muted-cell { margin-left: 42px; }
.m-body { white-space: pre-wrap; margin: 0; font: inherit; font-size: 13px; }
.star sup.tier-n { font-size: 9px; margin-left: 1px; vertical-align: super; }
.tier-pick { font-size: 12px; padding: 1px 4px; }
.watch-tier-head { margin: 18px 0 6px; display: flex; gap: 10px; align-items: baseline; }
.watch-tier-head h3 { margin: 0; font-size: 15px; }
.tier-menu { position: absolute; z-index: 1000; min-width: 230px; padding: 6px; background: var(--surface-2);
  border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(0, 0, 0, .45); }
.tier-menu-head { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 4px 8px 6px; }
.tier-menu button { display: grid; width: 100%; text-align: left; gap: 1px; padding: 7px 9px; border: 0; border-radius: var(--radius-sm);
  background: none; color: var(--text); cursor: pointer; }
.tier-menu button:hover { background: var(--accent-2); }
.tier-menu button.is-on { background: var(--accent-2); box-shadow: inset 3px 0 0 var(--accent); }
.tier-menu button small { color: var(--muted); font-size: 12px; }
.tier-menu .tier-remove { color: var(--bad); border-top: 1px solid var(--border); border-radius: 0; margin-top: 4px; padding-top: 9px; }
.m-pause-label { color: var(--text-2); font-size: 13px; margin-left: 6px; }
.m-log-actions { white-space: nowrap; text-align: right; }
.m-log-actions form { display: inline; margin: 0; }
.m-fade { opacity: 0; transition: opacity .25s; }
.page-messages tr[data-gone] { display: none !important; }
.m-toast { position: fixed; right: 20px; bottom: 20px; z-index: 2000; padding: 10px 16px; border-radius: var(--radius);
  background: var(--ok-bg); color: var(--ok); border: 1px solid var(--ok); box-shadow: 0 8px 24px rgba(0, 0, 0, .4); font-size: 13.5px; }
.m-toast.bad { background: var(--bad-bg); color: var(--bad); border-color: var(--bad); }

/* ===================================================================== phone (≤ 640px) === */
/* Same pages, same content, laid out for a narrow screen. Nothing here applies on a PC. */
@media (max-width: 640px) {
  :root { --appbar-h: 0px; }   /* the bar scrolls away on a phone, so sticky things stick to the top */

  /* app bar: logo + ⚙ on top, search under it, tabs as a swipeable strip */
  .appbar { position: relative; height: auto; flex-wrap: wrap; gap: 8px; padding: 8px 12px 0; }
  .brand { gap: 8px; font-size: 14px; order: 1; }
  .brand-mark { width: 30px; height: 30px; border-radius: 7px; }
  .view-menu { order: 2; margin-left: auto; position: static; }
  .view-menu summary { height: 32px; max-width: 190px; font-size: 12px; }
  .view-panel { position: absolute; left: 12px; right: 12px; top: 44px; width: auto; }
  .appbar-right { order: 3; margin-left: auto; }
  .view-menu + .gsearch, .gsearch { order: 4; flex: 1 0 100%; min-width: 0; margin: 0; }
  .gsearch input { height: 36px; font-size: 16px; }   /* 16px: iPhone doesn't zoom in on focus */
  .gsearch-list { min-width: 0; }
  .appbar .tabs { order: 5; flex: 1 0 100%; height: 40px; margin: 0 -12px; padding: 0 6px; gap: 0;
    overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .appbar .tabs::-webkit-scrollbar { display: none; }
  .appbar .tab { padding: 0 11px; white-space: nowrap; flex: none; }

  /* page frame */
  .page-wrap, .missing { padding: 14px 12px 40px; }
  .page-head h1, .person-head h1 { font-size: 21px; }
  .page-head p, .person-head p { margin-bottom: 12px; font-size: 13px; }
  .card { padding: 12px; margin-bottom: 12px; }
  .card-head { gap: 8px; justify-content: flex-start; }

  /* every two-column layout becomes one column (minmax(0, …) so a wide table can't widen it) */
  .feed-grid, .wiki-top, .holdings-top, .pnl-grid, .pie-wrap { grid-template-columns: minmax(0, 1fr); }
  .feed-main, .feed-rail, .wiki-left { min-width: 0; }
  .feed-rail { position: static; }

  /* stat cards: two per row, smaller */
  .stat-cards, .stat-cards.six { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-bottom: 12px; }
  .stat-card { padding: 10px 12px; }
  .stat-label { font-size: 10.5px; }
  .stat-value { font-size: 20px; }
  .stat-sub { font-size: 11.5px; }

  /* filter bars and table toolbars wrap; inputs take the full row */
  .filterbar input[type=search], .st-bar .st-search { flex: 1 1 100%; width: auto; min-width: 0; }
  .st-bar { gap: 6px; }
  .st-panel { left: 0; right: 0; width: auto; }
  .watch-add { flex-wrap: wrap; }
  .watch-add input { flex: 1; width: auto; min-width: 0; }

  /* tables scroll sideways inside their card rather than widening the page */
  .card, .card-body, .ptab-pane, .clusters-card, .coverage { min-width: 0; max-width: 100%; }
  table.st thead th { position: static; }
  .card:has(> table.st, > table.grid-table, > table.perf) { overflow-x: auto; }

  /* profile / ticker */
  .page-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
  .page-tabs button { flex: 1 1 auto; padding: 8px 10px; font-size: 12.5px; }
  .star.big { margin-left: 4px; padding: 3px 8px; font-size: 13px; }
  .chart-box.pie { height: 220px; }
  .price-now, .pnl-big b { font-size: 22px; }
  .price-chart { height: 260px; }
  .member-photo { width: 120px; height: 146px; }
  .kind-bars li { grid-template-columns: minmax(0, 1fr) 70px 56px 32px; }
  .trade-pick select { max-width: 100%; }
  .who-panel { width: calc(100vw - 48px); }

  /* simulator */
  .sim-chart { height: 300px; }
  .sim-srow { gap: 8px; padding: 8px 10px; }

  /* toasts and pop-ups fit the screen */
  .m-toast { left: 12px; right: 12px; bottom: 12px; }
  .tier-menu { max-width: calc(100vw - 24px); }
}
