/* Portfolio Manager — minimalist financial dashboard. Light & dark. */

/* ============ v3 identity: deep indigo-charcoal, gradient accent ========= */
:root {
  --page:      #f6f7fb;
  --page-glow: radial-gradient(1200px 480px at 18% -10%, rgba(97, 122, 255, 0.10), transparent 60%);
  --surface:   #ffffff;
  --ink:       #101422;
  --ink-2:     #4b5468;
  --muted:     #8a91a5;
  --grid:      #e8eaf2;
  --baseline:  #c9cede;
  --border:    rgba(30, 41, 82, 0.10);
  --up:        #0f9d6a;
  --down:      #e0446a;
  --accent:    #4f6ef7;
  --accent2:   #12b3d6;
  --accent-ink:#ffffff;
  --s1: #4f6ef7; --s2: #159a72; --s3: #d99a17; --s4: #38851f;
  --s5: #8b5cf6; --s6: #e05252; --s7: #d6519b; --s8: #e07028;
  --other: #8a91a5;
  --shadow:   0 12px 40px -8px rgba(30, 41, 82, 0.18);
  --shadow-1: 0 1px 2px rgba(30, 41, 82, 0.05), 0 10px 30px -18px rgba(30, 41, 82, 0.25);
  --card-top: rgba(255, 255, 255, 0.7);
  --radius: 16px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page:      #0a0d14;
    --page-glow: radial-gradient(1200px 480px at 18% -10%, rgba(109, 139, 255, 0.09), transparent 60%);
    --surface:   #10141e;
    --ink:       #edf0f8;
    --ink-2:     #a8b1c5;
    --muted:     #67708a;
    --grid:      #1b2130;
    --baseline:  #2b3348;
    --border:    rgba(148, 163, 208, 0.11);
    --up:        #2fd695;
    --down:      #ff6b8b;
    --accent:    #6d8bff;
    --accent2:   #38d9f5;
    --accent-ink:#0a0d14;
    --s1: #6d8bff; --s2: #2fbf8f; --s3: #e0a63a; --s4: #4ea34e;
    --s5: #a78bfa; --s6: #ff7070; --s7: #f472b6; --s8: #fb923c;
    --shadow:   0 16px 50px -10px rgba(0, 0, 0, 0.6);
    --shadow-1: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 10px 30px -18px rgba(0, 0, 0, 0.7);
    --card-top: rgba(255, 255, 255, 0.045);
    --radius: 16px;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { height: 100%; }
/* min-height, not height: a body capped at the viewport is the sidebar's
 * sticky containing block, so the nav scrolled away after one screen */
body {
  min-height: 100%;
  background: var(--page-glow), var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 13.5px;
  line-height: 1.5;
  display: flex;
}
h1, h2, h3 { margin: 0; font-weight: 650; }
.page-title { font-size: 18px; margin-bottom: 18px; }
code { background: var(--grid); padding: 1px 5px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--ink-2); }
.small { font-size: 12.5px; }
.hint { color: var(--muted); font-weight: 400; font-size: 11.5px; }
.pos { color: var(--up); }
.neg { color: var(--down); }

/* ------------------------------------------------------- tick animations */
/* Brokerage-style feedback: a value that just moved washes green or red and
 * fades back. Applied to freshly rendered markup, so the run fires on insert.
 * Nothing flashes while the market is closed — the app only tags these
 * classes when a session is actually live. */
@keyframes tick-up {
  from { background-color: color-mix(in srgb, var(--up) 30%, transparent);
         box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--up) 45%, transparent); }
  to   { background-color: transparent; box-shadow: inset 0 0 0 1px transparent; }
}
@keyframes tick-down {
  from { background-color: color-mix(in srgb, var(--down) 30%, transparent);
         box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--down) 45%, transparent); }
  to   { background-color: transparent; box-shadow: inset 0 0 0 1px transparent; }
}
.tick-up   { animation: tick-up   .95s cubic-bezier(.2,.7,.3,1) both; border-radius: 6px; }
.tick-down { animation: tick-down .95s cubic-bezier(.2,.7,.3,1) both; border-radius: 6px; }

/* The hero number is far too big for a background wash — flash the glyphs. */
@keyframes hero-tick-up {
  from { color: var(--up); }
  to   { color: var(--ink); }
}
@keyframes hero-tick-down {
  from { color: var(--down); }
  to   { color: var(--ink); }
}
.hero .topline-value.tick-up   { animation: hero-tick-up   1s cubic-bezier(.2,.7,.3,1) both; background-color: transparent; box-shadow: none; }
.hero .topline-value.tick-down { animation: hero-tick-down 1s cubic-bezier(.2,.7,.3,1) both; background-color: transparent; box-shadow: none; }

@media (prefers-reduced-motion: reduce) {
  .tick-up, .tick-down,
  .hero .topline-value.tick-up, .hero .topline-value.tick-down { animation: none; }
}

/* ------------------------------------------------------------- sidebar */
.sidebar {
  width: 200px; flex: 0 0 200px;
  display: flex; flex-direction: column;
  border-right: 1px solid var(--border);
  padding: 20px 12px 16px;
  position: sticky; top: 0; height: 100vh;
}
.side-brand {
  display: flex; align-items: center; gap: 9px;
  font-weight: 700; font-size: 14.5px;
  padding: 0 10px 18px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.side-logo { color: var(--accent); font-size: 15px; }
.side-nav { display: flex; flex-direction: column; gap: 1px; }
.nav-sec {
  font-size: 10px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 650; padding: 14px 10px 4px;
}
.nav-sec:first-child { padding-top: 0; }
.nav-item {
  appearance: none; border: none; background: none; cursor: pointer;
  font: inherit; color: var(--ink-2); text-align: left;
  padding: 7px 10px; border-radius: 7px;
}
.nav-item:hover { color: var(--ink); background: var(--grid); }
.nav-item.active { color: var(--ink); background: var(--grid); font-weight: 600; }
.side-foot { margin-top: auto; padding: 10px 4px; }
/* the live indicator is a self-contained chip, not floating text */
.live-row {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 10px; border: 1px solid var(--border); border-radius: 999px;
  background: color-mix(in srgb, var(--surface) 82%, transparent);
}
.live-row.live-mobile { display: none; }
.live-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--muted); flex: 0 0 auto; }
.live-dot.ok { background: var(--up); }
.live-dot.stale { background: #fab219; }
.live-status { font-size: 11px; color: var(--muted); line-height: 1.35; }

/* ---------------------------------------------------------------- main */
.main { flex: 1; min-width: 0; padding: 26px 36px 80px; max-width: 1720px; margin: 0 auto; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* -------------------------------------------------------------- topline */
.topline {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; flex-wrap: wrap; margin-bottom: 20px;
}
.metric-label {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
}
.topline-value { font-size: 34px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; }
.topline-day { font-size: 13.5px; margin-top: 2px; }
.topline-ext { font-size: 12.5px; margin-top: 2px; }

/* hero (Overview) */
.hero { margin: 2px 0 22px; animation: rise .45s cubic-bezier(.2,.8,.25,1) both; }
.hero .topline-value {
  font-size: 46px; letter-spacing: -.02em; color: var(--ink);
}

/* slot-machine digits: one reel per digit, clipped to a single row */
.odo {
  --odo-h: 1.16em;
  display: inline-flex; align-items: flex-start;
  font-variant-numeric: tabular-nums; user-select: none;
}
.odo-lit { display: block; height: var(--odo-h); line-height: var(--odo-h); }
.odo-cell { display: block; height: var(--odo-h); overflow: hidden; }
.odo-strip { display: block; will-change: transform; }
.odo-strip > span { display: block; height: var(--odo-h); line-height: var(--odo-h); }
@media (prefers-reduced-motion: reduce) {
  .odo-strip { transition: none !important; }
}
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.tab-panel.active > * { animation: rise .4s cubic-bezier(.2,.8,.25,1) both; }
.tab-panel.active > *:nth-child(2) { animation-delay: .04s; }
.tab-panel.active > *:nth-child(3) { animation-delay: .08s; }
@media (prefers-reduced-motion: reduce) {
  .hero, .tab-panel.active > * { animation: none; }
}
.hero .topline-day { font-size: 14.5px; margin-top: 4px; }
.hero .topline-ext { font-size: 13px; }
.topline-metrics {
  display: flex; gap: 26px; flex-wrap: wrap; align-items: flex-end;
  padding-bottom: 4px;
}
.tm { display: flex; flex-direction: column; gap: 1px; min-width: 78px; }
.tm-value { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 14px; }

/* ------------------------------------------------------------ range bar */
.range-bar { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 10px; }
.range-buttons, .chart-toggle {
  display: inline-flex; gap: 2px;
  background: var(--grid); border-radius: 8px; padding: 2px;
}
.range-buttons button, .chart-toggle button {
  appearance: none; border: none; cursor: pointer; font: inherit;
  font-size: 12px; font-weight: 600; color: var(--ink-2);
  background: none; border-radius: 6px; padding: 4px 10px;
}
.range-buttons button:hover, .chart-toggle button:hover { color: var(--ink); }
.range-buttons button.active, .chart-toggle button.active {
  background: var(--surface); color: var(--ink);
  box-shadow: 0 1px 2px rgba(0,0,0,.12);
}
.range-date {
  font: inherit; font-size: 12px; color: var(--ink-2);
  background: none; border: 1px solid var(--border); border-radius: 8px;
  padding: 4px 8px;
}
.chart-toggle { margin-left: auto; }
.chart-type + .chart-toggle { margin-left: 0; }
.chart-type button { padding: 4px 7px; display: inline-flex; align-items: center; }

/* --------------------------------------------------------------- panels */
.panel {
  background: linear-gradient(180deg, var(--card-top), transparent 42px), var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 18px;
  box-shadow: var(--shadow-1);
}
.panel.narrow { max-width: 620px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.panel-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 650; margin-bottom: 12px;
}
.panel-sub { color: var(--muted); font-size: 12px; }
.sm-only { display: none; }

[hidden] { display: none !important; }

/* ticker logos (FMP): letter chip until the logo loads, white chip after */
.tlogo {
  position: relative; width: 22px; height: 22px; border-radius: 6px; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--grid); overflow: hidden; vertical-align: -5px;
}
.tlogo i { font-style: normal; font-size: 11px; font-weight: 800; color: var(--muted); }
.tlogo img {
  position: absolute; inset: 0; width: 100%; height: 100%;
  object-fit: contain; padding: 2px; opacity: 0;
}
.tlogo.tl-ok { background: #fff; }
.tlogo.tl-ok img { opacity: 1; }
.tlogo.tl-ok i { visibility: hidden; }
.with-logo, .table .asset-cell.with-logo, .mover-card .mc-id.with-logo {
  display: flex; flex-direction: row; align-items: center; gap: 8px; min-width: 0;
}
.with-logo .asset-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
.sortable:hover { color: var(--ink); }
.sort-arrow { font-size: 8px; margin-left: 3px; color: var(--accent); }
th.sorted { color: var(--ink); }

/* grid/flex children may not shrink below content unless told to — without
   this, wide tables defeat their overflow-x scroll wrappers on mobile */
.perf-grid > *, .reb-grid > *, .insights-grid > *, .trade-grid > *,
.reb-left > *, .tab-panel > * { min-width: 0; max-width: 100%; }

.perf-grid { display: grid; grid-template-columns: 1fr 264px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .perf-grid { grid-template-columns: 1fr; } }
.range-spacer { flex: 1; }
.btn.icon-only { padding: 6px 10px; min-height: 0; }

/* chart footer: benchmark chips + legend */
.chart-footer { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; margin-top: 8px; }
.bench-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.bench-chip {
  appearance: none; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 999px;
  padding: 3px 10px; display: inline-flex; align-items: center; gap: 6px;
}
.bench-chip:hover { color: var(--ink); border-color: var(--baseline); }
.ds-pct { font-size: 11px; font-weight: 600; opacity: .85; }
.fut-tag {
  display: inline-block; padding: 0 5px; border-radius: 5px;
  font-size: 9px; font-weight: 750; letter-spacing: .06em; line-height: 1.6;
  color: var(--accent2); border: 1px solid color-mix(in srgb, var(--accent2) 45%, transparent);
  background: color-mix(in srgb, var(--accent2) 10%, transparent);
  vertical-align: 1px; cursor: help;
}
.bench-chip.active { color: var(--ink); border-color: var(--baseline); background: var(--grid); }
.chip-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }

/* glanceable summary chips under the chart */
.chips-row { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.chip-stat {
  display: flex; flex-direction: column; gap: 1px;
  background: var(--page); border: 1px solid var(--border); border-radius: 10px;
  padding: 8px 14px; min-width: 120px;
}
.chip-stat .chip-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.chip-stat .chip-value { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.chip-stat .chip-value small { font-size: 11.5px; font-weight: 500; color: var(--ink-2); }
.chip-stat.pos .chip-value { color: var(--up); }
.chip-stat.neg .chip-value { color: var(--down); }
.chip-more {
  appearance: none; font: inherit; cursor: pointer; justify-content: center;
  color: var(--ink-2); background: none; min-width: 0;
}
.chip-more:hover { color: var(--ink); background: var(--grid); }
.chip-more .chip-value { font-size: 12.5px; font-weight: 600; color: inherit; }
.stats-inline { margin-top: 12px; border-top: 1px solid var(--grid); padding-top: 6px; }
.stats-inline .stats-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 28px; }

/* what's-moving rail */
.movers-rail { padding-top: 4px; }
.mc-group-label {
  font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em;
  font-weight: 650; margin: 12px 0 6px;
}
.mc-group-label:first-child { margin-top: 0; }
.mover-card {
  appearance: none; font: inherit; cursor: pointer; width: 100%; text-align: left;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 6px; color: var(--ink);
}
.mover-card { transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.mover-card:hover { border-color: var(--baseline); background: color-mix(in srgb, var(--accent) 6%, var(--surface)); transform: translateY(-1px); }
.mover-card .mc-id { display: flex; flex-direction: column; min-width: 0; }
.mover-card .asset-name { font-size: 11px; color: var(--muted); max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mover-card .mc-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.mover-card .mc-num span { font-weight: 700; font-size: 13.5px; }
.mover-card .mc-num small { font-size: 11px; opacity: .85; }
.mc-all {
  appearance: none; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--accent); background: none; border: none; padding: 8px 2px;
}

/* broker-style holdings rows */
.holdings-list { display: flex; flex-direction: column; }

/* IBKR-style holdings table */
.h-table td { vertical-align: middle; }
.h-table tbody tr[data-holding] { cursor: pointer; }
.h-table tbody tr[data-holding]:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.h-table .t-sub { font-size: 10.5px; color: var(--muted); font-weight: 400; white-space: nowrap; }
.h-table .t-chg { white-space: nowrap; }
.h-table .t-tag {
  font-size: 9px; font-weight: 700; letter-spacing: .05em; color: var(--muted);
  border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; vertical-align: 1px;
}
.h-table tr.cash-row td { background: color-mix(in srgb, var(--grid) 40%, transparent); }
.h-table tr.sold-row { opacity: .55; }

/* holdings heatmap */
.hm-tile { cursor: pointer; }
.hm-tile:hover rect { filter: brightness(1.12); }
.hm-sym { fill: var(--ink); font-size: 12px; font-weight: 700; pointer-events: none; }
.hm-pct { fill: var(--ink-2); font-size: 11px; font-weight: 600; pointer-events: none; }
.hm-note { text-align: center; padding: 8px 0 2px; }
.h-row {
  appearance: none; font: inherit; text-align: left; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: minmax(140px, 1.2fr) 110px 1fr 1fr;
  gap: 14px; align-items: center;
  background: none; border: none; border-bottom: 1px solid var(--grid);
  padding: 11px 6px; color: var(--ink); border-radius: 8px;
}
.h-row:last-child { border-bottom: none; }
.h-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.h-row .h-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.h-row .asset-name { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.h-row .h-spark { display: flex; align-items: center; }
.h-row .h-num { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; line-height: 1.3; }
.h-row .h-num > span:first-child { font-weight: 650; font-size: 13.5px; }
.h-row .h-sub { font-size: 11px; color: var(--muted); font-weight: 400; }
.h-row.h-cash { cursor: default; background: color-mix(in srgb, var(--grid) 40%, transparent); }
.h-row.sold-row { opacity: .55; }
.chart-panel { display: flex; flex-direction: column; }
.perf-chart { flex: 1; min-height: 260px; position: relative; }
.perf-chart svg { display: block; width: 100%; height: 100%; }
.chart-legend { display: flex; gap: 18px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.chart-legend .key { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend .swatch { width: 14px; height: 2.5px; border-radius: 2px; display: inline-block; }

.stats-panel { align-self: stretch; }
.stats-list { margin: 0; display: flex; flex-direction: column; }
.stats-list .stat-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  padding: 7px 0; border-bottom: 1px solid var(--grid);
}
.stats-list .stat-row:last-child { border-bottom: none; }
.stats-list dt { font-size: 12px; color: var(--ink-2); }
.stats-list dd { margin: 0; font-weight: 650; font-variant-numeric: tabular-nums; font-size: 12.5px; white-space: nowrap; }
.stats-list .sub { font-size: 10.5px; color: var(--muted); font-weight: 400; }

/* --------------------------------------------------------------- tiles */
.tiles { display: grid; gap: 12px; margin-bottom: 16px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 13px 16px; }
.tile-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.tile-value { font-size: 20px; font-weight: 650; margin-top: 2px; }
.tile-sub { font-size: 12px; color: var(--ink-2); margin-top: 1px; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- table */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 600;
  padding: 7px 10px; border-bottom: 1px solid var(--baseline);
  white-space: nowrap;
}
.table td {
  padding: 8px 10px; border-bottom: 1px solid var(--grid);
  font-variant-numeric: tabular-nums; white-space: nowrap; font-size: 13px;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.clickable { cursor: pointer; }
.table tbody tr.clickable:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.table .num { text-align: right; }
.table .sym { font-weight: 650; }
.table .asset-cell { display: flex; flex-direction: column; line-height: 1.3; }
.table .asset-name { font-size: 11.5px; color: var(--muted); max-width: 200px; overflow: hidden; text-overflow: ellipsis; }
.table .name-cell { max-width: 220px; overflow: hidden; text-overflow: ellipsis; color: var(--ink-2); }
tr.sold-row td { opacity: .55; }
tr.cash-row td { background: color-mix(in srgb, var(--grid) 40%, transparent); }

.badge {
  display: inline-block; padding: 0 7px; border-radius: 999px;
  font-size: 10.5px; font-weight: 650; border: 1px solid var(--border); line-height: 1.7;
}
.badge.buy { color: var(--up); }
.badge.sell { color: var(--down); }
.badge.deposit { color: var(--accent); }
.badge.withdraw { color: var(--s8); }
.badge.dividend { color: var(--s2); }
.badge.announced { color: var(--muted); }
.badge.soldoff { color: var(--muted); }
.session-icon { font-size: 11px; cursor: help; }
.empty-note { color: var(--muted); text-align: center; padding: 20px 0 8px; }

.icon-btn {
  appearance: none; border: none; background: none; cursor: pointer;
  color: var(--muted); font-size: 14px; padding: 2px 6px; border-radius: 6px;
}
.icon-btn:hover { color: var(--down); background: var(--grid); }

/* --------------------------------------------------------------- forms */
.form { display: flex; flex-direction: column; gap: 12px; }
.form-row { display: flex; flex-direction: column; gap: 12px; }
/* minmax(0,…): a long <select> option (timezones) must not widen the column */
.form-row.two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.form input, .form select {
  font: inherit; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px;
}
.form input:focus, .form select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.symbol-row { display: flex; gap: 8px; }
.symbol-row input { flex: 1; text-transform: uppercase; }
.check-row { display: flex; flex-direction: row !important; align-items: center; gap: 8px; font-weight: 400 !important; }
.check-row input { width: 15px; height: 15px; }

.btn {
  appearance: none; font: inherit; font-weight: 600; cursor: pointer;
  border-radius: 8px; padding: 8px 15px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); font-size: 13px;
}
.btn:hover { border-color: var(--baseline); }
.btn.primary {
  background: linear-gradient(120deg, var(--accent), color-mix(in srgb, var(--accent2) 70%, var(--accent)));
  color: #fff; border-color: transparent;
}
.btn.primary:hover { filter: brightness(1.08); opacity: 1; }
.btn.ghost { background: none; }
.btn:disabled { opacity: .55; cursor: default; }

.form-msg { min-height: 18px; margin: 0; font-size: 12.5px; }
.form-msg.ok { color: var(--up); }
.form-msg.err { color: var(--down); }

.quote-box {
  border: 1px solid var(--grid); border-radius: 8px; padding: 10px 12px;
  display: flex; flex-wrap: wrap; gap: 6px 22px; background: var(--page);
}
.quote-box .q-item { display: flex; flex-direction: column; }
.quote-box .q-label { font-size: 11px; color: var(--muted); }
.quote-box .q-value { font-weight: 650; font-variant-numeric: tabular-nums; }

.preview {
  border-left: 2px solid var(--accent); background: var(--page);
  padding: 8px 12px; border-radius: 0 8px 8px 0; font-size: 12.5px; color: var(--ink-2);
}
.preview strong { color: var(--ink); font-variant-numeric: tabular-nums; }
.preview .warn { color: var(--down); }

.trade-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .trade-grid { grid-template-columns: 1fr; } }
.cash-now { margin-top: 14px; color: var(--ink-2); font-size: 12.5px; }
.cash-now strong { font-variant-numeric: tabular-nums; color: var(--ink); margin-left: 4px; }

.import-result { margin-top: 14px; font-size: 12.5px; }
.import-result ul { margin: 6px 0 0; padding-left: 18px; color: var(--down); }

/* -------------------------------------------------------------- charts */
.insights-grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(330px, 1fr)); }
.donut-holder { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.donut-holder svg { flex: 0 0 auto; }
.donut-legend { flex: 1; min-width: 170px; display: flex; flex-direction: column; gap: 5px; }
.legend-row {
  display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center;
  font-size: 12px; cursor: default; padding: 2px 4px; border-radius: 6px;
}
.legend-row:hover { background: var(--grid); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; }
.legend-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.legend-value { font-variant-numeric: tabular-nums; color: var(--ink); }
.legend-pct { font-variant-numeric: tabular-nums; color: var(--muted); width: 46px; text-align: right; }

.bars-holder { display: flex; flex-direction: column; gap: 7px; }
.bar-row { display: grid; grid-template-columns: 62px 1fr auto; gap: 10px; align-items: center; }
.bar-row .bar-val { min-width: 130px; }
.bar-sym { font-weight: 650; font-size: 12px; }
.bar-track { height: 16px; position: relative; }
.bar-fill { position: absolute; inset: 0 auto 0 0; border-radius: 0 4px 4px 0; min-width: 2px; }
.bar-val { font-size: 12px; font-variant-numeric: tabular-nums; color: var(--ink-2); text-align: right; }

.donut-seg { stroke: var(--surface); stroke-width: 2; cursor: default; }
.donut-seg:hover { opacity: .85; }
.donut-center-value { font-size: 14px; font-weight: 650; fill: var(--ink); }
.donut-center-label { font-size: 10px; fill: var(--muted); }

/* ===================== session recap (Insights) ===================== */
.recap { margin-bottom: 18px; }
.rc-top { display: grid; grid-template-columns: minmax(220px, 300px) 1fr; gap: 14px; align-items: stretch; }
.rc-hero {
  border-radius: var(--radius); padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); box-shadow: var(--shadow-1);
  display: flex; flex-direction: column; justify-content: center;
  position: relative; overflow: hidden;
}
.rc-hero::after {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px;
  background: var(--muted);
}
.rc-hero.pos::after { background: var(--up); }
.rc-hero.neg::after { background: var(--down); }
.rc-hero-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 700; }
.rc-hero-value { font-size: 42px; font-weight: 750; letter-spacing: -.02em;
  line-height: 1.1; font-variant-numeric: tabular-nums; }
.rc-hero.pos .rc-hero-value { color: var(--up); }
.rc-hero.neg .rc-hero-value { color: var(--down); }
.rc-hero-sub { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }

.rc-cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 12px 14px; box-shadow: var(--shadow-1); min-width: 0;
}
.rc-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rc-value { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.25; }
.rc-card.pos .rc-value { color: var(--up); }
.rc-card.neg .rc-value { color: var(--down); }
.rc-sub { font-size: 11px; color: var(--muted); }
.rc-breadth { display: block; height: 4px; border-radius: 3px; background: color-mix(in srgb, var(--down) 45%, transparent); margin: 5px 0 4px; overflow: hidden; }
.rc-breadth i { display: block; height: 100%; background: var(--up); }

/* the movers board (Insights): a terminal-style MOV screen */
/* position: the fading ghosts of leaving rows sit against it */
.mov { position: relative; margin-top: 12px; background: var(--surface); border: 1px solid var(--border);
       border-radius: 14px; box-shadow: var(--shadow-1); overflow: hidden; }
.mov-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px;
            padding: 10px 14px; border-bottom: 1px solid var(--grid); }
.mov-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.mov-basis { font-size: 12px; color: var(--muted); }
.mov-net { font-weight: 700; font-variant-numeric: tabular-nums; }
.mov-net small { font-weight: 500; color: var(--muted); margin-left: 4px; }
.mov-breadth { display: inline-flex; gap: 8px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; }
.mov-ctl { margin-left: auto; display: inline-flex; flex-wrap: wrap; gap: 8px; }
.mov-seg { display: inline-flex; gap: 2px; background: var(--grid); border-radius: 8px; padding: 2px; }
.mov-seg button { appearance: none; border: none; cursor: pointer; font: inherit; font-size: 11.5px;
                  font-weight: 600; color: var(--ink-2); background: none; border-radius: 6px; padding: 3px 9px; }
.mov-seg button:hover { color: var(--ink); }
.mov-seg button.active { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.12); }

/* clipped while it eases to a new height (show all / top five) */
.mov-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); overflow: hidden; }
.mov-ghost { position: absolute; margin: 0; pointer-events: none; z-index: 1; }
.mov-side + .mov-side { border-left: 1px solid var(--grid); }
/* .pos / .neg on the side name its direction; the rows keep the ink colour
   and only the figures take green or red */
.mov-side.pos, .mov-side.neg { color: var(--ink); }
.mov-side-head { display: flex; align-items: baseline; gap: 8px; padding: 9px 14px 4px; }
.mov-side-title { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; }
.mov-side.pos .mov-side-title { color: var(--up); }
.mov-side.neg .mov-side-title { color: var(--down); }
.mov-count { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mov-sum { margin-left: auto; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }

/* one grid for the column heads and the rows, so they line up exactly */
.mov-cols, .mov-row { display: grid; align-items: center; column-gap: 10px;
  grid-template-columns: 18px minmax(0, 1fr) 78px 62px 86px 92px; padding: 0 14px; }
.mov-cols { font-size: 10px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
            padding-top: 2px; padding-bottom: 4px; border-bottom: 1px solid var(--grid); }
.mov-row { width: 100%; min-height: 40px; background: none; border: 0; border-bottom: 1px solid var(--grid);
           cursor: pointer; font: inherit; color: inherit; text-align: left; }
.mov-row:last-of-type { border-bottom: 0; }
.mov-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.mov-cols .num, .mov-row .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.mov-rank { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.mov-tk { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mov-id { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.mov-id b { font-weight: 650; }
.mov-id small { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mov-row .mov-last { font-size: 12.5px; color: var(--ink-2); }
.mov-pct { font-weight: 700; }
.mov-amt { font-size: 12.5px; }
/* contribution: the bar grows from the right edge, the figure sits on it */
.mov-bp { position: relative; font-size: 12px; }
.mov-bp em { position: relative; font-style: normal; font-weight: 600; }
.mov-bar { position: absolute; right: 0; top: calc(50% - 9px); height: 18px; width: 100%;
           border-radius: 4px; opacity: .16; transform-origin: 100% 50%;
           /* resized by scaleX, so a new contribution grows or shrinks into place */
           transition: transform .55s cubic-bezier(.2, .8, .25, 1), background-color .3s; }
.mov-bar.pos { background: var(--up); }
.mov-bar.neg { background: var(--down); }
.mov-empty { padding: 14px; color: var(--muted); font-size: 12.5px; }
.mov-more { display: block; width: 100%; padding: 9px; border: 0; border-top: 1px solid var(--grid);
            background: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
            color: var(--accent); }
.mov-more:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* narrower: the two sides stack, and the last price goes first */
@media (max-width: 1100px) {
  .mov-grid { grid-template-columns: minmax(0, 1fr); }
  .mov-side + .mov-side { border-left: 0; border-top: 1px solid var(--grid); }
}
/* phone: ticker | % chg | impact, with the contribution as a thin bar under
   the row, so nothing scrolls sideways */
@media (max-width: 760px) {
  .mov-head { padding: 10px 12px; }
  .mov-ctl { margin-left: 0; width: 100%; }
  .mov-cols, .mov-row { grid-template-columns: minmax(0, 1fr) 62px 84px; padding: 0 12px; }
  .mov-cols > :nth-child(1), .mov-cols > :nth-child(3), .mov-cols > :nth-child(6),
  .mov-rank, .mov-last { display: none; }
  .mov-row { position: relative; min-height: 46px; }
  .mov-bp { position: absolute; left: 12px; right: 12px; bottom: 3px; height: 3px; }
  .mov-bp em { display: none; }
  .mov-bar { height: 3px; top: 0; opacity: .5; }
}

.rc-next, .opt-moves { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.rc-next-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; }
.rc-chip {
  font-size: 11.5px; padding: 4px 10px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border);
}
.rc-chip.pos { border-color: color-mix(in srgb, var(--up) 45%, transparent); color: var(--up); }
.rc-chip.neg { border-color: color-mix(in srgb, var(--down) 45%, transparent); color: var(--down); }

/* ===================== max-Sharpe sector model ===================== */
.opt-controls { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-bottom: 12px; }
.opt-rf { font-size: 11.5px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.opt-rf input { width: 72px; font: inherit; padding: 4px 6px; border-radius: 7px;
  border: 1px solid var(--border); background: var(--page); color: var(--ink); text-align: right; }
.opt-head { display: flex; align-items: stretch; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.opt-score {
  flex: 1 1 180px; background: var(--page); border: 1px solid var(--border);
  border-radius: 14px; padding: 12px 16px; display: flex; flex-direction: column;
}
.opt-score.best { border-color: color-mix(in srgb, var(--accent) 55%, transparent);
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.opt-score-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700; }
.opt-score-value { font-size: 30px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.15; }
.opt-score-sub { font-size: 11.5px; color: var(--muted); }
.opt-arrow { display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 700; padding: 0 4px; }
.opt-arrow small { font-size: 11.5px; font-weight: 650; }
.opt-legend { display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  font-size: 11.5px; color: var(--muted); margin-bottom: 8px; }
.opt-legend .swatch { width: 14px; height: 8px; border-radius: 3px; display: inline-block;
  margin-right: 5px; vertical-align: 0; }
.opt-legend .swatch.now { background: var(--muted); }
.opt-legend .swatch.target { background: var(--accent); }
.opt-rows { display: flex; flex-direction: column; }
.opt-row {
  display: grid; grid-template-columns: minmax(120px, 1.3fr) 2fr 68px 128px;
  gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--grid);
}
.opt-row:first-child { border-top: 0; }
.opt-name { font-weight: 650; font-size: 13px; min-width: 0; }
.opt-syms { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.opt-bars { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.opt-bar { position: relative; display: flex; align-items: center; gap: 6px; }
.opt-bar i { display: block; height: 9px; border-radius: 3px; min-width: 2px; }
.opt-bar i.now { background: var(--muted); }
.opt-bar i.target { background: linear-gradient(90deg, var(--accent), var(--accent2)); }
.opt-bar span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.opt-delta { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; font-size: 12.5px; }
.opt-stats { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; text-align: right; }
.opt-excluded { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--grid); }

/* --- Sector Opportunity Benchmark --- */
.sm-headnote { flex: 1 1 240px; display: flex; flex-direction: column; justify-content: center;
  gap: 3px; font-size: 11.5px; color: var(--ink-2); padding-left: 4px; }
.opt-row.sm-row { grid-template-columns: minmax(120px, 1.2fr) 1.6fr 66px 74px 116px; }
.opt-row.sm-book { grid-template-columns: minmax(120px, 1.2fr) 1.6fr 66px; }
.sm-scores { display: flex; align-items: flex-end; gap: 3px; height: 26px; }
.sm-score { display: block; width: 8px; border-radius: 2px 2px 0 0;
  height: var(--h, 50%); background: linear-gradient(180deg, var(--accent), var(--accent2)); }
.sm-score.na { height: 100%; background: repeating-linear-gradient(45deg,
  var(--grid), var(--grid) 2px, transparent 2px, transparent 4px); }
.sm-sub { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; font-weight: 700;
  color: var(--muted); margin: 16px 0 6px; padding-top: 10px; border-top: 1px solid var(--grid); }
.sm-whys { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-top: 12px; }
.sm-why { background: var(--page); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 12px; font-size: 11.5px; line-height: 1.55; }
.sm-why-head { font-size: 13px; margin-bottom: 3px; }
.sm-table td, .sm-table th { font-size: 12px; }
.sm-table tr.sm-primary td { background: color-mix(in srgb, var(--accent) 8%, transparent);
  font-weight: 650; }
.sm-note { margin: 0 0 8px; }
@media (max-width: 900px) {
  .opt-row.sm-row { grid-template-columns: 1fr 1.3fr 60px; }
  .opt-row.sm-row .sm-scores, .opt-row.sm-book .opt-bars span { display: none; }
}

@media (max-width: 900px) {
  .rc-top { grid-template-columns: 1fr; }
  .opt-row { grid-template-columns: 1fr 1.4fr 62px; }
  .rc-hero-value { font-size: 34px; }
}

/* loading skeletons — shown while daily closes are still being fetched */
@keyframes sk-sweep { to { background-position: 200% 0; } }
.chart-skeleton {
  position: relative; width: 100%; min-height: 260px; height: 100%;
  border-radius: 12px; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--grid) 55%, transparent) 8%,
    color-mix(in srgb, var(--grid) 20%, transparent) 22%,
    color-mix(in srgb, var(--grid) 55%, transparent) 36%);
  background-size: 200% 100%;
  animation: sk-sweep 1.3s linear infinite;
}
.chart-skeleton .sk-line {
  position: absolute; inset: 18% 4% 22%;
  border-bottom: 2px dashed color-mix(in srgb, var(--muted) 35%, transparent);
  border-radius: 10px;
}
.chart-skeleton .sk-label {
  position: relative; font-size: 12px; font-weight: 600; color: var(--muted);
  background: var(--surface); padding: 4px 12px; border-radius: 999px;
}
.chip-skeleton {
  min-width: 132px; height: 46px; border-color: transparent;
  background: linear-gradient(100deg,
    color-mix(in srgb, var(--grid) 55%, transparent) 8%,
    color-mix(in srgb, var(--grid) 20%, transparent) 22%,
    color-mix(in srgb, var(--grid) 55%, transparent) 36%);
  background-size: 200% 100%;
  animation: sk-sweep 1.3s linear infinite;
}
@media (prefers-reduced-motion: reduce) {
  .chart-skeleton, .chip-skeleton { animation: none; }
}

/* line chart */
.perf-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.perf-line.animate { stroke-dasharray: 1; stroke-dashoffset: 1; animation: drawline .9s cubic-bezier(.4,0,.2,1) forwards; }
@keyframes drawline { to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .perf-line.animate { animation: none; stroke-dashoffset: 0; } }
.perf-area { opacity: .14; }
.perf-grid-line { stroke: var(--grid); stroke-width: 1; }
.sess-band { fill: color-mix(in srgb, var(--accent) 5%, var(--grid) 30%); opacity: .55; }
.sess-band.night { fill: color-mix(in srgb, #4f46e5 10%, var(--grid) 45%); opacity: .7; }
.sess-bound { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 4 3; }
.sess-now { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 2; opacity: .55; }
.perf-zero { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 3 3; }
.perf-axis-label { font-size: 10px; fill: var(--muted); }
.perf-session-label { font-size: 11px; }
.perf-cross { stroke: var(--ink-2); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.perf-dot { stroke-width: 2; }

/* brokerage furniture: the readout, the axis tags, the last level, high/low,
   trades, the measuring band, candles */
.chart-readout {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px;
  min-height: 22px; margin: -2px 0 6px; font-size: 12.5px; color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}
.chart-readout .ro-when { color: var(--muted); }
.chart-readout .ro-main { font-weight: 700; color: var(--ink); font-size: 14px; }
.chart-readout .ro-chg { font-weight: 650; }
.chart-readout .ro-chg small { font-weight: 500; color: var(--muted); }
.chart-readout .ro-ohlc { color: var(--ink-2); letter-spacing: .01em; }
.chart-readout .ro-bench { display: inline-flex; align-items: baseline; gap: 5px; }
.chart-readout .ro-bench i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; align-self: center; }
.chart-readout .ro-trades { color: var(--ink); font-weight: 600; }
.perf-last { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 2 4; opacity: .6; }
.perf-tag rect { fill: var(--accent); }
.perf-tag text { fill: var(--accent-ink); font-size: 10.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.perf-tag.cross rect { fill: var(--ink); }
.perf-tag.cross text { fill: var(--surface); }
.perf-hilo { font-size: 10px; font-weight: 650; fill: var(--muted); font-variant-numeric: tabular-nums; }
.perf-trade { stroke: var(--surface); stroke-width: 1; cursor: default; }
.perf-trade.buy { fill: var(--up); }
.perf-trade.sell { fill: var(--down); }
.perf-trade-key { font-size: 9px; margin-right: 1px; }
.perf-trade-key.buy { color: var(--up); }
.perf-trade-key.sell { color: var(--down); }
.perf-measure { fill: var(--accent); opacity: .10; }
.perf-candles.animate { animation: candles-in .9s cubic-bezier(.4,0,.2,1) both; }
@keyframes candles-in { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@media (prefers-reduced-motion: reduce) { .perf-candles.animate { animation: none; } }
#pc-hover { cursor: crosshair; touch-action: pan-y; }

/* ----------------------------------------------------------- rebalance */
.reb-grid { display: grid; grid-template-columns: 1.25fr .75fr; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .reb-grid { grid-template-columns: 1fr; } }
.reb-right { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 16px;
             max-height: calc(100vh - 32px); overflow-y: auto; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.chip {
  appearance: none; font: inherit; font-size: 11.5px; font-weight: 600; cursor: pointer;
  color: var(--ink-2); background: var(--grid); border: none; border-radius: 999px;
  padding: 3px 10px;
}
.chip:hover { color: var(--ink); background: var(--baseline); }
.basket-actions { display: flex; gap: 10px; margin-top: 12px; }
.badge.rotate { color: var(--s5); }
.badge.target { color: var(--accent); }

/* positions panel */
.pos-target {
  font: inherit; color: var(--ink); background: var(--page);
  border: 1px solid var(--border); border-radius: 7px;
  padding: 4px 6px; width: 74px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.pos-target:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
tr.pos-staged td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
tr.pos-staged .pos-target { border-color: var(--accent); }
.pos-actions { white-space: nowrap; text-align: right; }
.btn.mini { padding: 3px 10px; font-size: 11.5px; border-radius: 7px; }
.btn.mini.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.pos-note-row td, .rotate-row td { border-bottom: 1px solid var(--grid); padding-top: 2px; }

/* what-if studio */
.studio-row td { vertical-align: middle; }
.shares-cell { font-variant-numeric: tabular-nums; }
.sim-shares { font-size: 11.5px; color: var(--accent); min-height: 15px; }
.wcell { min-width: 130px; }
.wbar {
  position: relative; height: 7px; border-radius: 999px;
  background: var(--grid); overflow: hidden; margin: 3px 0 5px;
}
.wbar-fill {
  position: absolute; inset: 0 auto 0 0; width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width .18s ease;
}
.wbar-mark {
  position: absolute; top: -2px; bottom: -2px; width: 2px;
  background: var(--ink); opacity: .55; transition: left .18s ease;
}
.wtext { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.wtext strong { color: var(--ink); }
.warrow { color: var(--muted); }
.tcell { min-width: 150px; }
.tcell .pos-slider {
  width: 100%; margin: 0 0 4px; accent-color: var(--accent);
  display: block; cursor: pointer;
}
.trade-cell { white-space: nowrap; font-size: 12.5px; font-variant-numeric: tabular-nums; }
.trade-cell .hint { font-size: 11px; }
tr.sim-active .trade-cell { color: var(--ink); }
.studio-footer {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  margin-top: 12px; padding: 10px 14px;
  border: 1px solid var(--border); border-radius: 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface));
  font-size: 13px;
}
.studio-footer .sf-item { color: var(--muted); }
.studio-footer .sf-val { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; margin-left: 4px; }
.studio-footer .sf-warn { color: var(--down); font-weight: 600; }
.studio-footer .sf-spacer { flex: 1; }
.ticket-preview {
  border: 1px solid var(--border); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 5%, var(--page));
  padding: 9px 12px; font-size: 12.5px; line-height: 1.6;
  font-variant-numeric: tabular-nums;
}
.ticket-preview .warrow { color: var(--muted); }
.studio-row .pos-actions {
  white-space: normal; display: flex; flex-direction: column;
  gap: 4px; align-items: stretch;
}
.studio-row .pos-actions .btn.mini { text-align: center; }
.studio-row .pos-actions .icon-btn { align-self: center; }
.rotate-form {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  background: var(--page); border-radius: 8px; padding: 8px 10px; font-size: 12.5px;
}
.rotate-form input[type="number"] { width: 70px; }
.rotate-form input {
  font: inherit; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 7px; padding: 4px 8px;
}
.rotate-form input[type="text"] { width: 110px; text-transform: uppercase; }

/* contribution waterfall */
.waterfall-holder { width: 100%; min-height: 280px; }
.wf-conn { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 2 3; opacity: .7; }
.wf-bar.clickable { cursor: pointer; }
.wf-bar.clickable:hover rect { filter: brightness(1.15); }
.wf-pp { font-size: 10px; font-weight: 650; }
.wf-pp.up { fill: var(--up); }
.wf-pp.down { fill: var(--down); }
.wf-xlab { font-weight: 600; }

.alloc-block { margin-bottom: 14px; }
.alloc-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 6px 0 3px; }
.alloc-strip { display: flex; height: 14px; border-radius: 4px; overflow: hidden; background: var(--grid); }
.alloc-seg { min-width: 2px; }
.alloc-seg + .alloc-seg { border-left: 2px solid var(--surface); }

.impact-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 7px 0; border-bottom: 1px solid var(--grid); font-size: 12.5px;
}
.impact-label { color: var(--ink-2); }
.impact-vals { font-variant-numeric: tabular-nums; text-align: right; }
.impact-arrow { color: var(--muted); }
.impact-warn {
  margin-top: 10px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px;
  background: color-mix(in srgb, #fab219 12%, transparent); color: var(--ink-2);
}
.impact-warn.err { background: color-mix(in srgb, var(--down) 12%, transparent); }
.impact-warn.ok { background: color-mix(in srgb, var(--up) 10%, transparent); }

/* ------------------------------------------------------------ calendar */
.calendar-list { display: flex; flex-direction: column; max-height: 320px; overflow-y: auto; }
.cal-row {
  display: grid; grid-template-columns: 64px 76px 1fr; gap: 10px; align-items: center;
  padding: 6px 2px; border-bottom: 1px solid var(--grid);
}
.cal-row:last-child { border-bottom: none; }
.cal-date { display: flex; flex-direction: column; line-height: 1.2; }
.cal-day { font-weight: 650; font-size: 12.5px; }
.cal-wd { font-size: 10.5px; color: var(--muted); }
.cal-badge { text-align: center; }
.badge.earnings { color: var(--s5); }
.badge.exdiv { color: var(--s2); }
.badge.payment { color: var(--accent); }
.cal-what { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.cal-detail { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------- benchmarks */
.bench-comp {
  display: grid; grid-template-columns: 1fr 110px 30px; gap: 8px; align-items: center;
  margin-top: 8px;
}
.bench-comp .bc-sym { text-transform: uppercase; }
#b-add-row { align-self: flex-start; margin-top: 8px; }

/* -------------------------------------------------------------- drawer */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 40;
}
.drawer[hidden], .drawer-backdrop[hidden] { display: none; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: 580px; max-width: 94vw;
  background: var(--surface); border-left: 1px solid var(--border);
  z-index: 41; display: flex; flex-direction: column;
  box-shadow: var(--shadow);
}
.drawer-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 18px 20px 10px;
}
.drawer-symbol { font-size: 19px; font-weight: 700; }
.drawer-name { font-size: 12px; color: var(--muted); }
.drawer-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px 14px;
  padding: 0 20px 14px;
}
.ds { display: flex; flex-direction: column; }
.ds-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ds-value { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 13px; }
.ds-strong { grid-column: 1 / -1; border-top: 1px solid var(--grid); padding-top: 8px; margin-top: 2px; }
.ds-strong .ds-value { font-size: 15px; font-weight: 750; }
.drawer-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 650; padding: 14px 20px 6px;
}
.drawer-body { padding: 0 20px 8px; }
.drawer-body .table td { font-size: 12.5px; padding: 7px 8px; }
.drawer-body .table th { padding: 6px 8px; }
.drawer-body .table td:last-child { white-space: normal; min-width: 120px; }
.pl-sub { display: block; font-size: 10.5px; color: var(--muted); }

/* ------------------------------------------------------------- tooltip */
.tooltip {
  position: fixed; z-index: 60; pointer-events: none;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 8px 11px; font-size: 12px; max-width: 280px;
}
.tooltip .tt-title { font-weight: 650; margin-bottom: 2px; }
.tooltip .tt-line { color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------- mobile navigation */
.bottom-nav {
  display: none;
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  grid-template-columns: repeat(5, 1fr);
}
.bn-item {
  appearance: none; border: none; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  font: inherit; font-size: 10.5px; font-weight: 600; color: var(--muted);
  padding: 6px 2px; min-height: 48px; border-radius: 10px;
}
.bn-item .bn-ic { font-size: 17px; line-height: 1.1; }
.bn-item.active { color: var(--accent); }
.sheet-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 46; }
.more-sheet {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 47;
  background: var(--surface); border-radius: 16px 16px 0 0;
  border: 1px solid var(--border); border-bottom: none;
  padding: 8px 16px calc(16px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow);
}
.sheet-grip {
  width: 36px; height: 4px; border-radius: 2px; background: var(--baseline);
  margin: 6px auto 10px;
}
.more-sheet button {
  appearance: none; border: none; background: none; cursor: pointer;
  display: block; width: 100%; text-align: left;
  font: inherit; font-size: 15px; font-weight: 600; color: var(--ink);
  padding: 14px 8px; min-height: 48px;
  border-bottom: 1px solid var(--grid); border-radius: 8px;
}
.more-sheet button:last-child { border-bottom: none; }
.more-sheet button.active { color: var(--accent); }
.more-sheet[hidden], .sheet-backdrop[hidden] { display: none; }

/* ------------------------------------------------------------- mobile */
@media (max-width: 760px) {
  body { flex-direction: column; }
  .sidebar { display: none; }                 /* bottom nav takes over */
  .bottom-nav { display: grid; }
  .main {
    padding: 16px 14px calc(84px + env(safe-area-inset-bottom));
    max-width: 100%;
  }
  .page-title { font-size: 17px; margin-bottom: 14px; }

  /* panel headers wrap cleanly: toggles on one row, subtitle on its own */
  .panel-head { flex-wrap: wrap; align-items: center; row-gap: 8px; }
  .panel-head .chart-toggle { flex: 0 0 auto; }
  .panel-head .panel-sub { flex: 1 1 100%; white-space: normal; text-align: left; }
  .sm-only { display: block; }

  /* hero + chips */
  .topline { flex-direction: column; align-items: stretch; gap: 12px; margin-bottom: 14px; }
  .topline-value { font-size: 30px; }
  .hero .topline-value { font-size: 34px; }
  .hero { margin-bottom: 14px; }
  .chips-row { overflow-x: auto; flex-wrap: nowrap; min-width: 0; max-width: 100%;
               padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
  .chip-stat { flex: 0 0 auto; min-width: 108px; padding: 7px 12px; }
  .bench-chips { overflow-x: auto; flex-wrap: nowrap; min-width: 0; max-width: 100%; }
  .movers-rail { order: 2; }
  .live-row.live-mobile { display: flex; margin-top: 10px; align-self: flex-start; }
  .hero { display: flex; flex-direction: column; align-items: flex-start; }

  /* range bar wraps; button groups scroll instead of overflowing */
  .range-bar { gap: 8px; }
  .range-buttons { overflow-x: auto; min-width: 0; max-width: 100%; }
  .chart-toggle { margin-left: 0; }
  #report-btn { order: 5; }

  .perf-grid { grid-template-columns: 1fr; }
  .perf-chart { min-height: 210px; }
  .panel { padding: 13px 14px; border-radius: 11px; }
  .tiles { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .tile-value { font-size: 17px; }

  /* tables: prune secondary columns, tighten density, keep scroll as fallback */
  .hide-sm { display: none !important; }
  .table th { padding: 6px 6px; font-size: 10px; }
  .table td { padding: 8px 6px; font-size: 12.5px; }
  .table .asset-name { max-width: 110px; }

  /* touch targets */
  .btn { min-height: 44px; }
  .btn.mini { min-height: 34px; }
  .icon-btn { min-width: 36px; min-height: 36px; font-size: 16px; }
  .nav-item, .tab { min-height: 44px; }

  /* forms: 16px inputs prevent iOS auto-zoom; full-width primary actions */
  .form input, .form select, .pos-target, .rotate-form input, .act-field input, .act-search input, .act-search select {
    font-size: 16px;
  }
  .form-row.two { grid-template-columns: minmax(0, 1fr); }
  .form .btn.primary { width: 100%; }
  .basket-actions { flex-direction: column; }
  .basket-actions .btn { width: 100%; }

  /* rebalance: single column, impact panel flows inline */
  .reb-grid { grid-template-columns: 1fr; }
  .impact-panel { position: static; }
  .pos-actions .btn.mini { padding: 6px 8px; }

  /* what-if editor becomes cards: one position per card, full-width slider */
  #positions-table, #positions-table tbody { display: block; width: 100%; }
  #positions-table thead { display: none; }
  #positions-table tr.studio-row {
    display: grid; width: 100%;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "asset shares" "weight weight" "target target" "trade actions";
    gap: 7px 10px; padding: 13px 2px;
    border-bottom: 1px solid var(--grid);
  }
  #positions-table tr.studio-row td { display: block; border: none; padding: 0; min-width: 0; }
  #positions-table tr.studio-row td:nth-child(1) { grid-area: asset; }
  #positions-table tr.studio-row td:nth-child(2) { grid-area: shares; text-align: right; }
  #positions-table tr.studio-row td:nth-child(4) { grid-area: weight; }
  #positions-table tr.studio-row td:nth-child(5) { grid-area: target; }
  #positions-table tr.studio-row td:nth-child(6) { grid-area: trade; white-space: normal; }
  #positions-table tr.studio-row td:nth-child(7) { grid-area: actions; }
  #positions-table .pos-note-row, #positions-table .rotate-row { display: block; }
  #positions-table .pos-note-row td, #positions-table .rotate-row td {
    display: block; border: none; padding: 4px 0 10px;
  }
  .studio-row .pos-actions {
    flex-direction: row; justify-content: flex-end; align-items: center;
  }
  .tcell { display: flex; align-items: center; gap: 12px; min-width: 0; }
  .tcell .pos-slider { flex: 1; margin: 0; min-width: 0; }
  .tcell .pos-target { flex: 0 0 76px; width: 76px; }
  .wcell { min-width: 0; }

  /* cash impact stays visible above the bottom nav while editing */
  .studio-footer {
    position: sticky; bottom: calc(78px + env(safe-area-inset-bottom));
    z-index: 5; background: var(--surface); box-shadow: var(--shadow-1);
    gap: 8px 12px; padding: 10px 12px;
  }
  .studio-footer .sf-item { flex: 1 1 100%; }
  .studio-footer .sf-spacer { display: none; }
  .studio-footer .btn { flex: 1; min-height: 40px; }

  /* holding drawer becomes a full-screen sheet */
  .drawer { width: 100vw; max-width: 100vw; }
  .drawer-summary { grid-template-columns: repeat(2, 1fr); }

  /* charts & panels */
  .insights-grid { grid-template-columns: 1fr; }
  .donut-holder { justify-content: center; }
  .bar-row { grid-template-columns: 52px 1fr auto; }
  .bar-row .bar-val { min-width: 104px; font-size: 11px; }
  .cal-row { grid-template-columns: 52px 64px 1fr; }
  .stats-panel { order: 2; }
}

/* very small phones */
@media (max-width: 380px) {
  .topline-value { font-size: 26px; }
  .table .asset-name { max-width: 80px; }
}
.sm-sleeve { margin: 0 0 8px; line-height: 1.5; }

/* attribution panel */
.attr-row {
  display: grid; grid-template-columns: minmax(140px, 1.3fr) 2fr auto auto auto;
  gap: 14px; align-items: center; padding: 9px 2px;
  border-bottom: 1px solid var(--grid);
}
.attr-row:last-child { border-bottom: none; }
.attr-name { font-weight: 650; min-width: 0; line-height: 1.3; }
.attr-sub { display: block; font-size: 11px; color: var(--muted); font-weight: 400;
            overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attr-track { height: 8px; border-radius: 999px; background: var(--grid); overflow: hidden; }
.attr-track i { display: block; height: 100%; border-radius: 999px; min-width: 2px; }
.attr-track i.up { background: var(--up); }
.attr-track i.down { background: var(--down); }
.attr-num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650;
            font-size: 13px; white-space: nowrap; }

/* sector model verdict strip */
.sm-tldr {
  border: 1px solid var(--border); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 6%, var(--page));
  padding: 10px 14px; margin-bottom: 12px; font-size: 13px; line-height: 1.55;
}

@media (max-width: 760px) {
  .attr-row { grid-template-columns: minmax(110px, 1fr) auto auto; }
  .attr-track { display: none; }
  .attr-row .attr-num:nth-child(4) { display: none; }   /* group return: keep P&L + edge */
}

/* sector model explainer */
.sm-help { margin: 2px 0 12px; }
.sm-help summary {
  cursor: pointer; color: var(--accent); font-size: 12.5px; font-weight: 600;
  user-select: none; list-style-position: inside;
}
.sm-help summary:hover { text-decoration: underline; }
.sm-help-body {
  border: 1px solid var(--border); border-radius: 10px;
  background: color-mix(in srgb, var(--accent) 4%, var(--page));
  padding: 12px 16px; margin-top: 8px;
  font-size: 12.5px; line-height: 1.6; color: var(--ink-2);
  max-width: 860px;
}
.sm-help-body b { color: var(--ink); }
.sm-help-body p { margin: 0 0 8px; }
.sm-help-body ol, .sm-help-body ul { margin: 0 0 8px; padding-left: 20px; }

/* screener */
.preset-chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.preset-chips button {
  appearance: none; cursor: pointer; font: inherit; font-size: 12.5px; font-weight: 600;
  color: var(--ink-2); background: var(--grid); border: 1px solid transparent;
  border-radius: 999px; padding: 7px 14px;
}
.preset-chips button:hover { color: var(--ink); }
.preset-chips button.active {
  color: var(--accent-ink); border-color: transparent;
  background: linear-gradient(115deg, var(--accent), var(--accent2));
}
.badge.held { color: var(--accent); }

/* Bloomberg EQS runner */
.eqs-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin: 4px 0 10px; }
.eqs-form input[type="text"], .eqs-form select {
  font: inherit; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px;
}
.eqs-form #eqs-name { flex: 1 1 220px; min-width: 0; }
.eqs-form #eqs-group { flex: 0 0 110px; }
.eqs-form .btn.ghost { padding: 6px 12px; }
.eqs-saved { margin-bottom: 6px; }
.eqs-saved:empty { display: none; }
.eqs-saved button { display: inline-flex; align-items: center; gap: 6px; padding-right: 8px; }
.eqs-saved button small { font-weight: 500; opacity: .75; }
.eqs-saved .eqs-x {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; font-size: 13px; line-height: 1;
  color: var(--muted); background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.eqs-saved .eqs-x:hover { color: var(--down); }
.eqs-saved button.active .eqs-x { color: var(--accent-ink); }
@media (max-width: 760px) {
  .eqs-form #eqs-name { flex-basis: 100%; font-size: 16px; }
  .eqs-form select, .eqs-form #eqs-group { flex: 1 1 40%; font-size: 16px; }
  .eqs-form .btn.primary { flex: 1 1 auto; }
  .eqs-form .btn.ghost { flex: 0 0 auto; min-height: 44px; }
}
#screener-desc { margin: 0 0 10px; }

/* ===================== v4: holdings for a growing book ===================== */
.holdings-head { margin-bottom: 4px; }
.h-toolbar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 2px 0 12px;
}
.h-search {
  font: inherit; font-size: 12.5px; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 10px; min-width: 190px; flex: 1 1 190px; max-width: 320px;
}
.h-search:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.h-ctl { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.h-ctl select, .h-ctl input {
  font: inherit; font-size: 12px; color: var(--ink); background: var(--page);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px;
}
.h-ctl input[type="number"] { width: 58px; text-align: right; }
.h-toolbar .chart-toggle { margin-left: 0; }
.h-toolbar .btn.mini.active { background: var(--grid); color: var(--ink); border-color: var(--baseline); }
.h-cols { position: relative; }
.h-cols-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  box-shadow: var(--shadow); padding: 8px 10px; display: flex; flex-direction: column; gap: 4px;
  min-width: 170px;
}
.cols-item { display: flex; align-items: center; gap: 8px; font-size: 12.5px; padding: 3px 2px; cursor: pointer; }
.h-cols-menu .btn { margin-top: 4px; }

/* composition strip */
.h-composition { margin-bottom: 12px; }
.h-composition:empty { display: none; }
.hc-strip { display: flex; height: 14px; border-radius: 6px; overflow: hidden; background: var(--grid); }
.hc-seg { appearance: none; border: none; padding: 0; margin: 0; cursor: pointer; min-width: 2px; }
.hc-seg + .hc-seg { border-left: 2px solid var(--surface); }
.hc-seg:hover { filter: brightness(1.12); }
.hc-legend { display: flex; flex-wrap: wrap; gap: 4px 12px; margin-top: 7px; }
.hc-key {
  appearance: none; border: none; background: none; cursor: pointer; font: inherit;
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2);
  padding: 2px 6px; border-radius: 6px;
}
.hc-key:hover { background: var(--grid); color: var(--ink); }
.hc-key b { color: var(--ink); font-variant-numeric: tabular-nums; }
.hc-key small { color: var(--muted); font-size: 10.5px; }
.hc-dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }

/* grouped table */
.h-wrap.tall { max-height: min(78vh, 1100px); overflow: auto; }
/* Desktop: slightly tighter cells so the default columns fit a 1440px
 * screen. Narrower screens or extra columns still scroll, and an edge
 * shadow says so — the cover gradients scroll with the content (local) and
 * hide the fixed shadows once that edge is reached. */
@media (min-width: 761px) {
  .h-table th, .h-table td { padding-left: 7px; padding-right: 7px; }
  .h-table .asset-name { max-width: 160px; }
}
.h-wrap {
  background:
    linear-gradient(to right, var(--surface) 30%, transparent) left center / 36px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, transparent) right center / 36px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(0, 0, 0, .16), transparent) left center / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(0, 0, 0, .16), transparent) right center / 12px 100% no-repeat scroll;
}
.h-wrap.tall thead th { position: sticky; top: 0; z-index: 2; background: var(--surface); }
.h-table tr.group-row td { padding: 9px 10px 6px; background: color-mix(in srgb, var(--grid) 55%, transparent); cursor: pointer; }
.h-table tr.group-row:hover td { background: color-mix(in srgb, var(--accent) 8%, var(--grid)); }
.h-table tr.group-row.g-flash td { animation: tick-up .9s ease both; }
.g-row { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; white-space: nowrap; }
.g-caret { color: var(--muted); font-size: 11px; width: 10px; }
.g-name { font-weight: 700; font-size: 13px; }
.g-count { color: var(--muted); font-size: 11.5px; }
.g-stat { display: inline-flex; align-items: baseline; gap: 5px; font-variant-numeric: tabular-nums; }
.g-stat small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.g-stat b { font-weight: 650; font-size: 12.5px; }
.g-stat i { font-style: normal; font-size: 11px; }
.g-stat .t-tag { font-size: 9px; color: var(--muted); border: 1px solid var(--border); border-radius: 5px; padding: 0 4px; }
.h-table tr.fold-row td { padding: 5px 10px; cursor: pointer; }
.fold-line { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.fold-line .hint { overflow: hidden; text-overflow: ellipsis; max-width: 42ch; }
.h-table tr.small-row td { font-size: 12px; }
.h-table tr.small-row .asset-name { display: none; }
.h-table .spark-col { width: 92px; padding-top: 4px; padding-bottom: 4px; }
.h-spark { display: block; }
.h-spark-empty { display: inline-block; width: 84px; height: 22px; }
.tag-row { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 2px; }
.tag {
  font-size: 9.5px; font-weight: 650; letter-spacing: .03em; color: var(--ink-2);
  background: var(--grid); border-radius: 5px; padding: 0 5px; line-height: 1.6; white-space: nowrap;
}
.wcol { white-space: nowrap; }
.wmini {
  display: inline-block; width: 44px; height: 5px; border-radius: 3px; background: var(--grid);
  vertical-align: 2px; margin-right: 7px; overflow: hidden;
}
.wmini i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; }

/* density */
.holdings-list.dense .h-table td { padding: 4px 8px; font-size: 12px; }
.holdings-list.dense .h-table .asset-name { display: none; }
.holdings-list.dense .h-table .t-sub { display: none; }
.holdings-list.dense .tlogo { width: 18px; height: 18px; }
.holdings-list.dense .h-table tr.group-row td { padding: 6px 8px 4px; }
.holdings-list.dense .h-spark, .holdings-list.dense .h-spark-empty { height: 16px; }

/* nested heatmap */
.hm-glabel { fill: var(--ink-2); font-size: 10.5px; font-weight: 700; pointer-events: none; }
.hm-group { pointer-events: none; }

/* drawer classification editor */
.drawer-edit { margin: 0 20px; border: 1px solid var(--border); border-radius: 10px; padding: 6px 12px; }
.drawer-edit summary { cursor: pointer; font-size: 12px; font-weight: 650; color: var(--accent); user-select: none; }
.drawer-edit .form { gap: 8px; margin-top: 8px; }
.drawer-edit .form input, .drawer-edit .form select { padding: 6px 8px; font-size: 12.5px; }
.drawer-edit-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.drawer-edit-actions .form-msg { min-height: 0; }

/* sync page */
.sync-grid { display: grid; grid-template-columns: 1.1fr .9fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .sync-grid { grid-template-columns: 1fr; } }
.sync-steps { margin: 0 0 12px; padding-left: 18px; color: var(--ink-2); font-size: 12.5px; line-height: 1.6; }
.sync-steps b { color: var(--ink); }
.export-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 8px 0 4px; }
.export-row .btn { text-decoration: none; display: inline-flex; align-items: center; }
.preview-box {
  border: 1px solid var(--border); border-radius: 10px; padding: 10px 14px;
  background: color-mix(in srgb, var(--accent) 5%, var(--page)); font-size: 12.5px; line-height: 1.55;
  margin-top: 10px;
}
.preview-box .pv-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 6px 14px; margin: 6px 0; }
.preview-box .pv-stat small { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.preview-box .pv-stat b { font-size: 15px; font-variant-numeric: tabular-nums; }
.preview-box ul { margin: 4px 0 0; padding-left: 18px; }
.preview-box .warn { color: var(--down); }
.preview-actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }

/* settings: data sources */
.ds-table td, .ds-table th { font-size: 12px; }
.ds-ok { color: var(--up); }
.ds-bad { color: var(--down); }
.ds-muted { color: var(--muted); }
.ds-key-row { display: flex; gap: 8px; align-items: flex-end; flex-wrap: wrap; }
.ds-key-row label { flex: 1 1 220px; }

@media (max-width: 760px) {
  .h-search { max-width: 100%; flex-basis: 100%; }
  .h-toolbar .h-fold { display: none; }
  .g-row { gap: 8px 12px; }
  .g-stat:nth-child(n+6) { display: none; }
  .h-wrap.tall { max-height: none; overflow-x: auto; }
  .h-wrap.tall thead th { position: static; }
  .hc-legend { gap: 2px 8px; }
}

/* ===================== v4: decision dashboard layout ===================== */
.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.hero-main { min-width: 0; }
.hero-kpis { display: flex; gap: 10px; flex-wrap: wrap; align-items: stretch; }
.kpi {
  display: flex; flex-direction: column; gap: 1px; min-width: 118px;
  background: color-mix(in srgb, var(--surface) 82%, transparent); border: 1px solid var(--border);
  border-radius: 12px; padding: 8px 14px;
}
.kpi-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.kpi-value { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi-sub { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.kpi.pos .kpi-value { color: var(--up); }
.kpi.neg .kpi-value { color: var(--down); }

.glance-rail { padding-top: 4px; display: flex; flex-direction: column; gap: 8px; }
.gl-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 10px 14px; box-shadow: var(--shadow-1);
}
.gl-label { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; margin-bottom: 5px; }
.gl-big { font-size: 20px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.2; }
.gl-big small { font-size: 12px; font-weight: 600; color: var(--muted); }
.gl-big.pos { color: var(--up); }
.gl-big.neg { color: var(--down); }
.gl-sub { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.gl-strip { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grid); }
.gl-strip i { display: block; min-width: 2px; }
.gl-strip i + i { border-left: 2px solid var(--surface); }
.gl-legend { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 6px; font-size: 11px; color: var(--ink-2); }
.gl-list { display: flex; flex-direction: column; }
.gl-item {
  appearance: none; border: 0; background: none; font: inherit; color: inherit; text-align: left;
  display: grid; grid-template-columns: 58px 1fr; gap: 8px; align-items: baseline;
  padding: 4px 2px; border-top: 1px solid var(--grid); font-size: 12px;
}
.gl-item:first-child { border-top: 0; }
.gl-item b { font-weight: 700; }
.gl-item span { color: var(--ink-2); font-variant-numeric: tabular-nums; }
button.gl-item { cursor: pointer; border-radius: 6px; }
button.gl-item:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }

/* widescreen: chart | movers | glance, holdings full width underneath */
@media (min-width: 1500px) {
  .main { max-width: 1900px; padding-left: 40px; padding-right: 40px; }
  .perf-grid { grid-template-columns: minmax(0, 1fr) 280px 300px; }
  .perf-chart { min-height: 320px; }
}
@media (min-width: 1000px) and (max-width: 1499px) {
  .perf-grid { grid-template-columns: minmax(0, 1fr) 272px; }
  .glance-rail { grid-column: 1 / -1; flex-direction: row; flex-wrap: wrap; }
  .glance-rail .panel-title { flex-basis: 100%; margin-bottom: 0; }
  .glance-rail #glance-cards { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; width: 100%; align-items: start; }
  .glance-rail .ev-card { grid-column: span 2; }
}

/* mobile: one glance strip you can swipe, then the chart, then movers */
@media (max-width: 999px) {
  .glance-rail { order: -1; }
  .glance-rail .panel-title { display: none; }
  #glance-cards { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; -webkit-overflow-scrolling: touch; align-items: flex-start; }
  .gl-card { flex: 0 0 200px; }
}
@media (max-width: 760px) {
  .hero-kpis { gap: 6px; overflow-x: auto; flex-wrap: nowrap; max-width: 100%; padding-bottom: 2px; }
  .kpi { min-width: 104px; padding: 6px 10px; flex: 0 0 auto; }
  .kpi-value { font-size: 14px; }
  .kpi-sub { display: none; }
  .gl-card { flex-basis: 176px; padding: 8px 12px; }
  .gl-big { font-size: 17px; }
  .h-toolbar .chart-toggle#h-filter, .h-toolbar #h-density, .h-toolbar .h-cols { display: none; }
  .holdings-list .h-table td { padding: 6px 6px; }
  .holdings-list .h-table .t-sub { display: none; }
  .g-row { font-size: 12px; }
}

/* mobile glance strip: uniform card height, lists trimmed to three lines */
@media (max-width: 999px) {
  .gl-card { max-height: 150px; overflow: hidden; }
  .gl-item:nth-child(n+4) { display: none; }
  .gl-legend { gap: 1px 8px; font-size: 10.5px; }
}

/* ===================== v5: phone layout — brokerage style ===================== */
/* Below 760px the app stops being a shrunken desktop. Nothing scrolls
   sideways: the holdings table becomes a list (symbol · sparkline · one
   number pair), every other table folds into cards that stack the cells
   under their headings, and the overview reads top to bottom the way a
   brokerage app does — balance, chart, positions, then what's moving. */
.h-metric { display: none; }
.h-mlist { display: none; }

@media (max-width: 760px) {
  html { -webkit-text-size-adjust: 100%; }
  .main { padding: 12px 12px calc(84px + env(safe-area-inset-bottom)); }
  .panel { padding: 12px 12px; margin-bottom: 12px; border-radius: 14px; }
  .page-title { margin: 4px 0 12px; }

  /* ---- overview: balance → chart → holdings → movers → glance ---- */
  #tab-dashboard.active { display: flex; flex-direction: column; }
  #tab-dashboard .perf-grid { display: contents; }
  #tab-dashboard .hero { order: 0; margin-bottom: 10px; }
  #tab-dashboard .chart-panel { order: 1; }
  #tab-dashboard > .panel { order: 2; }                /* holdings */
  #tab-dashboard .movers-rail { order: 3; }
  #tab-dashboard .glance-rail { order: 4; }
  #tab-dashboard .perf-grid > * { animation: rise .4s cubic-bezier(.2,.8,.25,1) both; }

  .hero { gap: 10px; }
  .hero .topline-value { font-size: 36px; letter-spacing: -.02em; }
  .hero-main { width: 100%; }
  .live-row.live-mobile { margin-top: 6px; }

  /* KPIs: a 2×2 grid instead of a strip that scrolls off the screen */
  .hero-kpis {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    overflow: visible; width: 100%; max-width: none; padding-bottom: 0;
  }
  .kpi { min-width: 0; flex: none; padding: 8px 12px; }
  .kpi:nth-child(5) { display: none; }                  /* positions: the list says it */
  .kpi-value { font-size: 15px; }
  .kpi-sub { display: block; white-space: normal; }

  /* period chips: wrap into a grid, no sideways scroll */
  .chips-row {
    display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
    overflow: visible; max-width: none; padding-bottom: 0;
  }
  .chip-stat { min-width: 0; flex: none; padding: 8px 12px; }
  .chip-stat:nth-child(odd):last-child { grid-column: 1 / -1; }
  .chip-stat .chip-value { font-size: 14px; }
  .stats-inline .stats-list { grid-template-columns: 1fr; gap: 0; }

  /* range bar: ranges on one line, mode toggle underneath */
  .range-bar { gap: 6px 8px; }
  .range-buttons { flex: 1 1 100%; justify-content: space-between; overflow: visible; }
  .range-buttons button { flex: 1; padding: 6px 0; font-size: 12px; }
  .range-date { display: none; }
  .range-spacer { display: none; }
  #chart-toggle { margin-left: 0; }
  #report-btn { margin-left: auto; order: 0; }
  .perf-chart { min-height: 220px; }
  .chart-footer { flex-wrap: wrap; gap: 6px; }

  /* what's moving: full-width tappable rows */
  .movers-rail .panel-title { margin-bottom: 8px; }
  .mover-card { width: 100%; }

  /* at a glance: two-up cards at the bottom, composition across the top */
  .glance-rail { order: 4; padding-top: 0; }
  .glance-rail .panel-title { display: block; margin-bottom: 8px; }
  #glance-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; overflow: visible; padding-bottom: 0; }
  .gl-card { flex: none; max-height: none; padding: 10px 12px; }
  .gl-card:first-child { grid-column: 1 / -1; }
  .gl-item:nth-child(n+4) { display: none; }

  /* ---- holdings: a brokerage list ---- */
  .holdings-head { flex-wrap: nowrap; align-items: baseline; }
  .holdings-head .panel-sub { flex: 0 1 auto; text-align: right; font-size: 11px; }
  .h-toolbar { gap: 8px; margin-bottom: 4px; }
  .h-search { flex-basis: 100%; font-size: 16px; padding: 9px 12px; border-radius: 10px; }
  .h-toolbar .h-ctl { font-size: 0; }                   /* keep the select, drop the "Group" word */
  .h-toolbar .h-ctl select { font-size: 12.5px; padding: 7px 8px; }
  .h-metric { display: inline-flex; }
  .h-toolbar #holdings-view { margin-left: auto; }
  .h-toolbar .chart-toggle button { padding: 6px 9px; font-size: 12px; }
  .h-composition { margin: 6px 0 4px; }
  .hc-legend { font-size: 11px; }

  .h-mlist { display: block; margin: 0 -12px -12px; }
  .h-mrow {
    display: grid; grid-template-columns: minmax(0, 1fr) auto auto;
    align-items: center; gap: 10px;
    padding: 10px 12px; min-height: 58px;
    border-top: 1px solid var(--grid);
    cursor: pointer; -webkit-tap-highlight-color: transparent;
  }
  .h-mrow:first-child { border-top: 0; }
  .h-mrow:active { background: color-mix(in srgb, var(--accent) 8%, transparent); }
  .hm-id { display: flex; align-items: center; gap: 10px; min-width: 0; }
  .h-mrow .tlogo { width: 32px; height: 32px; border-radius: 9px; }
  .h-mrow .tlogo i { font-size: 13px; }
  .hm-txt { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
  .hm-txt .sym { font-weight: 700; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .hm-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
  .hm-spark { display: flex; align-items: center; opacity: .9; }
  .hm-spark:empty { display: none; }
  .hm-num {
    display: flex; flex-direction: column; align-items: flex-end;
    font-variant-numeric: tabular-nums; line-height: 1.25; min-width: 92px;
  }
  .hm-top { font-weight: 650; font-size: 14.5px; padding: 0 3px; margin-right: -3px; }
  .hm-bot { font-size: 12px; color: var(--ink-2); white-space: nowrap; }
  .hm-bot small { font-size: 11px; font-weight: 500; color: var(--muted); }
  .hm-top.pos, .hm-bot.pos { color: var(--up); }
  .hm-top.neg, .hm-bot.neg { color: var(--down); }
  .hm-bot.pos small { color: color-mix(in srgb, var(--up) 70%, var(--muted)); }
  .hm-bot.neg small { color: color-mix(in srgb, var(--down) 70%, var(--muted)); }
  .hm-bot .t-tag { margin-left: 2px; }

  .h-mrow.group-row {
    display: flex; align-items: baseline; gap: 8px;
    min-height: 38px; padding: 8px 12px 6px;
    background: color-mix(in srgb, var(--grid) 55%, var(--surface));
    font-size: 12.5px; position: sticky; top: 0; z-index: 2;
  }
  .h-mrow.group-row .g-caret { color: var(--muted); font-size: 11px; }
  .hm-gname { font-weight: 700; }
  .hm-gcount { color: var(--muted); font-size: 11.5px; }
  .hm-gcount:empty { display: none; }
  .hm-gw { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; font-weight: 600; }
  .hm-gstat { font-variant-numeric: tabular-nums; font-weight: 650; min-width: 64px; text-align: right; }
  .hm-gstat:empty { display: none; }
  .h-mrow.fold-row {
    display: flex; align-items: baseline; gap: 8px;
    min-height: 40px; padding: 8px 12px; font-size: 12px; color: var(--ink-2);
  }
  .h-mrow.fold-row .hm-gname { font-weight: 600; }
  .h-mrow.cash-row { background: color-mix(in srgb, var(--grid) 35%, transparent); cursor: default; }
  .h-mrow.sold-row { opacity: .6; }
  .h-mrow .empty-note { margin: 0; }
  .hm-num .tick-up, .hm-num .tick-down { border-radius: 5px; }

  /* ---- every other table: rows become cards, cells stack under headings ---- */
  .table-wrap { overflow-x: visible; }
  table.table:not(.h-table):not(.studio-table),
  table.table:not(.h-table):not(.studio-table) > tbody { display: block; width: 100%; }
  table.table:not(.h-table):not(.studio-table) > thead { display: none; }
  table.table:not(.h-table):not(.studio-table) > tbody > tr {
    display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-auto-flow: dense; gap: 6px 10px; align-items: start;
    padding: 11px 0; border-bottom: 1px solid var(--grid);
  }
  table.table:not(.h-table):not(.studio-table) > tbody > tr:last-child { border-bottom: none; }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td {
    display: block; border: none; padding: 0; min-width: 0; font-size: 13px; text-align: left;
    overflow-wrap: anywhere; white-space: normal;
  }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td[data-label]::before {
    content: attr(data-label); display: block;
    font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em;
    font-weight: 650; margin-bottom: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  }
  /* the identity cell (asset / name / date) heads the card; the second cell
     sits on its right as the headline number; an unlabeled cell (actions)
     goes full width and right-aligned */
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td:first-child {
    grid-column: 1 / 3; font-weight: 600; font-size: 14px;
  }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td:first-child::before { display: none; }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td:nth-child(2) {
    grid-column: 3; text-align: right; font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums;
  }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td:nth-child(2)::before { text-align: right; }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td[data-label=""] {
    grid-column: 3; align-self: end; text-align: right; display: flex; justify-content: flex-end; gap: 6px;
  }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td[data-label=""]::before { display: none; }
  table.table:not(.h-table):not(.studio-table) > tbody > tr > td[colspan] { grid-column: 1 / -1; }
  .table .asset-name { max-width: none; white-space: normal; }
  .table .name-cell { max-width: none; }
  .table td .btn.mini { min-height: 36px; padding: 6px 14px; }
  .table td .icon-btn { min-width: 40px; }


  /* per-table: which cell is the headline on the right of the card */
  #div-upcoming > tbody > tr > td:nth-child(2) { grid-column: auto; text-align: left; font-weight: 500; font-size: 13px; }
  #div-upcoming > tbody > tr > td:nth-child(2)::before { text-align: left; }
  #div-upcoming > tbody > tr > td:nth-child(6) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; font-size: 14px; }
  #div-upcoming > tbody > tr > td:nth-child(6)::before { text-align: right; }
  #div-by-symbol > tbody > tr > td:nth-child(2) { grid-column: auto; text-align: left; font-weight: 500; font-size: 13px; }
  #div-by-symbol > tbody > tr > td:nth-child(2)::before { text-align: left; }
  #div-by-symbol > tbody > tr > td:nth-child(5) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; font-size: 14px; }
  #div-by-symbol > tbody > tr > td:nth-child(5)::before { text-align: right; }
  #div-detail > tbody > tr > td:nth-child(2) { grid-column: auto; text-align: left; font-weight: 500; font-size: 13px; }
  #div-detail > tbody > tr > td:nth-child(2)::before { text-align: left; }
  #div-detail > tbody > tr > td:nth-child(4) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; font-size: 14px; }
  #div-detail > tbody > tr > td:nth-child(4)::before { text-align: right; }
  #drawer-table > tbody > tr { grid-template-columns: auto auto minmax(0, 1fr); }
  #drawer-table > tbody > tr > td:first-child { grid-column: 1; font-weight: 500; font-size: 12.5px; color: var(--ink-2); }
  #drawer-table > tbody > tr > td:nth-child(2) { grid-column: 2; text-align: left; font-weight: 500; font-size: 13px; }
  #drawer-table > tbody > tr > td:nth-child(2)::before { display: none; }
  #drawer-table > tbody > tr > td:nth-child(6) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; }
  #drawer-table > tbody > tr > td:nth-child(6)::before { display: none; }
  #drawer-table > tbody > tr > td:nth-child(5) { text-align: right; }
  #drawer-table > tbody > tr > td:nth-child(5)::before { text-align: right; }
  .drawer { z-index: 48; }
  .drawer-backdrop { z-index: 47; }
  .drawer-body { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }
  #basket-table > tbody > tr > td:first-child { grid-column: 1; }
  #basket-table > tbody > tr > td:first-child::before { display: block; }
  #basket-table > tbody > tr > td:nth-child(2) { grid-column: 2; text-align: left; font-size: 14px; }
  #basket-table > tbody > tr > td:nth-child(2)::before { display: none; }
  #basket-table > tbody > tr > td:nth-child(5) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; font-size: 14px; }
  #basket-table > tbody > tr > td:nth-child(5)::before { text-align: right; }
  #bench-table > tbody > tr { grid-template-columns: auto 1fr auto; }
  #bench-table > tbody > tr > td:first-child { grid-column: 1; }
  #bench-table > tbody > tr > td:nth-child(2) { grid-column: 2; text-align: left; }
  #bench-table > tbody > tr > td:nth-child(2)::before { display: none; }
  #bench-table > tbody > tr > td:nth-child(3) { grid-column: 1 / 3; }
  #bench-table > tbody > tr > td:nth-child(4) { grid-column: 3; grid-row: 1; }
  #ds-table > tbody > tr > td:nth-child(2) { grid-column: 1 / -1; text-align: left; font-weight: 400; font-size: 12.5px; }
  #ds-table > tbody > tr > td:nth-child(2)::before { text-align: left; }
  #ds-table > tbody > tr > td:nth-child(3) { grid-column: 3; grid-row: 1; text-align: right; font-weight: 650; }
  #ds-table > tbody > tr > td:nth-child(3)::before { text-align: right; }
  #ds-table > tbody > tr > td:nth-child(6) { grid-column: 1 / -1; }
  #ds-table > tbody > tr > td:nth-child(6):empty { display: none; }
  #screener-table > tbody > tr > td:nth-child(3), #screener-table > tbody > tr > td:nth-child(4) { font-weight: 650; font-variant-numeric: tabular-nums; }
  #recoil-overlay > tbody > tr > td:nth-child(9) { grid-column: 3; }

  /* what-if editor: slider and its number box share one line */
  #positions-table tr.studio-row td.tcell { display: flex; align-items: center; gap: 12px; }
  #positions-table tr.studio-row td.pos-actions { display: flex; }

  /* holding drawer: a full-height sheet — pinned to both edges, and no left
     border, which otherwise read as a 1px strip of page behind it */
  .drawer { left: 0; width: auto; max-width: none; border-radius: 0; border-left: 0; }
  .drawer-summary { grid-template-columns: repeat(2, 1fr); }

  /* dividends: two-up tiles already; upcoming button sits under the title */
  .tiles { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 380px) {
  .hero .topline-value { font-size: 32px; }
  .hm-spark { display: none; }
  .h-mrow { grid-template-columns: minmax(0, 1fr) auto; }
  .kpi-sub { display: none; }
}

/* ======================= stock drawer: research card ======================= */
.drawer-head { padding: 16px 20px 8px; align-items: flex-start; }
.drawer-id { min-width: 0; flex: 1; }
.drawer-price { margin-top: 4px; font-size: 14px; font-variant-numeric: tabular-nums; }
.drawer-price b { font-size: 17px; font-weight: 700; margin-right: 4px; }
.drawer-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dtag { font-size: 10.5px; color: var(--ink-2); background: var(--grid); border-radius: 999px; padding: 2px 8px; }
.drawer-nav {
  display: flex; gap: 4px; padding: 6px 20px 8px; overflow-x: auto; -webkit-overflow-scrolling: touch;
  border-bottom: 1px solid var(--grid); scrollbar-width: none;
}
.drawer-nav::-webkit-scrollbar { display: none; }
.drawer-nav:empty { display: none; }
.drawer-nav button {
  appearance: none; border: 1px solid transparent; background: var(--grid); color: var(--ink-2); cursor: pointer;
  font: inherit; font-size: 11.5px; font-weight: 600; border-radius: 999px; padding: 4px 10px; white-space: nowrap; flex: 0 0 auto;
}
.drawer-nav button:hover { color: var(--ink); border-color: var(--baseline); }
.drawer-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-bottom: 12px; }
.drawer-flags { display: flex; flex-wrap: wrap; gap: 6px; padding: 12px 20px 4px; }
.drawer-flags:empty { display: none; }
.dflag {
  font-size: 11.5px; font-weight: 600; border-radius: 8px; padding: 5px 9px; line-height: 1.3;
  background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--ink);
  border-left: 3px solid var(--accent);
}
.dflag.warn { background: color-mix(in srgb, var(--down) 10%, transparent); border-left-color: var(--down); }
.dflag.good { background: color-mix(in srgb, var(--up) 10%, transparent); border-left-color: var(--up); }
.dsec { padding: 2px 0 6px; }
.dsec + .dsec { border-top: 1px solid var(--grid); }
.dsec .drawer-title { padding: 14px 20px 8px; }
.dkv { display: grid; grid-template-columns: 96px minmax(0, 1fr); gap: 8px 12px; padding: 0 20px; font-size: 12.5px; }
.dk { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; font-weight: 650; padding-top: 2px; }
.dv { min-width: 0; line-height: 1.45; font-variant-numeric: tabular-nums; }
.dv b { font-weight: 700; }
.dv .hint { display: block; }
.dd { display: inline-block; font-size: 11.5px; font-weight: 650; padding: 0 5px; border-radius: 5px; margin-left: 2px; }
.dd.pos { background: color-mix(in srgb, var(--up) 12%, transparent); color: var(--up); }
.dd.neg { background: color-mix(in srgb, var(--down) 12%, transparent); color: var(--down); }
.dsub { padding: 10px 20px 6px; font-size: 12px; font-weight: 650; }
.dsurprise { display: flex; gap: 6px; padding: 0 20px 6px; align-items: flex-end; }
.dsp { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 10.5px; font-variant-numeric: tabular-nums; min-width: 0; }
.dsp-col { height: 44px; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.dsp-col i { display: block; width: 60%; max-width: 26px; border-radius: 3px 3px 0 0; background: var(--muted); }
.dsp-col i.pos { background: var(--up); }
.dsp-col i.neg { background: var(--down); }
.dsp small { color: var(--muted); font-size: 10px; }
.ddist { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--grid); margin: 3px 0 2px; }
.ddist i { display: block; }
.ddist i.sb { background: var(--up); }
.ddist i.b { background: color-mix(in srgb, var(--up) 55%, var(--surface)); }
.ddist i.h { background: var(--baseline); }
.ddist i.s { background: color-mix(in srgb, var(--down) 55%, var(--surface)); }
.ddist i.ss { background: var(--down); }
.dtarget, .drange { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--ink-2); }
.drange { padding: 4px 20px 0; font-size: 12px; }
.drange-sub { padding: 2px 20px 6px; }
.dt-track { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, color-mix(in srgb, var(--down) 35%, var(--grid)), var(--grid), color-mix(in srgb, var(--up) 35%, var(--grid))); }
.dt-track i { position: absolute; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.dt-track .dt-price { width: 14px; height: 14px; background: var(--ink); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.dt-track .dt-mean { width: 10px; height: 10px; background: var(--accent); }
.dt-key { display: inline-block; width: 8px; height: 8px; border-radius: 50%; vertical-align: -1px; }
.dt-key.dt-price { background: var(--ink); }
.dt-key.dt-mean { background: var(--accent); }
.dtiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; padding: 6px 20px 4px; }
.dt { display: flex; flex-direction: column; gap: 1px; background: color-mix(in srgb, var(--grid) 45%, transparent); border-radius: 9px; padding: 7px 9px; min-width: 0; }
.dt-l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; }
.dt-v { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dt-v.pos { color: var(--up); } .dt-v.neg { color: var(--down); }
.dt-s { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dgrades { padding: 0 20px 4px; display: flex; flex-direction: column; }
.dg { display: grid; grid-template-columns: 44px minmax(0, 1.3fr) auto minmax(0, 1fr) auto; gap: 8px; align-items: center; padding: 6px 0; border-top: 1px solid var(--grid); font-size: 12px; }
.dg:first-child { border-top: 0; }
.dg-date { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 11px; }
.dg-firm { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-firm small { display: block; font-weight: 400; color: var(--muted); font-size: 10.5px; }
.dg-grade { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dg-pt { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.dg-pt.pos { color: var(--up); } .dg-pt.neg { color: var(--down); }
.dnews { display: flex; flex-direction: column; padding: 0 20px 4px; }
.dn { display: flex; flex-direction: column; gap: 2px; padding: 8px 0; border-top: 1px solid var(--grid); text-decoration: none; color: inherit; }
.dn:first-child { border-top: 0; }
.dn:hover .dn-t { color: var(--accent); }
.dn-t { font-size: 12.5px; font-weight: 600; line-height: 1.35; }
.dn-s { font-size: 11px; color: var(--muted); }
.dprofile { margin: 8px 20px 4px; font-size: 12.5px; color: var(--ink-2); line-height: 1.5; }
.dprofile summary { cursor: pointer; font-weight: 650; color: var(--accent); font-size: 12px; user-select: none; }
.dprofile p { margin: 8px 0 0; }
.drawer-foot { padding: 12px 20px 4px; font-size: 11.5px; color: var(--muted); border-top: 1px solid var(--grid); margin-top: 8px; }
.drawer-foot:empty { display: none; }
.linkish { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-size: 11.5px; font-weight: 650; cursor: pointer; padding: 0; }
.dskel { padding: 14px 20px; display: flex; flex-direction: column; gap: 10px; }
.dskel div { height: 14px; border-radius: 6px; background: linear-gradient(90deg, var(--grid), color-mix(in srgb, var(--grid) 40%, var(--surface)), var(--grid)); background-size: 200% 100%; animation: skel 1.2s linear infinite; }
.dskel div:nth-child(2) { width: 70%; } .dskel div:nth-child(3) { width: 85%; }
@keyframes skel { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.drawer-edit { margin: 10px 20px 4px; }
@media (max-width: 760px) {
  /* one scroll for the whole sheet: a swipe on the header scrolls too (the
     header scrolls away, the section chips stay pinned at the top) */
  .drawer { display: block; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
  .drawer-scroll { overflow: visible; }
  .drawer .dsec { scroll-margin-top: 52px; }
  .drawer-head { padding: 12px 14px 6px; }
  .drawer-nav { padding: 6px 14px 8px; position: sticky; top: 0; background: var(--surface); z-index: 2; }
  /* no sideways scrolling on a phone: the section chips wrap to a second row */
  .drawer-nav { flex-wrap: wrap; overflow-x: visible; row-gap: 6px; }
  .drawer-nav button { padding: 6px 11px; }
  .drawer-flags, .dkv, .dsub, .dsurprise, .dtiles, .dgrades, .dnews, .drange, .drange-sub, .drawer-summary, .drawer-foot, .drawer-body { padding-left: 14px; padding-right: 14px; }
  .dsec .drawer-title { padding-left: 14px; padding-right: 14px; }
  .dprofile, .drawer-edit { margin-left: 14px; margin-right: 14px; }
  .dkv { grid-template-columns: 1fr; gap: 2px 0; }
  .dkv .dk { margin-top: 8px; }
  .dkv .dk:first-child { margin-top: 0; }
  .dtiles { grid-template-columns: repeat(3, 1fr); gap: 6px; }
  .dg { grid-template-columns: 40px minmax(0, 1fr) auto; grid-template-areas: "date firm badge" "grade grade pt"; row-gap: 2px; }
  .dg-date { grid-area: date; } .dg-firm { grid-area: firm; } .dg .badge { grid-area: badge; }
  .dg-grade { grid-area: grade; font-size: 11.5px; } .dg-pt { grid-area: pt; }
  .drawer-summary { grid-template-columns: repeat(2, 1fr); }
  .drawer-body .table td:last-child { min-width: 0; }
}
@media (max-width: 380px) { .dtiles { grid-template-columns: repeat(2, 1fr); } }

/* ============================ calendar (agenda) ============================ */
.agenda-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.agenda-bar .chart-toggle { margin-left: 0; }
.agenda-bar .panel-sub { margin-left: auto; }
.ag-day { margin-bottom: 14px; }
.ag-day-head {
  display: flex; align-items: baseline; gap: 10px; padding: 6px 2px; margin-bottom: 4px;
  border-bottom: 1px solid var(--baseline); position: sticky; top: 0; background: var(--page); z-index: 3;
}
.ag-day-head b { font-size: 14px; }
.ag-day-head .hint { font-size: 11.5px; }
.ag-day-head.today b { color: var(--accent); }
.ag-list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-1); overflow: hidden; }
.ag-row {
  display: grid; grid-template-columns: 58px 44px minmax(0, 1fr) 150px auto; gap: 10px; align-items: center;
  padding: 8px 14px; border-top: 1px solid var(--grid); font-size: 12.5px; min-height: 44px;
  position: relative;
}
.ag-state { display: flex; justify-content: flex-end; }
.ag-reg { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px;
          border-radius: 4px; background: var(--grid); color: var(--ink-2); }
.ag-sur { font-size: 11px; font-weight: 650; white-space: nowrap; }
.ag-sur.pos { color: var(--up); }
.ag-sur.neg { color: var(--down); }
.ag-sur.flat { color: var(--muted); }
/* a held company's monthly sales release (TSMC's 6-K), told apart from a quarterly report */
.ag-kind { display: inline-block; margin-left: 4px; padding: 0 6px; border-radius: 999px; font-size: 10px; font-weight: 700;
           letter-spacing: .03em; vertical-align: 1px; color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.ag-sur.ag-est { font-style: italic; }
/* a held company's own event (company_events): a filing, a dividend, a split,
   a meeting, an analyst's call - its tag says which, the sub line what it says */
.ag-kind.pos { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.ag-kind.neg { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.ag-row.cev .ag-sub { color: var(--ink-2); }
.ag-row.cev .ag-sub small { color: var(--muted); font-size: inherit; }
.ag-row.cev a.ag-out { text-decoration: none; }
.ag-row.cev a.ag-out:hover { color: var(--accent); }
/* what already happened reads as done; what is live stands out */
.ag-row.st-released .ag-title, .ag-row.st-past .ag-title,
.ag-row.st-released .ag-time, .ag-row.st-past .ag-time { color: var(--muted); }
.ag-row.st-past { opacity: .6; }
.ag-row.st-imminent, .ag-row.st-live { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ag-row.st-imminent::before, .ag-row.st-live::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--accent); }
.ag-day.past .ag-day-head b { color: var(--muted); }
.ag-rel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px;
          border-radius: 999px; background: var(--grid); color: var(--ink-2); }
.ag-day-head.today .ag-rel { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
/* the Now line through today */
.ag-now { display: flex; align-items: center; gap: 8px; padding: 3px 14px; border-top: 1px solid var(--grid); }
.ag-now::after { content: ""; flex: 1; height: 2px; border-radius: 1px; background: var(--accent); }
.ag-now span { font-size: 10.5px; font-weight: 700; color: var(--accent); white-space: nowrap;
               padding: 1px 7px; border-radius: 999px; border: 1px solid var(--accent); }
.ag-row:first-child { border-top: 0; }
.ag-row.earn { cursor: pointer; }
.ag-row.earn:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ag-time { font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: 12px; white-space: nowrap; }
.ag-time small { display: block; color: var(--muted); font-size: 10px; }
.ag-flag { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; color: var(--ink-2); }
.ag-flag .tlogo { width: 24px; height: 24px; }
.ag-main { min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.ag-title { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-title .badge { margin-left: 4px; }
.ag-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ag-num { display: flex; gap: 14px; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.ag-num span { display: flex; flex-direction: column; align-items: flex-end; line-height: 1.25; }
.ag-num small { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ag-num b { font-weight: 650; }
.ag-num b.pos { color: var(--up); } .ag-num b.neg { color: var(--down); }
.ag-imp { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: 1px; }
.ag-imp i { width: 5px; height: 5px; border-radius: 50%; background: var(--baseline); display: block; }
.ag-imp.l3 i { background: var(--down); }
.ag-imp.l2 i:nth-child(-n+2) { background: var(--s3); }
.ag-imp.l1 i:first-child { background: var(--muted); }
.ag-more { appearance: none; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; font-weight: 650; cursor: pointer; padding: 8px 14px; text-align: left; border-top: 1px solid var(--grid); }
@media (max-width: 760px) {
  .agenda-bar { gap: 6px; }
  .agenda-bar .chart-toggle { width: 100%; justify-content: space-between; }
  .agenda-bar .chart-toggle button { flex: 1; padding: 6px 4px; }
  .agenda-bar .panel-sub { margin-left: 0; flex-basis: 100%; }
  .ag-day-head { top: 0; }
  /* phone: time | event | figures, the status on its own line under the event */
  .ag-row { grid-template-columns: 58px minmax(0, 1fr) auto; gap: 4px 10px; padding: 8px 12px; }
  .ag-state { grid-column: 2; grid-row: 2; justify-content: flex-start; }
  .ag-state:empty { display: none; }
  .ag-time small { white-space: normal; line-height: 1.15; }
  .ag-flag { display: none; }
  .ag-row.earn .ag-flag { display: inline-flex; }
  .ag-row.earn { grid-template-columns: 58px 30px minmax(0, 1fr) auto; }
  .ag-row.earn .ag-state { grid-column: 3; }
  .ag-row.earn .ag-flag span { display: none; }
  /* a filing's headline is the point of the row: let it wrap to two lines */
  .ag-row.cev .ag-sub { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
  .ag-title { white-space: normal; }
  .ag-num { gap: 10px; }
  .ag-num span:nth-child(n+3) { display: none; }
}

/* ------------------------------------------------------------------ Recoil tab (view-only) */
.rc-chart { width: 100%; min-height: 220px; }
.rc-chart svg { display: block; }
.rc-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 6px 0 10px; font-size: 12px; color: var(--ink-2); }
.rc-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }
.rc-leg b { font-variant-numeric: tabular-nums; }
.rc-h3 { font-size: 13px; font-weight: 650; margin: 16px 0 6px; }
.rc-h3 .hint { font-weight: 400; }
.rc-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--border); margin-top: 4px; }
.rc-bar span { display: block; height: 100%; }
.rc-next { margin: 0; padding-left: 18px; font-size: 13px; line-height: 1.5; }
.rc-rb { border-top: 1px solid var(--border); padding: 8px 0; font-size: 13px; }
.rc-rb:first-child { border-top: none; }
.rc-rb-head { margin-bottom: 4px; }
.rc-rb .badge { margin-right: 6px; }
.rc-sectors { margin-top: 8px; }
#tab-recoil .table td .hint { font-size: 11px; }

/* ================================ sign in ================================ */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100dvh; padding: 24px; }
.login-card {
  width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow); padding: 28px 26px 22px;
}
.login-brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; color: var(--ink-2); }
.login-brand .side-logo { color: var(--accent); }
.login-title { font-size: 22px; font-weight: 750; margin: 18px 0 6px; }
.login-sub { color: var(--ink-2); font-size: 13px; line-height: 1.55; margin: 0 0 18px; }
.login-sub code { background: var(--grid); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.login-btn { width: 100%; min-height: 46px; font-size: 14px; }
.login-card .form { gap: 14px; }
.login-card .form input { font-size: 16px; padding: 10px 12px; }
.login-foot { color: var(--muted); font-size: 11px; margin: 16px 0 0; text-align: center; }
.login-card .form-msg { min-height: 20px; margin-top: 12px; text-align: center; }

/* security panel */
.sec-list { display: flex; flex-direction: column; margin: 8px 0 12px; }
.sec-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center;
           padding: 9px 0; border-top: 1px solid var(--grid); font-size: 13px; }
.sec-row:first-child { border-top: 0; }
.sec-name { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sec-actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 760px) {
  .sec-row { grid-template-columns: minmax(0, 1fr) auto; }
  .sec-row .hint { grid-column: 1 / -1; grid-row: 2; }
  .sec-actions .btn { flex: 1 1 auto; }
}

/* the sign-in log */
.sec-divider { border-top: 1px solid var(--grid); margin: 16px 0 12px; }
.panel-head.tight { margin-bottom: 4px; }
.panel-title.small { font-size: 13px; }
.sec-accounts { display: flex; flex-direction: column; margin: 8px 0 4px; }
.sec-accounts .sec-row { grid-template-columns: minmax(0, 1fr) auto; }
.sec-accounts .sec-name { display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
                          white-space: normal; overflow: visible; }
.sec-accounts .sec-row.you .sec-name { color: var(--accent); }
.sec-tag { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
           padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.sec-tag.ok { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.sec-tag.bad { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.sec-tag.muted { background: var(--grid); color: var(--muted); }
.sec-events-wrap { margin-top: 6px; }
.sec-events-wrap summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 4px 0; }
.sec-events { display: flex; flex-direction: column; max-height: 340px; overflow-y: auto; margin-top: 4px; }
.sec-event { display: grid; grid-template-columns: 78px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
             padding: 7px 0; border-top: 1px solid var(--grid); font-size: 12px; }
.sec-event .sec-when { color: var(--muted); }
.sec-event .sec-who { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.sec-event .sec-how { color: var(--muted); }
.sec-event .hint { grid-column: 2 / -1; font-size: 11px; }
/* a refusal is the one row worth spotting from across the panel */
.sec-event.refused, .sec-event.failed { color: var(--down); }
.sec-event.refused .sec-how, .sec-event.failed .sec-how { color: var(--down); font-weight: 650; }
@media (max-width: 760px) {
  /* an email plus its counts will not sit on one phone line: name (with its
     tags) first, the counts under it */
  .sec-accounts .sec-row { grid-template-columns: minmax(0, 1fr); gap: 3px; }
  .sec-event { grid-template-columns: minmax(0, 1fr) auto; column-gap: 8px; row-gap: 2px; }
  .sec-event .sec-when { grid-column: 1 / -1; order: -1; font-size: 11px; }
  .sec-event .hint { grid-column: 1 / -1; }
}
.google-btn { display: flex; align-items: center; justify-content: center; gap: 10px; margin-top: 10px; }
.google-btn svg { flex: 0 0 auto; }
.login-alt { text-align: center; color: var(--muted); font-size: 11.5px; margin: 12px 0 2px;
             text-transform: uppercase; letter-spacing: .08em; }

/* ============================ market strip ============================== */
.markets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.mk { display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 999px; font-size: 11.5px;
  background: var(--surface); border: 1px solid var(--border); color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.mk b { color: var(--ink); font-weight: 650; }
.mk i { font-style: normal; font-size: 11px; }
.mk small { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); margin-left: 2px; }
.mk.pos { color: var(--up); } .mk.neg { color: var(--down); }
.mk em { font-style: normal; margin-left: 6px; padding-left: 6px; border-left: 1px solid var(--border); color: var(--muted); }
.mk em.pos { color: var(--up); } .mk em.neg { color: var(--down); }
.mk.you { background: color-mix(in srgb, var(--accent) 8%, var(--surface)); }
.mk.you b { color: inherit; }
/* the basis, said once for the whole strip rather than on every chip */
.mk-state { background: var(--grid); border-color: transparent; color: var(--muted);
  font-weight: 650; text-transform: uppercase; letter-spacing: .04em; font-size: 10px; }
.mk-state i { font-size: 10px; }
/* your edge against that index, subordinate to the index's own move */
.mk-edge { font-size: 10px; opacity: .85; }
@media (max-width: 760px) {
  /* wrap onto a second row rather than scroll sideways: four chips do not fit
     across a 390px phone, and a strip you have to swipe hides the index you
     were looking for */
  .markets { gap: 5px; flex-wrap: wrap; row-gap: 5px; }
  .mk { font-size: 11px; padding: 3px 8px; }
  .mk-state { flex-basis: 100%; }    /* the basis gets its own line, once */
  .mk-edge { display: none; }        /* one number per chip on a phone */
}

/* ============================ limit orders ============================== */
.basket-limit { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.basket-expiry { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--ink-2); }
.basket-expiry select, .basket-expiry input { font: inherit; font-size: 12px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 5px 8px; }
.basket-lim { width: 96px; font: inherit; font-size: 12.5px; text-align: right; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 4px 8px; font-variant-numeric: tabular-nums; }
.basket-lim:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.orders-committed { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; align-items: center; margin: 0 0 12px;
  padding: 10px 14px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 7%, var(--surface)); border: 1px solid var(--border); }
.oc-label { font-size: 12.5px; color: var(--ink-2); }
.oc-label b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.oc-bar { position: relative; height: 12px; border-radius: 6px; background: var(--grid); overflow: hidden; }
.oc-bar i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--accent); }
.oc-bar b { position: absolute; left: 0; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, var(--accent) 0 3px, color-mix(in srgb, var(--accent) 35%, transparent) 3px 7px); }
.oc-legend { grid-column: 1 / -1; display: flex; gap: 16px; font-size: 11px; color: var(--muted); }
.oc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; vertical-align: -1px; margin-right: 5px; }
.oc-legend i.free { background: var(--accent); }
.oc-legend i.held { background: repeating-linear-gradient(45deg, var(--accent) 0 3px, color-mix(in srgb, var(--accent) 35%, transparent) 3px 7px); }
.orders-history { margin-top: 10px; }
.orders-history summary { font-size: 12px; color: var(--ink-2); cursor: pointer; }
.orders-history .table-wrap { margin-top: 8px; }
.order-away.pos { color: var(--up); } .order-away.neg { color: var(--down); }
.order-away small { color: var(--muted); font-weight: 500; }
.badge.filled { color: var(--up); } .badge.expired, .badge.cancelled { color: var(--muted); } .badge.open { color: var(--accent); }
.kpi-committed { display: block; height: 5px; border-radius: 3px; background: var(--grid); margin-top: 6px; overflow: hidden; }
.kpi-committed i { display: block; height: 100%; background: repeating-linear-gradient(45deg, var(--accent) 0 3px, color-mix(in srgb, var(--accent) 35%, transparent) 3px 7px); }
@media (max-width: 760px) {
  .basket-actions { flex-wrap: wrap; }
  .basket-limit { width: 100%; }
}

/* ============================ research workspace ========================== */
.rs-search { position: relative; z-index: 30; max-width: 560px; margin: 2px 0 10px; }
#rs-q { width: 100%; font: inherit; font-size: 15px; color: var(--ink); background: var(--surface);
        border: 1px solid var(--border); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow-1); }
#rs-q:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rs-results { position: absolute; z-index: 20; left: 0; right: 0; top: calc(100% + 6px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: var(--shadow); overflow: hidden; max-height: 320px; overflow-y: auto; }
.rs-hit { display: flex; gap: 10px; align-items: baseline; width: 100%; text-align: left;
  appearance: none; border: 0; background: none; font: inherit; font-size: 13px; cursor: pointer;
  padding: 9px 14px; border-top: 1px solid var(--grid); color: var(--ink); }
.rs-hit:first-child { border-top: 0; }
.rs-hit:hover { background: color-mix(in srgb, var(--accent) 8%, transparent); }
.rs-hit .sym { font-weight: 700; min-width: 62px; }
.rs-hit span:last-child { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

#rs-body { transition: opacity .2s; position: relative; min-height: 40vh; }
#rs-body.rs-loading > :not(.rs-load-overlay) { opacity: .35; pointer-events: none; transition: opacity .2s; }
.rs-load-overlay { position: absolute; inset: 0; z-index: 5; display: flex; justify-content: center; align-items: flex-start; padding-top: 18vh; pointer-events: none; }
.rs-load-overlay .rs-load { width: auto; min-width: 320px; padding: 18px 36px 16px; background: color-mix(in srgb, var(--surface) 96%, transparent);
  border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow); }

/* loading: a price line climbing, drawn on a loop, while the Terminal answers */
.rs-load { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  gap: 4px; padding: 56px 0 40px; width: 100%; box-sizing: border-box; }
.rs-load.small { padding: 22px 0 14px; }
.rs-load svg { overflow: visible; display: block; margin: 0 auto; }
.rs-load-grid { stroke: var(--grid); stroke-width: 1; fill: none; }
/* pathLength="100" on the line: the dash runs 100 -> 0 on the same linear
   clock as the dot's motion, so the dot rides exactly the tip of the line */
.rs-load-line { fill: none; stroke: var(--up); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; animation: rs-draw 2.4s linear infinite; }
.rs-load-dot { fill: var(--up); stroke: var(--surface); stroke-width: 2; }
@keyframes rs-draw { 0% { stroke-dashoffset: 100; opacity: 1; } 78% { stroke-dashoffset: 0; opacity: 1; } 92% { stroke-dashoffset: 0; opacity: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.rs-load p { margin: 8px 0 0; font-size: 14px; font-weight: 650; }
.rs-load.small p { font-size: 12.5px; margin-top: 4px; }
.rs-load .hint { font-size: 12px; }
@media (prefers-reduced-motion: reduce) { .rs-load-line { animation: none; stroke-dashoffset: 0; } .rs-load-dot { display: none; } }

/* skeleton: the shape of the page while the Terminal answers */
.rs-skel { display: flex; flex-direction: column; gap: 14px; }
.rs-skel div div, .rs-skel-h div { border-radius: 10px;
  background: linear-gradient(90deg, var(--grid), color-mix(in srgb, var(--grid) 40%, var(--surface)), var(--grid));
  background-size: 200% 100%; animation: skel 1.2s linear infinite; }
.rs-skel-h { display: flex; gap: 14px; }
.rs-skel-h div:first-child { width: 42px; height: 42px; flex: 0 0 auto; }
.rs-skel-h div:last-child { flex: 1; height: 42px; max-width: 420px; }
.rs-skel-t { display: grid; grid-template-columns: repeat(6, 1fr); gap: 10px; }
.rs-skel-t div { height: 74px; }
.rs-skel-g { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 14px; }
.rs-skel-g div { height: 260px; }
.rs-skel .hint { text-align: center; }

/* ---- header */
.rs-head { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "id px" "id actions";
  gap: 6px 28px; align-items: start; margin: 6px 0 14px; }
.rs-id { grid-area: id; display: flex; gap: 12px; align-items: flex-start; min-width: 0; }
.rs-id .tlogo { width: 44px; height: 44px; border-radius: 12px; }
.rs-id h1 { font-size: 26px; font-weight: 750; margin: 0; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; letter-spacing: -.01em; }
.rs-kind { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em;
           color: var(--muted); background: var(--grid); border-radius: 999px; padding: 3px 9px; }
.rs-id .badge.held { color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 999px; padding: 3px 9px; font-size: 11px; }
.rs-id p { margin: 3px 0 0; color: var(--ink-2); font-size: 13.5px; }
.rs-tags { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 7px !important; }
.rs-px { grid-area: px; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; min-width: 300px; }
.rs-px-main { display: flex; align-items: baseline; gap: 10px; }
.rs-px-main b { font-size: 30px; font-weight: 750; letter-spacing: -.01em; }
.rs-px-chg { font-size: 13px; font-weight: 650; }
.rs-session { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
  background: var(--grid); border-radius: 999px; padding: 2px 8px; }
.rs-session.live { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.rs-ext { display: inline-flex; align-items: baseline; gap: 6px; font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rs-ext small { font-size: 11.5px; font-weight: 600; }
.rs-tape { display: flex; flex-wrap: wrap; gap: 3px 14px; justify-content: flex-end; font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.rs-tape b { color: var(--ink); font-weight: 650; }
.rs-tape small { color: var(--muted); }
#rs-px-value { display: inline-block; border-radius: 6px; padding: 0 4px; margin-left: -4px; }
#rs-px-value.tick-up { animation: tick-up .9s ease-out; }
#rs-px-value.tick-down { animation: tick-down .9s ease-out; }
.rs-legend.inline { display: inline-flex; margin: 0 0 0 10px; }
.rs-px-sub { display: flex; gap: 14px; flex-wrap: wrap; justify-content: flex-end; font-size: 11.5px; color: var(--muted); }
.rs-px-sub b { color: var(--ink); font-weight: 650; }
.rs-px-sub b.pos { color: var(--up); } .rs-px-sub b.neg { color: var(--down); }
.rs-actions { grid-area: actions; display: flex; gap: 6px; justify-content: flex-end; }

/* a track with markers: the 52-week range */
.rs-track { width: 100%; }
.rs-track-bar { position: relative; height: 6px; border-radius: 3px; background: var(--grid); margin: 6px 0 4px; }
.rs-mark { position: absolute; top: 50%; transform: translate(-50%, -50%); border-radius: 50%; }
.rs-mark.px { width: 14px; height: 14px; background: var(--accent); border: 2.5px solid var(--surface);
  box-shadow: 0 0 0 1px var(--border); z-index: 2; }
.rs-mark.ma, .rs-mark.ma2 { width: 2px; height: 12px; border-radius: 1px; background: var(--ink-2); z-index: 1; }
.rs-mark.ma2 { background: var(--muted); height: 12px; opacity: .7; }
.rs-track-l { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }

/* ---- tiles */
.rs-tiles { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.rs-tile { background: linear-gradient(180deg, var(--card-top), transparent 42px), var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 11px 14px; box-shadow: var(--shadow-1); min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.rs-tile-l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 650; }
.rs-tile-v { font-size: 21px; font-weight: 700; letter-spacing: -.01em; line-height: 1.15; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-tile-s { font-size: 11.5px; color: var(--ink-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-tile-s .pos, .rs-tile-v .pos { color: var(--up); font-weight: 650; }
.rs-tile-s .neg, .rs-tile-v .neg { color: var(--down); font-weight: 650; }

/* ---- scorecard */
.rs-score { display: grid; grid-template-columns: 170px 1fr; gap: 10px 18px; align-items: center;
  background: linear-gradient(180deg, var(--card-top), transparent 42px), var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px 16px; box-shadow: var(--shadow-1); margin-bottom: 14px; }
.rs-score-sum { display: flex; flex-direction: column; gap: 2px; }
.rs-score-n { font-size: 22px; font-weight: 750; letter-spacing: -.01em; }
.rs-score-n b { font-size: 30px; color: var(--up); }
.rs-score-t { font-size: 12px; color: var(--ink-2); line-height: 1.3; }
.rs-score-t b.neg { color: var(--down); }
.rs-score-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 6px 14px; }
.rs-sc { padding: 4px 0 4px 10px; border-left: 2px solid var(--baseline); }
.rs-sc.good { border-left-color: var(--up); }
.rs-sc.warn { border-left-color: var(--down); }
.rs-sc-l { display: flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase;
           letter-spacing: .05em; color: var(--muted); }
.rs-sc-l i { width: 7px; height: 7px; border-radius: 50%; background: var(--baseline); }
.rs-sc.good .rs-sc-l i { background: var(--up); }
.rs-sc.warn .rs-sc-l i { background: var(--down); }
.rs-sc-d { display: block; font-size: 12px; line-height: 1.4; margin-top: 2px; color: var(--ink); }

/* ---- grid of cards: twelve columns, each card says how many it spans */
.rs-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.rs-card { grid-column: span var(--span, 4); background: linear-gradient(180deg, var(--card-top), transparent 42px), var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px 14px; box-shadow: var(--shadow-1); min-width: 0; }
/* the chart spans two rows beside two stacked cards; it must not stretch to
   their height when one of them grows (a long holdings list), so it sits at
   its own height and the grid keeps the slack */
.rs-card.tall { grid-row: span 2; align-self: start; }
.rs-card-h { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.rs-card-h h2 { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted);
                font-weight: 700; margin: 0; flex: 0 0 auto; }
.rs-card-h .hint { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-card-h .rs-toggle { margin-left: auto; }
.rs-card-h .rs-seg { margin-left: auto; }
.rs-card-h .rs-seg + .rs-seg, .rs-card-h .rs-seg + .rs-toggle { margin-left: 6px; }
.rs-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; background: var(--surface); flex: 0 0 auto; }
.rs-seg button { appearance: none; border: 0; background: none; font: inherit; font-size: 11.5px; font-weight: 600;
  color: var(--ink-2); padding: 4px 10px; cursor: pointer; }
.rs-seg button + button { border-left: 1px solid var(--border); }
.rs-seg button.on { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--ink); }
.rs-seg button:hover:not(.on) { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.rs-sub-h { font-size: 10.5px; font-weight: 700; color: var(--muted); text-transform: uppercase;
            letter-spacing: .04em; margin: 12px 0 5px; }
.rs-sub-h:first-child { margin-top: 0; }
.rs-kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 8px 14px; font-size: 13px; }
.rs-k { color: var(--muted); font-size: 11.5px; padding-top: 2px; }
.rs-v { font-variant-numeric: tabular-nums; line-height: 1.4; min-width: 0; }
.rs-minis { display: flex; flex-wrap: wrap; gap: 4px 16px; margin-top: 12px; font-size: 11.5px; color: var(--muted); }
.rs-minis b { color: var(--ink); font-weight: 650; font-variant-numeric: tabular-nums; }
.rs-minis b.pos { color: var(--up); } .rs-minis b.neg { color: var(--down); }
.rs-minis small { color: var(--muted); margin-left: 3px; }
.rs-chart-foot { display: flex; justify-content: space-between; gap: 12px; font-size: 11.5px; color: var(--muted); margin-top: 6px; }
.rs-chart-foot b { color: var(--ink); font-weight: 650; }
.rs-chart-foot b.pos { color: var(--up); } .rs-chart-foot b.neg { color: var(--down); }

/* ---- indicator panes under the price, tracking statistics */
.rs-pane { margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--grid); }
.rs-pane-h { display: flex; justify-content: space-between; font-size: 10.5px; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em; margin-bottom: 2px; }
.rs-pane-h b { color: var(--ink); font-variant-numeric: tabular-nums; }
.rs-pane-h b.pos { color: var(--up); } .rs-pane-h b.neg { color: var(--down); }
.rs-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); gap: 8px; margin-top: 10px; }
.rs-stat { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 10px; background: var(--page); min-width: 0; }
.rs-stat-l { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-stat b { font-size: 15px; font-weight: 700; }
.rs-stat b.pos { color: var(--up); } .rs-stat b.neg { color: var(--down); }
.rs-stat-s { font-size: 10.5px; color: var(--muted); }

/* ---- svg charts */
.rsc { position: relative; width: 100%; }
.rsc-svg { display: block; overflow: visible; }
.rsc-empty { font-size: 11.5px; color: var(--muted); padding: 10px 0; }
.rsc-grid { stroke: var(--grid); stroke-width: 1; }
.rsc-zero { stroke: var(--baseline); stroke-width: 1; }
.rsc-ax { fill: var(--muted); font-size: 10.5px; text-anchor: middle; font-variant-numeric: tabular-nums; }
.rsc-ax-r { text-anchor: end; }
.rsc-ax-t { text-anchor: start; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; font-size: 9.5px; }
.rsc-ax-r.rsc-ax-t { text-anchor: end; }
.rsc-line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.rsc-line.est { stroke-dasharray: 4 4; opacity: .8; }
.rsc-area { opacity: .10; }
.rsc-end { stroke: var(--surface); stroke-width: 2; }
.rsc-ref { stroke: var(--ink-2); stroke-width: 1; opacity: .7; }
.rsc-ref.peer { stroke: var(--s3); }
.rsc-ref.hot { stroke: var(--down); } .rsc-ref.cool { stroke: var(--up); }
.rsc-ref-l { fill: var(--ink-2); font-size: 10.5px; font-weight: 600; }
.rsc-cross-l { stroke: var(--ink-2); stroke-width: 1; opacity: .6; }
.rsc-dot { stroke: var(--surface); stroke-width: 2; }
.rsc-bar { fill: var(--accent); transition: opacity .1s; }
.rsc-bar.neg { fill: var(--down); }
.rsc-bar.hover { opacity: .75; }
.rsc-bar.est { stroke: var(--accent); stroke-width: 1; }
.rsc-bar.est.neg { stroke: var(--down); }
.rsc-hatch-bg { fill: color-mix(in srgb, var(--accent) 10%, transparent); }
.rsc-hatch-l { stroke: var(--accent); stroke-width: 1; opacity: .75; }
.rs-est-legend { margin-top: 10px; }
.rs-est-legend i.solid { background: var(--accent); }
.rs-est-legend i.hatch { background: repeating-linear-gradient(45deg, var(--accent) 0 1.5px, color-mix(in srgb, var(--accent) 10%, transparent) 1.5px 5px); border: 1px solid var(--accent); box-sizing: border-box; }
.rs-fin tr.rs-est td { color: var(--ink-2); font-style: italic; }
.rsc-hit { fill: transparent; cursor: crosshair; }
.rsc-pt { fill: color-mix(in srgb, var(--ink-2) 45%, transparent); stroke: var(--surface); stroke-width: 2; transition: fill .1s; }
.rsc-pt.hover { fill: color-mix(in srgb, var(--ink-2) 85%, transparent); }
.rsc-pt.subject { fill: var(--accent); }
.rsc-pt.subject.hover { fill: color-mix(in srgb, var(--accent) 80%, black); }
.rsc-pt-l { fill: var(--ink-2); font-size: 10.5px; text-anchor: middle; font-weight: 600; pointer-events: none; }
.rsc-pt-l.subject { fill: var(--ink); font-size: 11.5px; font-weight: 750; }
.rsc-tip { position: absolute; z-index: 60; pointer-events: none; background: var(--surface); color: var(--ink);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 11px;
  font-size: 12px; min-width: 130px; max-width: 260px; }
.rsc-tip-h { font-weight: 700; margin-bottom: 4px; font-size: 12px; }
.rsc-tip-h .hint { font-weight: 500; }
.rsc-tip-row { display: flex; align-items: center; gap: 7px; padding: 1px 0; }
.rsc-tip-row i { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }
.rsc-tip-row span { color: var(--ink-2); flex: 1; }
.rsc-tip-row b { font-variant-numeric: tabular-nums; font-weight: 650; }

/* ---- consensus */
.rs-rating { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.rs-rating-n { display: flex; align-items: baseline; gap: 4px; }
.rs-rating-n b { font-size: 34px; font-weight: 750; letter-spacing: -.02em; line-height: 1; }
.rs-rating-n span { font-size: 11.5px; color: var(--muted); }
.rs-rating-t { display: flex; flex-direction: column; }
.rs-rating-t b { font-size: 15px; font-weight: 700; }
.rs-rating-t span { font-size: 11.5px; color: var(--muted); }
.rs-dist { height: 12px; border-radius: 6px; gap: 2px; background: none; }
.rs-dist i { border-radius: 3px; }
.rs-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2); margin-top: 6px; }
.rs-legend span { display: inline-flex; align-items: center; gap: 5px; }
.rs-legend i { width: 9px; height: 9px; border-radius: 3px; background: var(--baseline); display: inline-block; }
.rs-legend i.sb { background: var(--up); } .rs-legend i.h { background: var(--baseline); } .rs-legend i.ss { background: var(--down); }
.rs-legend i.mine { background: var(--accent); } .rs-legend i.peer { background: var(--baseline); }
.rs-bullet { margin-top: 16px; }
.rs-bullet-t { position: relative; height: 22px; }
.rs-bullet-t::before { content: ""; position: absolute; left: 10%; right: 10%; top: 50%; height: 2px; background: var(--grid); transform: translateY(-50%); }
.rs-bullet-fill { position: absolute; top: 50%; height: 6px; transform: translateY(-50%); border-radius: 3px; background: var(--baseline); }
.rs-bullet-fill.pos { background: var(--up); } .rs-bullet-fill.neg { background: var(--down); }
.rs-bullet-px, .rs-bullet-tg { position: absolute; top: 50%; transform: translate(-50%, -50%); }
.rs-bullet-px { width: 14px; height: 14px; border-radius: 50%; background: var(--accent); border: 2.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.rs-bullet-tg { width: 3px; height: 18px; border-radius: 2px; background: var(--ink); }
.rs-bullet-l { display: flex; justify-content: space-between; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.rs-bullet-l .pos { color: var(--up); font-weight: 650; } .rs-bullet-l .neg { color: var(--down); font-weight: 650; }

.rs-scale-t { position: relative; height: 6px; border-radius: 3px; margin: 8px 0 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--down) 45%, var(--grid)), var(--grid) 50%,
              color-mix(in srgb, var(--up) 45%, var(--grid))); }
.rs-scale-t i { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px;
  border-radius: 50%; background: var(--ink); border: 2.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.rs-scale-l { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }

/* ---- valuation */
.rs-pct { margin-top: 10px; }
.rs-pct-t { position: relative; height: 8px; border-radius: 4px; margin-bottom: 5px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--up) 45%, var(--grid)), var(--grid) 50%,
              color-mix(in srgb, var(--down) 45%, var(--grid))); }
.rs-pct-t i { position: absolute; top: 50%; transform: translate(-50%, -50%); width: 14px; height: 14px;
  border-radius: 50%; background: var(--ink); border: 2.5px solid var(--surface); box-shadow: 0 0 0 1px var(--border); }
.rs-pct-l { display: flex; justify-content: space-between; align-items: baseline; font-size: 10.5px; color: var(--muted); }
.rs-pct-l span:nth-child(2) { font-size: 11.5px; color: var(--ink-2); }
.rs-pct-l b { color: var(--ink); }
.rs-cmp { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.rs-cmp-row { display: grid; grid-template-columns: minmax(84px, 30%) 1fr 48px; gap: 10px; align-items: center; }
.rs-cmp-k { font-size: 11.5px; color: var(--ink-2); }
.rs-cmp-bars { display: flex; flex-direction: column; gap: 2px; }
.rs-cmp-b { display: flex; align-items: center; gap: 6px; height: 9px; }
.rs-cmp-b i { display: block; height: 100%; border-radius: 0 3px 3px 0; }
.rs-cmp-b i.mine { background: var(--accent); }
.rs-cmp-b i.peer { background: var(--baseline); }
.rs-cmp-b span { font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-cmp-d { text-align: right; font-size: 11.5px; font-weight: 650; font-variant-numeric: tabular-nums; }
.rs-cmp-d.pos { color: var(--up); } .rs-cmp-d.neg { color: var(--down); }

/* ---- metric bars (margins, returns, ownership, revisions, correlations) */
.rs-mb { display: flex; flex-direction: column; gap: 5px; }
.rs-mb-row { display: grid; grid-template-columns: minmax(96px, 36%) 1fr auto; gap: 9px; align-items: center; font-size: 12px; }
.rs-mb-k { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-mb-t { height: 8px; border-radius: 4px; background: var(--grid); overflow: hidden; }
.rs-mb-t i { display: block; height: 100%; border-radius: 4px; background: var(--accent); }
.rs-mb-t i.neg { background: var(--down); }
.rs-mb-t i.hot { background: var(--down); }
.rs-mb-t.signed i:not(.neg) { background: var(--up); }
.rs-mb-v { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.rs-mb-v.pos { color: var(--up); } .rs-mb-v.neg { color: var(--down); }

/* ---- small multiples */
.rs-multiples { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px 22px; }
.rs-mini-h { font-size: 11px; font-weight: 700; color: var(--ink-2); margin-bottom: 2px; display: flex; gap: 12px; align-items: baseline; flex-wrap: wrap; }
.rs-mini-h .rs-legend { margin: 0; font-size: 10.5px; }
.rs-fin td, .rs-fin th { font-size: 12px; white-space: nowrap; }
.rs-peers td, .rs-peers th { white-space: nowrap; }
.rs-fin-wrap { margin-top: 4px; }

/* ---- peers */
.rs-peer-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 18px; align-items: start; }
.rs-peer-table { min-width: 0; overflow: hidden; }
.rs-peers { width: 100%; table-layout: auto; }
.rs-peers td, .rs-peers th { padding-left: 7px; padding-right: 7px; font-size: 11.5px; }
.rs-peers td:first-child, .rs-peers th:first-child { padding-left: 4px; min-width: 0; }
.rs-peers .asset-name { max-width: 150px; }
.rs-scatter .rsc { cursor: default; }
.rs-scatter .hint { margin: 4px 0 0; }
.rs-peers .sym { display: block; font-weight: 700; }
.rs-peers .asset-name { display: block; font-size: 11px; color: var(--muted); max-width: 190px;
  overflow: hidden; text-overflow: ellipsis; }
.rs-peers tbody tr { cursor: pointer; }
.rs-peers tbody tr:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.rs-peers tr.rs-subject td { background: color-mix(in srgb, var(--accent) 11%, transparent); font-weight: 650; }

/* ---- ownership, options, compare */
.rs-own { display: flex; flex-direction: column; gap: 5px; }
.rs-own-row { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(40px, 1fr) 44px 58px; gap: 8px; align-items: center; font-size: 12px; }
.rs-own-n { display: flex; flex-direction: column; min-width: 0; }
.rs-own-n b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-own-n span { font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-own-row .rs-mb-t { display: block; }
.rs-own-p { text-align: right; font-variant-numeric: tabular-nums; }
.rs-own-c { text-align: right; font-size: 11px; font-variant-numeric: tabular-nums; color: var(--muted); }
.rs-own-c.pos { color: var(--up); } .rs-own-c.neg { color: var(--down); }
.rs-opt-move { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid var(--grid); }
.rs-opt-move:last-of-type { border-bottom: 0; }
.rs-opt-big { font-size: 26px; font-weight: 750; letter-spacing: -.01em; line-height: 1; min-width: 92px; }
.rs-opt-move span { font-size: 12.5px; line-height: 1.4; }
.rs-opt-move small { color: var(--muted); font-size: 11px; }
.rs-opt-notes { margin: 10px 0 0; padding-left: 18px; font-size: 12px; line-height: 1.5; color: var(--ink-2); }
.rs-opt-notes li + li { margin-top: 4px; }
.rs-opt-notes b { color: var(--ink); }
.rs-opt-notes b.pos { color: var(--up); } .rs-opt-notes b.neg { color: var(--down); }
.rs-cmp-strip { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0 0 12px; padding: 8px 12px;
  background: color-mix(in srgb, var(--accent) 6%, var(--surface)); border: 1px solid var(--border); border-radius: 12px; }
.rs-cmp-l { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.rs-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 6px 3px 8px; border-radius: 999px; background: var(--surface);
  border: 1px solid var(--border); font-size: 12px; font-weight: 650; }
.rs-chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.rs-chip button { appearance: none; border: 0; background: var(--grid); color: var(--muted); border-radius: 50%; width: 16px; height: 16px; font-size: 9px; cursor: pointer; }
.rs-cmp-q { font: inherit; font-size: 12px; padding: 4px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--ink); width: 130px; }
.rs-cmp-head { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 14px; }
.rs-cmp-name { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-1); border-left: 4px solid var(--c); }
.rs-cmp-name i { display: none; }
.rs-cmp-name > div { min-width: 0; display: flex; flex-direction: column; }
.rs-cmp-name > div b { font-size: 16px; font-weight: 750; }
.rs-cmp-name > div span { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-cmp-name em { font-style: normal; font-variant-numeric: tabular-nums; font-size: 13px; }
.rs-cmp-name > b { font-size: 13px; }
.rs-cmp-name > b.pos { color: var(--up); } .rs-cmp-name > b.neg { color: var(--down); }
.rs-cmp-wrap { overflow: hidden; }
.rs-cmp-t { width: 100%; }
.rs-cmp-t th i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--c); margin-right: 6px; }
.rs-cmp-t td, .rs-cmp-t th { font-size: 12.5px; }
.rs-cmp-t tr.rs-cmp-g td { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-top: 12px; border-bottom: 0; }
.rs-cmp-t td.best { background: color-mix(in srgb, var(--up) 12%, transparent); font-weight: 650; }

/* ---- analysts */
.rs-an-wrap { max-height: 520px; overflow-y: auto; margin-top: 8px; }
.rs-an td, .rs-an th { font-size: 12px; white-space: nowrap; }
.rs-an td.pos { color: var(--up); } .rs-an td.neg { color: var(--down); }
.rs-an .badge.buy { color: var(--up); } .rs-an .badge.sell { color: var(--down); } .rs-an .badge.hold { color: var(--ink-2); }
.rs-tgt { margin-bottom: 6px; max-width: 720px; }

/* ---- insights dashboard */
.in-alerts { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.in-alert { display: inline-flex; align-items: center; gap: 8px; appearance: none; border: 1px solid var(--border); background: var(--surface);
  border-radius: 999px; padding: 6px 12px 6px 8px; font: inherit; font-size: 12px; color: var(--ink); cursor: pointer; box-shadow: var(--shadow-1); text-align: left; }
.in-alert i { font-style: normal; font-size: 14px; }
.in-alert.drop, .in-alert.low { border-color: color-mix(in srgb, var(--down) 40%, var(--border)); }
.in-alert.jump, .in-alert.high { border-color: color-mix(in srgb, var(--up) 40%, var(--border)); }
.in-alert.order { border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.in-alert:hover { background: color-mix(in srgb, var(--accent) 6%, var(--surface)); }
.in-tiles { margin-bottom: 14px; }
.in-heat { display: grid; grid-template-columns: 44px repeat(var(--n), minmax(0, 1fr)); gap: 2px; font-size: 10px; margin-bottom: 8px; }
.in-heat-h { color: var(--muted); font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; align-self: center; text-align: center; }
.in-heat-c { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border-radius: 3px; color: var(--ink); font-variant-numeric: tabular-nums; min-width: 0; }
.in-heat-c.self { background: var(--grid) !important; }
.in-exp { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
@media (max-width: 760px) {
  .in-heat { font-size: 8px; grid-template-columns: 34px repeat(var(--n), minmax(0, 1fr)); }
  .in-heat-c { font-size: 0; }
}

/* ---- fund holdings */
.rs-hold { display: flex; flex-direction: column; gap: 6px; }
.rs-hold-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(60px, 1fr) 52px 60px; gap: 10px; align-items: center; font-size: 12px; }
.rs-hold-row.pick { cursor: pointer; }
.rs-hold-row.pick:hover .rs-hold-n b { color: var(--accent); }
.rs-hold-n { display: flex; flex-direction: column; min-width: 0; }
.rs-hold-n b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-hold-n span { font-size: 10.5px; color: var(--muted); }
.rs-hold-w { text-align: right; font-variant-numeric: tabular-nums; }
.rs-hold-v { text-align: right; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }

.rs-hold-bar { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.rs-hold-q { flex: 1 1 auto; min-width: 0; font: inherit; font-size: 12px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 10px; }
.rs-hold-q:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.rs-hold-bar .hint { white-space: nowrap; }
.rs-hold-all { max-height: 470px; overflow-y: auto; margin: 0 -6px; padding: 0 6px; }
.rs-hold-t { width: 100%; border-collapse: collapse; }
.rs-hold-t td { padding: 4px 4px; border-top: 1px solid var(--grid); font-size: 12px; vertical-align: middle; }
.rs-hold-t tr:first-child td { border-top: 0; }
.rs-hold-t td:nth-child(2) { width: 30%; }
.rs-hold-t .rs-mb-t { display: block; }
.rs-hold-t td:nth-child(3) { width: 58px; text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.rs-hold-t tr.pick { cursor: pointer; }
.rs-hold-t tr.pick:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.rs-hold-t .rs-hold-n b { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 260px; }
.rs-hold-t .rs-hold-n span { font-size: 10.5px; color: var(--muted); }

/* ---- fund composition */
.rs-comp-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 24px; }
.rs-comp-strip { display: flex; height: 12px; gap: 2px; margin: 2px 0 8px; }
.rs-comp-strip i { display: block; height: 100%; border-radius: 3px; min-width: 2px; }
.rs-comp-list { display: flex; flex-direction: column; gap: 3px; }
.rs-comp-row { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; font-size: 12px; }
.rs-comp-row span { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rs-comp-row b { font-variant-numeric: tabular-nums; font-weight: 650; }
.rs-comp-row i { width: 10px; height: 10px; border-radius: 3px; }
.rs-comp .c1 { background: var(--s1); } .rs-comp .c2 { background: var(--s2); } .rs-comp .c3 { background: var(--s3); }
.rs-comp .c4 { background: var(--s5); } .rs-comp .c5 { background: var(--s8); } .rs-comp .c6 { background: var(--s7); }
.rs-comp .c7 { background: var(--baseline); }
.rs-fit-note { font-size: 13px; margin: 0 0 10px; line-height: 1.5; }
.rs-foot { font-size: 11.5px; color: var(--muted); margin: 14px 0 0; }

/* ---- responsive */
@media (max-width: 1400px) {
  .rs-peer-grid { grid-template-columns: 1fr; }
  .rs-scatter { max-width: 760px; }
  .rs-peers .asset-name { max-width: 260px; }
}
@media (max-width: 1240px) {
  .rs-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .rs-card { grid-column: span 6; }
  .rs-card[style*="--span:12"] { grid-column: 1 / -1; }
  .rs-card[style*="--span:8"] { grid-column: 1 / -1; }
  .rs-card.tall { grid-row: auto; }
  .rs-multiples { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 999px) {
  .rs-score { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .rs-search { max-width: none; }
  #rs-q { font-size: 16px; }
  .rs-head { grid-template-columns: 1fr; grid-template-areas: "id" "px" "actions"; gap: 10px; }
  .rs-id h1 { font-size: 21px; }
  .rs-px { align-items: stretch; min-width: 0; }
  .rs-px-main b { font-size: 26px; }
  .rs-px-sub { justify-content: flex-start; }
  .rs-actions { justify-content: stretch; }
  .rs-actions .btn { flex: 1; }
  .rs-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .rs-tile { padding: 10px 12px; }
  .rs-tile-v { font-size: 18px; }
  .rs-score { padding: 12px 14px; }
  .rs-score-list { grid-template-columns: 1fr; }
  .rs-grid { grid-template-columns: 1fr; gap: 10px; }
  .rs-card, .rs-card[style*="--span:8"], .rs-card[style*="--span:12"] { grid-column: 1 / -1; padding: 12px 14px; border-radius: 12px; }
  .rs-card-h { flex-wrap: wrap; }
  .rs-card-h .rs-seg { margin-left: 0; }
  .rs-stats { grid-template-columns: repeat(2, 1fr); }
  .rs-hold-row { grid-template-columns: minmax(0, 1.4fr) minmax(40px, 1fr) 52px; }
  .rs-hold-v { display: none; }
  .rs-tape { justify-content: flex-start; }
  .rs-peer-table { overflow-x: auto; }
  .rs-multiples { grid-template-columns: 1fr; }
  .rs-comp-grid { grid-template-columns: 1fr; }
  .rs-skel-t { grid-template-columns: repeat(2, 1fr); }
  .rs-skel-g { grid-template-columns: 1fr; }
  .rs-skel-g div { height: 160px; }
}

/* ---- AI review pack --------------------------------------------------- */
.ai-pack { border: 1px solid var(--border); border-radius: var(--radius); padding: 0;
           width: min(680px, calc(100vw - 32px)); max-height: min(86vh, 900px);
           background: var(--surface); color: var(--ink); box-shadow: var(--shadow); }
.ai-pack::backdrop { background: rgba(10, 14, 30, .45); }
.ai-pack-inner { display: flex; flex-direction: column; gap: 14px; padding: 20px 22px; }
.ai-pack-head { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.ai-pack-head p { margin: 6px 0 0; }
.ai-pack-toggle { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px;
                  border: 1px solid var(--grid); border-radius: 12px; cursor: pointer; }
.ai-pack-toggle input { margin-top: 3px; flex: 0 0 auto; }
.ai-pack-toggle .hint { display: block; margin-top: 2px; }
.ai-pack-meta { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.ai-pack-meta.err { color: var(--down); }
.ai-pack-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ai-pack-actions a.btn { text-decoration: none; }
.ai-pack-preview summary { cursor: pointer; color: var(--muted); font-size: 12px; padding: 2px 0; }
.ai-pack-preview pre { margin: 8px 0 0; max-height: 42vh; overflow: auto; padding: 12px;
                       background: var(--page); border: 1px solid var(--grid); border-radius: 10px;
                       font-size: 11px; line-height: 1.45; white-space: pre; }
@media (max-width: 760px) {
  /* a bottom sheet, like the rest of the phone UI */
  .ai-pack { width: 100vw; max-width: 100vw; margin: auto 0 0; border-radius: 18px 18px 0 0;
             border-bottom: 0; max-height: 92vh; }
  .ai-pack-inner { padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); }
  .ai-pack-actions .btn { flex: 1 1 auto; text-align: center; }
  .ai-pack-preview pre { max-height: 36vh; }
}

/* ---- Performance tab -------------------------------------------------- */
.perf-axis { font-size: 10px; fill: var(--muted); }
.pf-chart { width: 100%; min-height: 150px; position: relative; }
.pf-chart-dd { min-height: 90px; }
.pf-cursor line { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: .7; }
.pf-hit { cursor: crosshair; }
.pf-section-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
                    color: var(--muted); }
.pf-dd-head-row { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap;
                  margin: 18px 0 2px; padding-top: 14px; border-top: 1px solid var(--grid); }

/* the hero: the verdict in words, the two numbers behind it, and the one
   line that shows when the ground was lost */
.pf-hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, 38%); gap: 20px;
           align-items: center; background: linear-gradient(180deg, var(--card-top), transparent 70px), var(--surface);
           border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px;
           margin-bottom: 14px; box-shadow: var(--shadow-1); }
.pf-hero-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase;
                 letter-spacing: .06em; font-weight: 700; }
.pf-hero-value { display: block; font-size: 27px; font-weight: 700; letter-spacing: -.02em;
                 margin-top: 3px; line-height: 1.15; }
.pf-hero.pos .pf-hero-value { color: var(--up); }
.pf-hero.neg .pf-hero-value { color: var(--down); }
.pf-hero-pair { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 10px; font-size: 13px; color: var(--ink-2); }
.pf-hero-leg { display: inline-flex; align-items: center; gap: 7px; }
.pf-hero-leg .swatch { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.pf-hero-leg b { font-variant-numeric: tabular-nums; }
.pf-spark { width: 100%; min-height: 92px; position: relative; }

/* period comparison: two bars on one scale, the gap as a length */
.pf-bars { display: flex; flex-direction: column; }
.pf-bar-row { display: grid; grid-template-columns: 170px minmax(0, 1fr) 215px; gap: 14px; align-items: center;
              padding: 10px 0; border-top: 1px solid var(--grid); }
.pf-bar-row:first-child { border-top: 0; }
.pf-bar-label { font-size: 13px; font-weight: 650; }
.pf-bar-track { position: relative; height: 26px; }
.pf-bar-zero { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--baseline); opacity: .6; }
.pf-bar { position: absolute; height: 9px; border-radius: 3px; }
.pf-bar.you { top: 2px; background: var(--accent); }
.pf-bar.bench { top: 14px; background: #e8a33d; }
.pf-bar-vals { display: flex; align-items: baseline; gap: 8px; justify-content: flex-end;
               font-variant-numeric: tabular-nums; font-size: 13px; }
.pf-bar-vals b { font-size: 15px; font-weight: 700; }
.pf-bar-bench { color: var(--muted); }
.pf-chip { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 999px; font-style: normal;
           background: var(--grid); color: var(--ink-2); white-space: nowrap; }
.pf-chip.pos { background: color-mix(in srgb, var(--up) 14%, transparent); color: var(--up); }
.pf-chip.neg { background: color-mix(in srgb, var(--down) 14%, transparent); color: var(--down); }
.pf-foot { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 12px; }
.pf-foot .hint { flex: 1 1 260px; }
.pf-sub { display: block; font-size: 10.5px; color: var(--muted); font-weight: 400; }

/* gauges: each number against the reference that makes it mean something */
.pf-read { font-size: 14.5px; line-height: 1.5; margin: 0 0 14px; color: var(--ink); }
.pf-gauges { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 14px; }
.pf-gauge { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.pf-gauge-l { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase;
              letter-spacing: .05em; font-weight: 700; }
.pf-gauge-v { display: block; font-size: 22px; font-weight: 700; letter-spacing: -.01em; margin: 2px 0 8px; }
.pf-gauge-v.pos { color: var(--up); }
.pf-gauge-v.neg { color: var(--down); }
.pf-gauge-track { position: relative; height: 7px; border-radius: 999px; background: var(--grid); }
.pf-gauge-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); }
.pf-gauge-fill.pos { background: var(--up); }
.pf-gauge-fill.neg { background: var(--down); }
.pf-gauge-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink);
                 opacity: .45; border-radius: 1px; }
.pf-gauge-s { display: block; font-size: 11px; color: var(--muted); margin-top: 7px; }
.pf-tiles { grid-template-columns: repeat(6, minmax(0, 1fr)); }

/* drawdowns as cards with a depth bar, under the chart they belong to */
.pf-dd-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 10px; margin-top: 12px; }
.pf-dd { border: 1px solid var(--grid); border-radius: 12px; padding: 10px 12px; }
.pf-dd-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.pf-dd-head b { font-size: 17px; font-variant-numeric: tabular-nums; }
.pf-dd-bar { height: 5px; border-radius: 999px; background: var(--grid); margin: 8px 0 7px; overflow: hidden; }
.pf-dd-bar span { display: block; height: 100%; border-radius: 999px; background: var(--down); opacity: .65; }
.pf-dd-foot { font-size: 11.5px; color: var(--ink-2); }
.pf-open { color: var(--down); font-weight: 700; }

@media (max-width: 1100px) {
  .pf-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .pf-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-bar-row { grid-template-columns: 150px minmax(0, 1fr) 190px; }
}
@media (max-width: 760px) {
  /* no sideways scrolling: the bar rows fold, the heat grid runs six months
     to a line, the tiles pair up */
  .pf-hero { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .pf-hero-value { font-size: 21px; }
  .pf-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .pf-gauges { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .pf-gauge { padding: 10px 11px; }
  .pf-gauge-v { font-size: 18px; }
  .pf-bar-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 10px; padding: 12px 0; }
  .pf-bar-track { grid-column: 1 / -1; grid-row: 2; height: 22px; }
  .pf-bar-vals { grid-column: 2; grid-row: 1; }
  .pf-dd-list { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
  .pf-read { font-size: 13.5px; }
}

/* ---- Research: search box, cached badge ------------------------------- */
/* the box is a ticker box: it shows what you type the way the Terminal wants it */
#rs-q { text-transform: uppercase; }
#rs-q::placeholder { text-transform: none; letter-spacing: .02em; }
.rs-hit-note { margin-left: auto; font-style: normal; font-size: 10.5px; color: var(--muted);
               white-space: nowrap; }
.rs-ticker { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums;
             letter-spacing: .02em; margin: 2px 0 0; }
.badge.cached { background: color-mix(in srgb, var(--other, #e8a33d) 16%, transparent);
                color: var(--other, #b8791f); border: 1px solid color-mix(in srgb, var(--other, #e8a33d) 35%, transparent);
                font-size: 10px; font-weight: 800; letter-spacing: .05em; }

/* ---- Research compare: bars, tally, four names ------------------------ */
.rs-cmp-wins { font-size: 10px; font-weight: 800; letter-spacing: .04em; color: var(--muted);
               text-transform: uppercase; white-space: nowrap; }
.rs-cmp-bars { display: flex; flex-direction: column; gap: 11px; }
.rs-cmp-bar { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 10px; align-items: center; }
.rs-cmp-bl { font-size: 11.5px; color: var(--muted); font-weight: 650; }
.rs-cmp-bset { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
/* one row per name: the bar is the size of the number, the value sits beside it.
   The bar lives in its own track so a full-length bar cannot push its own label
   off the side of a phone. */
.rs-cmp-brow { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rs-cmp-track { flex: 1 1 auto; min-width: 0; display: block; }
.rs-cmp-brow i { display: block; height: 9px; border-radius: 3px; min-width: 2px; max-width: 100%; }
.rs-cmp-brow b { flex: 0 0 auto; }
.rs-cmp-brow b { font-size: 11.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rs-cmp-brow.best b { font-weight: 800; }
.rs-cmp-brow.best::after { content: "best"; font-size: 9px; font-weight: 800; letter-spacing: .05em;
                           text-transform: uppercase; color: var(--up); }
@media (max-width: 760px) {
  .rs-cmp-bar { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .rs-cmp-bl { font-size: 11px; }
  .rs-cmp-head { gap: 8px; }
  .rs-cmp-name { min-width: 0; }
}

/* ---- Research suggestions: the highlighted row and its market ---------- */
.rs-hit.active { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
.rs-hit.active .sym { color: var(--accent); }
.rs-hit-mkt { font-size: 9.5px; font-weight: 800; letter-spacing: .06em; padding: 1px 5px;
              border-radius: 4px; background: var(--grid); color: var(--muted); flex: 0 0 auto; }
.rs-hit-mkt.mkt-HK { background: color-mix(in srgb, #e8a33d 20%, transparent); color: #a86f14; }
.rs-hit-mkt.mkt-SP { background: color-mix(in srgb, #8b5cf6 20%, transparent); color: #6d43c7; }

/* ---- EQS screen: categories, sortable columns, clickable rows ---------- */
.eqs-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 4px 0 8px; }
.eqs-cats { display: flex; gap: 6px; flex-wrap: wrap; }
.eqs-cat { border: 1px solid var(--border); background: var(--surface); color: var(--ink-2);
           border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; white-space: nowrap; }
.eqs-cat b { color: var(--muted); font-weight: 700; margin-left: 3px; }
.eqs-cat.active { background: color-mix(in srgb, var(--accent) 14%, var(--surface));
                  border-color: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--accent); }
.eqs-cat.active b { color: var(--accent); }
.eqs-tip { margin: 0 0 6px; }
#eqs-table th.sortable { cursor: pointer; user-select: none; white-space: nowrap; }
#eqs-table th.sortable:hover { color: var(--ink); }
#eqs-table th.sorted { color: var(--accent); }
.sort-ar { font-style: normal; font-size: 9px; margin-left: 4px; }
#eqs-table tr.eqs-row { cursor: pointer; }
#eqs-table tr.eqs-row:hover td { background: color-mix(in srgb, var(--accent) 6%, transparent); }
#eqs-table tr.eqs-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
#eqs-table tr.eqs-group td { font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em;
                             color: var(--muted); background: var(--grid); padding-top: 8px; padding-bottom: 6px; }
#eqs-table tr.eqs-group b { color: var(--ink-2); margin-left: 4px; }
/* on a phone the chips wrap rather than scroll: no sideways swiping */

/* ---- Income: equity / fixed income ------------------------------------ */
.div-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.div-top .page-title { margin-bottom: 0; }
.div-sleeve button { padding: 6px 14px; }
.fi-stack { display: flex; width: 100%; border-radius: 6px; overflow: hidden; background: var(--grid); }
.fi-stack span { display: block; height: 100%; }
.fi-legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin-top: 8px; font-size: 12px; color: var(--ink-2); }
.fi-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; }
.fi-legend b { font-variant-numeric: tabular-nums; }
.fi-read { margin: 10px 0 0; font-size: 13.5px; }
.fi-rate-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.fi-rate { border: 1px solid var(--grid); border-radius: 10px; padding: 10px 12px; }
.fi-rate span { display: block; font-size: 11px; color: var(--muted); font-weight: 650; }
.fi-rate b { display: block; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fi-rate.pos b { color: var(--up); }
.fi-rate.neg b { color: var(--down); }
.fi-fund { margin-top: 14px; }
.fi-fund-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.fi-fund-id { display: flex; gap: 10px; align-items: center; min-width: 0; }
.fi-fund-id > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.fi-fund-id span { color: var(--ink-2); font-size: 12.5px; }
.fi-fund-id .dtag { align-self: flex-start; }
.fi-fund-pos { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; font-size: 12.5px; color: var(--ink-2); }
.fi-fund-pos b { font-size: 18px; color: var(--ink); }
.fi-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 14px 0; }
.fi-m { border: 1px solid var(--grid); border-radius: 10px; padding: 9px 11px; min-width: 0; }
.fi-m span { display: block; font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
.fi-m b { display: block; font-size: 17px; margin-top: 2px; font-variant-numeric: tabular-nums; }
.fi-m em { display: block; font-style: normal; font-size: 11px; color: var(--ink-2); margin-top: 1px; }
.fi-two { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.fi-sub { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 8px; }
.fi-ladder { display: flex; flex-direction: column; gap: 5px; }
.fi-rung { display: grid; grid-template-columns: 110px minmax(0, 1fr) 52px; gap: 8px; align-items: center; font-size: 12px; }
.fi-rung-l { color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fi-rung-t { height: 9px; background: var(--grid); border-radius: 4px; overflow: hidden; }
.fi-rung-t i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }
.fi-rung-v { text-align: right; font-variant-numeric: tabular-nums; }
.fi-src { margin: 10px 0 0; }
.fi-up { display: flex; flex-direction: column; }
.fi-up-row { display: grid; grid-template-columns: 70px minmax(0, 1fr) auto; gap: 10px; align-items: baseline;
             padding: 8px 0; border-top: 1px solid var(--grid); font-size: 13px; }
.fi-up-row:first-child { border-top: 0; }
.fi-up-row span { color: var(--ink-2); }
@media (max-width: 1100px) { .fi-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 760px) {
  .fi-rate-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fi-two { grid-template-columns: minmax(0, 1fr); }
  .fi-rung { grid-template-columns: 90px minmax(0, 1fr) 46px; }
  .fi-fund-pos { align-items: flex-start; }
}
.eqs-sort-m { display: none; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.eqs-sort-m select { flex: 1 1 auto; min-width: 0; }
@media (max-width: 760px) {
  .eqs-sort-m { display: flex; width: 100%; }
  .eqs-tip { display: none; }
}

/* ---------------------------------------------------------- market clock */
/* "Opens in 2h 14m" under the headline, and the bell (see bell.js): short,
 * once, and only for someone watching. Nothing loops. */
/* the countdown rides on the "last session" / after-hours line, and drops
   under it only when the two do not fit side by side */
.topline-row { display: flex; flex-wrap: wrap; align-items: center; column-gap: 12px; margin-top: 2px; }
.topline-row .topline-ext { margin-top: 0; }
/* The market clock (bell.js): the US trading day as a timeline - pre-market,
 * the session, after hours - the countdown to the next bell, and the bell. */
.mkt-clock { display: block; margin-top: 14px; max-width: 560px; font-variant-numeric: tabular-nums; }
.mkt-clock:empty { display: none; }
.mc-top { display: flex; align-items: center; gap: 10px; min-height: 42px; }
.mc-bell { flex: none; display: grid; place-items: center; width: 32px; height: 32px; padding: 0; cursor: pointer;
  border-radius: 50%; border: 1px solid var(--border); background: var(--surface); color: var(--ink-2); }
.mc-bell svg { width: 16px; height: 16px; fill: currentColor; }
.mc-bell:hover { color: var(--ink); border-color: var(--baseline); }
.mc-bell:hover .mc-bell-body { animation: bell-nudge .6s ease-in-out; transform-origin: 12px 3px; }
.mkt-clock[data-phase="regular"] .mc-bell { color: var(--up); border-color: color-mix(in srgb, var(--up) 40%, var(--border)); }
.mc-state { display: flex; flex-direction: column; min-width: 0; line-height: 1.2; }
.mc-name { font-size: 14px; font-weight: 650; color: var(--ink); }
.mkt-clock[data-phase="regular"] .mc-name { color: var(--up); }
.mc-state small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mc-count { margin-left: auto; display: flex; flex-direction: column; align-items: flex-end; line-height: 1.15; }
.mc-what { font-size: 11px; color: var(--muted); }
.mc-t { font-size: 21px; font-weight: 700; color: var(--ink-2); letter-spacing: -0.01em; white-space: nowrap; }
.mc-t u { text-decoration: none; font-size: 11px; font-weight: 600; color: var(--muted); margin: 0 1px 0 1px; }
.mc-top.soon .mc-t { color: var(--ink); }

.mc-strip { margin: 8px -8px 0; padding: 0 8px; overflow-x: clip; }       /* the now-marker slides; it must not widen the page */
.mc-track { position: relative; height: 8px; container-type: inline-size; }
.mc-lane { position: absolute; inset: 0; border-radius: 4px; overflow: hidden; background: var(--grid); }
.mc-seg { position: absolute; top: 0; bottom: 0; }
.mc-seg.pre, .mc-seg.post { background: color-mix(in srgb, var(--accent) 12%, var(--grid)); }
.mc-seg.reg { background: color-mix(in srgb, var(--up) 16%, var(--grid)); }
.mc-seg i { position: absolute; inset: 0; transform-origin: left center; transform: scaleX(0); transition: transform 1s linear; }
.mc-seg.pre i, .mc-seg.post i { background: color-mix(in srgb, var(--accent) 55%, transparent); }
.mc-seg.reg i { background: var(--up); }
.mc-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; margin-left: -1px; background: var(--surface); }
/* the now dot moves by the track's own width (cqw): a full-width strip slid
   along with transform reached past the page edge on phones and gave the
   Overview a gap on the right */
.mc-now { position: absolute; left: 0; top: 0; bottom: 0; width: 0; pointer-events: none; }
.mc-now i { transform: translateX(calc(var(--at, 0) * 100cqw)); transition: transform 1s linear; }
.mc-now i { position: absolute; left: -7px; top: -3px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--surface); border: 3px solid var(--ink-2); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.mkt-clock[data-phase="regular"] .mc-now i { border-color: var(--up); }
.mc-now.off { display: none; }
.mc-strip[data-phase="weekend"] .mc-lane, .mc-strip[data-phase="holiday"] .mc-lane, .mc-strip[data-phase="overnight"] .mc-lane { opacity: .7; }
.mc-ticks { position: relative; height: 30px; margin-top: 7px; font-size: 11px; color: var(--muted); }
.mc-ticks span { position: absolute; top: 0; transform: translateX(-50%); text-align: center; white-space: nowrap; line-height: 1.15; }
.mc-ticks span:first-child { transform: none; text-align: left; }
.mc-ticks span:last-child { transform: translateX(-100%); text-align: right; }
.mc-ticks small { display: block; font-size: 10px; }
.mc-ticks .key b { font-weight: 650; color: var(--ink-2); }

/* the bell: it swings and rings out, once */
.mc-ring { --bell: var(--up); display: flex; align-items: center; gap: 12px; animation: bell-arrive .4s ease-out; }
.mc-ring.close { --bell: var(--accent); }
.mc-ring-bell { position: relative; width: 36px; height: 36px; flex: none; display: grid; place-items: center; }
.mc-ring-bell svg { width: 30px; height: 30px; fill: var(--bell); overflow: visible; }
.mc-ring .mc-bell-body { transform-origin: 12px 3px; animation: bell-ring 2s cubic-bezier(.36, .07, .19, .97) .1s; }
.mc-ring .mc-bell-clapper { animation: bell-clapper 2s cubic-bezier(.36, .07, .19, .97) .1s; }
.mc-wave { position: absolute; inset: 3px; border-radius: 50%; border: 2px solid var(--bell); opacity: 0;
  animation: bell-wave 1.3s ease-out forwards; }
.mc-wave:nth-of-type(1) { animation-delay: .15s; }
.mc-wave:nth-of-type(2) { animation-delay: .5s; }
.mc-wave:nth-of-type(3) { animation-delay: .85s; }
.mc-ring-t { display: flex; flex-direction: column; line-height: 1.2; }
.mc-ring-t b { font-size: 15px; font-weight: 700; color: var(--ink); }
.mc-ring-t small { font-size: 12px; color: var(--muted); }
.mc-ring.still .mc-bell-body, .mc-ring.still .mc-bell-clapper, .mc-ring.still .mc-wave, .mc-ring.still { animation: none; }
@keyframes bell-ring {
  0% { transform: rotate(0); } 8% { transform: rotate(24deg); } 20% { transform: rotate(-20deg); }
  32% { transform: rotate(15deg); } 44% { transform: rotate(-11deg); } 56% { transform: rotate(7deg); }
  68% { transform: rotate(-4deg); } 80% { transform: rotate(2deg); } 100% { transform: rotate(0); }
}
@keyframes bell-clapper {
  0% { transform: translateX(0); } 8% { transform: translateX(-2.2px); } 20% { transform: translateX(2px); }
  32% { transform: translateX(-1.6px); } 44% { transform: translateX(1.2px); } 56% { transform: translateX(-.8px); }
  68% { transform: translateX(.4px); } 100% { transform: translateX(0); }
}
@keyframes bell-nudge { 0%, 100% { transform: rotate(0); } 25% { transform: rotate(14deg); } 50% { transform: rotate(-10deg); } 75% { transform: rotate(5deg); } }
@keyframes bell-wave { 0% { opacity: .7; transform: scale(.7); } 100% { opacity: 0; transform: scale(1.8); } }
@keyframes bell-arrive { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* the band of light along the day, left to right, as the bell rings */
.mc-beam { position: absolute; top: 0; bottom: 0; left: 0; width: 30%; opacity: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bell, var(--up)) 75%, #fff 25%), transparent); }
.mc-strip.open { --bell: var(--up); }
.mc-strip.close { --bell: var(--accent); }
.mc-strip.beam .mc-beam { animation: mc-beam 1.6s ease-in-out .15s; }
@keyframes mc-beam { 0% { opacity: 0; transform: translateX(-100%); } 15% { opacity: 1; } 85% { opacity: 1; } 100% { opacity: 0; transform: translateX(340%); } }

@media (max-width: 760px) {
  .mkt-clock { max-width: none; margin-top: 12px; }
  .mc-t { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .mc-seg i, .mc-now, .mc-now i { transition: none; }
  .mc-strip.beam .mc-beam, .mc-bell:hover .mc-bell-body { animation: none; }
}

/* The clock as a pill: the line and a hairline of the day, quiet until it
 * has something to say. Tapped, it opens the full day below it (an overlay,
 * so nothing under it moves); pinned, the day stays open in the page. */
.mkt-clock { position: relative; flex-direction: column; align-items: flex-start; }
.mkt-clock:not(:empty) { display: flex; }
.mkt-clock.pinned { align-items: stretch; }
.mc-pill { position: relative; min-width: 300px; max-width: 100%; padding: 5px 14px 10px 6px; border-radius: 16px; cursor: pointer;
           border: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 70%, transparent);
           transition: border-color .2s ease, box-shadow .2s ease, background-color .3s ease; -webkit-tap-highlight-color: transparent; }
.mc-pill:hover { border-color: var(--baseline); }
.mc-pill:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mkt-clock.open .mc-pill { box-shadow: var(--shadow); border-color: var(--baseline); }
.mkt-clock.pinned .mc-pill { cursor: default; padding-bottom: 5px; }
.mc-pill .mc-top { min-height: 34px; gap: 9px; }
.mc-pill .mc-bell { width: 28px; height: 28px; border: none; background: color-mix(in srgb, var(--ink) 6%, transparent); }
.mc-pill .mc-bell svg { width: 15px; height: 15px; }
.mc-pill .mc-name { font-size: 13px; }
.mc-pill .mc-state small { font-size: 11px; }
.mc-pill .mc-what { font-size: 10px; }
.mc-pill .mc-t { font-size: 17px; }
.mc-pill .mc-t u { font-size: 10px; }
/* a chevron that says it opens */
.mc-pill .mc-top[data-mode="plain"]::after { content: ""; flex: none; width: 6px; height: 6px; margin: 0 0 3px 2px;
  border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg);
  transition: transform .25s cubic-bezier(.2, .8, .25, 1); }
.mkt-clock.open .mc-pill .mc-top[data-mode="plain"]::after { transform: translateY(3px) rotate(225deg); }
.mkt-clock.pinned .mc-pill .mc-top::after { display: none; }
/* a new phase or the end of a bell message arrives instead of snapping */
.mc-pill .mc-top[data-mode="plain"] > * { animation: bell-arrive .35s ease-out; }
/* the final seconds and the bell: the pill takes the tone, the box inside goes */
.mc-pill .mc-final { background: none; border: none; padding: 0 2px; }
.mc-pill:has(.mc-final.close), .mc-pill:has(.mc-ring.close) { border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
  background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.mc-pill:has(.mc-final.open), .mc-pill:has(.mc-ring.open) { border-color: color-mix(in srgb, var(--up) 45%, var(--border));
  background: color-mix(in srgb, var(--up) 7%, var(--surface)); }
/* the hairline of the day along the pill's foot */
.mc-strip.mini { position: absolute; left: 14px; right: 14px; bottom: 5px; margin: 0; padding: 0; overflow: visible; }
.mc-strip.mini .mc-track { height: 3px; }
.mc-strip.mini .mc-lane { border-radius: 2px; }
.mc-strip.mini .mc-now i { left: -3.5px; top: -2px; width: 7px; height: 7px; border-width: 1.5px; box-shadow: none; }
.mkt-clock.pinned .mc-strip.mini { display: none; }
/* the full day, dropping down from the pill */
.mc-pop { position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: min(560px, calc(100vw - 32px));
          padding: 12px 18px 10px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border);
          box-shadow: var(--shadow); opacity: 0; visibility: hidden; pointer-events: none;
          transform: translateY(-6px) scale(.985); transform-origin: 30px 0;
          transition: opacity .16s ease, transform .2s ease, visibility 0s linear .2s; }
.mkt-clock.open .mc-pop { opacity: 1; visibility: visible; pointer-events: auto; transform: none;
                          transition: opacity .18s ease, transform .26s cubic-bezier(.2, .8, .25, 1); }
.mkt-clock.pinned .mc-pop { position: static; width: auto; padding: 4px 0 0; opacity: 1; visibility: visible; pointer-events: auto;
                            transform: none; background: none; border: none; box-shadow: none; transition: none; }
.mc-pop .mc-strip { margin-top: 6px; }
.mc-pin { display: inline-flex; align-items: center; gap: 6px; margin-top: 2px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.mc-pin input { margin: 0; }
.mkt-clock.pinned .mc-pin { opacity: .75; }

/* While it rings the bell turns brass, and one glint of light crosses it,
 * left to right, as it starts. */
.mc-final.ringing .mc-final-bell svg, .mc-ring-bell svg { fill: url(#pm-brass); }
.mc-final.ringing .mc-wave, .mc-ring .mc-wave { border-color: #d9a73e; }
.mc-final.ringing .mc-final-bell, .mc-ring-bell { filter: drop-shadow(0 1px 3px rgba(150, 100, 20, .35)); }
.mc-glint { opacity: 0; }
.mc-final.ringing .mc-glint { animation: bell-glint .9s ease-out .05s; }
.mc-ring:not(.settle) .mc-glint { animation: bell-glint .9s ease-out .12s; }
@keyframes bell-glint { from { opacity: 1; transform: translateX(0); } to { opacity: 1; transform: translateX(38px); } }

@media (max-width: 760px) {
  .mc-pill { width: 100%; min-width: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .mc-pop, .mkt-clock.open .mc-pop, .mc-pill .mc-top[data-mode="plain"]::after { transition: none; }
  .mc-pill .mc-top[data-mode="plain"] > *, .mc-glint { animation: none !important; }
}

/* one ripple from every live dot */
.live-dot.ripple { position: relative; }
.live-dot.ripple::after { content: ""; position: absolute; inset: 0; border-radius: 50%;
                          border: 2px solid var(--up); animation: dot-ripple 1.2s ease-out 2; }
@keyframes dot-ripple { from { transform: scale(1); opacity: .8; } to { transform: scale(3.4); opacity: 0; } }

/* The bell (bell.js): one band of light passing left to right, over the
 * headline and then across the 1D chart. Green at the open, neutral at the
 * close; only transform, opacity and clip-path move, so it stays smooth on a
 * phone. --bell is the colour, --scan the chart pass's length. */
.bell-layer, .hero-sheen { --bell: var(--up); }
.bell-layer.close, .hero-sheen.close { --bell: var(--ink-2); }

.chart-panel { position: relative; }
.bell-layer { position: absolute; pointer-events: none; overflow: hidden; z-index: 2; }
/* what the band leaves behind: revealed left to right, then gone */
/* linear on purpose: bell.js works out when the band reaches the Open line
   and the newest point, and lights them exactly then */
.bell-wash { position: absolute; inset: 0;
  background: linear-gradient(180deg, color-mix(in srgb, var(--bell) 10%, transparent), transparent 85%);
  clip-path: inset(0 100% 0 0);
  animation: bell-reveal calc(var(--scan) / 1.18) linear .25s forwards,
             bell-fade 1s ease-out calc(.25s + var(--scan)) forwards; }
/* the band itself */
.bell-scan { position: absolute; top: 0; bottom: 0; left: 0; width: 18%; margin-left: -18%;
  background: linear-gradient(90deg, transparent,
    color-mix(in srgb, var(--bell) 22%, transparent) 70%,
    color-mix(in srgb, var(--bell) 55%, transparent) 97%, transparent);
  --travel: 656%;                           /* the plot's width plus its own, in its own widths */
  opacity: 0; animation: bell-scan var(--scan) linear .25s forwards; }
/* the Open / Close line lights as the band reaches it (delay set inline) */
.bell-beam { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; opacity: 0;
  background: var(--bell); transform-origin: 50% 100%;
  box-shadow: 0 0 14px 2px color-mix(in srgb, var(--bell) 50%, transparent);
  animation: bell-beam 1.9s ease-out forwards; }
/* the tag sits under the chart's Pre / Day / Post labels */
.bell-tag { position: absolute; top: 12px; transform: translateX(-50%); white-space: nowrap; opacity: 0;
  font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px;
  background: var(--surface); color: var(--bell); border: 1px solid var(--bell);
  animation: bell-tag 2.2s ease-out forwards; }
.bell-layer.close .bell-tag { border-color: var(--border); }
/* the newest point: a glow and two ripples, where the band ends on the line */
.bell-dot { position: absolute; width: 0; height: 0; }
.bell-dot i { position: absolute; left: -5px; top: -5px; width: 10px; height: 10px; border-radius: 50%;
  border: 2px solid var(--bell); opacity: 0; animation: bell-dot 1.3s ease-out forwards; }
.bell-dot i { animation-delay: var(--at); }
.bell-dot i + i { animation-delay: calc(var(--at) + .35s); }
.bell-dot::before { content: ""; position: absolute; left: -4px; top: -4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--bell); opacity: 0;
  box-shadow: 0 0 12px 3px color-mix(in srgb, var(--bell) 55%, transparent);
  animation: bell-glow 2s ease-out var(--at) forwards; }

/* the headline: the same band, a beat earlier, and a ring from the countdown */
.hero-main { position: relative; }
.hero-sheen { position: absolute; inset: -6px -10px; pointer-events: none; overflow: hidden;
  border-radius: 12px; z-index: 1; }
.hero-band { position: absolute; top: 0; bottom: 0; left: 0; width: 35%; margin-left: -35%;
  background: linear-gradient(100deg, transparent,
    color-mix(in srgb, var(--bell) 16%, transparent) 60%, transparent);
  --travel: 386%;
  animation: bell-scan .9s ease-in-out forwards; }
.hero-ring { position: absolute; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  border: 2px solid var(--bell); opacity: 0; animation: hero-ring 1.2s ease-out .1s forwards; }

@keyframes bell-scan {
  0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; }
  88% { opacity: 1; } 100% { transform: translateX(var(--travel)); opacity: 0; }
}
@keyframes bell-reveal { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes bell-fade { from { opacity: 1; } to { opacity: 0; } }
@keyframes bell-beam {
  0% { opacity: 0; transform: scaleY(.2); } 12% { opacity: 1; transform: scaleY(1); }
  60% { opacity: .8; } 100% { opacity: 0; transform: scaleY(1); }
}
@keyframes bell-tag {
  0% { opacity: 0; transform: translate(-50%, 4px); } 15%, 75% { opacity: 1; transform: translate(-50%, 0); }
  100% { opacity: 0; transform: translate(-50%, 0); }
}
@keyframes bell-dot { 0% { opacity: .9; transform: scale(1); } 100% { opacity: 0; transform: scale(3.6); } }
@keyframes bell-glow { 0% { opacity: 0; } 15% { opacity: 1; } 70% { opacity: .9; } 100% { opacity: 0; } }
@keyframes hero-ring { 0% { opacity: .7; transform: scale(1); } 100% { opacity: 0; transform: scale(14); } }

@media (prefers-reduced-motion: reduce) {
  .bell-layer, .hero-sheen { display: none; }
  .mkt-clock.ring, .mkt-clock.ring .mc-icon, .live-dot.ripple::after { animation: none; }
}
.bell-preview { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: -2px 0 6px 23px; }

/* ---------------------------------------------------------- key events */
/* One status look everywhere (events.js): a countdown, IMMINENT, live while
 * the figure is awaited, then the figure. The dot only pulses while an
 * event is imminent or live, and a landed figure gets the bell's band of
 * light, once. */
.ev-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 650;
           padding: 2px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
           background: var(--grid); color: var(--ink-2); }
.ev-pill i { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .45; flex: none; }
.ev-pill.imminent { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.ev-pill.live { background: color-mix(in srgb, var(--up) 16%, transparent); color: var(--up); }
.ev-pill.imminent i, .ev-pill.live i { opacity: 1; animation: ev-pulse 1.6s ease-out infinite; }
.ev-pill.done { color: var(--muted); }
.ev-pill.stale { color: var(--muted); background: none; padding-left: 0; }
@keyframes ev-pulse {
  0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 55%, transparent); }
  100% { box-shadow: 0 0 0 7px transparent; }
}
.ev-fig { font-weight: 750; font-variant-numeric: tabular-nums; }
.ev-fig.pos { color: var(--up); }
.ev-fig.neg { color: var(--down); }
.ev-vs { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.ev-reg { font-size: 10px; font-weight: 700; letter-spacing: .04em; padding: 1px 5px; border-radius: 4px;
          background: var(--grid); color: var(--ink-2); flex: none; }

/* the Overview card */
.ev-label { display: flex; align-items: center; justify-content: space-between; }
.ev-link { appearance: none; border: 0; background: none; font: inherit; font-size: 11px; font-weight: 650;
           text-transform: none; letter-spacing: 0; color: var(--accent); cursor: pointer; padding: 0; }
.ev-list { display: flex; flex-direction: column; }
.ev-row { appearance: none; border: 0; border-top: 1px solid var(--grid); background: none; font: inherit; color: inherit;
          text-align: left; cursor: pointer; display: grid; grid-template-columns: auto minmax(0, 1fr) auto;
          gap: 8px; align-items: center; padding: 6px 2px; position: relative; overflow: hidden; border-radius: 6px; }
.ev-row:first-child { border-top: 0; }
.ev-row:hover { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ev-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.ev-name b { font-size: 12px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-name small { font-size: 10.5px; color: var(--muted); }
.ev-right { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }

/* the live line under the headline */
.hero-event { appearance: none; font: inherit; color: inherit; cursor: pointer; display: inline-flex; align-items: center;
              gap: 8px; max-width: 100%; margin-top: 8px; padding: 4px 10px 4px 5px; border-radius: 999px;
              border: 1px solid var(--border); background: var(--surface); font-size: 12.5px;
              position: relative; overflow: hidden; box-shadow: var(--shadow-1); }
.hero-event[hidden] { display: none; }
.hero-event b { font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.hero-event .ev-go { color: var(--muted); }
.hero-event.st-imminent { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.hero-event.st-live { border-color: color-mix(in srgb, var(--up) 45%, var(--border)); }

/* a figure just landed, or arriving from the Overview: the bell's band of
   light, left to right, once */
.ev-flash::after, .ag-flash::after, .ag-focus::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--bell-c, var(--up)) 24%, transparent) 75%, transparent);
  transform: translateX(-100%); animation: ev-sweep 1.3s ease-out forwards; }
.ag-focus { --bell-c: var(--accent); box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--accent) 55%, transparent); }
@keyframes ev-sweep { to { transform: translateX(100%); } }

/* an announcement: a holding just filed or announced something. It glides in
   at the corner (above the bottom bar on a phone) with the band of light,
   stays a few seconds, and leads to the event when tapped. */
.cev-toasts { position: fixed; right: 20px; bottom: 20px; z-index: 50; width: min(380px, calc(100vw - 32px));
              display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.cev-toast { appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; pointer-events: auto;
             display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 10px; align-items: start;
             padding: 10px 10px 10px 12px; border-radius: 12px; border: 1px solid var(--border);
             background: var(--surface); box-shadow: var(--shadow); position: relative; overflow: hidden;
             transition: transform .32s cubic-bezier(.2, .7, .2, 1), opacity .32s ease; }
.cev-toast::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; background: var(--s3); }
.cev-toast.i3::before { background: var(--accent); }
.cev-toast .tlogo { width: 30px; height: 30px; }
.cev-t-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cev-t-meta { display: flex; align-items: center; gap: 6px; font-size: 11.5px; min-width: 0; }
.cev-t-meta b { font-size: 12.5px; }
.cev-t-meta .ag-kind { margin-left: 0; }
.cev-t-when { color: var(--muted); margin-left: auto; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cev-t-title { font-size: 12.5px; line-height: 1.35; color: var(--ink); display: -webkit-box; -webkit-line-clamp: 2;
               -webkit-box-orient: vertical; overflow: hidden; }
.cev-t-x { appearance: none; border: 0; background: none; color: var(--muted); font: inherit; font-size: 16px;
           line-height: 1; padding: 2px 4px; cursor: pointer; border-radius: 6px; }
.cev-t-x:hover { color: var(--ink); background: var(--grid); }
.cev-toast.arrive { animation: cev-in .42s cubic-bezier(.2, .7, .2, 1) both; }
.cev-toast.arrive::after {
  content: ""; position: absolute; inset: 0; pointer-events: none; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--accent) 22%, transparent) 75%, transparent);
  animation: ev-sweep 1.3s ease-out .25s forwards; }
.cev-toast.out { opacity: 0; transform: translateX(28px); pointer-events: none; }
@keyframes cev-in { from { opacity: 0; transform: translateX(32px); } }
@keyframes cev-fade { from { opacity: 0; } }
@media (max-width: 760px) {
  /* a phone: across the screen, above the bottom bar, gliding up */
  .cev-toasts { left: 12px; right: 12px; width: auto; bottom: calc(80px + env(safe-area-inset-bottom)); }
  .cev-toast.arrive { animation-name: cev-in-up; }
  .cev-toast.out { transform: translateY(12px); }
  @keyframes cev-in-up { from { opacity: 0; transform: translateY(16px); } }
}
@media (prefers-reduced-motion: reduce) {
  .cev-toast { transition: opacity .2s ease; }
  .cev-toast.arrive { animation: cev-fade .2s ease both; }
  .cev-toast.arrive::after { display: none; }
  .cev-toast.out { transform: none; }
}
@media (prefers-reduced-motion: reduce) {
  .ev-pill.imminent i, .ev-pill.live i { animation: none; }
  .ev-flash::after, .ag-flash::after, .ag-focus::after { animation: none; display: none; }
}
@media (max-width: 760px) {
  .hero-event { font-size: 12px; }
}

/* ============ overview layout (v6): one grid, one gap ============
 * Supersedes the layered v4/v5 rules above. The page is a column of
 * sections spaced by one value (--ov-gap); on a desktop the chart and
 * "What's moving" share a row and are the same height (no hole under the
 * chart when the rail runs longer), and "At a glance" is one full-width row
 * of four equal-height columns:
 *   Key events | the three small stats, stacked | Needs attention | Coming up
 * On a tablet or phone everything stacks with the same gap: the lists run
 * the full width, the small stats sit two-up. */
#tab-dashboard { --ov-gap: 16px; }
#tab-dashboard > .hero { margin-bottom: var(--ov-gap); }
#tab-dashboard .perf-grid { gap: var(--ov-gap); margin-bottom: var(--ov-gap); }
#tab-dashboard .perf-grid > .panel { margin-bottom: 0; }
.gl-stack { display: flex; flex-direction: column; gap: var(--ov-gap, 12px); min-width: 0; }
.glance-rail #glance-cards { display: flex; flex-direction: column; gap: var(--ov-gap, 12px); }

@media (min-width: 1000px) {
  #tab-dashboard .perf-grid { grid-template-columns: minmax(0, 1fr) 280px; align-items: stretch; }
  #tab-dashboard .chart-panel { height: 100%; }
  #tab-dashboard .glance-rail { grid-column: 1 / -1; flex-direction: column; flex-wrap: nowrap; padding-top: 0; }
  .glance-rail .panel-title { flex-basis: auto; margin-bottom: 0; }
  .glance-rail #glance-cards {
    display: grid; width: 100%; align-items: stretch;
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr) minmax(0, 1.25fr) minmax(0, 1fr);
  }
  .glance-rail .ev-card { grid-column: auto; }
  .gl-stack .gl-card { flex: 1 1 auto; }
  #glance-cards .gl-card { max-height: none; overflow: visible; }
  #glance-cards .gl-item:nth-child(n+4) { display: grid; }
}
@media (min-width: 1000px) and (max-width: 1279px) {
  /* four columns get too narrow here: two by two */
  .glance-rail #glance-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1500px) {
  #tab-dashboard .perf-grid { grid-template-columns: minmax(0, 1fr) 300px; }
}

@media (max-width: 999px) {
  #tab-dashboard { --ov-gap: 12px; }
  #tab-dashboard.active { display: flex; flex-direction: column; gap: var(--ov-gap); }
  #tab-dashboard .perf-grid { display: contents; }
  #tab-dashboard > .hero, #tab-dashboard > .panel, #tab-dashboard .perf-grid > * { margin: 0; }
  #tab-dashboard .hero { order: 0; }
  #tab-dashboard .chart-panel { order: 1; }
  #tab-dashboard > .panel { order: 2; }                  /* holdings */
  #tab-dashboard .movers-rail { order: 3; padding-top: 0; }
  #tab-dashboard .glance-rail { order: 4; padding-top: 0; }
  .glance-rail .panel-title { display: block; margin-bottom: 0; }
  .glance-rail #glance-cards {
    display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--ov-gap);
    overflow: visible; padding-bottom: 0; align-items: stretch;
  }
  .gl-stack { display: contents; }
  #glance-cards > .gl-card, .gl-stack > .gl-card:first-child { grid-column: 1 / -1; }
  #glance-cards .gl-card { flex: none; max-height: none; overflow: visible; }
  #glance-cards .gl-item:nth-child(n+4) { display: grid; }
}

/* Core & Satellite: the size ranking (companies outside the top 9 read as context) */
.rc-board .muted-row td { color: var(--muted); }
.rc-board { margin-top: 4px; }

/* Core & Satellite activity: one action per row, grouped by day */
.rc-howto { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 16px; margin: 4px 0 12px;
            font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.rc-howto .badge { margin-right: 4px; }
.rc-act-bar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.badge.sleeve { font-size: 10px; letter-spacing: .04em; }
.badge.sleeve.core { color: var(--accent2); background: color-mix(in srgb, var(--accent2) 12%, transparent); }
.badge.sleeve.sat { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.badge.act { font-weight: 700; min-width: 34px; text-align: center; }
.badge.buy.act { background: color-mix(in srgb, var(--up) 12%, transparent); }
.badge.sell.act { background: color-mix(in srgb, var(--down) 12%, transparent); }
.rc-activity .rc-act-cell { white-space: nowrap; }
.rc-activity .rc-why { font-size: 12px; color: var(--ink-2); min-width: 220px; }
.rc-activity tr.day-first td { border-top: 1px solid var(--baseline); }
.rc-activity tr.day-more td { border-top-color: transparent; }
@media (max-width: 760px) {
  .rc-howto { grid-template-columns: minmax(0, 1fr); }
  .rc-activity .rc-why { min-width: 0; }
}

/* Research: is the Bloomberg Terminal usable right now */
.rs-search { position: relative; }
.rs-bbg { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600;
          padding: 3px 10px; border-radius: 999px; margin-bottom: 6px; background: var(--grid); color: var(--ink-2); }
.rs-bbg i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.rs-bbg.up { color: var(--up); background: color-mix(in srgb, var(--up) 10%, transparent); }
.rs-bbg.down { color: #b7791f; background: color-mix(in srgb, #fab219 16%, transparent); }
.rs-bbg-why { font-weight: 500; opacity: .85; }

/* ================================ activity ================================ */
.act-head { display: flex; align-items: baseline; gap: 12px; }
.act-head .panel-sub { margin-left: auto; }
.act-summary { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.act-summary .tile-value { font-size: 18px; font-variant-numeric: tabular-nums; }
.act-summary .tile-value.up { color: var(--up); }
.act-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.act-tools .chart-toggle { margin-left: 0; flex-wrap: wrap; }
.act-tools .chart-toggle button:disabled { opacity: .4; cursor: default; }
.act-count { font-size: 10.5px; font-weight: 600; margin-left: 5px; opacity: .6; font-variant-numeric: tabular-nums; }
.act-search { display: flex; gap: 8px; margin-left: auto; }
.act-search input, .act-search select {
  font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: 9px; padding: 6px 10px; min-width: 0;
}
.act-search input { width: 210px; }

.act-month { margin-bottom: 22px; }
.act-month-h { display: flex; align-items: baseline; gap: 10px; margin: 0 2px 8px; font-size: 16px; font-weight: 700; }
.act-month-sum { font-size: 12px; font-weight: 500; color: var(--muted); }
.act-month-sum .up { color: var(--up); }
.act-day { margin-bottom: 12px; }
.act-day-h {
  display: flex; align-items: baseline; gap: 8px; padding: 6px 2px; position: sticky; top: 0;
  background: var(--page); z-index: 3; font-size: 12px; color: var(--ink-2);
}
.act-day-h b { font-size: 13px; color: var(--ink); }
.act-day-h.today b { color: var(--accent); }
.act-rel { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px;
           border-radius: 999px; background: var(--grid); color: var(--ink-2); }
.act-day-h.today .act-rel { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.act-day-net { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--muted); }
.act-day-net.up { color: var(--up); }
.act-day-cash { font-variant-numeric: tabular-nums; font-weight: 600; color: var(--ink-2); }
.act-day-net:empty + .act-day-cash { margin-left: auto; }
.act-list { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-1); overflow: hidden; }

.act-item + .act-item { border-top: 1px solid var(--grid); }
.act-row {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 12px; align-items: center;
  padding: 10px 14px; cursor: pointer; transition: background .15s;
}
.act-row:hover { background: color-mix(in srgb, var(--accent) 4%, transparent); }
.act-row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.act-item.open .act-row { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.act-ico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; }
.act-ico svg { width: 18px; height: 18px; }
.act-ico.t-buy { color: var(--accent); background: color-mix(in srgb, var(--accent) 13%, transparent); }
.act-ico.t-sell { color: var(--s8); background: color-mix(in srgb, var(--s8) 14%, transparent); }
.act-ico.t-dividend { color: var(--up); background: color-mix(in srgb, var(--up) 13%, transparent); }
.act-ico.t-deposit { color: var(--s5); background: color-mix(in srgb, var(--s5) 13%, transparent); }
.act-ico.t-withdraw { color: var(--ink-2); background: var(--grid); }
.act-main { min-width: 0; }
.act-title { font-size: 13.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.act-title b { font-weight: 700; }
.act-name { color: var(--muted); font-size: 12px; margin-left: 7px; }
.act-sub { font-size: 12px; color: var(--ink-2); margin-top: 2px; font-variant-numeric: tabular-nums;
           display: flex; flex-wrap: wrap; align-items: center; gap: 3px 8px; }
.act-facts { display: inline-flex; flex-wrap: wrap; align-items: center; }
.act-dot { color: var(--muted); margin: 0 6px; }
.act-summary .tile-sub .pos { color: var(--up); } .act-summary .tile-sub .neg { color: var(--down); }
.act-tag, .act-flag { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--grid); color: var(--ink-2); }
.act-flag { background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); }
.act-note { color: var(--muted); font-style: italic; }
.act-real { font-weight: 650; }
.act-real.pos, .act-real.up { color: var(--up); }
.act-real.neg, .act-real.down { color: var(--down); }
.act-amt { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.act-money { font-size: 14px; font-weight: 700; color: var(--ink); }
.act-money.in { color: var(--up); }
.act-cash { font-size: 11.5px; color: var(--muted); margin-top: 2px; }

/* the breakdown glides open (grid rows 0fr -> 1fr): no jump, no measuring */
.act-detail { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .22s ease; }
.act-item.open .act-detail { grid-template-rows: 1fr; }
.act-detail-in { overflow: hidden; min-height: 0; }
.act-item.open .act-detail-in { padding: 4px 14px 14px 62px; }
.act-kvs { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 22px; padding: 8px 0 4px; }
.act-kv { display: flex; flex-direction: column; gap: 1px; font-size: 12.5px; min-width: 0; }
.act-kv span { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.act-kv b { font-weight: 600; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.act-kv em, .act-field em { font-style: normal; color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; }
.act-actions { display: flex; align-items: center; gap: 6px; margin-top: 10px; grid-column: 1 / -1; }
.act-grow { flex: 1; }
.btn.danger { color: var(--down); }
.act-edit { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px 12px; padding-top: 8px; }
.act-field { display: flex; flex-direction: column; gap: 4px; font-size: 10.5px; font-weight: 650;
             text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.act-field input {
  font: inherit; font-size: 13px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px;
  width: 100%; box-sizing: border-box; font-variant-numeric: tabular-nums;
}
.act-field input:focus { outline: 2px solid color-mix(in srgb, var(--accent) 50%, transparent); border-color: var(--accent); }
#act-more { display: block; margin: 4px auto 0; }
@media (prefers-reduced-motion: reduce) {
  .act-detail, .act-row { transition: none; }
}

/* phones: one column, nothing wider than the screen */
@media (max-width: 700px) {
  .act-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .act-summary .tile { padding: 8px 10px; border-radius: 10px; min-width: 0; }
  .act-summary .tile-label { font-size: 9.5px; letter-spacing: .03em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .act-summary .tile-value { font-size: 14.5px; }
  .act-summary .tile-sub { font-size: 10.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .act-count { display: none; }
  .act-tools .chart-toggle { flex-wrap: nowrap; width: 100%; }
  .act-tools .chart-toggle button { flex: 1 1 auto; padding-left: 4px; padding-right: 4px; font-size: 12px; }
  .act-search { margin-left: 0; width: 100%; }
  .act-search input { flex: 1; width: auto; }
  .act-row { grid-template-columns: 32px minmax(0, 1fr) auto; gap: 10px; padding: 10px 12px; }
  .act-ico { width: 32px; height: 32px; border-radius: 10px; }
  .act-name { display: none; }
  .act-item.open .act-detail-in { padding: 2px 12px 12px; }
  .act-kvs { grid-template-columns: 1fr 1fr; gap: 8px 14px; }
  .act-edit { grid-template-columns: 1fr 1fr; }
  .act-edit .act-field:last-of-type { grid-column: 1 / -1; }
  .act-day-net { display: none; }
  .act-day-cash { margin-left: auto; }
}

/* ======================== price vs estimates (R28) ======================== */
#div-panel .panel-head .btn { margin-left: 8px; }
.div-lists { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 6px; }
.div-list { border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; min-width: 0;
            background: linear-gradient(180deg, color-mix(in srgb, var(--tone) 7%, transparent), transparent 70px); }
.div-list.watch { --tone: var(--accent); }
.div-list.caution { --tone: #d99a17; }
.div-head { display: flex; align-items: center; gap: 8px; }
.div-head h3 { margin: 0; font-size: 15px; }
.div-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; padding: 1px 7px;
            border-radius: 999px; color: var(--tone); background: color-mix(in srgb, var(--tone) 14%, transparent); }
.div-count { margin-left: auto; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.div-evidence { font-size: 12px; color: var(--ink-2); margin: 6px 0 10px; line-height: 1.45; }
.div-rows { display: flex; flex-direction: column; gap: 6px; }
.div-row {
  appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; width: 100%;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; align-items: center;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 9px 12px;
  transition: border-color .15s, background .15s;
}
.div-row:hover { border-color: color-mix(in srgb, var(--tone) 45%, var(--border)); }
.div-row:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.div-id { min-width: 0; }
.div-id .asset-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.div-facts { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 4px 10px;
             font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.div-facts em { font-style: normal; color: var(--muted); }
.div-z { font-weight: 700; color: var(--tone); }
.div-tag { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--grid); color: var(--ink-2); }
.dvg { grid-column: 1 / -1; display: grid; grid-template-columns: auto minmax(0, 1fr) 62px; gap: 3px 10px;
      align-items: center; font-size: 11px; }
.dvg-k { color: var(--muted); }
.dvg b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 650; }
.dvg b.pos { color: var(--up); } .dvg b.neg { color: var(--down); }
.dvg-bar { position: relative; height: 6px; border-radius: 3px; background: var(--grid); overflow: hidden; }
.dvg-bar::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--baseline); }
.dvg-bar i { position: absolute; top: 0; bottom: 0; border-radius: 3px; }
.dvg-bar i.pos { background: var(--up); } .dvg-bar i.neg { background: var(--down); }
.div-row.near { padding: 7px 12px; }
.div-row.near .asset-name { display: none; }
.div-near { margin-top: 10px; }
.div-near summary { cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.div-near summary .hint { font-weight: 400; margin-left: 4px; }
.div-dropped { margin-top: 14px; }
.tag.sig { cursor: pointer; font-weight: 650; }
.hm-sig { display: block; margin-top: 2px; line-height: 1; }
.hm-sig .tag.sig { display: inline-block; font-size: 10px; padding: 1px 6px; }
.div-lists { align-items: start; }
#div-panel .panel-head { flex-wrap: wrap; row-gap: 4px; }
.tag.sig.caution { color: #b7791f; background: color-mix(in srgb, #fab219 16%, transparent); }
.tag.sig.watch { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.rs-signal { display: flex; flex-direction: column; gap: 3px; margin: 0 0 14px; padding: 10px 14px; border-radius: 12px;
             font-size: 13px; border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--border));
             background: color-mix(in srgb, var(--tone) 8%, var(--surface)); }
.rs-signal.caution { --tone: #d99a17; } .rs-signal.watch { --tone: var(--accent); }
.rs-signal b { color: var(--tone); }
.rs-signal-ev { font-size: 12px; color: var(--ink-2); }
@media (max-width: 700px) {
  .div-lists { grid-template-columns: minmax(0, 1fr); }
  .div-row { grid-template-columns: minmax(0, 1fr); }
  .div-facts { justify-content: flex-start; }
}

/* ============================ supply chain ============================ */
.sc-lead { font-size: 13px; margin: 0 0 12px; padding: 8px 12px; border-radius: 10px;
           background: color-mix(in srgb, var(--accent) 8%, transparent); }
.sc-cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.sc-cols h3, .sc-inside h3 { font-size: 13px; margin: 0 0 8px; }
.sc-cols h3 .hint, .sc-inside h3 .hint { font-weight: 400; margin-left: 4px; }
.sc-rows { display: flex; flex-direction: column; }
.sc-row, .sc-rank {
  appearance: none; font: inherit; color: inherit; text-align: left; background: none; border: none; cursor: pointer;
  display: grid; grid-template-columns: minmax(0, 1fr) 150px; gap: 2px 12px; align-items: center;
  padding: 7px 6px; border-top: 1px solid var(--grid); border-radius: 6px; width: 100%;
}
.sc-row:hover, .sc-rank:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.sc-name, .sc-rank-n { min-width: 0; font-size: 13px; }
.sc-name b, .sc-rank-n b { font-weight: 600; }
.sc-name small, .sc-rank-n small { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sc-w { position: relative; display: flex; align-items: center; gap: 8px; }
.sc-w i { display: block; height: 7px; border-radius: 4px; background: linear-gradient(90deg, var(--accent), var(--accent2)); flex: 0 0 auto; max-width: 95px; }
.sc-w b { font-size: 12.5px; font-variant-numeric: tabular-nums; margin-left: auto; }
.sc-meta { grid-column: 1 / -1; font-size: 11.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sc-meta .pos { color: var(--up); } .sc-meta .neg { color: var(--down); }
.sc-rep { font-size: 10.5px; font-weight: 650; padding: 1px 6px; border-radius: 5px; background: var(--grid); color: var(--ink-2); margin-left: 4px; }
.sc-rep.soon { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.sc-foot { margin-top: 10px; }
.sc-inside { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: center; margin-bottom: 18px; }
.sc-pairs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.sc-pairs li { font-size: 12.5px; line-height: 1.45; }
.sc-pairs li .sc-desc { display: block; color: var(--ink-2); font-size: 12px; }
.sc-more summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--ink-2); padding: 6px; border-top: 1px solid var(--grid); }
.sc-arr { color: var(--muted); }
.sc-map { width: 100%; height: auto; max-height: 320px; }
.sc-map .sc-edges path { fill: none; stroke: color-mix(in srgb, var(--accent) 55%, transparent); }
.sc-map marker path { fill: color-mix(in srgb, var(--accent) 70%, transparent); }
.sc-map .sc-node { cursor: pointer; }
.sc-map .sc-node circle { fill: var(--surface); stroke: var(--accent); stroke-width: 1.5; }
.sc-map .sc-node text { font-size: 10.5px; font-weight: 700; text-anchor: middle; fill: var(--ink); }
.sc-map .sc-node:hover circle { fill: color-mix(in srgb, var(--accent) 12%, var(--surface)); }
@media (max-width: 700px) {
  .sc-cols, .sc-inside { grid-template-columns: minmax(0, 1fr); }
  .sc-row, .sc-rank { grid-template-columns: minmax(0, 1fr) 110px; }
  .sc-w i { max-width: 60px; }
}

/* Calendar: the week strip — every day of the week, today, and a band of light up to now */
.agenda-week { margin-bottom: 14px; }
.agw-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agw-title { flex: 1; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.agw-title .ag-rel.now { background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.agw-nav { appearance: none; border: 1px solid var(--border); background: var(--surface); color: var(--ink);
           width: 34px; height: 34px; border-radius: 10px; font-size: 18px; line-height: 1; cursor: pointer; }
.agw-nav:disabled { opacity: .35; cursor: default; }
.agw-nav:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.agw-days { position: relative; display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; padding-bottom: 10px; }
.agw-day { appearance: none; font: inherit; color: var(--ink); cursor: pointer; text-align: center;
           display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 7px 2px 6px;
           border: 1px solid var(--border); border-radius: 12px; background: var(--surface); min-width: 0; }
.agw-day:hover { border-color: color-mix(in srgb, var(--accent) 45%, var(--border)); }
.agw-dow { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.agw-day b { font-size: 17px; font-variant-numeric: tabular-nums; }
.agw-n { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; display: flex; gap: 3px; align-items: baseline; }
.agw-n i { font-style: normal; color: var(--accent); letter-spacing: -1px; }
.agw-n em { font-style: normal; font-size: 9.5px; font-weight: 700; color: var(--accent); text-transform: uppercase; }
.agw-day.past { background: color-mix(in srgb, var(--grid) 55%, var(--surface)); }
.agw-day.past b, .agw-day.past .agw-dow { color: var(--muted); }
.agw-day.today { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.agw-day.today .agw-dow, .agw-day.today b { color: var(--accent); }
.agw-day.wkend { opacity: .8; }
.agw-day.empty { cursor: default; }
.agw-day.empty .agw-n { color: var(--muted); }
/* the week so far: a thin band filling left to right up to now */
.agw-band { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.agw-band span { position: absolute; left: 0; top: 0; bottom: 0; width: var(--p);
                 background: linear-gradient(90deg, color-mix(in srgb, var(--accent) 30%, transparent), var(--accent));
                 transform-origin: left; }
.agw-band.anim span { animation: agw-fill .9s cubic-bezier(.2, .7, .2, 1) both; }
.agw-band:not(.done) span::after { content: ""; position: absolute; right: -3px; top: -2px; width: 7px; height: 7px;
                 border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
@keyframes agw-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
.ag-list.empty { min-height: 0; border-style: dashed; box-shadow: none; }
@media (prefers-reduced-motion: reduce) { .agw-band span { animation: none; } }
@media (max-width: 700px) {
  .agw-days { gap: 3px; }
  .agw-day { padding: 6px 0 5px; border-radius: 9px; }
  .agw-day b { font-size: 15px; }
  .agw-dow { font-size: 9.5px; letter-spacing: .02em; }
  .agw-n em { display: none; }
}

/* Performance: period against period */
#pf-cmp-kind { margin-left: auto; }
.pf-cmp-lead { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 10px; font-size: 13.5px; margin-bottom: 12px; }
.pf-cmp-warn { color: #b7791f; }
.pf-cmp { display: flex; flex-direction: column; }
.pf-cmp-row { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)) minmax(0, .9fr);
              gap: 8px; align-items: center; padding: 6px 4px; border-top: 1px solid var(--grid);
              font-size: 13px; font-variant-numeric: tabular-nums; }
.pf-cmp.two .pf-cmp-row { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); }
.pf-cmp-row > span:not(:first-child) { text-align: right; }
.pf-cmp-row.head { border-top: none; font-size: 10.5px; font-weight: 650; text-transform: uppercase;
                   letter-spacing: .05em; color: var(--muted); }
.pf-cmp-row.head i { font-style: normal; }
.pf-cmp-label { color: var(--ink-2); }
.pf-cmp-group { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
                color: var(--accent); padding: 12px 4px 4px; }
.pf-cmp-d { font-weight: 650; white-space: nowrap; }
.pf-cmp-d i { font-style: normal; font-size: 9px; margin-right: 4px; vertical-align: 1px; }
.pf-cmp-d.better { color: var(--up); }
.pf-cmp-d.worse { color: var(--down); }
.pf-cmp-d.neutral { color: var(--muted); }
.pf-cmp-cur { color: var(--muted); }
.pf-cmp-cur small { font-weight: 500; }

/* Performance: calendar returns */
.pf-cal-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.pf-cal-tools .chart-toggle { margin-left: 0; }
.pf-cal-tools select { font: inherit; font-size: 12.5px; color: var(--ink); background: var(--surface);
                       border: 1px solid var(--border); border-radius: 9px; padding: 5px 8px; }
.pf-cal-bname { font-size: 12.5px; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.pf-cal-bname .swatch { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pf-cal-sum { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 13px; margin-bottom: 12px;
              font-variant-numeric: tabular-nums; }
.pf-cal-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-bottom: 10px; font-size: 14px; }
.pf-cal-days { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)) minmax(0, 1.1fr); gap: 6px; }
.pf-cal-dow { font-size: 10.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); text-align: center; }
.pf-cal-cell { appearance: none; font: inherit; color: var(--ink); cursor: default; text-align: left;
               display: flex; flex-direction: column; gap: 1px; min-width: 0; min-height: 58px; padding: 6px 8px;
               border: 1px solid var(--border); border-radius: 10px; background: var(--surface); }
button.pf-cal-cell[data-cal-open], button.pf-cal-cell[data-cal-year] { cursor: pointer; }
button.pf-cal-cell[data-cal-open]:hover, button.pf-cal-cell[data-cal-year]:hover { border-color: var(--accent); }
.pf-cal-cell.blank { border: none; background: none; }
.pf-cal-cell.off { background: none; border-style: dashed; color: var(--muted); }
.pf-cal-cell.week { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.pf-cal-l { font-size: 11px; font-weight: 650; color: var(--muted); }
.pf-cal-l i { font-style: normal; }
.pf-cal-cell b { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-cal-cell small { font-size: 11px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.pf-cal-cell b.pos { color: var(--up); } .pf-cal-cell b.neg { color: var(--down); }
.pf-cal-months { display: flex; flex-direction: column; gap: 10px; }
.pf-cal-year { display: flex; gap: 10px; align-items: stretch; }
.pf-cal-yl { width: 38px; flex: 0 0 38px; font-size: 12px; font-weight: 700; color: var(--muted); padding-top: 8px; }
.pf-cal-mgrid { flex: 1; display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)) minmax(0, 1.15fr); gap: 6px; }
.pf-cal-yrow { appearance: none; font: inherit; color: inherit; background: none; border: none; width: 100%; text-align: left; cursor: pointer; }
@media (max-width: 900px) {
  .pf-cal-mgrid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .pf-cal-year { flex-direction: column; gap: 6px; }
  .pf-cal-yl { width: auto; padding: 0; }
}
@media (max-width: 700px) {
  #pf-cmp-kind { margin-left: 0; width: 100%; }
  #pf-cmp-kind button { flex: 1; font-size: 11.5px; padding-left: 4px; padding-right: 4px; }
  .pf-cmp-row, .pf-cmp.two .pf-cmp-row { grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr)); font-size: 12px; gap: 6px; }
  .pf-cmp-cur { display: none; }
  .pf-cal-days { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .pf-cal-days .week, .pf-cal-dow:nth-child(6) { display: none; }
  .pf-cal-cell { padding: 5px 5px; min-height: 50px; border-radius: 8px; }
  .pf-cal-cell b { font-size: 11.5px; }
  .pf-cal-cell small { font-size: 9.5px; }
  .pf-cal-mgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

/* Research: insider trades with prices (SEC Form 4) */
.rs-ins-sum { display: flex; flex-direction: column; gap: 4px; font-size: 13px; margin-bottom: 10px; }
.rs-ins-sum em { font-style: normal; font-weight: 600; }
.rs-ins-sum em.pos { color: var(--up); } .rs-ins-sum em.neg { color: var(--down); }
.rs-ins { display: flex; flex-direction: column; }
.rs-ins-row { display: grid; grid-template-columns: 84px minmax(0, 1.6fr) 44px minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
              gap: 4px 10px; align-items: center; padding: 7px 4px; border-top: 1px solid var(--grid);
              color: inherit; text-decoration: none; font-size: 12.5px; font-variant-numeric: tabular-nums; border-radius: 6px; }
.rs-ins-row:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.rs-ins-d { color: var(--muted); }
.rs-ins-who { min-width: 0; }
.rs-ins-who b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-ins-who small, .rs-ins-n small, .rs-ins-p small { display: block; color: var(--muted); font-size: 11px;
                                                      white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rs-ins-n, .rs-ins-p, .rs-ins-v { text-align: right; }
.rs-ins-plan { font-size: 10px; font-weight: 700; padding: 0 5px; border-radius: 4px; background: var(--grid); color: var(--ink-2); white-space: nowrap; }
.rs-ins-v { white-space: nowrap; }
@media (max-width: 700px) {
  .rs-ins-row { grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 2px 8px; }
  .rs-ins-d { grid-column: 1 / -1; font-size: 11px; }
  .rs-ins-n { display: none; }
}
.dgrades a.dg { color: inherit; text-decoration: none; }
.dgrades a.dg:hover .dg-firm { color: var(--accent); }
.dgrades .dg .badge { justify-self: end; }
/* the drawer's company events: date, what happened, its tag */
.dcev { grid-template-columns: 44px minmax(0, 1fr) auto; align-items: start; position: relative; overflow: hidden; }
.dcev .dg-firm { white-space: normal; font-weight: 550; line-height: 1.35; }
.dcev .dg-firm small { margin-top: 1px; }
.dcev .ag-kind { margin-left: 0; justify-self: end; }
.dcev.up .dg-date { color: var(--accent); font-weight: 650; }

/* Overview chart, value mode: the gap over deposits, and deposits off the chart */
.perf-gap { stroke: none; }
.perf-gap.up { fill: color-mix(in srgb, var(--up) 14%, transparent); }
.perf-gap.down { fill: color-mix(in srgb, var(--down) 14%, transparent); }
.perf-dep rect { fill: var(--surface); stroke: var(--border); }
.perf-dep text { font-size: 11px; fill: var(--ink-2); font-variant-numeric: tabular-nums; }

.check-row { flex-wrap: wrap; }
.check-row .hint { flex-basis: 100%; margin-left: 23px; }
#s-dbpath { overflow-wrap: anywhere; }          /* a long path never widens the phone's page */

/* The last 20 seconds before a bell: seconds and milliseconds, a band of light draining */
.mc-final { display: inline-grid; grid-template-columns: auto auto auto; align-items: baseline; gap: 2px 10px;
            padding: 6px 12px 8px; border-radius: 12px; position: relative;
            background: color-mix(in srgb, var(--tone) 10%, var(--surface));
            border: 1px solid color-mix(in srgb, var(--tone) 35%, var(--border)); }
.mc-final.close { --tone: var(--accent); } .mc-final.open { --tone: var(--up); }
.mc-final-l { font-size: 10.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--tone); }
.mc-final-t { font: 700 22px/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-variant-numeric: tabular-nums;
              color: var(--ink) !important; letter-spacing: .02em; }
.mc-final-bar { grid-column: 2 / -1; display: block; height: 3px; border-radius: 2px; background: var(--grid); overflow: hidden; }
.mc-final-bar i { display: block; height: 100%; transform-origin: left;
                  background: linear-gradient(90deg, color-mix(in srgb, var(--tone) 35%, transparent), var(--tone)); }
@media (prefers-reduced-motion: reduce) { .mc-final-bar { display: none; } }
/* ...and the bell beside it, ringing through the last ten seconds */
.mc-final-bell { --bell: var(--tone); grid-row: 1 / span 2; align-self: center; position: relative; width: 30px; height: 30px;
                 display: grid; place-items: center; color: var(--muted); }
.mc-final-bell svg { width: 22px; height: 22px; fill: currentColor; overflow: visible; }
.mc-final-bell .mc-wave { opacity: 0; animation: none; }
.mc-final.ringing .mc-final-bell { color: var(--tone); }
.mc-final.ringing .mc-bell-body { transform-origin: 12px 3px;
  animation: bell-peal var(--swing, .2s) ease-in-out var(--swings, 50) alternate; }
.mc-final.ringing .mc-bell-clapper { animation: bell-peal-clapper var(--swing, .2s) ease-in-out var(--swings, 50) alternate; }
.mc-final.ringing .mc-wave { animation: bell-wave 1.2s ease-out var(--waves, 8); }
.mc-final.ringing .mc-wave:nth-of-type(2) { animation-delay: .6s; }
.mc-final.ringing .mc-final-l { animation: bell-arrive .3s ease-out; }
.mc-final.ringing.still .mc-bell-body, .mc-final.ringing.still .mc-bell-clapper,
.mc-final.ringing.still .mc-wave, .mc-final.ringing.still .mc-final-l { animation: none; }
@keyframes bell-peal { from { transform: rotate(-17deg); } to { transform: rotate(17deg); } }
@keyframes bell-peal-clapper { from { transform: translateX(2.2px); } to { transform: translateX(-2.2px); } }
/* at zero, after ringing: it comes to rest instead of being struck again */
.mc-ring.settle .mc-bell-body { animation: bell-settle 1.1s ease-out; }
.mc-ring.settle .mc-bell-clapper { animation: none; }
.mc-ring.settle .mc-wave:nth-of-type(n+2) { display: none; }
@keyframes bell-settle { 0% { transform: rotate(9deg); } 35% { transform: rotate(-5deg); } 65% { transform: rotate(2deg); } 100% { transform: rotate(0); } }
@media (prefers-reduced-motion: reduce) { .mc-final.ringing .mc-bell-body, .mc-final.ringing .mc-bell-clapper, .mc-final.ringing .mc-wave { animation: none; } }

/* Rebalance: the order ticket first. On a phone it opens the page and each
   what-if row is two short lines (target box, no slider); 19 holdings used to
   push the ticket four screens down. */
@media (max-width: 1000px) {
  .reb-right { position: static; max-height: none; overflow: visible; order: -1; }
  .reb-grid { display: flex; flex-direction: column; }
}
@media (max-width: 700px) {
  #positions-table tr.studio-row {
    grid-template-columns: minmax(0, 1fr) auto auto;
    grid-template-areas: "asset asset target" "weight trade actions";
    gap: 4px 10px; padding: 9px 2px; align-items: center;
  }
  #positions-table tr.studio-row td:nth-child(2) { display: none; }
  #positions-table tr.studio-row .asset-name { display: none; }
  #positions-table tr.studio-row .wbar { display: none; }
  #positions-table tr.studio-row .wtext { font-size: 12px; }
  #positions-table tr.studio-row td.tcell .pos-slider { display: none; }
  #positions-table tr.studio-row td.tcell { justify-content: flex-end; }
  #positions-table tr.studio-row td.tcell .pos-target { flex: 0 0 72px; width: 72px; }
  #positions-table tr.studio-row td.trade-cell { font-size: 12px; text-align: right; }
  #positions-table tr.studio-row .pos-actions .btn.mini { padding: 4px 8px; font-size: 11px; min-height: 30px; }
}
.order-ticket .ticket-amount { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.order-ticket .ticket-amount input { font-size: 16px; }
.order-ticket .panel-head { flex-wrap: nowrap; }
@media (max-width: 700px) {
  .order-ticket .ticket-pair { grid-template-columns: 1fr 1fr; }             /* price and fee side by side */
  .reb-right .impact-panel:has(#impact-body > .empty-note:only-child) { display: none; }   /* nothing staged yet */
}
.order-ticket .panel-title { white-space: nowrap; }
.order-ticket .ticket-pair label { min-width: 0; }
.order-ticket .ticket-pair input { width: 100%; min-width: 0; box-sizing: border-box; }
@media (max-width: 700px) { #r-comm-hint { display: none; } }

/* The drawer's stock chart (stockchart.js) */
.sc-sec { padding-top: 4px; }
.sc-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.sc-bar .range-buttons button, .sc-bar .chart-toggle button { padding: 4px 8px; }
.sc-types { margin-left: 0; }
.sc-studies { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 2px 0 6px; font-size: 11.5px; color: var(--ink-2); }
.sc-study { display: inline-flex; align-items: center; gap: 5px; cursor: pointer; user-select: none; }
.sc-study input { margin: 0; accent-color: var(--accent); }
.sc-study i { width: 10px; height: 3px; border-radius: 2px; display: inline-block; }
.sc-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; min-height: 20px; margin-bottom: 4px;
  font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sc-readout .ro-when { color: var(--muted); }
.sc-readout .ro-chg { font-weight: 650; }
.sc-readout .ro-chg small { font-weight: 500; color: var(--muted); }
.sc-readout .ro-bench { display: inline-flex; align-items: baseline; gap: 4px; }
.sc-readout .ro-bench i { width: 8px; height: 3px; border-radius: 2px; display: inline-block; align-self: center; }
.sc-chart { min-height: 250px; position: relative; }
.sc-chart svg { display: block; width: 100%; }
.sc-chart #sc-hover { cursor: crosshair; touch-action: pan-y; }
.sc-vol { opacity: .28; }
.sc-ma { stroke-width: 1.3; opacity: .9; }
.sc-rsi-band { fill: color-mix(in srgb, var(--accent2) 7%, transparent); }
.sc-pane-label { font-size: 10px; fill: var(--muted); }

/* Rebalance: the live quote card in the order ticket */
.ticket-quote { border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; margin: 2px 0 10px;
  background: color-mix(in srgb, var(--grid) 35%, transparent); font-variant-numeric: tabular-nums; }
.tq-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tq-sym { display: inline-flex; align-items: center; gap: 7px; min-width: 0; }
.tq-sym small { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.tq-spark { flex: 0 0 auto; }
.tq-px { margin: 4px 0 8px; font-size: 13px; }
.tq-px .tq-last { font-size: 20px; font-weight: 750; color: var(--ink); margin-right: 6px; border-radius: 6px; padding: 0 2px; }
.tq-book { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.tq-fill { appearance: none; font: inherit; font-size: 11.5px; color: var(--ink-2); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 4px; cursor: pointer; text-align: center; min-width: 0; }
.tq-fill b { display: block; color: var(--ink); font-size: 13px; }
.tq-fill small { color: var(--muted); }
.tq-fill:hover:not(:disabled) { border-color: var(--accent); }
.tq-fill:disabled { opacity: .5; cursor: default; }
.tq-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 8px; font-size: 11.5px; color: var(--ink-2); align-items: center; }
.tq-meta small { color: var(--muted); }
.tq-range { display: inline-flex; align-items: center; gap: 6px; }
.tq-range i { position: relative; width: 70px; height: 4px; border-radius: 2px; background: var(--grid); display: inline-block; }
.tq-range i b { position: absolute; top: -3px; width: 2px; height: 10px; margin-left: -1px; background: var(--accent); border-radius: 1px; }
.sc-avg { stroke: var(--accent); stroke-width: 1; stroke-dasharray: 6 4; opacity: .75; }
.sc-avg-label { font-size: 10px; font-weight: 650; fill: var(--accent); }

/* Calendar: the price reaction to a report */
.ag-react { display: inline-flex; align-items: baseline; gap: 3px; font-weight: 700; font-size: 12px;
  padding: 1px 7px; border-radius: 999px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ag-react small { font-weight: 500; opacity: .8; }
.ag-react.pos { color: var(--up); background: color-mix(in srgb, var(--up) 12%, transparent); }
.ag-react.neg { color: var(--down); background: color-mix(in srgb, var(--down) 12%, transparent); }
.ag-react.flat { color: var(--ink-2); background: var(--grid); }
.ag-state { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; justify-content: flex-end; }
.ag-row.earn { cursor: pointer; }
.ag-row.earn.open { background: color-mix(in srgb, var(--accent) 6%, transparent); }
.ag-react-panel { padding: 10px 12px 8px; border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--grid) 30%, transparent); }
.ag-react-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; margin-bottom: 6px; font-size: 12.5px; }
.ag-react-chart { width: 100%; height: 150px; display: block; }
.ag-react-after { fill: color-mix(in srgb, var(--accent) 5%, transparent); }
.ag-react-foot { display: flex; justify-content: flex-end; margin-top: 4px; font-size: 12px; }

/* Bid x ask (drawer, ticket, basket) */
.drawer-book { margin-top: 4px; font-size: 12px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.bk { display: flex; flex-wrap: wrap; gap: 2px 14px; align-items: baseline; }
.bk-side b { color: var(--ink); font-weight: 700; border-radius: 4px; padding: 0 2px; }
.bk-side small, .bk-spread small { color: var(--muted); }
.bk-mini { display: block; font-size: 10.5px; color: var(--muted); white-space: nowrap; margin-top: 1px; }
.bk-mini i { font-style: normal; margin: 0 3px; opacity: .6; }
.bk-mini span { border-radius: 3px; padding: 0 1px; }
.tq-fill b.tick-up, .tq-fill b.tick-down { border-radius: 4px; }

/* Earnings events on the charts */
.perf-event circle { stroke: var(--surface); stroke-width: 1.5; }
.perf-event text { font-size: 9px; font-weight: 800; fill: #fff; pointer-events: none; }
.perf-event.pos circle { fill: var(--up); }
.perf-event.neg circle { fill: var(--down); }
.perf-event.flat circle { fill: var(--muted); }
.perf-event-stem { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 1 3; opacity: .6; }
.perf-event-key { display: inline-grid; place-items: center; width: 14px; height: 14px; border-radius: 50%;
  background: var(--muted); color: #fff; font-size: 8.5px; font-weight: 800; margin-right: 4px; }
.chart-readout .ro-event { font-weight: 600; }
.chart-readout .ro-event.pos { color: var(--up); }
.chart-readout .ro-event.neg { color: var(--down); }

/* Activity: share-class dividends */
.corp-actions { display: grid; gap: 10px; margin-bottom: 14px; }
.corp-card { border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 10px;
  padding: 10px 14px; background: var(--surface); }
.corp-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; font-size: 13px; }
.corp-head span { color: var(--ink-2); }
.corp-card p { margin: 6px 0 0; }
.corp-edit { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; margin-top: 8px; }
.corp-edit label { display: flex; flex-direction: column; gap: 3px; font-size: 11.5px; color: var(--ink-2); }
.corp-edit input { width: 150px; }

/* The chart readouts never change height: text coming and going above a
   chart made it bounce under the pointer. One line (two on a phone); what
   does not fit is clipped, the detail of trades and earnings sits on its own
   fixed line below the chart. */
.chart-readout { flex-wrap: nowrap; white-space: nowrap; overflow: hidden; height: 22px; min-height: 0; }
.chart-readout > * { flex: 0 0 auto; }
.chart-notes { height: 20px; margin-top: 4px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  font-size: 12px; color: var(--ink-2); display: flex; gap: 14px; align-items: baseline; }
.chart-notes > * { flex: 0 0 auto; }
.chart-notes .ro-trades { font-weight: 600; }
.chart-notes .ro-trades.buy { color: var(--up); }
.chart-notes .ro-trades.sell { color: var(--down); }
.chart-notes .ro-event { font-weight: 600; }
.chart-notes .ro-event.pos { color: var(--up); }
.chart-notes .ro-event.neg { color: var(--down); }
.sc-readout { height: 36px; overflow: hidden; align-content: flex-start; }
@media (max-width: 760px) {
  .chart-readout { flex-wrap: wrap; white-space: normal; height: 40px; align-content: flex-start; }
  .chart-notes { height: 34px; white-space: normal; flex-wrap: wrap; align-content: flex-start; font-size: 11.5px; }
  .sc-readout { height: 52px; }
}

/* The detail card over the chart (a point's trades and earnings) */
.chart-pop { position: absolute; z-index: 3; pointer-events: none; background: var(--surface);
  border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 10px;
  font-size: 12px; line-height: 1.35; color: var(--ink); }
.chart-pop .cp-head { font-weight: 700; color: var(--ink-2); margin-bottom: 4px; }
.chart-pop .cp-row { display: flex; gap: 6px; align-items: baseline; padding: 1px 0; }
.chart-pop .cp-row i { font-style: normal; font-weight: 800; flex: 0 0 12px; text-align: center; }
.chart-pop .cp-row.buy i { color: var(--up); }
.chart-pop .cp-row.sell i { color: var(--down); }
.chart-pop .cp-row.ev i { color: #fff; background: var(--muted); border-radius: 50%; width: 14px; height: 14px;
  flex: 0 0 14px; font-size: 8.5px; display: inline-grid; place-items: center; }
.chart-pop .cp-row.ev.pos i { background: var(--up); }
.chart-pop .cp-row.ev.neg i { background: var(--down); }
.chart-pop .cp-more { color: var(--muted); margin-top: 3px; }

/* Loading chart: candles growing in a wave, green and red */
.candle-loader { flex-direction: column; gap: 14px; background: none; animation: none; }
.cl-bars { display: flex; align-items: flex-end; gap: 7px; height: 96px; }
.cl-c { position: relative; display: block; width: 10px; height: var(--h); border-radius: 2px;
  transform-origin: 50% 100%; animation: cl-grow 1.5s cubic-bezier(.45,0,.25,1) infinite;
  animation-delay: calc(var(--i) * 95ms); opacity: .85; }
.cl-c::before { content: ""; position: absolute; left: 50%; top: -14%; bottom: -10%; width: 1.5px;
  transform: translateX(-50%); background: inherit; opacity: .7; border-radius: 1px; }
.cl-c.up { background: var(--up); }
.cl-c.down { background: var(--down); }
@keyframes cl-grow {
  0%, 100% { transform: scaleY(.35); opacity: .35; }
  45% { transform: scaleY(1); opacity: .95; }
  70% { transform: scaleY(.8); opacity: .75; }
}
.ag-react-panel .candle-loader { min-height: 150px; }
.ag-react-panel .cl-bars { height: 64px; }
@media (prefers-reduced-motion: reduce) { .cl-c { animation: none; transform: none; opacity: .7; } }


/* Insights in chapters: a sticky list on the left; a wrapping row on a phone */
.in-layout { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 22px; align-items: start; }
.in-nav { position: sticky; top: 16px; display: flex; flex-direction: column; gap: 2px; padding-top: 52px; }
.in-nav button { appearance: none; border: 0; background: none; font: inherit; text-align: left; cursor: pointer;
  font-size: 13.5px; font-weight: 600; color: var(--ink-2); padding: 8px 12px; border-radius: 8px; }
.in-nav button:hover { color: var(--ink); background: var(--grid); }
.in-nav button.active { color: var(--ink); background: var(--surface); box-shadow: var(--shadow-1); }
.in-main { min-width: 0; }
.in-ch { display: none; }
.in-ch.active { display: block; }
.in-ch-title { font-size: 18px; margin: 0; }
@media (max-width: 900px) {
  .in-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .in-nav { position: static; flex-direction: row; flex-wrap: wrap; padding-top: 0; order: 0; gap: 6px; }
  .in-nav button { background: var(--grid); padding: 6px 11px; font-size: 12.5px; }
  .in-nav button.active { background: var(--surface); }
}

/* The market briefing (Insights -> Briefing): a hero, chips, a callout for
   your book, toned section cards, bar charts, the stories, a timeline */
.ds-h { font-size: 14px; margin: 18px 0 6px; }
.bf-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px 24px;
  box-shadow: var(--shadow-1); margin-bottom: 18px; }
.bf-empty p { color: var(--ink-2); max-width: 60ch; }
.bf-top { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.bf-greet { font-size: 13px; font-weight: 700; letter-spacing: .02em; color: var(--accent); }
.bf-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.bf-tools { display: flex; gap: 8px; align-items: center; }
.bf-tools select { font: inherit; font-size: 12px; max-width: 220px; }
.bf-headline { font-size: 26px; line-height: 1.2; margin: 14px 0 8px; letter-spacing: -.01em; }
.bf-summary { font-size: 15px; line-height: 1.55; color: var(--ink-2); margin: 0 0 16px; max-width: 75ch; }
.bf-pills { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.bf-pill { display: flex; flex-direction: column; gap: 1px; padding: 8px 12px; border-radius: 12px; min-width: 108px;
  background: color-mix(in srgb, var(--grid) 55%, transparent); font-variant-numeric: tabular-nums; }
.bf-pill-l { font-size: 11px; color: var(--muted); font-weight: 600; }
.bf-pill b { font-size: 16px; }
.bf-pill b small { font-size: 11px; font-weight: 600; color: var(--ink-2); }
.bf-pill-n { font-size: 11px; color: var(--ink-2); }
.bf-pill.pos b { color: var(--up); }
.bf-pill.neg b { color: var(--down); }
.bf-book { border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent);
  padding: 10px 14px; border-radius: 0 10px 10px 0; font-size: 14px; line-height: 1.5; margin-bottom: 18px; }
.bf-book b { margin-right: 6px; }
.bf-book.tone-positive { border-left-color: var(--up); background: color-mix(in srgb, var(--up) 7%, transparent); }
.bf-book.tone-negative { border-left-color: var(--down); background: color-mix(in srgb, var(--down) 7%, transparent); }
.bf-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin-bottom: 18px; }
.bf-sec { border: 1px solid var(--border); border-top: 3px solid var(--muted); border-radius: 12px; padding: 10px 14px; }
.bf-sec h3 { font-size: 13px; margin: 2px 0 6px; }
.bf-sec ul { margin: 0; padding-left: 18px; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.bf-sec li { margin: 3px 0; }
.bf-sec.tone-positive { border-top-color: var(--up); }
.bf-sec.tone-negative { border-top-color: var(--down); }
.bf-sec.tone-mixed { border-top-color: var(--s3); }
.bf-charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 14px; margin-bottom: 18px; }
.bf-chart-t { font-size: 12px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.bf-bar { display: grid; grid-template-columns: 110px 1fr 64px; gap: 8px; align-items: center; font-size: 12px; padding: 2px 0; }
.bf-bar-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bf-bar b { text-align: right; font-variant-numeric: tabular-nums; }
.bf-bar-track { position: relative; height: 8px; background: var(--grid); border-radius: 4px; }
.bf-bar-track.mid::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--baseline); }
.bf-bar-track i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.bf-bar-track i.pos { background: var(--up); }
.bf-bar-track i.neg { background: var(--down); }
.bf-bar-track i.acc { background: var(--accent); }
.bf-charts.one { grid-template-columns: minmax(0, 1fr); }
.bf-chart { margin: 0; min-width: 0; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.bf-cap { margin: 8px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.bf-axis-note { margin: 6px 0 0; font-size: 11px; color: var(--muted); }
.bf-plot { --pad: 52px; --h: 190px; position: relative; padding-left: var(--pad); }
.bf-curve { --h: 200px; }
.bf-plot svg { display: block; width: 100%; height: var(--h, 190px); overflow: visible; }
.bf-band { fill: color-mix(in srgb, var(--accent) 8%, transparent); }
.bf-med { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; opacity: .8; }
.bf-band-l { position: absolute; right: 2px; transform: translateY(-120%); font-size: 10px; color: var(--muted); pointer-events: none; }
.bf-hover { position: absolute; left: var(--pad); right: 0; top: 0; height: var(--h, 190px); pointer-events: none; }
.bf-hover-x { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--baseline); }
.bf-hover-c { position: absolute; top: 4px; display: grid; gap: 2px; padding: 6px 9px; border-radius: 8px; font-size: 11.5px; white-space: nowrap;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-1); }
.bf-hover-c time { color: var(--muted); font-size: 10.5px; }
.bf-hover-c i { display: inline-block; width: 8px; height: 3px; border-radius: 2px; margin-right: 5px; vertical-align: middle; }
.bf-hover-c b { font-variant-numeric: tabular-nums; }
.bf-zero { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.bf-yax { position: absolute; left: 0; top: 0; height: var(--h, 190px); width: 48px; pointer-events: none; }
.bf-yax span { position: absolute; right: 0; transform: translateY(-50%); font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.bf-xax { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; position: relative; min-height: 14px; }
.bf-xax.cats span, .bf-curve .bf-xax span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.bf-curve .bf-xax { display: block; }
.bf-dot { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--c); border: 2px solid var(--surface); box-sizing: content-box; }
.bf-dot.sub { width: 6px; height: 6px; margin-top: -3px; opacity: .8; }
.bf-dot b { position: absolute; bottom: 9px; left: 50%; transform: translateX(-50%); font-size: 11px; color: var(--ink); white-space: nowrap; font-variant-numeric: tabular-nums; }
.bf-dot.now { box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 22%, transparent); }
.bf-legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12px; }
.bf-legend i { display: inline-block; width: 10px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.bf-legend i.acc, .bf-gb i.acc { background: var(--accent); }
.bf-legend i.sub, .bf-gb i.sub { background: var(--baseline); }
.bf-pill-l em, .bf-bar-l em { font-style: normal; font-weight: 500; font-size: 10px; color: var(--muted); margin-left: 4px; }

/* grouped bars: options against history, what came next against any time */
.bf-groups { display: grid; gap: 10px; }
.bf-grp { display: grid; grid-template-columns: 96px 1fr; gap: 10px; align-items: center; }
.bf-grp-l { font-size: 12.5px; font-weight: 650; }
.bf-grp-b { display: grid; gap: 4px; }
.bf-gb { display: grid; grid-template-columns: 1fr 64px; column-gap: 8px; align-items: center; font-size: 12px; }
.bf-gb b { text-align: right; font-variant-numeric: tabular-nums; }
.bf-gb.s1 b { color: var(--ink-2); font-weight: 600; }
.bf-gb small { grid-column: 1 / -1; font-size: 10.5px; color: var(--muted); margin-top: -2px; }

/* scatter: points and labels in HTML, guides in SVG */
.bf-scatter { position: relative; }
.bf-sc-area { position: relative; aspect-ratio: 16 / 9; border-left: 1px solid var(--baseline); border-bottom: 1px solid var(--baseline); }
.bf-sc-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.bf-guide { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; }
.bf-guide-l { position: absolute; font-size: 10px; color: var(--muted); transform: translate(-100%, -130%); white-space: nowrap; }
.bf-pt { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent); opacity: .85; }
.bf-pt.pos { background: var(--up); }
.bf-pt.neg { background: var(--down); }
.bf-pt b { position: absolute; font-size: 10.5px; font-weight: 650; color: var(--ink); white-space: nowrap; line-height: 1; }
.bf-pt b.at-r { left: 11px; top: -1px; }
.bf-pt b.at-l { right: 11px; top: -1px; }
.bf-pt b.at-t { left: 50%; bottom: 10px; transform: translateX(-50%); }
.bf-pt b.at-b { left: 50%; top: 11px; transform: translateX(-50%); }
.bf-q { position: absolute; font-size: 10px; color: var(--muted); }
.bf-q.tl { left: 6px; top: 4px; } .bf-q.tr { right: 6px; top: 4px; } .bf-q.bl { left: 6px; bottom: 4px; } .bf-q.br { right: 6px; bottom: 4px; }
.bf-sc-y { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.bf-sc-y span { margin-left: 6px; opacity: .8; }
.bf-sc-x { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); margin-top: 4px; }
.bf-facts { margin: 8px 0 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-2); }
.bf-facts b.pos { color: var(--up); } .bf-facts b.neg { color: var(--down); }

/* the chart of the day */
.bf-kicker { font-size: 11px; font-weight: 750; letter-spacing: .06em; text-transform: uppercase; color: var(--accent); }
.bf-cod { display: grid; grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.4fr); gap: 22px; align-items: start;
  padding: 18px 0 20px; margin: 4px 0 18px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.bf-cod h3 { font-size: 21px; line-height: 1.25; margin: 6px 0 10px; letter-spacing: -.01em; }
.bf-cod-text > p { margin: 0 0 8px; font-size: 14.5px; line-height: 1.6; color: var(--ink-2); }
.bf-cod-chart { margin: 0; min-width: 0; }
.bf-cod-chart .bf-plot { --h: 230px; }

/* the earlier-briefings menu */
.bf-pick { position: relative; }
.bf-pick-btn { display: inline-flex; align-items: center; gap: 8px; font: inherit; font-size: 12.5px; color: var(--ink); cursor: pointer;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 6px 10px; box-shadow: var(--shadow-1); }
.bf-pick-btn:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--border)); }
.bf-pick-btn svg { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.bf-pick.open .bf-pick-btn svg { transform: rotate(180deg); }
.bf-pick-menu { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; width: min(340px, calc(100vw - 32px)); max-height: 60vh; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); padding: 6px; }
.bf-pick-menu[hidden] { display: none; }
.bf-pick-day { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 4px; }
.bf-pick-opt { display: grid; gap: 2px; width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: none; border: 0; border-radius: 10px; padding: 8px 10px; }
.bf-pick-opt:hover { background: var(--grid); }
.bf-pick-opt.active { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.bf-pick-m { display: flex; justify-content: space-between; gap: 8px; font-size: 13px; }
.bf-pick-m time { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.bf-pick-h { font-size: 12px; color: var(--ink-2); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.bf-legend b { font-variant-numeric: tabular-nums; }
.bf-pie { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.bf-pie svg { width: 130px; height: 130px; flex: none; }
.bf-pie-n { font-size: 24px; font-weight: 750; fill: var(--ink); }
.bf-pie-s { font-size: 10px; fill: var(--muted); }
.bf-pie ul { list-style: none; margin: 0; padding: 0; flex: 1 1 140px; min-width: 0; font-size: 12.5px; }
.bf-pie li { display: grid; grid-template-columns: 10px 1fr auto; gap: 8px; align-items: center; padding: 2px 0; }
.bf-pie li i { width: 10px; height: 10px; border-radius: 3px; }
.bf-pie li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bf-pie li b { font-variant-numeric: tabular-nums; }

/* what history says */
.bf-hist { border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: 12px; padding: 12px 16px; margin-bottom: 18px; }
.bf-hist.tone-positive { border-left-color: var(--up); }
.bf-hist.tone-negative { border-left-color: var(--down); }
.bf-hist.tone-mixed { border-left-color: var(--s3); }
.bf-hist h3 { font-size: 13px; margin: 0 0 6px; }
.bf-hist > p { margin: 0 0 10px; font-size: 14px; line-height: 1.55; max-width: 80ch; }
.bf-hist table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.bf-hist th, .bf-hist td { text-align: left; padding: 6px 8px 6px 0; border-top: 1px solid var(--border); vertical-align: top; }
.bf-hist thead th { border-top: 0; font-size: 11px; color: var(--muted); font-weight: 600; }
.bf-hist tbody th small { display: block; font-weight: 500; }
.bf-hist td small { display: block; font-size: 11px; }
.bf-hist td small.pos { color: var(--up); }
.bf-hist td small.neg { color: var(--down); }
.bf-hist-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.bf-hist-chips span { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: var(--grid); color: var(--ink-2); }
.bf-hist-chips b { color: var(--ink); }
.bf-hist-chips b.neg { color: var(--down); }
.bf-hist-chips b.pos { color: var(--up); }

/* the idea: a sector worth a look */
.bf-idea { border-radius: 14px; padding: 16px 18px; margin-bottom: 18px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 9%, transparent), color-mix(in srgb, var(--accent2) 5%, transparent));
  border: 1px solid color-mix(in srgb, var(--accent) 22%, transparent); }
.bf-idea h3 { font-size: 19px; line-height: 1.25; margin: 4px 0 8px; }
.bf-idea h4 { font-size: 12px; margin: 0 0 3px; color: var(--ink); }
.bf-idea-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 12px; }
.bf-idea-facts b.neg { color: var(--down); }
.bf-idea-facts b.pos { color: var(--up); }
.bf-idea-grid { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.bf-idea-grid .bf-chart { background: var(--surface); }
.bf-idea-case { display: grid; gap: 10px; }
.bf-idea-p { padding-left: 10px; border-left: 2px solid var(--accent); }
.bf-idea-p p { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink-2); }
.bf-idea-p.fear { border-left-color: var(--down); }
.bf-idea-p.pass { border-left-color: var(--up); }
.bf-idea-p.risk { border-left-color: var(--s3); }
.bf-idea h4.bf-names-t { margin: 14px 0 8px; }
.bf-names { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.bf-name { appearance: none; font: inherit; color: inherit; text-align: left; cursor: pointer; display: grid; gap: 6px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.bf-name:hover { border-color: color-mix(in srgb, var(--accent) 45%, transparent); }
.bf-name-h { display: flex; align-items: center; gap: 6px; min-width: 0; }
.bf-name-h .hint { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.bf-name-px { font-size: 12.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bf-name-px b.pos { color: var(--up); }
.bf-name-px b.neg { color: var(--down); }
.bf-name-why { font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }
.bf-name-f { display: flex; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.bf-name-f b { color: var(--ink); font-variant-numeric: tabular-nums; }
.bf-name-f b.neg { color: var(--down); }
.bf-name-f b.pos { color: var(--up); }
.bf-news h3, .bf-watch h3 { font-size: 13px; margin: 0 0 8px; }
.bf-news { margin-bottom: 18px; }
.bf-story { display: grid; grid-template-columns: 74px 1fr; gap: 10px; padding: 8px 0; border-top: 1px solid var(--border); }
.bf-story a { font-weight: 650; color: var(--ink); text-decoration: none; }
.bf-story a:hover { text-decoration: underline; }
.bf-story p { margin: 2px 0; font-size: 13px; color: var(--ink-2); }
.bf-kind { align-self: start; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 2px 6px; border-radius: 6px; background: var(--grid); color: var(--ink-2); text-align: center; }
.bf-kind.k-deal, .bf-kind.k-rumour { background: color-mix(in srgb, var(--s5) 18%, transparent); color: var(--s5); }
.bf-kind.k-earnings { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.bf-kind.k-macro, .bf-kind.k-policy { background: color-mix(in srgb, var(--s3) 18%, transparent); color: var(--s3); }
.bf-watch ol { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--grid); }
.bf-watch li { position: relative; padding: 4px 0 4px 10px; font-size: 13px; display: flex; gap: 10px; flex-wrap: wrap; }
.bf-watch li::before { content: ""; position: absolute; left: -20px; top: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.bf-watch li b { min-width: 92px; color: var(--ink); }
.bf-watch li span { color: var(--ink-2); }
.bf-foot { margin-top: 16px; }
@media (max-width: 700px) {
  .bf-card { padding: 16px; border-radius: 12px; }
  .bf-headline { font-size: 21px; }
  .bf-pill { min-width: calc(50% - 4px); flex: 1 1 calc(50% - 4px); box-sizing: border-box; }
  .bf-story { grid-template-columns: 1fr; gap: 4px; }
  .bf-kind { justify-self: start; }
  .bf-bar { grid-template-columns: 84px 1fr 56px; }
  .bf-idea { padding: 14px; }
  .bf-idea-grid { grid-template-columns: minmax(0, 1fr); }
  .bf-names { grid-template-columns: minmax(0, 1fr); }
  .bf-plot { --pad: 44px; }
  .bf-yax { width: 40px; }
  .bf-cod { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .bf-cod h3 { font-size: 19px; }
  .bf-grp { grid-template-columns: 72px 1fr; }
  .bf-sc-area { aspect-ratio: 4 / 3; }
  .bf-tools { width: 100%; justify-content: space-between; }
  .bf-pick-menu { left: 0; right: auto; }
  .bf-hist th, .bf-hist td { padding-right: 4px; }
  .bf-hist td .hint { display: block; }
}

/* Earnings-call write-ups: a research note, not a stack of cards */
.cl-wrap { margin-top: 8px; }
.cl-wrap .in-ch-title { margin-bottom: 10px; }
.cl-list { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.cl-card + .cl-card { border-top: 1px solid var(--border); }
.cl-card.pending { padding: 12px 16px; }
.cl-head { appearance: none; border: 0; background: none; font: inherit; color: inherit; width: 100%; text-align: left; cursor: pointer;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; padding: 14px 16px; }
.cl-card:not(.pending) .cl-head:hover { background: color-mix(in srgb, var(--grid) 55%, transparent); }
.cl-card.pending .cl-head { padding: 0; cursor: default; flex-wrap: wrap; }
.cl-id { display: inline-flex; flex-direction: column; line-height: 1.2; min-width: 92px; }
.cl-id .hint { font-size: 11.5px; }
.cl-headline { flex: 1 1 260px; color: var(--ink); font-size: 14px; }
.cl-head-f { display: inline-flex; align-items: center; gap: 14px; margin-left: auto; font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cl-eps b { font-weight: 700; }
.cl-eps.r-beat b { color: var(--up); }
.cl-eps.r-miss b { color: var(--down); }
.cl-react.pos { color: var(--up); } .cl-react.neg { color: var(--down); }
.cl-chev { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; }
.cl-card.open .cl-chev { transform: rotate(180deg); }
.cl-body { padding: 2px 16px 16px; }
.cl-tabs { margin: 2px 0 14px; display: inline-flex; }
.cl-pane { max-width: 860px; }
.cl-pane h4 { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); margin: 20px 0 8px; }
.cl-verdict-line { font-size: 15px; line-height: 1.55; margin: 0 0 8px; }
.cl-verdict-line b { margin-right: 2px; }
.cl-verdict-line.v-good b { color: var(--up); }
.cl-verdict-line.v-bad b { color: var(--down); }
.cl-verdict-line.v-mixed b { color: var(--s3); }
.cl-overview { font-size: 14px; line-height: 1.6; color: var(--ink-2); margin: 0 0 14px; }

/* results and guidance: tables, numbers right-aligned */
.cl-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.cl-tbl th { font-size: 11px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 10px 6px 0; border-bottom: 1px solid var(--border); }
.cl-tbl td { padding: 9px 10px 9px 0; border-bottom: 1px solid var(--border); vertical-align: top; }
.cl-tbl tr:last-child td { border-bottom: 0; }
.cl-tbl .n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cl-tbl th.n { text-align: right; }
.cl-tbl td small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; white-space: normal; }
.cl-tbl td:last-child, .cl-tbl th:last-child { padding-right: 0; }
.cl-sur { font-weight: 650; }
.cl-tbl tr.r-beat .cl-sur { color: var(--up); }
.cl-tbl tr.r-miss .cl-sur { color: var(--down); }
.cl-tbl tr.r-beat .cl-sur small, .cl-tbl tr.r-miss .cl-sur small { color: inherit; opacity: .8; }
.cl-guide td:first-child { width: 34%; color: var(--ink-2); }
.cl-chg { font-weight: 650; color: var(--ink-2); }
.cl-guide tr.g-raised .cl-chg, .cl-guide tr.g-initiated .cl-chg { color: var(--up); }
.cl-guide tr.g-lowered .cl-chg, .cl-guide tr.g-withdrawn .cl-chg { color: var(--down); }

/* management: topic on the left, what was said on the right */
.cl-rows { display: grid; }
.cl-row { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); }
.cl-row:first-child { border-top: 0; padding-top: 2px; }
.cl-row-k b { display: block; font-size: 13.5px; }
.cl-row-k small { display: block; font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.cl-row.s-positive .cl-row-k b::after { content: " ▲"; color: var(--up); font-size: 9px; vertical-align: 2px; }
.cl-row.s-negative .cl-row-k b::after { content: " ▼"; color: var(--down); font-size: 9px; vertical-align: 2px; }
.cl-row-v p { margin: 0; font-size: 14px; line-height: 1.55; }
.cl-row-v ul { margin: 0; padding-left: 18px; font-size: 14px; line-height: 1.55; }
.cl-row-v.full { grid-column: 1 / -1; }
.cl-row-v blockquote { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--ink-2); font-style: italic; }
.cl-row-v blockquote::before { content: "“"; } .cl-row-v blockquote::after { content: "”"; }

/* the Q&A: one line a subject, opened into the exchange */
.cl-qa-sum { font-size: 13px; color: var(--ink-2); margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 4px 14px; align-items: center; }
.cl-dotw { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; }
.cl-dotw i, .cl-th-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--baseline); flex: none; }
.v-good > i, .cl-th.v-good .cl-th-dot { background: var(--up); }
.v-bad > i, .cl-th.v-bad .cl-th-dot { background: var(--down); }
.v-mixed > i, .cl-th.v-mixed .cl-th-dot { background: var(--s3); }
.cl-threads { border-top: 1px solid var(--border); }
.cl-th { border-bottom: 1px solid var(--border); }
.cl-th-h { appearance: none; border: 0; background: none; font: inherit; color: inherit; cursor: pointer; width: 100%; text-align: left;
  display: flex; align-items: center; gap: 10px; padding: 11px 2px; }
.cl-th-h:hover .cl-th-t { color: var(--accent); }
.cl-th-t { font-size: 14px; font-weight: 600; }
.cl-th-w { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-th-h svg { width: 12px; height: 12px; color: var(--muted); transition: transform .15s; flex: none; }
.cl-th.open .cl-th-h svg { transform: rotate(90deg); }
.cl-th-b { padding: 0 0 14px 18px; }
.cl-ex + .cl-ex { margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--border); }
.cl-ex p { margin: 0 0 6px; font-size: 14px; line-height: 1.55; }
.cl-who { display: block; font-size: 11.5px; font-weight: 650; color: var(--muted); margin-bottom: 1px; }
.cl-ex-q { color: var(--ink); }
.cl-ex-a { color: var(--ink-2); }
.cl-ex details { font-size: 13px; color: var(--ink-2); margin: 2px 0 4px; }
.cl-ex summary { cursor: pointer; color: var(--accent); font-size: 12px; }
.cl-ex details p { margin-top: 6px; font-size: 13px; }
.cl-read { margin: 12px 0 0; font-size: 13.5px; line-height: 1.55; padding-left: 12px; border-left: 2px solid var(--baseline); }
.cl-read span { display: block; font-size: 11px; font-weight: 700; letter-spacing: .03em; color: var(--muted); margin-bottom: 2px; }
.cl-th.v-good .cl-read { border-left-color: var(--up); }
.cl-th.v-bad .cl-read { border-left-color: var(--down); }
.cl-th.v-mixed .cl-read { border-left-color: var(--s3); }
.cl-src { margin: 16px 0 0; font-size: 11.5px; color: var(--muted); }
@media (max-width: 700px) {
  .cl-head { padding: 12px; }
  .cl-head-f { margin-left: 0; width: 100%; }
  .cl-chev { margin-left: auto; }
  .cl-body { padding: 0 12px 14px; }
  .cl-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .cl-tbl { font-size: 13px; }
  .cl-guide td:first-child { width: auto; }
  .cl-th-b { padding-left: 0; }
  .cl-th-w { display: none; }
  .cl-tabs { display: flex; width: 100%; }
  .cl-tabs button { flex: 1; padding: 6px 4px; }
}


/* a scheduled briefing that failed */
.bf-missed { display: grid; gap: 2px; margin: 12px 0 4px; padding: 10px 12px; border-radius: 10px;
  border: 1px solid color-mix(in srgb, var(--down) 45%, transparent);
  background: color-mix(in srgb, var(--down) 9%, transparent); font-size: 13px; }
.bf-missed b { font-weight: 600; }
.bf-missed small { color: var(--muted); overflow-wrap: anywhere; }

/* ================= the calendar's report dashboard (earnings_card) ================= */
.ec { display: grid; gap: 12px; padding: 4px 0 6px; }
.ec-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; }
.ec-verdict { font-size: 16px; font-weight: 700; letter-spacing: -0.01em; color: var(--ink); }
.ec-verdict.pos { color: var(--up); }
.ec-verdict.neg { color: var(--down); }
.ec-head .hint { font-size: 12px; }
.ec-head a { color: var(--accent); text-decoration: none; }
.ec-record { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; font-size: 12px; color: var(--ink-2); }
.ec-record b { font-weight: 600; color: var(--ink); }
.ec-dots { display: inline-flex; gap: 3px; }
.ec-dots i { width: 8px; height: 8px; border-radius: 2px; background: var(--grid); }
.ec-dots i.v-beat { background: var(--up); }
.ec-dots i.v-miss { background: var(--down); }
.ec-dots i.v-inline { background: var(--muted); }

.ec-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.ec-sec { min-width: 0; padding: 12px 14px; border-radius: 12px; background: var(--surface); border: 1px solid var(--border); }
.ec-sec h4 { margin: 0 0 8px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; }
.ec-wide { grid-column: 1 / -1; }
.ec-cap { margin: 6px 0 4px; font-size: 12px; color: var(--ink-2); }
.ec-cap b { color: var(--ink); }
.ec-v { font-weight: 650; font-style: normal; }
.ec-v.v-beat, .ec .pos { color: var(--up); }
.ec-v.v-miss, .ec .neg { color: var(--down); }
.ec-v.v-inline, .ec-v.v-none { color: var(--ink-2); }

/* the quarter */
.ec-tbl { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 13px; }
.ec-tbl th, .ec-tbl td { padding: 7px 6px; text-align: right; border-top: 1px solid var(--grid); vertical-align: baseline; }
.ec-tbl thead th { border-top: 0; padding-top: 0; font-size: 10.5px; font-weight: 600; color: var(--muted); }
.ec-tbl th:first-child { text-align: left; padding-left: 0; font-weight: 600; color: var(--ink-2); }
.ec-tbl td:nth-child(2) { font-weight: 700; color: var(--ink); }
.ec-tbl td small { display: block; font-size: 11px; color: var(--muted); font-weight: 400; }
.ec-tbl tr.r-beat th:first-child { box-shadow: inset 3px 0 0 var(--up); padding-left: 8px; }
.ec-tbl tr.r-miss th:first-child { box-shadow: inset 3px 0 0 var(--down); padding-left: 8px; }

/* analysts: the consensus by period, a bar either side of zero */
.ec-revs, .ec-firms { list-style: none; margin: 0; padding: 0; }
.ec-revs li { display: grid; grid-template-columns: 92px minmax(40px, 1fr) 56px auto; gap: 8px; align-items: center; padding: 3px 0; font-size: 12.5px; }
.ec-per { color: var(--ink-2); }
.ec-diverge { position: relative; height: 8px; border-radius: 4px; background: var(--grid); }
.ec-diverge::after { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--muted); }
.ec-diverge i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.ec-diverge i.pos { background: var(--up); }
.ec-diverge i.neg { background: var(--down); }
.ec-revs b { text-align: right; font-variant-numeric: tabular-nums; }
.ec-revs small { font-variant-numeric: tabular-nums; }
.ec-firms li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: baseline; padding: 4px 0;
  border-top: 1px solid var(--grid); font-size: 12.5px; }
.ec-firms li:first-child { border-top: 0; }
.ec-firms span { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ec-firms em { font-style: normal; color: var(--ink-2); font-size: 12px; }
.ec-firms b { font-variant-numeric: tabular-nums; text-align: right; }

/* the move on one scale */
.ec-scale { position: relative; height: 46px; margin: 18px 6px 4px; }
.ec-axis { position: absolute; left: 0; right: 0; top: 24px; height: 2px; background: var(--grid); }
.ec-zero { position: absolute; left: 50%; top: 14px; height: 22px; width: 1px; background: var(--muted); }
.ec-usual { position: absolute; top: 18px; height: 14px; border-radius: 7px; background: color-mix(in srgb, var(--ink-2) 14%, transparent); }
.ec-imp { position: absolute; top: 12px; height: 26px; width: 0; border-left: 2px dashed var(--accent); margin-left: -1px; }
.ec-act { position: absolute; top: 18px; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; box-shadow: 0 0 0 3px var(--surface); }
.ec-act.pos { background: var(--up); }
.ec-act.neg { background: var(--down); }
.ec-act b { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.ec-act.pos b { color: var(--up); }
.ec-act.neg b { color: var(--down); }
.ec-scale-key { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 11.5px; color: var(--ink-2); }
.ec-scale-key i { display: inline-block; width: 14px; height: 8px; margin-right: 5px; vertical-align: middle; border-radius: 4px; }
.ec-scale-key .k-usual { background: color-mix(in srgb, var(--ink-2) 14%, transparent); }
.ec-scale-key .k-imp { width: 0; height: 12px; border-left: 2px dashed var(--accent); border-radius: 0; }

/* valuation */
.ec-val { display: flex; flex-wrap: wrap; gap: 8px 22px; }
.ec-val b { display: block; font-size: 19px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--ink); }
.ec-val small { font-size: 11.5px; color: var(--ink-2); }
.ec-rank { position: relative; height: 6px; margin: 14px 0 4px; border-radius: 3px;
  background: linear-gradient(90deg, color-mix(in srgb, var(--up) 45%, transparent), var(--grid) 50%, color-mix(in srgb, var(--down) 45%, transparent)); }
.ec-rank span { position: absolute; top: -4px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: var(--ink); }
.ec-rank-l { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }

/* two years at a glance: HTML bars, so nothing stretches */
.ec-trend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.ec-cols { display: flex; align-items: stretch; gap: 6px; height: 132px; }
.ec-col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ec-col small { font-size: 10px; height: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ec-bar { position: relative; flex: 1; width: 100%; max-width: 34px; }
.ec-bar i { position: absolute; left: 0; right: 0; bottom: 0; border-radius: 4px 4px 1px 1px; background: color-mix(in srgb, var(--accent) 55%, transparent); }
.ec-bar i.v-beat { background: color-mix(in srgb, var(--up) 70%, transparent); }
.ec-bar i.v-miss { background: color-mix(in srgb, var(--down) 70%, transparent); }
.ec-bar i.v-inline, .ec-bar i.v-none { background: color-mix(in srgb, var(--ink-2) 40%, transparent); }
.ec-bar.split i { bottom: 50%; }
.ec-bar.split i.below { bottom: auto; top: 50%; border-radius: 1px 1px 4px 4px; }
.ec-bar.split::after { content: ""; position: absolute; left: -2px; right: -2px; top: 50%; height: 1px; background: var(--muted); }
.ec-bar u { position: absolute; left: -3px; right: -3px; height: 0; border-top: 2px solid var(--ink); text-decoration: none; }
.ec-col b { font-size: 10.5px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ec-col em { font-size: 10px; font-style: normal; color: var(--muted); white-space: nowrap; }
.ec-key-est { display: inline-block; width: 12px; vertical-align: middle; border-top: 2px solid var(--ink); text-decoration: none; margin: 0 2px; }

/* Claude's read of the call */
.ec-call { background: color-mix(in srgb, var(--accent) 4%, var(--surface)); }
.ec-call-h { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.ec-call-h .ec-v { font-size: 12px; text-transform: capitalize; }
.ec-call-t { margin: 0 0 2px; font-size: 14px; font-weight: 600; color: var(--ink); }
.ec-call-l { list-style: none; margin: 6px 0 4px; padding: 0; }
.ec-call-l li { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.4fr); gap: 10px; align-items: baseline;
  padding: 5px 0; border-top: 1px solid var(--grid); font-size: 12.5px; }
.ec-call-l span { color: var(--ink-2); }
.ec-call-l b { font-weight: 650; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.ec-call-l em { text-align: right; overflow-wrap: anywhere; }
.ec-call .linkish { font-size: 12.5px; }

@media (max-width: 760px) {
  .ec-grid, .ec-trend { grid-template-columns: minmax(0, 1fr); }
  .ec-sec { padding: 11px 12px; }
  .ec-record { margin-left: 0; }
  .ec-tbl { font-size: 12.5px; }
  .ec-tbl th, .ec-tbl td { padding: 6px 4px; }
  .ec-revs li { grid-template-columns: 84px minmax(30px, 1fr) 52px; }
  .ec-revs small { grid-column: 1 / -1; margin-top: -2px; }
  .ec-col b { font-size: 9.5px; }
  .ec-call-l li { grid-template-columns: minmax(0, 1fr) auto; }
  .ec-call-l em { grid-column: 1 / -1; text-align: left; margin-top: -2px; }
}

/* ================= trade setups (briefing.js bfTrades) ================= */
.tr-wrap { display: grid; gap: 12px; margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--grid); }
.tr-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.tr-top h3 { margin: 2px 0 2px; font-size: 18px; }
.tr-top .hint { margin: 0; }
.tr-sum { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.tr-sum .hint { display: block; margin-top: 4px; font-size: 12px; }
.tr-list { display: grid; gap: 14px; }
.tr-card { display: grid; gap: 10px; padding: 14px 16px; border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
.tr-card.outside { border-style: dashed; }
.tr-h { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.tr-id { display: inline-flex; align-items: center; gap: 8px; min-width: 0; padding: 0; border: 0; background: none; cursor: pointer; color: var(--ink); font: inherit; }
.tr-id b { font-size: 16px; }
.tr-id span { font-size: 12.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-chips { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.tr-chip { font-size: 11px; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--grid); color: var(--ink-2); }
.tr-chip.in { background: color-mix(in srgb, var(--accent) 12%, var(--surface)); color: var(--accent); }
.tr-chip.out { background: color-mix(in srgb, #d97706 14%, var(--surface)); color: #b45309; }
.tr-conv { display: inline-flex; gap: 3px; }
.tr-conv i { width: 7px; height: 7px; border-radius: 50%; background: var(--grid); }
.tr-conv i.on { background: var(--ink-2); }
.tr-title { margin: 0; font-size: 16px; font-weight: 650; color: var(--ink); line-height: 1.35; }
.tr-status { margin: -4px 0 0; font-size: 12.5px; color: var(--ink-2); }
.tr-status.pos { color: var(--up); }
.tr-status.neg { color: var(--down); }
.tr-status b { color: var(--ink); font-variant-numeric: tabular-nums; }

.tr-plan { display: grid; grid-template-columns: minmax(0, 1fr) 190px; gap: 14px; align-items: stretch; }
.tr-chart { position: relative; height: 170px; }
.tr-chart svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.tr-line { fill: none; stroke: var(--ink-2); stroke-width: 1.8; stroke-linejoin: round; }
.tr-zone { fill: color-mix(in srgb, var(--up) 16%, transparent); }
.tr-target { stroke: var(--up); stroke-width: 1.2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.tr-stop { stroke: var(--down); stroke-width: 1.2; stroke-dasharray: 5 4; vector-effect: non-scaling-stroke; }
.tr-tag { position: absolute; left: 4px; transform: translateY(-50%); font-size: 10.5px; font-weight: 600; padding: 0 5px; border-radius: 4px;
  background: color-mix(in srgb, var(--surface) 85%, transparent); font-variant-numeric: tabular-nums; pointer-events: none; }
.tr-tag.target { color: var(--up); }
.tr-tag.stop { color: var(--down); }
.tr-tag.zone { color: var(--up); left: auto; right: 12px; }
.tr-dot { position: absolute; width: 10px; height: 10px; margin: -5px 0 0 -5px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.tr-xax { display: flex; justify-content: space-between; font-size: 10.5px; color: var(--muted); }

/* the chart's technical analysis (briefing.js trChart): muted, under the plan */
.tr-viz { --ta-50: var(--s3); --ta-200: var(--s5); --ta-trend: var(--accent2); --ta-lvl: var(--muted); --ta-fib: var(--s7);
  --gut: 50px; min-width: 0; display: flex; flex-direction: column; gap: 6px; }
.tr-head { display: grid; min-height: 24px; }
.tr-lays, .tr-hov { grid-area: 1 / 1; min-width: 0; transition: opacity .2s ease; }
.tr-lays { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.tr-lay { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 999px;
  border: 1px solid var(--border); background: none; color: var(--muted); font: inherit; font-size: 11px; font-weight: 600;
  cursor: pointer; transition: color .2s ease, background-color .2s ease, border-color .2s ease; }
.tr-lay:hover { color: var(--ink-2); }
.tr-lay[aria-pressed="true"] { color: var(--ink-2); border-color: transparent; background: color-mix(in srgb, var(--grid) 70%, transparent); }
.tr-lay i { width: 11px; height: 2px; border-radius: 1px; background: currentColor; transition: opacity .2s ease; }
.tr-lay.k-avg i { height: 3px; background: linear-gradient(90deg, var(--ta-50) 50%, var(--ta-200) 50%); }
.tr-lay.k-lvl i { height: 0; background: none; border-top: 2px dotted var(--ta-lvl); }
.tr-lay.k-trend i { background: var(--ta-trend); transform: rotate(-24deg); }
.tr-lay.k-rsi i { height: 7px; border-radius: 2px; background: linear-gradient(180deg, color-mix(in srgb, var(--down) 45%, transparent) 30%,
  color-mix(in srgb, var(--grid) 90%, transparent) 30% 70%, color-mix(in srgb, var(--up) 45%, transparent) 70%); }
.tr-lay.k-fib i { height: 6px; background: none; border-top: 1px solid var(--ta-fib); border-bottom: 1px solid var(--ta-fib); }
.tr-lay[aria-pressed="false"] i { opacity: .35; }
.tr-hov { opacity: 0; pointer-events: none; display: flex; align-items: center; gap: 10px; overflow: hidden; white-space: nowrap;
  font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.tr-hov .h-day { color: var(--ink-2); font-weight: 600; }
.tr-hov .h-px b { color: var(--ink); font-size: 12.5px; }
.tr-hov b { color: var(--ink-2); font-weight: 600; }
.tr-hov span i { display: inline-block; width: 8px; height: 2px; margin-right: 4px; border-radius: 1px; vertical-align: middle; }
.tr-hov .h-50 i { background: var(--ta-50); }
.tr-hov .h-200 i { background: var(--ta-200); }
.tr-hov .h-rsi i { display: none; }
.tr-viz.hovering .tr-hov { opacity: 1; }
.tr-viz.hovering .tr-lays { opacity: 0; pointer-events: none; }

.tr-stage { position: relative; touch-action: pan-y; cursor: crosshair; }
.tr-viz .tr-chart { margin-right: var(--gut); }
.tr-viz .tr-xax { padding-right: var(--gut); }
.tr-ta { position: absolute; inset: 0; pointer-events: none;
  clip-path: inset(-12px 100% -12px -12px); transition: clip-path 1.4s ease-in-out .1s; }
.tr-viz.seen .tr-ta { clip-path: inset(-12px calc(-4px - var(--gut)) -12px -12px); }
.tr-chart .tr-ta-svg { overflow: hidden; }
.tr-ta .ta-avg, .tr-ta .ta-lvl, .tr-ta .ta-trend, .tr-ta .ta-fib { transition: opacity .35s ease; }
.tr-viz.off-avg .ta-avg, .tr-viz.off-lvl .ta-lvl, .tr-viz.off-trend .ta-trend, .tr-viz.off-fib .ta-fib { opacity: 0; }
.ta-ma50, .ta-ma200, .ta-trend-l { fill: none; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.ta-ma50 { stroke: var(--ta-50); stroke-width: 1.3; opacity: .8; }
.ta-ma200 { stroke: var(--ta-200); stroke-width: 1.3; opacity: .75; }
.ta-trend-l { stroke: var(--ta-trend); stroke-width: 1.4; stroke-dasharray: 8 3; opacity: .9; }
.ta-level { stroke: var(--ta-lvl); stroke-width: 1.2; stroke-dasharray: 1 3; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.ta-fib-l { stroke: var(--ta-fib); stroke-width: 1; stroke-dasharray: 2 4; opacity: .55; vector-effect: non-scaling-stroke; }
.ta-tag { position: absolute; left: calc(100% + 9px); transform: translateY(-50%); padding: 0 4px; border-radius: 4px; line-height: 14px;
  font-size: 10px; font-weight: 600; white-space: nowrap; color: var(--muted); font-variant-numeric: tabular-nums;
  background: color-mix(in srgb, var(--surface) 82%, transparent); }
.ta-tag small { font-size: 9.5px; font-weight: 500; }
.ta-tag.ta-trend { color: var(--ta-trend); }
.ta-tag.fib { font-size: 9.5px; font-weight: 500; color: var(--ta-fib); background: none; }
.ta-break { position: absolute; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%;
  border: 1.5px solid var(--ta-trend); background: var(--surface); }

/* Claude's own analysis (trChart's "Claude" layer): its levels and lines,
   the swing it measured and the retracement it buys at, in its own colour,
   drawn over the muted mechanical layers */
.tr-viz { --ta-cl: var(--s8); }
.tr-lay.k-cl i { width: 8px; height: 8px; border-radius: 50%; background: var(--ta-cl); }
.tr-ta .ta-cl { transition: opacity .35s ease; }
.tr-viz.off-cl .ta-cl { opacity: 0; }
.tr-viz.off-cl .cl-lab { visibility: hidden; transition: visibility 0s .35s; }
.cl-line, .cl-curve, .cl-leg, .cl-fib { fill: none; vector-effect: non-scaling-stroke; stroke: var(--ta-cl); stroke-linecap: round; }
.cl-line { stroke-width: 1.4; }
.cl-line.resistance { stroke-dasharray: 7 3; }
.cl-line.gap { stroke-dasharray: 3 3; }
.cl-curve { stroke-width: 1.5; stroke-linejoin: round; opacity: .9; }
.cl-leg { stroke-width: 1.1; stroke-dasharray: 2 3; opacity: .75; }
.cl-fib { stroke-width: 1; stroke-dasharray: 2 4; opacity: .6; }
.cl-fib.buy { stroke-width: 2.2; stroke-dasharray: none; opacity: 1; }
.cl-anc { position: absolute; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%;
  border: 1.5px solid var(--ta-cl); background: var(--surface); }
.cl-lab { position: absolute; z-index: 1; transform: translate(6px, -118%); padding: 0 4px; border-radius: 4px; line-height: 14px;
  font-size: 10px; font-weight: 600; white-space: nowrap; color: var(--ta-cl); pointer-events: auto; cursor: help;
  background: color-mix(in srgb, var(--surface) 86%, transparent); transition: opacity .35s ease; }
.cl-lab.flip { transform: translate(calc(-100% - 6px), -118%); }
.cl-lab.pct { font-size: 9.5px; font-weight: 500; transform: translate(6px, -50%); }
.cl-lab.pct.flip { transform: translate(calc(-100% - 6px), -50%); }
.cl-lab.pct.buy { font-size: 10px; font-weight: 700; color: var(--surface); background: var(--ta-cl); }
/* moved by trDeclutter: to the other side of the line's start, or left off */
.cl-lab.cl-swap { transform: translate(calc(-100% - 6px), -118%); }
.cl-lab.flip.cl-swap { transform: translate(6px, -118%); }
.cl-lab.pct.cl-swap { transform: translate(calc(-100% - 6px), -50%); }
.cl-lab.pct.flip.cl-swap { transform: translate(6px, -50%); }
.cl-lab.cl-hide { visibility: hidden; }
.tr-tag-cl { color: var(--ta-cl); }
.tr-lay .l-short { display: none; }
.ta-tag.ta-cl { color: var(--ta-cl); }
.ta-tag.ta-cl.buy { font-weight: 700; color: var(--surface); background: var(--ta-cl); }
/* with Claude's layer off, its read gives way to the app's own */
.tr-read.by-ta, .tr-viz.off-cl .tr-read.by-cl, .tr-viz.off-cl .tr-tag-cl { display: none; }
.tr-viz.off-cl .tr-read.by-ta { display: block; }
.tr-read-k { margin-right: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--ta-cl); }

.tr-rsi { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .35s ease, opacity .3s ease; }
.tr-viz.off-rsi .tr-rsi { grid-template-rows: 0fr; opacity: 0; }
.tr-rsi-in { position: relative; min-height: 0; overflow: hidden; }
.tr-rsi-in svg { display: block; width: calc(100% - var(--gut)); height: 40px; margin-top: 6px; }
.rsi-mid { fill: color-mix(in srgb, var(--grid) 45%, transparent); }
.rsi-band { stroke: var(--baseline); stroke-width: 1; stroke-dasharray: 2 3; vector-effect: non-scaling-stroke; }
.rsi-lo { fill: color-mix(in srgb, var(--up) 34%, transparent); }
.rsi-hi { fill: color-mix(in srgb, var(--down) 30%, transparent); }
.rsi-line { fill: none; stroke: var(--ink-2); stroke-width: 1.1; opacity: .75; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.rsi-k { position: absolute; left: 3px; margin-top: 3px; transform: translateY(-50%); font-size: 9px; line-height: 1; color: var(--muted); }
.rsi-now { position: absolute; left: calc(100% - var(--gut) + 9px); top: 26px; transform: translateY(-50%); padding: 0 4px;
  font-size: 10px; font-weight: 600; line-height: 14px; white-space: nowrap; color: var(--muted); }
.rsi-now.lo { color: var(--up); }
.rsi-now.hi { color: var(--down); }

.tr-vx { position: absolute; top: 0; bottom: 0; left: 0; width: 1px; background: var(--ink-2); opacity: 0; pointer-events: none;
  transition: opacity .15s ease; }
.tr-vx.on { opacity: .35; }
.tr-hdot { position: absolute; z-index: 1; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--ink);
  box-shadow: 0 0 0 2px var(--surface); opacity: 0; pointer-events: none; transition: opacity .15s ease; }
.tr-hdot.on { opacity: 1; }
.tr-read { margin: 2px 0 0; font-size: 12.5px; line-height: 1.45; color: var(--ink-2); }

/* the band of light as the analysis first draws in */
.tr-sheen { position: absolute; top: -4px; bottom: -4px; left: 0; width: 22%; margin-left: -22%; z-index: 2; pointer-events: none; opacity: 0;
  background: linear-gradient(100deg, transparent, color-mix(in srgb, var(--accent) 15%, transparent) 60%, transparent);
  animation: tr-scan 1.4s ease-in-out .1s forwards; }
@keyframes tr-scan {
  0% { transform: translateX(0); opacity: 0; } 12% { opacity: 1; }
  88% { opacity: 1; } 100% { transform: translateX(555%); opacity: 0; }
}
.tr-tag-n { display: none; }            /* the ladder beside the chart has the numbers */
@media (max-width: 760px) {
  .tr-tag-n { display: inline; }        /* on a phone the ladder sits below: keep them on the chart */
  .tr-viz { --gut: 44px; }
  .tr-lays { gap: 4px; }
  .tr-lay { padding: 0 7px; font-size: 10.5px; }
  .tr-lay:not(.k-avg):not(.k-cl) i { display: none; }
  .tr-hov { gap: 8px; font-size: 11px; }
  .ta-tag { left: calc(100% + 7px); font-size: 9.5px; padding: 0 2px; }
  .rsi-now { left: calc(100% - var(--gut) + 7px); padding: 0 2px; font-size: 9.5px; }
  .rsi-k { display: none; }             /* too narrow for 70 and 30 beside the line: the bands say it */
  .tr-chart { height: 210px; }          /* narrow: a little taller, so the levels have room for their names */
  .tr-lay .l-long { display: none; }    /* one row of chips */
  .tr-lay .l-short { display: inline; }
  .cl-lab { font-size: 9.5px; padding: 0 3px; }
  .cl-lab.pct { font-size: 9px; }
  .cl-lab.pct.buy { font-size: 9.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .tr-ta, .tr-rsi, .tr-ta .ta-avg, .tr-ta .ta-lvl, .tr-ta .ta-trend, .tr-ta .ta-fib, .tr-ta .ta-cl, .cl-lab, .tr-lays, .tr-hov { transition: none; }
  .tr-sheen { display: none; }
}

.tr-ladder { display: flex; flex-direction: column; gap: 4px; }
.tr-rung { display: grid; grid-template-columns: 50px 1fr; column-gap: 8px; align-items: baseline; padding: 6px 10px; border-radius: 8px;
  border-left: 3px solid var(--grid); background: color-mix(in srgb, var(--grid) 40%, transparent); }
.tr-rung span { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.tr-rung b { font-size: 14px; font-variant-numeric: tabular-nums; text-align: right; }
.tr-rung small { grid-column: 1 / -1; font-size: 11px; color: var(--ink-2); text-align: right; }
.tr-rung.target { border-left-color: var(--up); }
.tr-rung.zone { border-left-color: color-mix(in srgb, var(--up) 55%, transparent); }
.tr-rung.stop { border-left-color: var(--down); }
.tr-rung.now { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--surface)); }
.tr-rr { display: flex; align-items: baseline; justify-content: space-between; padding: 4px 10px 0; }
.tr-rr b { font-size: 15px; font-variant-numeric: tabular-nums; }
.tr-rr small { font-size: 11px; color: var(--muted); }

.tr-outside { margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 13px; background: color-mix(in srgb, #d97706 8%, var(--surface)); }
.tr-case { margin: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.tr-case div { min-width: 0; }
.tr-case .risk { grid-column: 1 / -1; }
.tr-case dt { font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 2px; }
.tr-case dd { margin: 0; font-size: 13.5px; line-height: 1.5; color: var(--ink); }
.tr-case dd small { display: block; margin-top: 3px; font-size: 11.5px; color: var(--muted); }
.tr-case .risk dd { color: var(--ink-2); }

.tr-past h4 { margin: 4px 0 6px; font-size: 11px; font-weight: 650; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
.tr-past-l { display: grid; }
.tr-past-r { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto 64px 84px; gap: 10px; align-items: center; padding: 8px 4px;
  border: 0; border-top: 1px solid var(--grid); background: none; font: inherit; text-align: left; cursor: pointer; color: var(--ink); }
.tr-past-r:hover { background: color-mix(in srgb, var(--grid) 40%, transparent); }
.tr-past-d { font-size: 12px; color: var(--muted); }
.tr-past-s { display: flex; align-items: center; gap: 6px; min-width: 0; }
.tr-past-s small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-past-p { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tr-past-c { text-align: right; font-variant-numeric: tabular-nums; }
.tr-past-h { font-size: 11.5px; text-align: right; color: var(--muted); }
.tr-past-h.pos { color: var(--up); } .tr-past-h.neg { color: var(--down); }
.tr-note { margin: 0; font-size: 11.5px; }

@media (max-width: 760px) {
  .tr-card { padding: 12px; }
  .tr-plan { grid-template-columns: minmax(0, 1fr); }
  .tr-ladder { display: grid; grid-template-columns: 1fr 1fr; }
  .tr-rr { grid-column: 1 / -1; }
  .tr-case { grid-template-columns: minmax(0, 1fr); }
  .tr-past-r { grid-template-columns: minmax(0, 1fr) auto auto; }
  .tr-past-d, .tr-past-p { display: none; }
  .tr-top { flex-direction: column; }
}

/* ----------------------------------------------------- motion, not snaps
 * Sheets slide in from where they live and back out (hideAnimated in
 * core.js), segmented controls glide, and things that appear rise in. */
.drawer:not([hidden]) { animation: drawer-in .34s cubic-bezier(.2, .8, .25, 1); }
.drawer.leaving { animation: drawer-out .21s cubic-bezier(.4, 0, 1, 1) forwards; }
.drawer-backdrop:not([hidden]), .sheet-backdrop:not([hidden]) { animation: fade-in .25s ease; }
.drawer-backdrop.leaving, .sheet-backdrop.leaving { animation: fade-out .21s ease forwards; }
.more-sheet:not([hidden]) { animation: sheet-up .32s cubic-bezier(.2, .8, .25, 1); }
.more-sheet.leaving { animation: sheet-down .21s cubic-bezier(.4, 0, 1, 1) forwards; }
.ai-pack[open] { animation: pop-in .24s cubic-bezier(.2, .8, .25, 1); }
.ai-pack[open]::backdrop { animation: fade-in .24s ease; }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
@keyframes sheet-up { from { transform: translateY(100%); } }
@keyframes sheet-down { to { transform: translateY(100%); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.98); } }
/* lines that come and go under the headline rise in instead of popping */
.hero .topline-ext:not([hidden]), .hero-event:not([hidden]), .hero .markets:not([hidden]), .stats-inline:not([hidden]) {
  animation: rise .35s cubic-bezier(.2, .8, .25, 1); }
/* the gliding highlight of a segmented control */
.has-thumb { position: relative; }
.has-thumb > button { position: relative; z-index: 1; }
.has-thumb.thumb-on > button.active { background: none; box-shadow: none; }
.seg-thumb { position: absolute; left: 0; top: 0; height: 100%; z-index: 0; pointer-events: none; opacity: 0;
             background: var(--surface); }
.thumb-on > .seg-thumb { opacity: 1; }
.seg-thumb.ready { transition: clip-path .3s cubic-bezier(.2, .8, .25, 1); }
/* the stock sheet's chart drawn in, left to right */
.sc-reveal { animation: bell-reveal .7s cubic-bezier(.4, 0, .2, 1) both; }
@media (prefers-reduced-motion: reduce) {
  .drawer:not([hidden]), .drawer.leaving, .drawer-backdrop, .sheet-backdrop, .more-sheet:not([hidden]), .more-sheet.leaving,
  .ai-pack[open], .ai-pack[open]::backdrop, .hero .topline-ext, .hero-event, .hero .markets, .stats-inline, .sc-reveal { animation: none !important; }
  .seg-thumb.ready { transition: none; }
}

/* ===================== Sessions on the 1D charts: pre-market, after hours,
 * overnight. Shared by the Overview chart (chart.js) and the stock sheet's
 * 1D (stockchart.js). Extended hours sit on a soft hatched tint - warm
 * before the open, cool after the close, indigo overnight - and the line
 * runs quieter there (a luminance mask, .sess-mask-*), easing up to full
 * strength into the open and back down after the close. The open and the
 * close are hairlines with their times on the axis; each session's move is a
 * chip in a strip above the plot, where it can never sit on the line or on
 * the high / low. No motion of its own. */
:root {
  --sess-pre:   #d4851a;
  --sess-post:  #6d5df0;
  --sess-night: #4f46e5;
  --sess-tint:  5%;               /* the band's wash */
  --sess-hatch: 15%;              /* its hatch lines */
  --sess-stars: 24%;              /* the overnight band's dots */
  --sess-dim:   .45;              /* the line's strength outside regular hours */
}
@media (prefers-color-scheme: dark) {
  :root {
    --sess-pre:   #f2a948;
    --sess-post:  #9d8cff;
    --sess-night: #818cf8;
    --sess-tint:  4.5%;
    --sess-hatch: 10%;
    --sess-stars: 30%;
    --sess-dim:   .5;
  }
}
.sess-band, .sess-band.night { opacity: 1; stroke: none; }
.sess-band.pre   { fill: color-mix(in srgb, var(--sess-pre) var(--sess-tint), transparent); }
.sess-band.post  { fill: color-mix(in srgb, var(--sess-post) var(--sess-tint), transparent); }
.sess-band.night { fill: color-mix(in srgb, var(--sess-night) calc(var(--sess-tint) * 1.8), transparent); }
.sess-hatch line { stroke-width: 1; }
.sess-hatch.pre line  { stroke: color-mix(in srgb, var(--sess-pre) var(--sess-hatch), transparent); }
.sess-hatch.post line { stroke: color-mix(in srgb, var(--sess-post) var(--sess-hatch), transparent); }
.sess-hatch.night circle { fill: color-mix(in srgb, var(--sess-night) var(--sess-stars), transparent); }
.sess-mask-full { stop-color: #fff; stop-opacity: 1; }
.sess-mask-dim  { stop-color: #fff; stop-opacity: var(--sess-dim); }
/* the open and the close: a hairline, not a dashed fence */
.sess-bound { stroke: color-mix(in srgb, var(--ink-2) 34%, transparent); stroke-width: 1; stroke-dasharray: none; }
.sess-bound.soft { stroke: color-mix(in srgb, var(--sess-night) 30%, transparent); stroke-dasharray: 2 3; }
.perf-axis-label.sess-time { fill: var(--ink-2); font-weight: 650; }
.perf-axis-label.sess-time tspan { fill: var(--muted); font-weight: 500; }
/* each session's move: a chip over its band */
.sess-chip rect { fill: var(--surface); stroke: var(--border); stroke-width: 1; }
.sess-chip text { font-size: 10.5px; font-weight: 600; fill: var(--ink-2); font-variant-numeric: tabular-nums; }
.sess-chip text tspan.mv { font-weight: 750; }
.sess-chip circle { fill: var(--accent); }
.sess-chip.pre circle   { fill: var(--sess-pre); }
.sess-chip.post circle  { fill: var(--sess-post); }
.sess-chip.night circle { fill: var(--sess-night); }
.sess-chip.waiting { opacity: .62; }
.sess-chip.waiting rect { fill: none; stroke: none; }
.wl-chart .sess-chip text { font-size: 13px; }
/* the readout says which session the point under the crosshair is in */
.ro-sess {
  display: inline-flex; align-items: center; gap: 5px; align-self: center;
  padding: 1px 8px 1px 7px; border-radius: 999px; font-size: 11px; font-weight: 650; line-height: 1.5;
  color: var(--ink-2); background: color-mix(in srgb, var(--accent) 10%, transparent);
}
.ro-sess::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.ro-sess.pre   { background: color-mix(in srgb, var(--sess-pre) 14%, transparent); }
.ro-sess.pre::before   { background: var(--sess-pre); }
.ro-sess.post  { background: color-mix(in srgb, var(--sess-post) 14%, transparent); }
.ro-sess.post::before  { background: var(--sess-post); }
.ro-sess.night { background: color-mix(in srgb, var(--sess-night) 16%, transparent); }
.ro-sess.night::before { background: var(--sess-night); }

/* Ultrawide screens (3000px and up, tall enough to matter): the Overview on
   one screen. The page takes the width; the holdings get their own column
   on the right, scrolling inside it, and stay in view; the headline, the
   chart beside the movers, and the at-a-glance cards fill the left. */
@media (min-width: 2300px) {
  .main { max-width: 3200px; }
}
/* 2300-3000: the chart, the movers and the glance cards (two by two) in one
   row, the holdings full width under them (too narrow for its own column) */
@media (min-width: 2300px) and (max-width: 2999px) {
  #tab-dashboard .perf-grid { grid-template-columns: minmax(0, 1fr) 320px minmax(620px, .6fr); }
  #tab-dashboard .glance-rail { grid-column: auto; padding-top: 4px; }
  .glance-rail #glance-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 3000px) and (min-height: 850px) {
  #tab-dashboard.active { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); column-gap: 22px; align-items: start; }
  #tab-dashboard > * { min-width: 0; }
  #tab-dashboard > .hero { grid-column: 1 / -1; }
  #tab-dashboard > .perf-grid { grid-column: 1; grid-row: 2; grid-template-columns: minmax(0, 1fr) 300px; }
  #tab-dashboard .glance-rail { grid-column: 1 / -1; }
  #tab-dashboard > .panel { grid-column: 2; grid-row: 2; margin-top: 0; position: sticky; top: 16px;
    max-height: calc(100vh - 260px); display: flex; flex-direction: column; }
  #tab-dashboard > .panel .holdings-list { flex: 1 1 auto; min-height: 0; overflow: auto; }
  /* the chart takes the height the left column has spare */
  #tab-dashboard .perf-chart { min-height: clamp(320px, calc(100vh - 860px), 760px); }
}

/* a person's portrait over their initials (personFaceHtml) */
.face { position: relative; display: inline-grid; place-items: center; flex: none; width: 2.2em; height: 2.2em; border-radius: 50%; overflow: hidden;
  background: color-mix(in srgb, var(--accent) 22%, var(--surface)); color: var(--ink); font-weight: 750; font-size: 1em; vertical-align: middle; }
.face i { display: block; font-style: normal; font-size: .8em; line-height: 1; letter-spacing: .02em; text-indent: .02em; }
.face img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: 50% 22%; }
.cl-who { display: inline-flex; align-items: center; gap: 6px; }
.cl-who .face { width: 1.9em; height: 1.9em; }
