:root {
  color-scheme: light;
  --bg: #f6f6f4;
  --surface: #ffffff;
  --surface-2: #f0f0ec;
  --line: #e3e2dd;
  --line-strong: #cfcdc6;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #7a7974;
  --accent: #2a78d6;
  --accent-soft: #e4eefb;
  --series-1: #2a78d6;
  --series-2: #eb6834;
  --series-3: #1baf7a;
  --st-dip: #d6336c; --st-main: #d99a00; --st-spec: #7b4fa0; --st-watch: #2a78d6;
  --rec-sb: #1f5fae; --rec-b: #6fa3e0; --rec-h: #b4b2aa; --rec-s: #f0a37a; --rec-ss: #c9501c;
  --good: #0f7a3a;
  --bad: #c4312f;
  --good-soft: #e3f3e8;
  --bad-soft: #fbe6e5;
  --warn-soft: #fdf1d8;
  --teal-soft: #dff3ef;
  --shadow: 0 8px 30px rgb(0 0 0 / .12);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", Roboto, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2e2e2b; --line-strong: #3d3d39;
    --ink: #f5f5f2; --ink-2: #c3c2b7; --muted: #8f8e87;
    --accent: #3987e5; --accent-soft: #1d2a3b; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --st-dip: #f06595; --st-main: #f2b01e; --st-spec: #a98be0; --st-watch: #5c9ded; --rec-sb: #5b9cf0; --rec-b: #2f5f9a; --rec-h: #6b6a64; --rec-s: #9a4f2a; --rec-ss: #e0703d;
    --good: #4cc47a; --bad: #f07070; --good-soft: #17301f; --bad-soft: #3a1c1c; --warn-soft: #36290f; --teal-soft: #13302b;
    --shadow: 0 8px 30px rgb(0 0 0 / .5);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --surface-2: #232321; --line: #2e2e2b; --line-strong: #3d3d39;
  --ink: #f5f5f2; --ink-2: #c3c2b7; --muted: #8f8e87;
  --accent: #3987e5; --accent-soft: #1d2a3b; --series-1: #3987e5; --series-2: #d95926; --series-3: #199e70; --st-dip: #f06595; --st-main: #f2b01e; --st-spec: #a98be0; --st-watch: #5c9ded; --rec-sb: #5b9cf0; --rec-b: #2f5f9a; --rec-h: #6b6a64; --rec-s: #9a4f2a; --rec-ss: #e0703d;
  --good: #4cc47a; --bad: #f07070; --good-soft: #17301f; --bad-soft: #3a1c1c; --warn-soft: #36290f; --teal-soft: #13302b;
  --shadow: 0 8px 30px rgb(0 0 0 / .5);
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font: 13px/1.45 var(--sans); }
button, input, select { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; }

/* --- top bar --- */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: baseline; gap: 12px; flex: 1; min-width: 0; }
.brand h1 { font-size: 16px; font-weight: 650; letter-spacing: -.01em; white-space: nowrap; }
.asof { color: var(--muted); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.top-actions { display: flex; gap: 6px; }

.btn { border: 1px solid var(--accent); background: var(--accent); color: #fff; border-radius: 7px;
  padding: 6px 12px; cursor: pointer; font-weight: 550; }
.btn.ghost { background: transparent; color: var(--ink); border-color: var(--line-strong); }
.btn.small { padding: 3px 9px; font-size: 12px; }
.btn:hover { filter: brightness(1.06); }
.link { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0; font-size: 12px; }
.icon-btn { border: 1px solid var(--line-strong); background: none; border-radius: 7px; padding: 4px 9px; cursor: pointer; }
.only-narrow { display: none; }

/* --- layout --- */
.layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: calc(100vh - 53px); }
.side { border-right: 1px solid var(--line); background: var(--surface); padding: 14px 14px 40px;
  position: sticky; top: 53px; height: calc(100vh - 53px); overflow-y: auto; }
.side section { margin-bottom: 20px; }
.side-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.side h2 { font-size: 11px; font-weight: 650; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); }
.facet { list-style: none; margin: 0; padding: 0; }
.facet li { display: flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 6px; cursor: pointer; color: var(--ink-2); }
.facet li:hover { background: var(--surface-2); }
.facet li.on { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.facet .n { margin-left: auto; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.facet .del { visibility: hidden; border: 0; background: none; color: var(--muted); cursor: pointer; padding: 0 2px; }
.facet li:hover .del { visibility: visible; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 6px; overflow: hidden; }
.seg button { border: 0; background: none; padding: 1px 8px; font-size: 11px; cursor: pointer; color: var(--muted); }
.seg button.on { background: var(--accent); color: #fff; }
.tag-search { width: 100%; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--bg); margin-bottom: 8px; font-size: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line); background: var(--surface-2);
  color: var(--ink-2); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; cursor: pointer; white-space: nowrap; }
.chip:hover { border-color: var(--line-strong); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chip .n { opacity: .65; font-size: 10.5px; }
.chip .x { border: 0; background: none; padding: 0; cursor: pointer; color: inherit; opacity: .7; }

/* --- main --- */
.main { padding: 14px 16px 30px; min-width: 0; }
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
#search { flex: 1 1 240px; max-width: 360px; padding: 7px 10px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--surface); }
.tabs { display: flex; gap: 2px; background: var(--surface-2); border-radius: 8px; padding: 3px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: none; padding: 4px 10px; border-radius: 6px; cursor: pointer; color: var(--ink-2); white-space: nowrap; }
.tabs button.on { background: var(--surface); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgb(0 0 0 / .08); }
.active-filters { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 22px; margin-bottom: 8px; color: var(--muted); font-size: 12px; }
.bulk { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 8px 10px; margin-bottom: 8px;
  background: var(--accent-soft); border-radius: 8px; }
.bulk[hidden], [hidden] { display: none !important; }
.bulk select, .bulk input { padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--surface); font-size: 12px; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); max-height: calc(100vh - 190px); }
.grid { border-collapse: separate; border-spacing: 0; width: 100%; }
.grid th, .grid td { padding: 7px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; text-align: right; }
.grid th { position: sticky; top: 0; z-index: 2; background: var(--surface-2); font-size: 10.5px; font-weight: 650;
  letter-spacing: .05em; text-transform: uppercase; color: var(--muted); cursor: pointer; user-select: none; }
.grid th:hover { color: var(--ink); }
.grid th.sorted { color: var(--ink); }
.grid th.sorted::after { content: " ▾"; }
.grid th.sorted.asc::after { content: " ▴"; }
.grid th.l, .grid td.l { text-align: left; }
.grid td { font-variant-numeric: tabular-nums; font-family: var(--mono); font-size: 12px; }
.grid td.l { font-family: var(--sans); font-size: 12.5px; }
.grid tbody tr { cursor: pointer; }
.grid tbody tr:hover td { background: var(--surface-2); }
.grid tbody tr.sel td { background: var(--accent-soft); }
.grid .sticky { position: sticky; left: 0; z-index: 1; background: var(--surface); }
.grid th.sticky { z-index: 3; background: var(--surface-2); }
.grid .cb { width: 28px; padding-right: 0; }
.grid .sym b { font-family: var(--sans); font-size: 13px; }
.grid .sym .nm { color: var(--muted); font-size: 11px; max-width: 190px; overflow: hidden; text-overflow: ellipsis; }
.grid .tagcell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--muted); font-size: 11.5px; }
.pos { color: var(--good); }
.neg { color: var(--bad); }
.dim { color: var(--muted); }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.foot { color: var(--muted); font-size: 11.5px; margin-top: 10px; }

.flag { display: inline-block; font-family: var(--sans); font-size: 11px; font-weight: 600; padding: 1px 8px; border-radius: 5px; color: var(--ink); }
.flag.buy { background: var(--good-soft); }
.flag.trim { background: var(--bad-soft); }
.flag.over { background: var(--teal-soft); }
.flag.hold { background: var(--surface-2); color: var(--ink-2); }
.rec { font-family: var(--sans); font-size: 11.5px; }

/* --- drawer --- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(760px, 100vw); background: var(--bg); z-index: 40;
  box-shadow: var(--shadow); transform: translateX(105%); transition: transform .18s ease; overflow-y: auto; }
.drawer.open { transform: none; }
.scrim { position: fixed; inset: 0; background: rgb(0 0 0 / .25); z-index: 30; display: none; }
.scrim.open { display: block; }
.drawer-inner { padding: 18px 20px 40px; }
.d-head { display: flex; gap: 12px; align-items: flex-start; }
.d-head .t { flex: 1; min-width: 0; }
.d-head h2 { font-size: 20px; letter-spacing: -.01em; }
.d-head .sub { color: var(--muted); font-size: 12px; }
.d-price { font: 600 24px/1.1 var(--mono); margin-top: 6px; }
.d-price small { font-size: 13px; margin-left: 6px; }
.d-close { border: 0; background: none; font-size: 22px; cursor: pointer; color: var(--muted); line-height: 1; }
.d-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 10px 0; }
.d-row .lbl { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-right: 4px; }
.d-row input, .d-row select { padding: 2px 8px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); font-size: 12px; width: 120px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 14px; margin-top: 12px; }
.card h3 { font-size: 12px; font-weight: 650; color: var(--ink-2); margin-bottom: 8px; display: flex; align-items: center; gap: 8px; }
.card h3 .seg { margin-left: auto; }
.summary { color: var(--ink-2); font-size: 12.5px; max-height: 4.4em; overflow: hidden; position: relative; cursor: pointer; }
.summary.full { max-height: none; }
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 2px 16px; }
.stat { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px dashed var(--line); font-size: 12px; }
.stat span:first-child { color: var(--muted); }
.stat span:last-child { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.stat-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; grid-column: 1 / -1; margin-top: 10px; }
.stat-group:first-child { margin-top: 0; }
.chart { width: 100%; position: relative; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .axis text { fill: var(--muted); font: 10.5px var(--sans); }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .zero { stroke: var(--line-strong); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--ink-2); margin-bottom: 6px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.mini { width: 100%; border-collapse: collapse; font-size: 12px; }
.mini th, .mini td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: right; white-space: nowrap; }
.mini th { color: var(--muted); font-weight: 600; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em; }
.mini td { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.mini th:first-child, .mini td:first-child { text-align: left; font-family: var(--sans); }
.scroll-x { overflow-x: auto; }

.tooltip { position: fixed; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 7px; padding: 6px 9px; font-size: 12px; box-shadow: var(--shadow); display: none; }
.tooltip b { font-family: var(--mono); }
.tooltip .muted { color: var(--muted); font-size: 11px; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 8px 14px; border-radius: 8px; font-size: 12.5px; z-index: 70; opacity: 0; transition: opacity .2s; pointer-events: none; }
.toast.show { opacity: 1; }
.toast.err { background: var(--bad); color: #fff; }

dialog { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--ink); padding: 18px 20px; width: min(420px, calc(100vw - 32px)); box-shadow: var(--shadow); }
dialog::backdrop { background: rgb(0 0 0 / .3); }
dialog h3 { font-size: 15px; margin-bottom: 12px; }
dialog label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 10px; }
dialog input { display: block; width: 100%; margin-top: 4px; padding: 7px 9px; border: 1px solid var(--line-strong); border-radius: 7px; background: var(--bg); }
.hint { font-size: 11.5px; color: var(--muted); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }
.setup { max-width: 620px; margin: 60px auto; padding: 0 16px; }
.setup code, .setup pre { font-family: var(--mono); font-size: 12px; background: var(--surface-2); border-radius: 5px; padding: 1px 5px; }
.setup pre { padding: 10px; overflow-x: auto; }

@media (max-width: 860px) {
  .only-narrow { display: inline-block; }
  .layout { grid-template-columns: 1fr; }
  .side { position: fixed; top: 53px; left: 0; width: 270px; z-index: 35; transform: translateX(-105%); transition: transform .18s; box-shadow: var(--shadow); }
  .side.open { transform: none; }
  .brand .asof { display: none; }
  .table-wrap { max-height: none; }
  .col-theme { display: none; }
  .grid .sym .nm { max-width: 140px; }
}
.d-price .dim { font: 12px var(--sans); }

/* --- sign-in --- */
.who { align-self: center; color: var(--muted); font-size: 12px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
body.signed-out .top-actions > :not(#btn-theme) { display: none; }
body.signed-out #toggle-side { display: none; }
.login { max-width: 360px; margin: 12vh auto; padding: 24px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.login h2 { font-size: 18px; margin-bottom: 6px; }
.login form { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.login input { padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--bg); font-size: 16px; }
.login .btn { padding: 9px 12px; font-size: 14px; }
.login .btn:disabled { opacity: .6; }
.login-msg { background: var(--warn-soft); border-radius: 7px; padding: 8px 10px; font-size: 12.5px; }
@media (max-width: 860px) {
  .who, .wide-only { display: none; }
  .topbar { gap: 8px; padding: 10px 12px; }
  .top-actions { gap: 4px; }
  .top-actions .btn { padding: 6px 10px; }
}

/* --- watchlist star + popover --- */
.sym-row { display: flex; align-items: center; gap: 6px; }
.star { border: 0; background: none; padding: 2px 4px; margin-left: -4px; font-size: 16px; line-height: 1; cursor: pointer; color: var(--muted); border-radius: 5px; }
.star:hover { background: var(--surface-2); color: var(--ink); }
.star.on { color: var(--st-watch); }
.popover { position: fixed; z-index: 55; width: 230px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px; font-size: 13px; }
.pop-h { font-size: 11px; font-weight: 650; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 2px 6px 6px; }
.pop-item { display: flex; align-items: center; gap: 8px; padding: 7px 6px; border-radius: 6px; cursor: pointer; }
.pop-item:hover { background: var(--surface-2); }
.pop-item input { width: 16px; height: 16px; margin: 0; }
.pop-empty { padding: 4px 6px; margin: 0; }
.pop-new { display: flex; gap: 6px; margin-top: 6px; padding-top: 8px; border-top: 1px solid var(--line); }
.pop-new input { flex: 1; min-width: 0; padding: 5px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); font-size: 14px; }
.sub-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 650; margin: 14px 0 6px; }

/* --- help --- */
.help { cursor: help; text-decoration: underline dotted var(--line-strong); text-underline-offset: 3px; }
.grid th[data-help] { cursor: pointer; }
.tooltip.help-tip { max-width: 300px; white-space: normal; padding: 9px 11px; line-height: 1.45; }
.help-name { font-weight: 650; font-size: 12.5px; margin-bottom: 3px; font-family: var(--sans); text-transform: none; letter-spacing: 0; color: var(--ink); }
.help-text { font-size: 12px; color: var(--ink-2); font-family: var(--sans); text-transform: none; letter-spacing: 0; font-weight: 400; }
.guide-btn { white-space: nowrap; }
dialog.guide { width: min(560px, calc(100vw - 24px)); max-height: 82vh; padding: 0; }
dialog.guide form { display: flex; flex-direction: column; max-height: 82vh; }
.guide-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px 10px; border-bottom: 1px solid var(--line); }
.guide-head h3 { margin: 0; }
#guide-body { overflow-y: auto; padding: 6px 18px 16px; }
.guide-row { display: grid; grid-template-columns: 84px 1fr; gap: 12px; padding: 10px 0; border-bottom: 1px dashed var(--line); }
.guide-lbl { font: 600 11px var(--sans); text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 2px; }
.active-filters:empty { display: none; }

.grid td .txt { font-family: var(--sans); font-size: 12px; color: var(--ink-2); display: inline-block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }

/* --- pages: screener / ideas / setups --- */
.pages { display: flex; gap: 6px; margin-bottom: 12px; overflow-x: auto; }
.pages button { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 999px; padding: 6px 14px; cursor: pointer; white-space: nowrap; font-weight: 550; color: var(--ink-2); }
.pages button.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.cards-intro { color: var(--ink-2); font-size: 12.5px; line-height: 1.55; max-width: 900px; margin: 0 0 12px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(340px, 100%), 1fr)); gap: 12px; }
.idea { min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; gap: 8px; }
.idea:hover { border-color: var(--line-strong); box-shadow: 0 2px 10px rgb(0 0 0 / .06); }
.idea-head { display: flex; align-items: flex-start; gap: 8px; }
.idea-t { flex: 1; min-width: 0; }
.idea-t b { font-size: 15px; }
.idea-t .nm { color: var(--muted); font-size: 12px; }
.idea-sub { color: var(--muted); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.idea-score { text-align: right; flex: none; max-width: 48%; }
.idea-score strong { display: block; font: 700 22px/1 var(--mono); }
.idea-score span { font-size: 11px; color: var(--accent); font-weight: 600; }
.idea-kpis { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: var(--ink-2); }
.idea-kpis b { font-family: var(--mono); color: var(--ink); font-weight: 600; }
.reasons { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; }
.reasons li { padding-left: 20px; position: relative; line-height: 1.4; }
.reasons li::before { position: absolute; left: 0; top: 0; font-weight: 700; }
.reasons .pro::before { content: "✓"; color: var(--good); }
.reasons .con::before { content: "!"; color: #b7791f; left: 4px; }
.reasons .con { color: var(--ink-2); }
.sbars { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 4px 12px; margin-top: 2px; }
.sbar { display: grid; grid-template-columns: 78px 1fr 34px; align-items: center; gap: 6px; font-size: 11px; color: var(--muted); }
.sbar i { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.sbar i b { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.sbar em { font-style: normal; font-family: var(--mono); text-align: right; }
@media (max-width: 860px) { .cards-grid { grid-template-columns: minmax(0, 1fr); } }

.cards-intro summary { cursor: pointer; color: var(--accent); font-size: 12px; margin-top: 4px; }
.cards-intro details p { margin: 6px 0 0; }
.cards-count { color: var(--muted); font-size: 12px; margin: 0 0 10px; }

/* --- financial trends --- */
.trend-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.trend { border: 1px solid var(--line); border-radius: 9px; padding: 8px 10px 4px; min-width: 0; }
.trend-h { font-size: 11.5px; color: var(--muted); }
.trend-v { font-size: 12px; margin: 2px 0 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trend-v b { font: 600 14px var(--mono); }
.trend svg { display: block; width: 100%; height: auto; }
.trend .zero { stroke: var(--line-strong); }
.mini-x { fill: var(--muted); font: 9px var(--sans); }
.fin-table summary { cursor: pointer; color: var(--accent); font-size: 12px; margin-top: 10px; }
/* --- competitor comparison --- */
.peer-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.peer { display: inline-flex; align-items: center; gap: 5px; border: 1px solid var(--line-strong); border-radius: 999px; padding: 3px 10px; font-size: 12px; cursor: pointer; background: var(--surface); }
.peer.on { border-color: var(--accent); background: var(--accent-soft); }
.peer input { margin: 0; }
#peer-add { width: 140px; padding: 3px 9px; border: 1px dashed var(--line-strong); border-radius: 999px; background: var(--bg); font-size: 12px; }
.mini.cmp th.me { color: var(--ink); }
.mini.cmp td.best { font-weight: 700; color: var(--ink); }
.mini.cmp .link-th { cursor: pointer; text-decoration: underline dotted; }
.cmp-chart-h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 14px 0 6px; flex-wrap: wrap; }
.end-lbl { fill: var(--ink-2); font: 11px var(--sans); }
.tooltip .dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

/* --- analysts & news --- */
.rec-bar { display: flex; height: 22px; border-radius: 6px; overflow: hidden; gap: 2px; background: var(--surface); }
.rec-bar span { display: flex; align-items: center; justify-content: center; color: #fff; font: 600 11px var(--mono); min-width: 3px; }
.rec-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }
.rec-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }
.rec-sum { font-size: 12.5px; margin: 8px 0 0; }
.t-lbl { fill: var(--ink-2); font: 11px var(--sans); }
.why { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; margin-top: 12px; font-size: 12.5px; }
.why p { margin: 4px 0; }
.an-scroll { max-height: 340px; overflow-y: auto; }
.mini.an td:nth-child(2), .mini.an td:nth-child(3) { font-family: var(--sans); text-align: left; white-space: normal; }
.mini.an th:nth-child(2), .mini.an th:nth-child(3) { text-align: left; }
.badge { display: inline-block; font: 600 10px var(--sans); padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--ink-2); }
.badge.pos { background: var(--good-soft); color: var(--good); }
.badge.neg { background: var(--bad-soft); color: var(--bad); }
.news { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.news a { color: var(--ink); font-weight: 600; text-decoration: none; font-size: 13px; }
.news a:hover { text-decoration: underline; }
.news .dim { font-size: 11.5px; }
.news-sum { font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.mini.an tr.stale td { color: var(--muted); }
.t-stats { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 12px; color: var(--ink-2); margin-top: 2px; }
.t-stats b { font-family: var(--mono); color: var(--ink); }
.t-stats .tick { display: inline-block; width: 2px; height: 12px; background: var(--ink-2); margin-right: 6px; vertical-align: -2px; }
.t-stats .tick.dash { background: none; border-left: 2px dotted var(--ink); }
.mini.cmp tr.grp td { font: 650 10.5px var(--sans); text-transform: uppercase; letter-spacing: .07em; color: var(--accent); padding-top: 12px; text-align: left; border-bottom: 1px solid var(--line-strong); }
.mini.cmp th.med, .mini.cmp td.med { color: var(--muted); background: var(--surface-2); }
.mini.cmp td:first-child { white-space: normal; min-width: 130px; }

/* --- buy on dip --- */
.dip-state { font: 600 12px var(--sans); padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.dip-state.in { background: var(--good-soft); color: var(--good); }
.dip-state.near { background: var(--warn-soft); color: #9a6700; }
.dip-state.wait { background: var(--surface-2); color: var(--ink-2); }
.idea.dip.in { border-color: var(--good); }
.dip-zone { font-size: 12.5px; }
.dip-zone b { font-family: var(--mono); }
.dip-edit { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 12px; color: var(--muted); border-top: 1px dashed var(--line); padding-top: 8px; cursor: default; }
.dip-edit input { width: 84px; padding: 3px 6px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); font-size: 14px; }
/* --- digest --- */
.dg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.dg-grid { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 14px; align-items: start; }
.dg-h { font-size: 12px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 0 0 8px; }
.dg-sec { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin-bottom: 10px; }
.dg-sec h3 { font-size: 13px; margin: 0 0 8px; display: flex; align-items: center; gap: 6px; }
.dg-sec h3 .n { margin-left: auto; font: 600 11px var(--mono); color: var(--muted); }
.dg-sec p { margin: 4px 0; font-size: 12.5px; }
.mini.dg td { vertical-align: top; }
.mini.dg td.dg-txt { text-align: left; font-family: var(--sans); white-space: normal; font-size: 12px; }
.mini.dg a, .dg-news a { color: var(--ink); text-decoration: none; }
.mini.dg a:hover, .dg-news a:hover { text-decoration: underline; }
.sym-link { font-weight: 700; font-family: var(--sans); color: var(--accent) !important; }
.badge.dipb { background: none; padding: 0 2px; }
.dg-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.dg-chip { border: 1px solid var(--line-strong); background: var(--surface); border-radius: 8px; padding: 5px 9px; cursor: pointer; font-size: 12px; display: flex; gap: 6px; align-items: baseline; }
.dg-chip span:last-child { color: var(--muted); }
.dg-chip.in { border-color: var(--good); background: var(--good-soft); }
.dg-chip.near { border-color: #d9a400; background: var(--warn-soft); }
.dg-news { gap: 6px; }
.dg-news li { font-size: 12.5px; }
@media (max-width: 860px) { .dg-grid { grid-template-columns: minmax(0, 1fr); } }
.dist { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.dist i { display: block; height: 100%; background: var(--series-1); border-radius: 3px; }
.idea.dip.in .dist i { background: var(--good); }
.dip-zone .dim { font-size: 11.5px; margin-top: 2px; }

/* star colour = most important list the stock is on */
.star.on.k-dip, .lstar.k-dip { color: var(--st-dip); }
.star.on.k-main, .lstar.k-main { color: var(--st-main); }
.star.on.k-spec, .lstar.k-spec { color: var(--st-spec); }
.star.on.k-watch, .lstar.k-watch { color: var(--st-watch); }
.lstar { font-style: normal; font-size: 12px; width: 14px; flex: none; }
.holdings td:nth-child(3) { min-width: 90px; }
.holdings tfoot td { font-weight: 700; border-top: 1px solid var(--line-strong); }
.holdings .wbar { margin-top: 3px; }
.wbar { display: block; height: 6px; background: var(--series-1); border-radius: 3px; }
.news-when { color: var(--muted); font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.holdings td.dg-txt { text-align: left; font-family: var(--sans); white-space: normal; font-size: 12px; min-width: 110px; max-width: 190px; }
.holdings th:nth-child(2) { text-align: left; }
@media (max-width: 600px) { .holdings td:nth-child(2), .holdings th:nth-child(2) { display: none; } }

/* --- settings --- */
.set-search { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.set-search input { flex: 1 1 280px; max-width: 520px; padding: 9px 12px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); font-size: 15px; }
.sym-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.sym-item { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 8px 12px; }
.sym-item.na { opacity: .65; }
.sym-main b { font-size: 14px; }
.sym-main span { color: var(--ink-2); font-size: 12.5px; }
.sym-main .dim { font-size: 11.5px; }
.sym-act { text-align: right; white-space: nowrap; }
.sym-form { grid-column: 1 / -1; display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 12px; color: var(--ink-2); border-top: 1px dashed var(--line); padding-top: 8px; }
.sym-form input { padding: 4px 8px; border: 1px solid var(--line-strong); border-radius: 6px; background: var(--bg); font-size: 14px; width: 190px; }
@media (max-width: 600px) { .sym-item { grid-template-columns: 1fr; } .sym-act { text-align: left; } }

/* --- fixed comparison slots on cards --- */
.slots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; }
.slot { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; grid-template-rows: auto auto; column-gap: 6px; align-items: baseline;
  padding: 5px 7px; border-radius: 7px; background: var(--surface-2); }
.slot i { grid-row: 1 / 3; font-style: normal; font-weight: 800; font-size: 13px; text-align: center; align-self: center; }
.slot .sl { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot b { font: 600 12.5px var(--mono); text-align: right; }
.slot .sp { grid-column: 2 / 4; font-size: 10.5px; color: var(--muted); text-align: right; }
.slot.good { background: var(--good-soft); } .slot.good i { color: var(--good); }
.slot.bad { background: var(--bad-soft); } .slot.bad i { color: var(--bad); }
.slot.even i, .slot.na i { color: var(--muted); }
.slot-peers { font-size: 11px; color: var(--ink-2); }
.watch-out { font-size: 12px; background: var(--warn-soft); border-radius: 6px; padding: 5px 8px; }
.card-more summary { font-size: 11.5px; color: var(--accent); cursor: pointer; }
.card-more .reasons { margin-top: 6px; }

/* --- live prices --- */
.live-btn { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; color: var(--muted) !important; }
.live-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); display: inline-block; }
.live-btn.on { color: var(--good) !important; border-color: var(--good) !important; }
.live-btn.on i { background: var(--good); animation: livepulse 2s infinite; }
@keyframes livepulse { 50% { opacity: .35; } }
.live-tag { font: 600 10px var(--sans); color: var(--good); border: 1px solid var(--good); border-radius: 4px; padding: 0 4px; vertical-align: 3px; }
body.signed-out .top-actions > #btn-live { display: none; }
