/* ============================================================
   Smart Invest design system — tokens + components
   See DESIGN.md. Style through tokens only; both themes always.
   ============================================================ */

:root {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #edefe9;
  --ink: #182420;
  --muted: #5f6d66;
  --line: #e2e6de;
  --accent: #8f6e22;
  --accent-ink: #ffffff;
  --gain: #1d7a46;
  --loss: #ba3b2b;
  --focus: #8f6e2255;
  --cat0: #4a5fa5;
  --cat1: #2e7d74;
  --cat2: #8a4f7d;
  --cat3: #a66b1f;

  --font-display: "Instrument Serif", Georgia, "Times New Roman", serif;
  --font-ui: "Instrument Sans", -apple-system, "Segoe UI", system-ui, sans-serif;

  --r-card: 8px;
  --r-input: 6px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121815;
    --surface: #1a211d;
    --surface-2: #222b26;
    --ink: #e8ece6;
    --muted: #93a198;
    --line: #2a332e;
    --accent: #d3ac5a;
    --accent-ink: #16130a;
    --gain: #53c08a;
    --loss: #e06a56;
    --focus: #d3ac5a55;
    --cat0: #8fa0d8;
    --cat1: #63b8ad;
    --cat2: #c58ab4;
    --cat3: #d8a45c;
  }
}
:root[data-theme="light"] {
  --bg: #f4f5f1;
  --surface: #ffffff;
  --surface-2: #edefe9;
  --ink: #182420;
  --muted: #5f6d66;
  --line: #e2e6de;
  --accent: #8f6e22;
  --accent-ink: #ffffff;
  --gain: #1d7a46;
  --loss: #ba3b2b;
  --focus: #8f6e2255;
  --cat0: #4a5fa5;
  --cat1: #2e7d74;
  --cat2: #8a4f7d;
  --cat3: #a66b1f;
}
:root[data-theme="dark"] {
  --bg: #121815;
  --surface: #1a211d;
  --surface-2: #222b26;
  --ink: #e8ece6;
  --muted: #93a198;
  --line: #2a332e;
  --accent: #d3ac5a;
  --accent-ink: #16130a;
  --gain: #53c08a;
  --loss: #e06a56;
  --focus: #d3ac5a55;
  --cat0: #8fa0d8;
  --cat1: #63b8ad;
  --cat2: #c58ab4;
  --cat3: #d8a45c;
}

/* ---------- base ---------- */

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

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.num { font-variant-numeric: tabular-nums; }

.eyebrow {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.display { font-family: var(--font-display); font-weight: 400; }

a { color: var(--accent); }

:is(button, input, select, a, [tabindex]):focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---------- buttons ---------- */

.btn {
  font: 600 13.5px/1 var(--font-ui);
  padding: 10px 16px;
  border-radius: var(--r-input);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  transition: background 120ms, border-color 120ms;
}
.btn:hover { background: var(--surface-2); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover { filter: brightness(1.08); background: var(--accent); }

.btn-quiet { background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- card ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
}

/* ---------- stat tiles ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}
.stat { padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}
.stat-value.lead { font-size: 38px; }
.stat-sub { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---------- delta (signed change) ---------- */

.delta { font-variant-numeric: tabular-nums; }
.delta .pct { display: block; font-size: 11px; opacity: 0.85; }
.delta.up { color: var(--gain); }
.delta.down { color: var(--loss); }
.delta.flat { color: var(--muted); }

/* ---------- pills ---------- */

.pill {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 2px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.pill-gain { color: var(--gain); border-color: color-mix(in srgb, var(--gain) 35%, transparent); }
.pill-loss { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 35%, transparent); }

/* ---------- account chips ---------- */

.chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.chip b { color: var(--ink); font-weight: 600; }
.chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--line); flex-shrink: 0; }
.chip .dot.ok { background: var(--gain); }
.chip .dot.err { background: var(--loss); }
/* Visible connection-status pill on each account chip. */
.chip .astat {
  font-size: 10px; font-weight: 700; letter-spacing: .03em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 999px; flex-shrink: 0; white-space: nowrap;
}
.astat.st-ok   { color: var(--gain); background: color-mix(in srgb, var(--gain) 14%, transparent); }
.astat.st-warn { color: var(--cat3); background: color-mix(in srgb, var(--cat3) 16%, transparent); }
.astat.st-err  { color: var(--loss); background: color-mix(in srgb, var(--loss) 14%, transparent); }
/* Keep the pill legible when the chip is the active (filled-brass) filter. */
.fpill.active .astat { color: var(--accent-ink); background: rgba(255, 255, 255, .22); }
.chip .act {
  border: none; background: none; padding: 0;
  font: inherit; color: var(--accent);
  cursor: pointer; font-weight: 600;
}
.chip .act:hover { text-decoration: underline; }

/* Account row doubles as a filter when >1 account: pills with a clear
   selected state, actions revealed on hover to cut clutter. */
.fpill { cursor: pointer; transition: border-color 120ms, background 120ms; }
.fpill:hover { border-color: var(--accent); }
.fpill.active {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-ink);
}
.fpill.active b, .fpill.active .broker { color: var(--accent-ink); }
button.fpill {
  font: 600 12.5px var(--font-ui);
  padding: 6px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
}
.chip .chip-actions { display: inline-flex; gap: 8px; align-items: center; opacity: 0; transition: opacity 120ms; }
.chip:hover .chip-actions, .chip.active .chip-actions { opacity: 1; }
.chip .broker { color: var(--muted); }

/* Account badge: broker initial, one categorical color per account. */
.abadge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 17px; height: 17px;
  border-radius: 50%;
  font-size: 10px; font-weight: 700;
  margin-left: 5px;
  vertical-align: 1px;
  cursor: default;
}
.abadge.c0 { background: color-mix(in srgb, var(--cat0) 16%, transparent); color: var(--cat0); }
.abadge.c1 { background: color-mix(in srgb, var(--cat1) 16%, transparent); color: var(--cat1); }
.abadge.c2 { background: color-mix(in srgb, var(--cat2) 16%, transparent); color: var(--cat2); }
.abadge.c3 { background: color-mix(in srgb, var(--cat3) 16%, transparent); color: var(--cat3); }

/* ---------- ledger table ---------- */

.ledger { width: 100%; border-collapse: collapse; }
.ledger th, .ledger td {
  padding: 10px 14px;
  text-align: right;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.ledger th:first-child, .ledger td:first-child { text-align: left; }
.ledger thead th {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-top: 14px;
  padding-bottom: 10px;
}
.ledger tbody tr { border-bottom: 1px solid var(--line); }
.ledger tbody tr:last-child { border-bottom: none; }
.ledger tr.hold:hover td { background: color-mix(in srgb, var(--surface-2) 55%, var(--surface)); }

.ledger tr.grp td {
  background: var(--surface-2);
  font-weight: 600;
  cursor: pointer;
  user-select: none;
}
.ledger tr.grp .caret {
  display: inline-block;
  width: 14px;
  color: var(--muted);
  font-size: 10px;
  transition: transform 120ms;
}
.ledger tr.grp.open .caret { transform: rotate(90deg); }
.ledger tr.grp .count { font-weight: 400; color: var(--muted); margin-left: 8px; font-size: 12px; }

.ledger td .sub {
  display: block;
  font-size: 11.5px;
  color: var(--muted);
  font-weight: 400;
}
.ledger tr.hold td:first-child { padding-left: 34px; }
.ledger .sym { font-weight: 600; letter-spacing: 0.01em; }

/* Per-account breakdown rows under a multi-account holding */
.ledger tr.acct td {
  background: color-mix(in srgb, var(--surface-2) 45%, var(--surface));
  font-size: 12.5px;
  color: var(--muted);
  padding-top: 7px;
  padding-bottom: 7px;
}
.ledger tr.acct td:first-child { padding-left: 52px; }
.ledger tr.hold.expandable { cursor: pointer; }
.ledger .edit-hint { color: var(--muted); font-size: 11px; margin-left: 8px; opacity: 0; transition: opacity 120ms; }
.ledger tr.hold:hover .edit-hint { opacity: 1; }

.ledger tr.total td {
  font-weight: 700;
  border-top: 1px solid var(--ink);
  background: var(--surface);
  padding-top: 12px;
  padding-bottom: 14px;
}

/* ---------- sidebar ---------- */

.side-item {
  position: relative;
  padding: 10px 14px;
  border-radius: var(--r-input);
  cursor: pointer;
  transition: background 120ms;
}
.side-item:hover { background: var(--surface-2); }
.side-item.active { background: var(--surface); border: 1px solid var(--line); }
.side-item.active::before {
  content: "";
  position: absolute;
  left: 0; top: 8px; bottom: 8px;
  width: 3px;
  border-radius: 2px;
  background: var(--accent);
}
.side-item .side-name { font-weight: 600; }
.side-item .side-sub { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.side-item .side-del {
  position: absolute; right: 10px; top: 10px;
  color: var(--muted); font-size: 12px; display: none; cursor: pointer;
}
.side-item:hover .side-del { display: block; }

/* ---------- dialogs & forms ---------- */

.dlg {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0;
  width: 440px;
  max-width: 92vw;
  margin: auto;               /* restore native dialog centering (global reset zeroed it) */
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 64px rgb(10 16 12 / 0.35);
}
.dlg::backdrop { background: rgb(12 18 14 / 0.5); }
.dlg-h {
  font-family: var(--font-display);
  font-size: 22px;
  padding: 20px 22px 0;
}
.dlg-b { padding: 16px 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-f { display: flex; justify-content: flex-end; gap: 10px; padding: 2px 22px 20px; }

.field label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 5px;
}
.field input, .field select {
  width: 100%;
  font: 14px var(--font-ui);
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
}

.hint {
  font-size: 12.5px;
  color: var(--muted);
  background: var(--surface-2);
  border-radius: var(--r-input);
  padding: 10px 12px;
  line-height: 1.55;
}

/* ---------- manual asset detail dialog ---------- */
.dlg-wide { width: 580px; }
.dlg-wide .dlg-b { gap: 18px; }
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

.asset-summary {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: 1px; background: var(--line);
  border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden;
}
.asset-summary > div { background: var(--surface); padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.asset-summary .s-lbl {
  font-size: 10.5px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted);
}
.asset-summary .s-val { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }

.ledger-head { display: flex; align-items: center; justify-content: space-between; }
.ledger-head .eyebrow { margin: 0; }
.txn-wrap { max-height: 220px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-input); }
.txn-table { width: 100%; border-collapse: collapse; }
.txn-table thead th {
  font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted); text-align: left; padding: 8px 12px;
  border-bottom: 1px solid var(--line); background: var(--surface-2);
  position: sticky; top: 0;
}
.txn-table thead th:nth-child(3) { text-align: right; }
.txn-table td { padding: 9px 12px; font-size: 13px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.txn-table tr:last-child td { border-bottom: none; }
.txn-table td:nth-child(2), .txn-table td:nth-child(3) { text-align: right; color: var(--muted); }
.txn-table td:nth-child(3) { color: var(--ink); font-weight: 500; }
.txn-table td.txn-x { text-align: center; color: var(--muted); cursor: pointer; width: 34px; }
.txn-table td.txn-x:hover { color: var(--loss); }
.txn-empty { text-align: center !important; color: var(--muted); padding: 24px !important; }
.auto-tag {
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 3px; padding: 0 4px; margin-left: 6px; vertical-align: 1px;
}
.import-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 2px; }
.import-row .btn { cursor: pointer; }
.asset-note { font-size: 11.5px; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.txn-add { display: grid; grid-template-columns: 1.1fr 1fr 1fr 1.4fr auto; gap: 8px; margin-top: 10px; }
.txn-add select, .txn-add input {
  font: 13px var(--font-ui); color: var(--ink);
  padding: 8px 9px; border: 1px solid var(--line); border-radius: var(--r-input); background: var(--bg); min-width: 0;
}
@media (max-width: 640px) {
  .asset-grid { grid-template-columns: 1fr; }
  .txn-add { grid-template-columns: 1fr 1fr; }
}
.error-msg { color: var(--loss); font-size: 12.5px; }

.hint code.copy {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 6px;
  cursor: pointer;
  color: var(--accent);
  white-space: nowrap;
}
.hint code.copy:hover { border-color: var(--accent); }

code.masked {
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  font-size: 12.5px;
  letter-spacing: 0.04em;
  color: var(--ink);
  display: inline-block;
}

/* Credential rows in the Manage dialog: stored value clearly separated from
   the replace input. */
.cred-group { display: flex; flex-direction: column; gap: 16px; }
.cred label {
  display: block;
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 6px;
}
.cred-current {
  display: flex; align-items: center; gap: 8px;
  background: var(--surface-2);
  border-radius: var(--r-input);
  padding: 7px 10px;
  margin-bottom: 8px;
}
.cred-tag {
  font-size: 9.5px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 1px 5px;
  background: var(--surface);
}
.cred input {
  width: 100%;
  font: 14px var(--font-ui);
  color: var(--ink);
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--r-input);
  background: var(--bg);
}

/* ---------- misc ---------- */

.spin { display: inline-block; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.empty { padding: 56px 24px; text-align: center; color: var(--muted); }

/* Holdings card header: section label + search, aligned inside the card. */
.card-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px; border-bottom: 1px solid var(--line);
}
.card-toolbar .eyebrow { margin: 0; }
.search-box {
  display: flex; align-items: center; gap: 8px;
  width: 240px; max-width: 55%;
  padding: 7px 11px;
  border: 1px solid var(--line); border-radius: 999px;
  background: var(--bg);
  transition: border-color 120ms, box-shadow 120ms;
}
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--focus); }
.search-box svg { width: 15px; height: 15px; color: var(--muted); flex-shrink: 0; }
.search-box input {
  flex: 1; min-width: 0; border: none; background: none; outline: none;
  font: 13.5px var(--font-ui); color: var(--ink);
}
.search-box input::-webkit-search-cancel-button { cursor: pointer; }
@media (max-width: 640px) {
  .card-toolbar .eyebrow { display: none; }
  .search-box { width: 100%; max-width: 100%; }
}

/* ---------- mobile (see DESIGN.md "Mobile") ---------- */
/* Mark secondary ledger columns with .m-hide; phones show only
   Asset · Today · Unrealised · Value. */

@media (max-width: 640px) {
  .m-hide { display: none; }
  .stat-value { font-size: 26px; }
  .stat-value.lead { font-size: 30px; }
  .stat { padding: 13px 14px; }
  .ledger { font-size: 12.5px; }
  .ledger th, .ledger td { padding: 8px 5px; }
  .ledger th:first-child, .ledger td:first-child { padding-left: 10px; }
  .ledger th:last-child, .ledger td:last-child { padding-right: 10px; }
  .ledger tr.hold td:first-child { padding-left: 16px; }
  .ledger td .sub { max-width: 86px; overflow: hidden; text-overflow: ellipsis; }
  .ledger .delta .pct { font-size: 10px; }
  .btn { padding: 9px 13px; }
  .dlg { width: 100%; max-width: 100vw; margin: auto 0 0; border-radius: 12px 12px 0 0; }
}

/* ============================================================
   Signals panel (delivery-strategy view)
   ============================================================ */
/* In Signals mode, hide the Holdings chrome — DIRECT CHILDREN of <main> only, so
   the trade tables nested inside #signals-view (also .table-card) stay visible.
   !important beats the inline display:flex on #accounts and the .stats grid rule. */
main.signals-mode > #accounts,
main.signals-mode > #stats,
main.signals-mode > .table-card { display: none !important; }

.viewtoggle {
  display: inline-flex; gap: 2px; padding: 3px; margin-left: 14px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.viewtoggle .vt {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--muted);
  padding: 5px 14px; border-radius: 999px; transition: background .15s, color .15s;
}
.viewtoggle .vt:hover { color: var(--ink); }
.viewtoggle .vt.active { background: var(--accent); color: var(--accent-ink); }

.sig-subtabs {
  display: inline-flex; gap: 2px; padding: 3px; margin-bottom: 16px;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px;
}
.sig-subtabs .subtab {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; color: var(--muted);
  padding: 5px 15px; border-radius: 999px; transition: background .15s, color .15s;
}
.sig-subtabs .subtab:hover { color: var(--ink); }
.sig-subtabs .subtab.active { background: var(--accent); color: var(--accent-ink); }
.s3stats { display: flex; flex-wrap: wrap; gap: 10px; margin: 2px 0 16px; }
.s3stat {
  flex: 1 1 auto; min-width: 96px; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 10px 13px; display: flex; flex-direction: column; gap: 3px;
}
.s3stat .eyebrow { font-size: 10px; }
.s3stat b { font-size: 18px; font-family: var(--font-display); font-weight: 400; }
.s3stat b.up { color: var(--gain); }
.s3stat b.down { color: var(--loss); }
.s3pager { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 16px 0; }
.s3pageinfo { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.s3pager .btn[disabled] { opacity: .4; cursor: default; }

.sig-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 16px;
}
.sig-counts { display: flex; gap: 6px; flex-wrap: wrap; }
.sig-chip {
  font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--surface);
}
.sig-chip.buy  { color: var(--gain); border-color: color-mix(in srgb, var(--gain) 40%, var(--line)); }
.sig-chip.sell { color: var(--loss); border-color: color-mix(in srgb, var(--loss) 40%, var(--line)); }
.sig-chip.hold { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.sig-stale { color: var(--loss); font-weight: 600; }

/* Top-level band separating the page's two halves (Your book / Ideas). */
.sig-band {
  display: flex; align-items: center; gap: 8px;
  margin: 30px 0 6px; padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
  font-family: var(--font-display); font-size: 20px; font-weight: 600;
  letter-spacing: -0.01em; color: var(--ink);
}
.sig-band:first-child { margin-top: 4px; }
/* Delivery-metrics cell: shows latest delivery %, full breakdown on hover. */
.mcell { position: relative; cursor: help; border-bottom: 1px dotted var(--muted); }
.mcell:hover::after {
  content: attr(data-tip);
  position: absolute; right: 0; top: calc(100% + 6px);
  width: max-content; max-width: 260px; white-space: pre-line; text-align: left;
  background: var(--ink); color: var(--surface); padding: 9px 11px; border-radius: 7px;
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 400; line-height: 1.5;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .28); z-index: 60;
}
.lv-bench { display: block; font-size: 10px; color: var(--muted); margin-top: 2px; }
/* Agent conviction badge (1–5): green = real catalyst, grey = noise. */
.conv {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 22px; height: 22px; padding: 0 6px; border-radius: 6px;
  font: 600 12px/1 var(--font-ui); cursor: pointer; border: 1px solid transparent;
}
.conv-5 { background: color-mix(in srgb, var(--gain) 22%, transparent); color: var(--gain); border-color: color-mix(in srgb, var(--gain) 45%, transparent); }
.conv-4 { background: color-mix(in srgb, var(--gain) 14%, transparent); color: var(--gain); }
.conv-3 { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.conv-2 { background: color-mix(in srgb, var(--muted) 16%, transparent); color: var(--muted); }
.conv-1 { background: color-mix(in srgb, var(--muted) 12%, transparent); color: var(--muted); }
.why-label { font-size: 12px; font-weight: 400; color: var(--muted); font-family: var(--font-ui); }
.why-block { margin: 12px 0; }
.why-block .eyebrow { display: block; margin-bottom: 3px; }
.why-block p { margin: 0; font-size: 13.5px; line-height: 1.5; }
.why-src { margin: 4px 0 0; padding-left: 18px; font-size: 12.5px; line-height: 1.55; }
.why-src li { margin-bottom: 4px; }
.deliv-toolbar { display: flex; align-items: center; gap: 12px; margin: 4px 0 12px; flex-wrap: wrap; }
.deliv-count { font-size: 12px; color: var(--muted); }
th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
th.sortable:hover { color: var(--ink); }
.sort-arr { font-size: 9px; margin-left: 3px; color: var(--accent); vertical-align: middle; }
.seen-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px; margin: -2px 0;
  border-radius: 5px; font: inherit; color: inherit;
  border-bottom: 1px dashed var(--gain);
}
.seen-btn:hover { background: color-mix(in srgb, var(--gain) 14%, transparent); }
.sig-live {
  font-size: 9px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--gain); border: 1px solid var(--gain); border-radius: 4px;
  padding: 1px 4px; margin-left: 6px; vertical-align: middle;
}
.sig-sec { margin: 22px 0 10px; }
.sig-sechead { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* Info icon with hover/tap tooltip. */
.info-i {
  display: inline-flex; align-items: center; justify-content: center;
  width: 15px; height: 15px; margin-left: 6px; vertical-align: middle;
  border: 1px solid var(--line); border-radius: 50%;
  font-family: var(--font-display); font-size: 11px; font-style: italic; font-weight: 700;
  color: var(--muted); cursor: help; position: relative; text-transform: none;
  letter-spacing: 0; line-height: 1;
}
.info-i:hover, .info-i:focus { border-color: var(--accent); color: var(--accent); outline: none; }
.info-i:hover::after, .info-i:focus::after {
  content: attr(data-tip);
  position: absolute; left: 0; top: calc(100% + 8px);
  width: min(300px, 72vw); background: var(--ink); color: var(--surface);
  padding: 9px 11px; border-radius: 7px;
  font-family: var(--font-ui); font-size: 11.5px; font-weight: 400; font-style: normal;
  line-height: 1.45; text-align: left; text-transform: none; letter-spacing: 0;
  box-shadow: 0 6px 22px rgba(0, 0, 0, .28); z-index: 60; white-space: normal;
}
.sig-table .act {
  border: 1px solid var(--line); background: var(--surface); color: var(--muted);
  padding: 3px 10px; border-radius: 999px; font-size: 11.5px; cursor: pointer;
}
.sig-table .act:hover { border-color: var(--loss); color: var(--loss); text-decoration: none; }
.sig-note { margin: -2px 0 10px; }
.empty.small { color: var(--muted); font-size: 13px; padding: 6px 2px; }

.sig-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.sig-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 12px 14px; border-left: 3px solid var(--gain);
}
.sig-card .sig-sym { font-weight: 700; letter-spacing: .01em; }
.sig-card .sig-px { font-size: 20px; font-family: var(--font-display); margin: 2px 0 6px; }
.sig-lvls { display: flex; flex-direction: column; gap: 2px; font-size: 12.5px; color: var(--ink); }
.sig-lvls em { color: var(--muted); font-style: normal; }
.sig-foot { margin-top: 8px; font-size: 11.5px; color: var(--muted); }

.sig-rows { display: flex; flex-direction: column; gap: 6px; }
.sig-row {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  border-left: 3px solid var(--loss); padding: 10px 14px;
}
.sig-row .sig-sym { font-weight: 700; min-width: 92px; }
.sig-row .sig-move { color: var(--muted); font-size: 13px; }
.sig-row .sig-reason { margin-left: auto; font-size: 12.5px; color: var(--loss); font-weight: 600; }

.sig-table td.sig-sym { font-weight: 600; }
.sig-status { font-size: 12.5px; color: var(--muted); }
.sig-empty { padding: 30px 4px; color: var(--muted); max-width: 46ch; }
.sig-empty p { margin-bottom: 8px; }
.sig-empty code { background: var(--surface-2); padding: 1px 5px; border-radius: 4px; font-size: 12px; }

@media (max-width: 640px) {
  .viewtoggle { margin-left: 8px; }
  .sig-row .sig-reason { margin-left: 0; }
}
