/* Scout OS — market terminal theme. Graphite surfaces, one blue accent, teal/coral up and down (always with a
   ▲/▼ or +/− sign too). System fonts only: the Content Security Policy blocks external fonts. Tokens are
   explained in docs/DESIGN.md. Old token names (--panel-2, --cyan, ...) are kept so every page keeps working. */
:root {
  color-scheme: dark;
  /* surfaces, darkest to lightest */
  --bg: #090d13;
  --bg-2: #0c111a;
  --panel: #10161f;
  --panel-2: #151c28;
  --panel-3: #1b2433;
  --border: #1d2634;
  --border-strong: #2a3649;
  --border-hi: #3a4a64;
  /* text: each passes WCAG AA (4.5:1) on every surface above */
  --text: #e8edf5;
  --text-2: #b4bfd0;
  --muted: #8493a9;
  /* the one accent */
  --accent: #2962ff;
  --accent-hi: #4d7fff;
  --accent-text: #6aa6ff;
  --accent-soft: rgba(41, 98, 255, 0.16);
  --link-hover: #9cc4ff;
  --cyan: var(--accent-text);
  /* semantic */
  --green: #2ecc8f;
  --green-soft: rgba(46, 204, 143, 0.12);
  --red: #ff6b7a;
  --red-soft: rgba(255, 107, 122, 0.12);
  --orange: #f5a524;
  --orange-soft: rgba(245, 165, 36, 0.12);
  --yellow: #f2c94c;
  --yellow-soft: rgba(242, 201, 76, 0.11);
  --purple: #b39cff;
  --purple-soft: rgba(179, 156, 255, 0.13);
  --gray-soft: rgba(132, 147, 169, 0.12);
  /* spacing (4px scale), corners, motion */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 20px;
  --s6: 24px;
  --s8: 32px;
  --radius: 6px;
  --radius-sm: 4px;
  --radius-lg: 8px;
  --shadow: 0 10px 28px rgba(0, 0, 0, 0.5);
  --ease: 120ms ease-out;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
  /* page chrome: header row + ticker tape; --header-h is both together so drawers and anchors clear them */
  --bar-h: 48px;
  --tape-h: 34px;
  --header-h: calc(var(--bar-h) + var(--tape-h));
  --brand-w: 224px;
  --side-w: 224px;
}

* { box-sizing: border-box; }
/* Reading size and weight: the default is a hair larger and bolder; Settings > Text can go back or go bigger. */
:root { --ts: 1.1; --fw-light: 600; }
html[data-ts="1.1"] { --ts: 1.1; }
html[data-ts="1"] { --ts: 1; }
html[data-ts="1.25"] { --ts: 1.25; }
/* Opt-in iPhone/iPad Dynamic Type: update --ts from the system body font's computed size. */
/* We retain explicit Standard/Large/Extra large controls for unsupported webviews and desktops. */
html[data-ts="system"] { --ts: var(--scout-system-scale, 1.1); }
@supports (font: -apple-system-body) {
  html[data-ts="system"] { font: -apple-system-body; }
}
html[data-bold="off"] { --fw-light: 400; }
html, body { margin: 0; }
body { min-height: 100vh; }
html { scrollbar-color: var(--border-strong) transparent; scrollbar-width: thin; }
body { padding-inline: env(safe-area-inset-left) env(safe-area-inset-right); }   /* landscape phones with a notch */
.net-bar { position: sticky; top: var(--header-h); z-index: 29; display: flex; align-items: center; gap: var(--s2); padding: 6px var(--s4);
  background: var(--orange-soft); border-bottom: 1px solid rgba(245, 165, 36, .3); color: var(--text); font-size: calc(13px * var(--ts, 1.1)); }
.net-bar[hidden] { display: none; }
.load-fail { max-width: 560px; margin: var(--s6) auto; }
.load-fail .btn-row { margin-top: var(--s3); }
body {
  background: radial-gradient(900px 420px at 88% -8%, rgba(41, 98, 255, 0.08), transparent 62%), var(--bg);
  color: var(--text);
  font: var(--fw-light, 600) calc(14px * var(--ts, 1.1))/1.45 var(--font);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent-text); text-underline-offset: 2px; }
a:hover { color: var(--link-hover); }
::selection { background: var(--accent-soft); color: #fff; }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 1px; border-radius: 3px; }
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hi); background-clip: padding-box; border: 2px solid transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.hidden { display: none !important; }
.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }
.mono { font-family: var(--mono); font-size: 0.88em; }
.muted { color: var(--muted); }
.small { font-size: calc(12px * var(--ts, 1.1)); }
.up { color: var(--green); }
.down { color: var(--red); }
.nowrap { white-space: nowrap; }
h1, h2, h3 { text-wrap: balance; }

/* Shared SVG gradients take their colours from the tokens */
.stop-up { stop-color: var(--green); }
.stop-down { stop-color: var(--red); }
.stop-accent { stop-color: var(--accent); }
.stop-accent-hi { stop-color: var(--accent-text); }

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 30; height: var(--bar-h);
  display: grid; grid-template-columns: var(--brand-w) minmax(0, 1fr) auto; align-items: center; gap: var(--s4);
  padding: 0 var(--s4) 0 var(--s3);
  background: color-mix(in srgb, var(--bg) 94%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.brand-wrap { display: flex; align-items: center; gap: var(--s2); min-width: 0; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; min-width: 0; border-radius: var(--radius-sm); }
.brand:hover { color: inherit; }
.brand svg { width: 30px; height: 30px; flex: none; }
.brand-text { display: flex; flex-direction: column; white-space: nowrap; line-height: 1; }
.brand-name { font-weight: 800; font-size: calc(16px * var(--ts, 1.1)); letter-spacing: 0.1em; }
.brand-os { color: var(--accent-text); font-weight: 600; }
.brand-sub { font-size: calc(8.5px * var(--ts, 1.1)); letter-spacing: 0.2em; color: var(--muted); margin-top: 4px; font-weight: 600; font-family: var(--mono); }
.icon-btn.menu-btn { display: none; }

.cmd { position: relative; display: flex; align-items: center; max-width: 720px; width: 100%; }
.cmd input {
  width: 100%; height: 32px; padding: 0 44px 0 34px; font-size: calc(13px * var(--ts, 1.1));
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
  outline: none; transition: border-color var(--ease), box-shadow var(--ease), background var(--ease);
}
.cmd input::placeholder { color: var(--muted); }
.cmd input:hover { border-color: var(--border-hi); }
.cmd input:focus { border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-soft); }
.cmd .icon-search { position: absolute; left: 10px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.cmd .send {
  position: absolute; right: 3px; width: 26px; height: 26px; border-radius: 3px;
  border: 0; background: var(--accent); color: #fff; cursor: pointer; display: grid; place-items: center;
  transition: background var(--ease);
}
.cmd .send:hover { background: var(--accent-hi); }
.cmd .send:disabled { opacity: .5; cursor: wait; }
.cmd .send svg { width: 14px; height: 14px; }

.header-right { display: flex; align-items: center; gap: var(--s2); }
.icon-btn {
  position: relative; width: 32px; height: 32px; border-radius: var(--radius-sm); display: grid; place-items: center;
  background: transparent; border: 1px solid transparent; color: var(--text-2); cursor: pointer;
  transition: background var(--ease), border-color var(--ease), color var(--ease);
}
.icon-btn:hover { background: var(--panel-2); border-color: var(--border); color: var(--text); }
.icon-btn:active { background: var(--panel-3); }
.icon-btn svg { width: 17px; height: 17px; }
.badge-count {
  position: absolute; top: 0; right: 0; transform: translate(30%, -20%); min-width: 14px; height: 14px; padding: 0 3px; border-radius: 8px;
  background: var(--orange); color: #14100a; font-size: calc(9.5px * var(--ts, 1.1)); font-weight: 800; display: grid; place-items: center;
  border: 2px solid var(--bg); box-sizing: content-box; line-height: 1;
}
.owner { display: flex; align-items: center; gap: var(--s2); padding-left: var(--s2); border-left: 1px solid var(--border); margin-left: 2px; }
.avatar {
  width: 26px; height: 26px; border-radius: var(--radius-sm); display: grid; place-items: center; font-weight: 700; font-size: calc(12px * var(--ts, 1.1));
  background: linear-gradient(135deg, var(--accent), #1a3fb3); color: #fff;
}
.owner-name { font-weight: 600; font-size: calc(12px * var(--ts, 1.1)); line-height: 1.1; }
.owner-role { font-size: calc(10.5px * var(--ts, 1.1)); color: var(--muted); }

/* Market status pill: OPEN / PRE-MARKET / AFTER-HOURS / CLOSED with the New York clock and a countdown */
.mkt {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding: 0 9px; border-radius: var(--radius-sm);
  background: var(--bg-2); border: 1px solid var(--border-strong); white-space: nowrap; font-size: calc(11.5px * var(--ts, 1.1)); color: var(--text-2);
}
.mkt-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: currentColor; color: var(--muted); }
.mkt-state { font-weight: 800; letter-spacing: 0.07em; font-size: calc(11px * var(--ts, 1.1)); color: var(--muted); }
.mkt-clock { font-family: var(--mono); font-size: calc(11px * var(--ts, 1.1)); color: var(--text); }
.mkt-verb { color: var(--muted); }
.mkt-count { color: var(--text-2); font-family: var(--mono); font-size: calc(11px * var(--ts, 1.1)); }
.mkt[data-state="open"] { border-color: rgba(46, 204, 143, .4); }
.mkt[data-state="open"] .mkt-dot, .mkt[data-state="open"] .mkt-state { color: var(--green); }
.mkt[data-state="open"] .mkt-dot { animation: mkt-pulse 2.4s ease-in-out infinite; }
.mkt[data-state="pre"] { border-color: rgba(245, 165, 36, .4); }
.mkt[data-state="pre"] .mkt-state, .mkt[data-state="pre"] .mkt-dot { color: var(--orange); }
.mkt[data-state="pre"] .mkt-dot { background: conic-gradient(currentColor 50%, transparent 0); border: 1.5px solid currentColor; }
.mkt[data-state="after"] { border-color: rgba(179, 156, 255, .4); }
.mkt[data-state="after"] .mkt-state, .mkt[data-state="after"] .mkt-dot { color: var(--purple); }
.mkt[data-state="after"] .mkt-dot { background: transparent; border: 1.5px solid currentColor; }
.mkt[data-state="closed"] .mkt-dot { border-radius: 1px; }
.mkt[data-state="unknown"] .mkt-dot { border-radius: 1px; background: transparent; border: 1.5px dashed currentColor; }
@keyframes mkt-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(46, 204, 143, .55); } 60% { box-shadow: 0 0 0 5px rgba(46, 204, 143, 0); } }

/* ---------- Ticker tape ---------- */
.tape {
  position: sticky; top: var(--bar-h); z-index: 29; height: var(--tape-h); display: flex; align-items: stretch;
  background: var(--bg-2); border-bottom: 1px solid var(--border); overflow: hidden;
}
.tape-label {
  flex: none; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s2) 0 var(--s3);
  border-right: 1px solid var(--border); background: var(--bg-2); position: relative; z-index: 1;
  font-family: var(--mono); font-size: calc(10px * var(--ts, 1.1)); font-weight: 700; letter-spacing: 0.14em; color: var(--muted);
}
.tape-pause {
  width: 22px; height: 22px; border-radius: 3px; border: 1px solid var(--border-strong); background: var(--panel);
  color: var(--text-2); display: grid; place-items: center; cursor: pointer; padding: 0;
}
.tape-pause:hover { border-color: var(--border-hi); color: var(--text); }
.tape-pause svg { width: 10px; height: 10px; }
.tape-pause .i-play { display: none; }
.tape-pause[aria-pressed="true"] .i-play { display: block; }
.tape-pause[aria-pressed="true"] .i-pause { display: none; }
.tape-view { flex: 1; min-width: 0; overflow: hidden; position: relative; }
.tape-view.scrolling { -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); mask-image: linear-gradient(90deg, transparent 0, #000 22px, #000 calc(100% - 22px), transparent 100%); }
.tape-view.static { overflow-x: auto; scrollbar-width: none; }
.tape-view.static::-webkit-scrollbar { display: none; }
.tape-track { display: flex; width: max-content; height: 100%; }
.tape-view.scrolling .tape-track { animation: tape-scroll var(--tape-dur, 120s) linear infinite; }
.tape-view.scrolling:hover .tape-track, .tape-view.scrolling:focus-within .tape-track, .tape-view.paused .tape-track { animation-play-state: paused; }
@keyframes tape-scroll { from { transform: translateX(0); } to { transform: translateX(-50%); } }
.tape-set { display: flex; flex: none; }
.tape-set[hidden] { display: none; }
.tape-view.note .tape-track { width: 100%; }
.tape-cell {
  display: flex; align-items: center; gap: 8px; height: 100%; padding: 0 14px; background: transparent; border: 0;
  border-right: 1px solid var(--border); color: var(--text); cursor: pointer; white-space: nowrap; font-size: calc(12px * var(--ts, 1.1));
  transition: background var(--ease);
}
.tape-cell:hover { background: var(--panel-2); }
.tape-cell:focus-visible { outline-offset: -2px; }
.tc-label { color: var(--muted); font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; }
.tc-last { font-family: var(--mono); font-weight: 600; font-size: calc(12.5px * var(--ts, 1.1)); }
.tc-chg { display: inline-flex; align-items: center; gap: 4px; font-family: var(--mono); font-size: calc(11.5px * var(--ts, 1.1)); font-weight: 600; color: var(--muted); }
.tc-arrow { font-style: normal; font-size: calc(8px * var(--ts, 1.1)); }
.tape-cell.up .tc-chg { color: var(--green); }
.tape-cell.down .tc-chg { color: var(--red); }
.tc-spark { width: 44px; height: 16px; flex: none; overflow: visible; }
.tc-spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.4; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.tape-cell.up .tc-spark polyline { stroke: var(--green); }
.tape-cell.down .tc-spark polyline { stroke: var(--red); }
.tc-spark circle { fill: var(--muted); }
.tape-cell.up .tc-spark circle { fill: var(--green); }
.tape-cell.down .tc-spark circle { fill: var(--red); }
.tc-asof { font-size: calc(10px * var(--ts, 1.1)); color: var(--muted); display: inline-flex; align-items: center; gap: 4px; }
.tc-asof::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.tape-cell.aged .tc-asof::before { background: var(--yellow); }
.tape-cell.old .tc-asof::before, .tape-cell.eod .tc-asof::before { background: transparent; border: 1px solid var(--muted); }
.tape-cell.old .tc-asof { color: #c7a86a; }
.tape-cell.na .tc-last, .tape-cell.na .tc-asof { color: var(--muted); font-weight: var(--fw-light, 600); }
.tape-cell.na .tc-asof::before { display: none; }
.tape-cell.na .tc-spark { display: none; }
.tape-note { flex: 1; min-width: 0; display: flex; align-items: center; gap: var(--s2); padding: 0 var(--s3); background: transparent; border: 0; color: var(--text-2); font-size: calc(12px * var(--ts, 1.1)); text-align: left; cursor: pointer; overflow: hidden; }
.tape-note span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tape-note:hover { color: var(--text); }
.tape-skel { flex: 1; display: flex; align-items: center; gap: var(--s4); padding: 0 var(--s4); overflow: hidden; }
.tape-skel .skel { height: 10px; width: 110px; flex: none; }

/* ---------- Layout ---------- */
.layout { display: grid; grid-template-columns: var(--side-w) minmax(0, 1fr); min-height: calc(100vh - var(--header-h)); }
.sidebar {
  position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); overflow-y: auto;
  padding: var(--s2) var(--s2) var(--s4); border-right: 1px solid var(--border); background: var(--bg-2);
  display: flex; flex-direction: column; gap: 1px;
}
.nav-group { display: grid; }
.nav-head { display: flex; align-items: center; gap: 2px; }
.nav-item {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; height: 32px; padding: 0 var(--s2); cursor: pointer;
  background: transparent; border: 0; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none;
  font-size: calc(13px * var(--ts, 1.1)); font-weight: 600; transition: background var(--ease), color var(--ease);
}
.nav-item svg { width: 16px; height: 16px; flex: none; opacity: .8; }
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item.active svg { color: var(--accent-text); opacity: 1; }
.nav-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-toggle {
  flex: none; width: 26px; height: 26px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted);
  display: grid; place-items: center; cursor: pointer; padding: 0;
}
.nav-toggle:hover { background: var(--panel-2); color: var(--text); }
.nav-toggle svg { width: 13px; height: 13px; transition: transform var(--ease); }
.nav-group.open .nav-toggle svg { transform: rotate(180deg); }
.nav-subs { display: none; margin: 1px 0 6px 16px; padding-left: var(--s2); border-left: 1px solid var(--border); }
.nav-group.open .nav-subs { display: grid; }
.nav-sub {
  display: flex; align-items: center; gap: 6px; min-height: 26px; padding: 3px var(--s2); border-radius: var(--radius-sm);
  font-size: calc(12.5px * var(--ts, 1.1)); color: var(--muted); text-decoration: none; cursor: pointer; transition: background var(--ease), color var(--ease);
}
.nav-sub:hover { color: var(--text); background: var(--panel-2); }
.nav-sub.active { color: var(--text); background: var(--accent-soft); font-weight: 600; }
.nav-sub .tag { margin-left: auto; font-size: calc(9px * var(--ts, 1.1)); letter-spacing: .08em; font-weight: 700; color: var(--muted); border: 1px solid var(--border-strong); padding: 0 5px; border-radius: 3px; }
.nav-sep { height: 1px; background: var(--border); margin: var(--s2) 2px; }
.nav-foot {
  margin-top: auto; padding: var(--s2) var(--s3); border: 1px solid var(--border); border-radius: var(--radius-sm);
  font: calc(10.5px * var(--ts, 1.1))/1.7 var(--mono); color: var(--muted);
}
.nav-foot b { color: var(--text-2); font-weight: 700; }

.main { padding: var(--s4) var(--s5) 96px; min-width: 0; }   /* the floating help button covers the bottom 66px: the last row must clear it */
#view > * + * { margin-top: var(--s3); }
.view-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; }
.view-head h1 { margin: 0; font-size: calc(20px * var(--ts, 1.1)); line-height: 1.2; letter-spacing: -0.01em; font-weight: 700; }
.view-head p { margin: 4px 0 0; color: var(--text-2); font-size: calc(13px * var(--ts, 1.1)); max-width: 78ch; }
.clock { text-align: right; }
.clock .date { color: var(--muted); font-size: calc(12px * var(--ts, 1.1)); }
.clock .time { font: 600 calc(18px * var(--ts, 1.1))/1.2 var(--mono); }
.head-badges { display: flex; gap: 6px; align-items: center; justify-content: flex-end; margin-top: 4px; flex-wrap: wrap; }

/* ---------- Panels & cards ---------- */
.grid { display: grid; gap: var(--s3); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); }
.mt { margin-top: var(--s3); }
.panel {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 var(--s3) var(--s3); min-width: 0;
}
.panel-head {
  display: flex; align-items: center; gap: var(--s2); margin: 0 calc(-1 * var(--s3)) var(--s3); padding: 8px var(--s3);
  min-height: 38px; flex-wrap: wrap; border-bottom: 1px solid var(--border); background: rgba(255, 255, 255, 0.015);
  border-radius: var(--radius) var(--radius) 0 0;
}
.panel-head h2 { margin: 0; font-size: calc(13px * var(--ts, 1.1)); font-weight: 650; letter-spacing: 0.005em; line-height: 1.3; }
.panel-head .spacer { flex: 1; }
.panel-icon { width: 16px; height: 16px; display: grid; place-items: center; color: var(--accent-text); flex: none; }
.panel-icon svg { width: 16px; height: 16px; }
.panel > :first-child:not(.panel-head) { margin-top: var(--s3); }
.panel p { margin: 0 0 var(--s2); }
h3.small { font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; margin: var(--s3) 0 6px; }
h3.small.mt { margin-top: var(--s4); }

/* Dashboard scout cards: compact, number first */
.scout-card {
  position: relative; display: block; width: 100%; text-align: left; cursor: pointer; color: inherit; min-height: 0;
  border-radius: var(--radius); padding: var(--s3) var(--s4) var(--s3) var(--s3); border: 1px solid var(--border);
  border-left: 3px solid var(--card-color, var(--accent)); background: var(--panel);
  transition: background var(--ease), border-color var(--ease);
}
.scout-card:hover { background: var(--panel-2); border-color: var(--border-strong); border-left-color: var(--card-color, var(--accent)); }
.scout-card .row { display: flex; gap: 10px; align-items: flex-start; }
.scout-card .card-icon { width: 26px; height: 26px; border-radius: var(--radius-sm); display: grid; place-items: center; flex: none; background: var(--card-soft); color: var(--card-color); }
.scout-card .card-icon svg { width: 15px; height: 15px; }
.scout-card h3 { margin: 0; font-size: calc(13.5px * var(--ts, 1.1)); font-weight: 650; }
.scout-card .desc { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); margin: 1px 0 5px; }
.scout-card .metric { margin-top: var(--s3); font-size: calc(30px * var(--ts, 1.1)); font-weight: 700; line-height: 1; letter-spacing: -0.02em; font-family: var(--mono); }
.scout-card .metric.none { font-size: calc(18px * var(--ts, 1.1)); color: var(--muted); font-weight: 600; }
.scout-card .metric-label { color: var(--muted); font-size: calc(11.5px * var(--ts, 1.1)); margin-top: 5px; }
.scout-card .go { position: absolute; right: var(--s3); top: var(--s3); width: 20px; height: 20px; display: grid; place-items: center; color: var(--muted); }
.scout-card:hover .go { color: var(--card-color); }
.scout-card .go svg { width: 14px; height: 14px; }
.accent-green { --card-color: var(--green); --card-soft: var(--green-soft); }
.accent-blue { --card-color: var(--accent-text); --card-soft: var(--accent-soft); }
.accent-purple { --card-color: var(--purple); --card-soft: var(--purple-soft); }
.accent-orange { --card-color: var(--orange); --card-soft: var(--orange-soft); }
.accent-gray, .accent-cyan { --card-color: var(--accent-text); --card-soft: var(--accent-soft); }

/* ---------- Chips ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 18px; padding: 0 6px; border-radius: 3px;
  font-size: calc(10px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; border: 1px solid transparent;
}
.chip::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; flex: none; }
.chip.plain::before { display: none; }
/* a check written as a sentence: wraps on a phone instead of forcing the page wider */
.chip.gate { white-space: normal; height: auto; min-height: 18px; line-height: 1.3; padding: 2px 7px; text-transform: none; letter-spacing: 0; font-size: calc(11.5px * var(--ts, 1.1)); max-width: 100%; }
.chip-green { color: var(--green); background: var(--green-soft); border-color: rgba(46, 204, 143, .3); }
.chip-blue { color: var(--accent-text); background: var(--accent-soft); border-color: rgba(106, 166, 255, .3); }
.chip-yellow { color: var(--yellow); background: var(--yellow-soft); border-color: rgba(242, 201, 76, .28); }
.chip-orange { color: var(--orange); background: var(--orange-soft); border-color: rgba(245, 165, 36, .32); }
.chip-red { color: var(--red); background: var(--red-soft); border-color: rgba(255, 107, 122, .32); }
.chip-purple { color: var(--purple); background: var(--purple-soft); border-color: rgba(179, 156, 255, .3); }
.chip-gray { color: var(--muted); background: var(--gray-soft); border-color: var(--border-strong); }

/* ---------- Tabs (segmented, like timeframe buttons) ---------- */
.tabs {
  display: flex; flex-wrap: wrap; gap: 2px; width: fit-content; max-width: 100%; margin-bottom: var(--s3); padding: 2px;
  background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.tab {
  height: 26px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid transparent; background: transparent;
  color: var(--text-2); cursor: pointer; font-size: calc(12px * var(--ts, 1.1)); font-weight: 600; transition: background var(--ease), color var(--ease);
}
.tab:hover { color: var(--text); background: var(--panel-2); }
.tab[aria-selected="true"] { background: var(--accent-soft); border-color: rgba(106, 166, 255, .35); color: var(--text); }
.tab:disabled { opacity: .5; cursor: not-allowed; }
/* A strip of links between the tabs of one page (the menu shows one entry for the whole page) */
a.tab { display: inline-flex; align-items: center; gap: 6px; text-decoration: none; white-space: nowrap; }
a.tab:hover { text-decoration: none; }
a.tab .tag { font-size: calc(9px * var(--ts, 1.1)); letter-spacing: .08em; font-weight: 700; color: var(--text-2); border: 1px solid var(--border-strong); padding: 0 5px; border-radius: 3px; line-height: 14px; }
/* The selected tab is the "you are here" mark, so it gets a shape (an underline) as well as the colour: it stays
   visible in high-contrast mode, where backgrounds are dropped. */
a.tab.active, a.tab[aria-current="page"] { background: var(--accent-soft); border-color: rgba(106, 166, 255, .35); color: var(--text); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 5px; text-decoration-color: var(--accent-text); }
.page-tabs { margin-top: var(--s3); }

/* ---------- Tables ---------- */
.table-wrap { overflow: auto; -webkit-overflow-scrolling: touch; max-height: min(74vh, 780px); }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: calc(12.5px * var(--ts, 1.1)); }
th {
  position: sticky; top: 0; z-index: 2; background: var(--panel); text-align: left; font-weight: 700; color: var(--muted);
  font-size: calc(10.5px * var(--ts, 1.1)); letter-spacing: .06em; text-transform: uppercase; padding: 7px 10px; border-bottom: 1px solid var(--border-strong); white-space: nowrap;
}
td { padding: 6px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { cursor: default; transition: background var(--ease); }
tbody tr.clickable { cursor: pointer; }
tbody tr:hover td { background: var(--panel-2); }
tbody tr.selected td { background: var(--accent-soft); }
tbody tr.selected td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.sym, td.sym { font-weight: 700; letter-spacing: .02em; }
td.why { min-width: 240px; max-width: 420px; font-size: calc(11.5px * var(--ts, 1.1)); line-height: 1.35; }
td.why > div { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Score bar and setup badge on the Opportunity Board */
.score { display: inline-flex; align-items: center; gap: 7px; min-width: 76px; }
.score b { font-family: var(--mono); font-size: calc(12.5px * var(--ts, 1.1)); min-width: 2ch; text-align: right; }
.score-bar { flex: 1; height: 4px; min-width: 32px; border-radius: 2px; background: var(--panel-3); overflow: hidden; }
.score-fill { display: block; height: 100%; border-radius: 2px; background: var(--muted); }
.score-fill.hi { background: var(--green); }
.score-fill.mid { background: var(--accent-text); }
.setup {
  display: inline-block; padding: 1px 6px; border-radius: 3px; font-size: calc(9.5px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .06em; white-space: nowrap;
  color: var(--muted); border: 1px solid var(--border-strong); background: var(--gray-soft);
}
.setup.breakout, .setup.momentum-leader { color: var(--green); border-color: rgba(46, 204, 143, .3); background: var(--green-soft); }
.setup.pullback-in-uptrend, .setup.uptrend { color: var(--accent-text); border-color: rgba(106, 166, 255, .3); background: var(--accent-soft); }
.setup.volume-surge { color: var(--purple); border-color: rgba(179, 156, 255, .3); background: var(--purple-soft); }
.setup.recovery-watch { color: var(--yellow); border-color: rgba(242, 201, 76, .28); background: var(--yellow-soft); }

/* ---------- Buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 12px;
  border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--panel-3); color: var(--text);
  cursor: pointer; font-weight: 600; font-size: calc(12.5px * var(--ts, 1.1)); text-decoration: none; white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), transform var(--ease);
}
.btn[hidden], button[hidden] { display: none !important; } /* .btn's display must not override the hidden attribute (Try loading again) */
.btn:hover { background: color-mix(in srgb, var(--panel-3), var(--text) 7%); border-color: var(--border-hi); color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hi); border-color: var(--accent-hi); color: #fff; }
.btn-danger { border-color: rgba(255, 107, 122, .45); color: var(--red); background: var(--red-soft); }
.btn-danger:hover { background: rgba(255, 107, 122, .2); border-color: var(--red); color: var(--red); }
.btn-ok { border-color: rgba(46, 204, 143, .45); color: var(--green); background: var(--green-soft); }
.btn-ok:hover { background: rgba(46, 204, 143, .2); border-color: var(--green); color: var(--green); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 14px; height: 14px; flex: none; }
.btn.btn-sm { height: 24px; padding: 0 8px; font-size: calc(11.5px * var(--ts, 1.1)); min-height: 0; }
.btn-row { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
form.btn-row { align-items: flex-end; }
form.btn-row .field { flex: 1 1 min(240px, 100%); }
form.btn-row .field.grow { flex: 3 1 min(320px, 100%); }
.pre-line { white-space: pre-line; }
form.stack { display: grid; gap: var(--s3); }
.field { display: grid; gap: 5px; min-width: 0; }
.field label { overflow-wrap: anywhere; }
.field input, .field select, .field textarea { min-width: 0; max-width: 100%; box-sizing: border-box; }
.field label { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--text-2); font-weight: 600; }
.field input, .field select, .field textarea {
  height: 32px; padding: 0 10px; background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); outline: none;
  font-size: calc(13px * var(--ts, 1.1)); transition: border-color var(--ease), box-shadow var(--ease);
}
.field input:hover, .field select:hover, .field textarea:hover { border-color: var(--border-hi); }
.field textarea { height: auto; min-height: 120px; padding: 8px 10px; resize: vertical; font-family: var(--mono); font-size: calc(12.5px * var(--ts, 1.1)); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
select { background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); height: 32px; padding: 0 8px; }
.fields-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }

/* ---------- Empty / notices / loading ---------- */
.empty {
  padding: var(--s6) var(--s4); text-align: center; border: 1px dashed var(--border-strong); border-radius: var(--radius);
  color: var(--text-2); background: var(--bg-2); font-size: calc(13px * var(--ts, 1.1));
}
.empty::before {
  content: ""; display: block; width: 36px; height: 36px; margin: 0 auto var(--s2); opacity: .75;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 36' fill='none' stroke='%238493a9' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='M5 30h26'/%3E%3Cpath d='M10 30V20M18 30V10M26 30V16' stroke-dasharray='2 3'/%3E%3C/svg%3E") center / contain no-repeat;
}
.empty h3 { margin: 0 0 4px; color: var(--text); font-size: calc(14px * var(--ts, 1.1)); }
.empty .btn { margin-top: var(--s3); }
.notice {
  display: flex; gap: 10px; padding: 9px 12px; border-radius: var(--radius-sm); font-size: calc(12.5px * var(--ts, 1.1)); border: 1px solid var(--border);
  border-left: 3px solid var(--border-hi); background: var(--panel-2); color: var(--text-2);
}
.notice b { color: var(--text); }
.notice > div { min-width: 0; overflow-wrap: anywhere; }
.notice > svg { width: 16px; height: 16px; flex: none; margin-top: 1px; color: var(--muted); }
.notice.warn { border-color: rgba(245, 165, 36, .3); border-left-color: var(--orange); background: var(--orange-soft); }
.notice.warn > svg { color: var(--orange); }
.notice.danger { border-color: rgba(255, 107, 122, .3); border-left-color: var(--red); background: var(--red-soft); }
.notice.danger > svg { color: var(--red); }
.notice.demo { border-color: rgba(179, 156, 255, .3); border-left-color: var(--purple); background: var(--purple-soft); }
.notice.demo > svg { color: var(--purple); }
.notice.good { border-color: rgba(46, 204, 143, .3); border-left-color: var(--green); background: var(--green-soft); }

.skel { display: block; border-radius: 3px; background: linear-gradient(90deg, var(--panel-2) 0%, var(--panel-3) 40%, var(--panel-2) 80%); background-size: 220% 100%; animation: shimmer 1.4s ease-in-out infinite; }
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -100% 0; } }
.loading { display: grid; gap: 7px; }
.loading .skel { height: 11px; }
.loading .skel:nth-child(1) { width: 38%; }
.loading .skel:nth-child(2) { width: 100%; }
.loading .skel:nth-child(3) { width: 82%; }
.loading .loading-text { font-size: calc(12px * var(--ts, 1.1)); color: var(--muted); margin-top: 2px; }

/* ---------- Lists ---------- */
.list { display: grid; gap: 0;  grid-template-columns: minmax(0, 1fr); }
.list-item { display: flex; gap: var(--s3); align-items: flex-start; padding: 8px 2px; border-bottom: 1px solid var(--border); }
.list-item:last-child { border-bottom: 0; }
.list-item .li-icon { width: 24px; height: 24px; border-radius: var(--radius-sm); display: grid; place-items: center; background: var(--panel-3); color: var(--accent-text); flex: none; }
.list-item .li-icon svg { width: 13px; height: 13px; }
.list-item .li-main { min-width: 0; flex: 1 1 180px; }
.list-item.wrap { flex-wrap: wrap; }
.list-item.wrap .btn-row { margin-left: 36px; }
.list-item .li-title { font-size: calc(13px * var(--ts, 1.1)); font-weight: 600; overflow-wrap: anywhere; }
.list-item .li-sub { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); overflow-wrap: anywhere; }
.list-item .li-main .small { overflow-wrap: anywhere; }   /* a long setting name such as SCOUT_OS_SCHEDULER=true must wrap, not run under the buttons */
.kv { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 5px 14px; font-size: calc(12.5px * var(--ts, 1.1)); margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.metric-box { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; }
.metric-box .k { font-size: calc(10.5px * var(--ts, 1.1)); color: var(--muted); letter-spacing: .04em; text-transform: uppercase; font-weight: 600; }
.metric-box .v { font-weight: 700; font-size: calc(15px * var(--ts, 1.1)); margin-top: 2px; font-family: var(--mono); }

/* ---------- Market pulse ---------- */
.pulse { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: var(--s2); }
.pulse-tile { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 10px; min-width: 0; }
.pulse-tile .k { font-size: calc(10.5px * var(--ts, 1.1)); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.pulse-tile .v { font: 700 calc(18px * var(--ts, 1.1))/1.2 var(--mono); margin-top: 2px; }
.pulse-tile .small.up::before { content: "▲ "; font-size: .75em; }
.pulse-tile .small.down::before { content: "▼ "; font-size: .75em; }
.pulse-tile .chart { height: 36px; margin: 4px 0; }
@media (max-width: 1280px) { .pulse { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .pulse { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ---------- Market Scout full report ---------- */
.lane-strip { display: flex; flex-wrap: wrap; gap: 5px; margin-top: var(--s2); }
.lane-pill, .lane-mini {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 6px 2px 7px; border-radius: var(--radius-sm);
  border: 1px solid var(--border); background: var(--bg-2); color: var(--text-2); font-size: calc(11.5px * var(--ts, 1.1)); cursor: pointer;
  transition: border-color var(--ease), background var(--ease);
}
.lane-pill:hover { border-color: var(--border-hi); background: var(--panel-2); }
.lane-mini { cursor: default; }
.lane-pill .n, .lane-mini .n { font-weight: 800; color: var(--text); min-width: 1.2em; text-align: center; font-family: var(--mono); }
.lane-pill .chip, .lane-mini .chip { height: 16px; font-size: calc(9px * var(--ts, 1.1)); padding: 0 5px; }
.rep-section { scroll-margin-top: calc(var(--header-h) + 12px); }
.rep-section .panel-head h2 { font-size: calc(13.5px * var(--ts, 1.1)); }
.sec-num { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: var(--radius-sm); background: var(--accent-soft);
  color: var(--accent-text); font: 800 calc(12px * var(--ts, 1.1)) var(--mono); flex: none; }
.rep-block { margin-top: var(--s3); min-width: 0; }
.rep-title { font-size: calc(12.5px * var(--ts, 1.1)); margin: 0 0 6px; color: var(--text); }
.rep-text { font-size: calc(13px * var(--ts, 1.1)); color: var(--text-2); margin: var(--s2) 0 0; }
.rep-callout { margin-top: var(--s2); }
.rep-kv { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); gap: 5px 14px; margin: 0; font-size: calc(12.5px * var(--ts, 1.1)); }
.rep-kv dt { color: var(--muted); font-weight: 600; }
.rep-kv dd { margin: 0; overflow-wrap: anywhere; }
.rep-list { margin: 0; padding-left: 18px; font-size: calc(12.5px * var(--ts, 1.1)); color: var(--text-2); }
.rep-list li { margin: 3px 0; overflow-wrap: anywhere; }
.rep-card { margin-top: var(--s2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 8px 12px; background: var(--bg-2); }
.rep-card.bad { border-color: rgba(255, 107, 122, .4); border-left: 3px solid var(--red); }
.rep-card h4 { margin: 0 0 5px; font-size: calc(13px * var(--ts, 1.1)); }
.rep-table { font-size: calc(12px * var(--ts, 1.1)); }
.rep-table td { vertical-align: top; min-width: 90px; max-width: 360px; overflow-wrap: anywhere; padding: 6px 8px; }
.rep-table th { white-space: normal; min-width: 80px; }
.rep-table td.nw { white-space: nowrap; }
.rep-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: var(--s2); }
.rep-tile { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 10px; min-width: 0; }
.rep-tile.pos { border-color: rgba(46, 204, 143, .35); background: var(--green-soft); }
.rep-tile.neg { border-color: rgba(255, 107, 122, .35); background: var(--red-soft); }
.rep-tile .k { font-size: calc(10.5px * var(--ts, 1.1)); line-height: 1.3; color: var(--muted); white-space: normal; overflow-wrap: anywhere; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.rep-tile .v { font: 700 calc(15px * var(--ts, 1.1))/1.3 var(--mono); }
.rep-tile .s { font-size: calc(11px * var(--ts, 1.1)); color: var(--muted); }
.rep-tile.pos .s::before { content: "▲ "; color: var(--green); font-size: .8em; }
.rep-tile.neg .s::before { content: "▼ "; color: var(--red); font-size: .8em; }
.rep-tile.tile-link { display: block; color: inherit; text-decoration: none; }
.rep-tile.tile-link:hover, .rep-tile.tile-link:focus-visible { border-color: var(--accent, var(--muted)); }
/* Dashboard: today's call */
.today { margin-top: var(--s3); border: 1px solid rgba(106, 166, 255, .35); border-left: 3px solid var(--accent); background: var(--accent-soft);
  border-radius: var(--radius); padding: var(--s3) var(--s4); }
.today.old { border-color: rgba(245, 165, 36, .35); border-left-color: var(--orange); background: var(--orange-soft); }
.today-k { font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.today.old .today-k { color: var(--orange); }
.today-call { margin: 2px 0 4px; font-size: calc(20px * var(--ts, 1.1)); line-height: 1.25; letter-spacing: -0.01em; }
.today-why { margin: 0; font-size: calc(13px * var(--ts, 1.1)); color: var(--text-2); max-width: 90ch; }
.today-meta { margin: 6px 0 0; font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); }
.today-tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.today-tile { display: block; min-width: 0; padding: 8px 10px; color: inherit; text-decoration: none; background: var(--bg-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); transition: border-color var(--ease), background var(--ease); }
.today-tile:hover { border-color: var(--border-hi); background: var(--panel-2); }
.today-tile.attn { border-color: rgba(245, 165, 36, .45); }
.today-tile .k { display: block; font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.today-tile .v { display: block; margin-top: 2px; font: 700 calc(20px * var(--ts, 1.1))/1.2 var(--mono); }
.today-tile .s { display: block; font-size: calc(11px * var(--ts, 1.1)); color: var(--muted); overflow-wrap: anywhere; }
@media (max-width: 640px) {
  .today { padding: var(--s3); }
  .today-call { font-size: calc(18px * var(--ts, 1.1)); }
  .today-tiles { gap: 6px; }
  .today-tile { padding: 8px; }
  .today-tile .v { font-size: calc(17px * var(--ts, 1.1)); }
  /* short, wide report tables: one card per row, the column name in front of each value */
  .table-wrap.stack-wrap { max-height: none; overflow: visible; }
  .rep-table.stackable, .rep-table.stackable tbody { display: block; }
  .rep-table.stackable thead { display: none; }
  .rep-table.stackable tr { display: block; margin: 0 0 var(--s2); padding: 2px 10px; background: var(--bg-2);
    border: 1px solid var(--border); border-radius: var(--radius-sm); }
  .rep-table.stackable td, .rep-table.stackable td:first-child { display: grid; grid-template-columns: minmax(72px, 34%) minmax(0, 1fr); gap: 2px 10px;
    position: static; min-width: 0; max-width: none; padding: 6px 0; background: none; border-bottom: 1px solid var(--border); }
  .rep-table.stackable td:last-child { border-bottom: 0; }
  .rep-table.stackable td:first-child { font-weight: 600; }
  .rep-table.stackable td::before { content: attr(data-label); font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
  .rep-table.stackable tbody tr:hover td { background: none; }
}
/* "Why does it say LIMITED?" — grouped by who can change it */
.limits-card > summary { display: flex; align-items: center; gap: var(--s2); cursor: pointer; list-style: none;
  padding: 8px var(--s3); margin: 0 calc(-1 * var(--s3)) var(--s3); min-height: 38px; border-bottom: 1px solid var(--border); }
.limits-card > summary::-webkit-details-marker { display: none; }
.limits-card > summary::before { content: "▾"; color: var(--muted); font-size: calc(12px * var(--ts, 1.1)); }
.limits-card:not([open]) > summary { margin-bottom: 0; border-bottom: 0; }
.limits-card:not([open]) > summary::before { content: "▸"; }
.limits-card > summary h2 { margin: 0; font-size: calc(13px * var(--ts, 1.1)); font-weight: 650; line-height: 1.3; flex: 1 1 0; min-width: 0; }
.limit-group { margin-top: var(--s3); }
.limit-group h3 { margin: 0 0 4px; font-size: calc(11px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.limit-group[data-who="you"] h3 { color: var(--green); }
.limit-group[data-who="your call"] h3 { color: var(--orange); }
.limit-list { margin: 0; padding-left: 18px; font-size: calc(12.5px * var(--ts, 1.1)); color: var(--text-2); }
.limit-list li { margin: 5px 0; overflow-wrap: anywhere; }
.limit-helps { display: block; margin-top: 2px; }
.limit-helps .receipt-link { display: inline; padding: 0; }
.limits-mini { margin-top: var(--s2); }
.limits-mini > summary { cursor: pointer; color: var(--accent-text); font-weight: 600; }
.limits-mini ul { margin: 6px 0; padding-left: 18px; }
.final-call { margin-top: var(--s3); border: 1px solid rgba(106, 166, 255, .4); border-left: 3px solid var(--accent); background: var(--accent-soft); border-radius: var(--radius-sm); padding: var(--s3) var(--s4); }
.final-call h3 { margin: 0 0 5px; font-size: calc(12px * var(--ts, 1.1)); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-text); }
.final-call p { margin: 0; font-size: calc(14px * var(--ts, 1.1)); }
@media (max-width: 860px) {
  .rep-kv { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .rep-kv dd { margin-bottom: 6px; }
  .rep-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ---------- Charts ---------- */
.chart { width: 100%; height: 210px; display: block; }
.chart .line { fill: none; stroke: var(--green); stroke-width: 1.8; }
.chart .line.neg { stroke: var(--red); }
.chart .line.blue { stroke: var(--accent-text); }
.chart .area { fill: url(#gradGreen); opacity: .9; }
.chart .grid-line { stroke: var(--border); stroke-width: 1; }
.chart .axis { fill: var(--muted); font-size: calc(10px * var(--ts, 1.1)); font-family: var(--mono); }
.chart .vol { fill: rgba(132, 147, 169, .26); }
.donut-track { fill: none; stroke: var(--border-strong); }
.donut-num { fill: var(--text); font-family: var(--mono); }
.donut-cap { fill: var(--muted); }
.spark { width: 100%; height: 40px; }

/* ---------- Detail header ---------- */
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--s2); }
.detail-sym { font-size: calc(18px * var(--ts, 1.1)); font-weight: 800; }
.detail-price { font: 700 calc(22px * var(--ts, 1.1))/1.2 var(--mono); text-align: right; }

/* ---------- Chat drawer ---------- */
.chat {
  position: fixed; top: var(--header-h); right: 0; bottom: 0; width: min(420px, 100vw); z-index: 40;
  background: var(--bg-2); border-left: 1px solid var(--border-strong); display: flex; flex-direction: column;
  box-shadow: -16px 0 36px rgba(0, 0, 0, .45);
}
.chat:not(.open) { display: none; }
.chat-head { display: flex; align-items: center; gap: var(--s2); padding: 10px var(--s3); border-bottom: 1px solid var(--border); }
.chat-head svg { color: var(--accent-text); }
.chat-head h2 { margin: 0; font-size: calc(14px * var(--ts, 1.1)); }
.chat-head .spacer { flex: 1; }
.chat-log { flex: 1; overflow-y: auto; padding: var(--s3); display: grid; gap: 10px; align-content: start; }
.msg-user { justify-self: end; max-width: 85%; background: var(--accent); color: #fff; padding: 7px 11px; border-radius: 8px 8px 2px 8px; font-size: calc(13px * var(--ts, 1.1)); overflow-wrap: anywhere; }
.msg-bot { background: var(--panel); border: 1px solid var(--border); border-radius: 8px 8px 8px 2px; padding: 10px 12px; font-size: calc(13px * var(--ts, 1.1)); }
.msg-bot .meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-bottom: var(--s2); }
.msg-bot ul { margin: var(--s2) 0 0; padding-left: 18px; color: var(--text-2); font-size: calc(12.5px * var(--ts, 1.1)); }
.chat-suggest { display: flex; gap: 6px; flex-wrap: wrap; padding: 0 var(--s3) var(--s3); }
.chat-suggest button { font-size: calc(11.5px * var(--ts, 1.1)); padding: 4px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--panel); cursor: pointer; color: var(--text-2); transition: border-color var(--ease), color var(--ease); }
.chat-suggest button:hover { border-color: var(--accent); color: var(--text); }
.chat-form { display: flex; gap: var(--s2); padding: var(--s3); border-top: 1px solid var(--border); }
.chat-form input { flex: 1; height: 36px; padding: 0 12px; border-radius: var(--radius-sm); background: var(--panel); border: 1px solid var(--border-strong); outline: none; }
.chat-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-form button { width: 36px; height: 36px; border-radius: var(--radius-sm); border: 0; background: var(--accent); color: #fff; display: grid; place-items: center; cursor: pointer; }
.chat-form button:hover { background: var(--accent-hi); }
.chat-form button svg { width: 16px; height: 16px; }
.receipt-link { background: none; border: 0; padding: 0; color: var(--accent-text); cursor: pointer; font-size: calc(11.5px * var(--ts, 1.1)); font-family: var(--mono); text-align: left; overflow-wrap: anywhere; }
.receipt-link:hover { color: var(--link-hover); text-decoration: underline; }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; z-index: 60; background: rgba(3, 6, 12, .74); backdrop-filter: blur(2px); display: grid; place-items: center; padding: var(--s4); animation: fade-in 120ms ease-out; }
.modal { width: min(820px, 100%); max-height: 90vh; overflow: auto; background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: 0 var(--s4) var(--s4); box-shadow: var(--shadow); animation: pop-in 140ms ease-out; }
.modal > .panel-head { position: sticky; top: 0; z-index: 3; margin: 0 calc(-1 * var(--s4)) var(--s3); padding: 10px var(--s4); background: var(--panel-2); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.modal h2 { margin: 0; font-size: calc(15px * var(--ts, 1.1)); }
pre.json { background: #060a10; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: var(--s3); font: calc(11.5px * var(--ts, 1.1))/1.55 var(--mono); color: #9fe3bf; overflow: auto; max-height: 50vh; white-space: pre-wrap; word-break: break-word; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(6px) scale(.99); } to { opacity: 1; transform: none; } }

/* ---------- Login ---------- */
.login {
  position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: var(--s4);
  background:
    radial-gradient(760px 420px at 50% -10%, rgba(41, 98, 255, .22), transparent 70%),
    radial-gradient(520px 320px at 100% 100%, rgba(31, 191, 117, .10), transparent 70%),
    repeating-linear-gradient(0deg, transparent 0 39px, rgba(255, 255, 255, .025) 39px 40px),
    repeating-linear-gradient(90deg, transparent 0 39px, rgba(255, 255, 255, .025) 39px 40px),
    var(--bg);
}
.login .box { width: min(420px, 100%); background: var(--panel); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); padding: var(--s6); display: grid; gap: var(--s4); box-shadow: var(--shadow); animation: pop-in .25s ease-out; }
.login-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 2px; }
.login-brand svg { width: 44px; height: 44px; flex: none; }
.login-brand .brand-name { font-size: calc(20px * var(--ts, 1.1)); }
.login-brand .brand-sub { font-size: calc(9px * var(--ts, 1.1)); }
.login h1 { margin: 0; font-size: calc(24px * var(--ts, 1.1)); letter-spacing: -0.02em; line-height: 1.15; }
.login .box p { margin: 0; font-size: calc(13.5px * var(--ts, 1.1)); line-height: 1.45; }
.login .field label { font-size: calc(12.5px * var(--ts, 1.1)); }
.login .field input { height: calc(44px * var(--ts, 1.1)); font-size: calc(16px * var(--ts, 1.1)); padding: 0 12px; border-radius: var(--radius); }
.login #pwFields, .login #setupFields { display: grid; gap: var(--s3); }
.pw-wrap { position: relative; display: block; }
.pw-wrap input { width: 100%; padding-right: 48px; }
.pw-eye { position: absolute; top: 50%; right: 6px; transform: translateY(-50%); width: 36px; height: 36px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--muted); display: grid; place-items: center; cursor: pointer; }
.pw-eye svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.pw-eye:hover, .pw-eye[aria-pressed="true"] { color: var(--accent-text); background: var(--accent-soft); }
.pw-eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.login .check { display: flex; align-items: center; gap: 10px; font-size: calc(13.5px * var(--ts, 1.1)); color: var(--text-2); cursor: pointer; min-height: 32px; }
.login .check input { width: 20px; height: 20px; accent-color: var(--accent); flex: none; margin: 0; }
.login-error { color: var(--text-2); min-height: 1.2em; font-weight: 600; }
.login-error.is-error { color: var(--red); }
.login-error:empty { display: none; }
.login .btn-lg { height: calc(46px * var(--ts, 1.1)); font-size: calc(15px * var(--ts, 1.1)); font-weight: 700; border-radius: var(--radius); }
.login-foot { text-align: center; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* ---------- Toast ---------- */
.toasts { position: fixed; inset-inline: 0; bottom: var(--s5); z-index: 90; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; }
.toast {
  width: fit-content; background: var(--panel-3); border: 1px solid var(--border-strong); pointer-events: auto;
  border-left: 3px solid var(--accent); padding: 9px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-size: calc(13px * var(--ts, 1.1));
  max-width: min(460px, calc(100vw - 32px)); animation: toast-in 160ms ease-out;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- Bottom nav (phone) ---------- */
.bottom-nav { display: none; }
.mobile-cmd { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .owner-text { display: none; }
}
@media (max-width: 1100px) {
  .clock { text-align: left; }
  .head-badges { justify-content: flex-start; }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .mkt-clock, .mkt-verb { display: none; }
}
@media (max-width: 860px) {
  :root { --bar-h: 50px; --tape-h: 30px; --brand-w: auto; }
  body { font-size: calc(14px * var(--ts, 1.1)); }
  .header { grid-template-columns: minmax(0, 1fr) auto; padding: 0 var(--s2); gap: var(--s2); }
  .header .cmd { display: none; }
  .icon-btn.menu-btn { display: grid; }
  #modeChip { display: none; }
  .header-right { gap: 2px; justify-self: end; }
  .icon-btn { width: 36px; height: 36px; }
  .brand svg { width: 28px; height: 28px; }
  .brand-name { font-size: calc(14px * var(--ts, 1.1)); letter-spacing: .08em; }
  .owner { display: none; }
  .mkt { padding: 0 7px; gap: 5px; margin-right: 2px; }
  .mkt-clock, .mkt-verb { display: none; }
  .layout { grid-template-columns: minmax(0, 1fr); }
  .sidebar {
    position: fixed; z-index: 50; top: var(--header-h); left: 0; bottom: 0; width: min(300px, 86vw); height: auto;
    transform: translateX(-100%); transition: transform .2s ease;
  }
  .sidebar.open { transform: none; box-shadow: 20px 0 40px rgba(0, 0, 0, .5); }
  .nav-item { height: 40px; font-size: calc(14px * var(--ts, 1.1)); }
  .nav-toggle { width: 36px; height: 36px; }
  .nav-sub { min-height: 36px; font-size: calc(13.5px * var(--ts, 1.1)); }
  .main { padding: var(--s3) var(--s3) calc(136px + env(safe-area-inset-bottom)); }   /* bottom bar 56px + help button up to 116px */
  .mobile-cmd { display: block; margin-bottom: var(--s3); }
  .mobile-cmd .cmd { max-width: none; }
  .mobile-cmd .cmd input, .chat-form input { height: 40px; font-size: calc(16px * var(--ts, 1.1)); }   /* 16px stops iOS zooming into the box */
  .mobile-cmd .cmd .send { width: 32px; height: 32px; right: 4px; }
  .view-head h1 { font-size: calc(18px * var(--ts, 1.1)); }
  .clock { text-align: left; }
  .clock .time { font-size: calc(16px * var(--ts, 1.1)); }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s2); }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
  .stack-sm { grid-template-columns: minmax(0, 1fr) !important; }
  .scout-card { padding: 10px; }
  .scout-card .row { flex-direction: column; gap: 6px; }
  .scout-card .desc { display: none; }
  .scout-card .metric { font-size: calc(22px * var(--ts, 1.1)); margin-top: 6px; }
  .scout-card .go { display: none; }
  .scout-card .chip { font-size: calc(9px * var(--ts, 1.1)); padding: 0 5px; }
  .panel { padding: 0 10px 10px; }
  .panel-head { margin: 0 -10px 10px; padding: 8px 10px; }
  .hide-sm { display: none; }
  .setup { white-space: normal; max-width: 9.5em; line-height: 1.2; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fields-2 { grid-template-columns: 1fr; }
  .tab { height: 40px; padding: 0 14px; }
  .btn { height: 44px; min-height: 44px; }
  .btn.btn-sm { height: 40px; min-height: 40px; }
  .icon-btn { min-width: 40px; min-height: 40px; }
  .field input, .field select, .field textarea, select { height: 40px; font-size: calc(16px * var(--ts, 1.1)); }
  input.term-symin { font-size: calc(16px * var(--ts, 1.1)); }   /* Chart Terminal symbol search: 16px stops iPhones zooming in */
  .receipt-link { padding: 12px 0; }   /* bigger tap area for run-receipt links */
  .limit-helps .receipt-link { padding: 8px 0; }
  .limits-mini > summary { padding: 8px 0; }
  .lane-pill { min-height: 40px; padding: 4px 10px; }
  .chat-suggest button { min-height: 40px; padding: 8px 12px; font-size: calc(13px * var(--ts, 1.1)); }
  /* keep the stock name in view while a wide report table is swiped sideways */
  .rep-table th:first-child, .rep-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--panel); max-width: 120px; }
  .rep-table th:first-child { z-index: 3; }
  .rep-table tbody tr:hover td:first-child { background: var(--panel-2); }
  .rep-table tbody tr.selected td:first-child { background: var(--accent-soft); }
  .field textarea { height: auto; }
  .table-wrap { max-height: 70vh; }
  .brand-wrap { min-width: 0; }
  .tape-label { padding: 0 var(--s2); }
  .tape-label .tape-title { display: none; }
  .tape-cell { padding: 0 10px; gap: 6px; }
  .tc-spark { width: 36px; }
  .chat { top: 0; width: 100vw; z-index: 70; }
  .toasts { inset-inline: var(--s3); bottom: calc(68px + env(safe-area-inset-bottom)); }
  .toast { width: auto; max-width: none; }
  .bottom-nav {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 45;
    background: color-mix(in srgb, var(--bg) 97%, transparent); backdrop-filter: blur(8px); border-top: 1px solid var(--border-strong);
    padding: 0 2px env(safe-area-inset-bottom);
  }
  .bottom-nav button {
    position: relative; display: grid; justify-items: center; align-content: center; gap: 3px; min-height: 56px; padding: 6px 0;
    background: none; border: 0; color: var(--muted); font-size: calc(10.5px * var(--ts, 1.1)); font-weight: 600; letter-spacing: .02em; cursor: pointer;
  }
  .bottom-nav button svg { width: 21px; height: 21px; }
  .bottom-nav button.active { color: var(--accent-text); }
  .bottom-nav button.active::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 2px; border-radius: 0 0 2px 2px; background: var(--accent); }
  .bn-badge { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--orange); color: #14100a; font-size: calc(10px * var(--ts, 1.1)); font-weight: 800; display: grid; place-items: center; line-height: 1; }
}
@media (max-width: 520px) {
  .tc-asof { display: none; }
  .mkt-state { letter-spacing: .04em; }
}
@media (max-width: 400px) {
  .header .brand-name { font-size: calc(12px * var(--ts, 1.1)); letter-spacing: .06em; }   /* the name stays on a phone: two small lines beside the logo */
  .header .brand-sub { font-size: calc(8px * var(--ts, 1.1)); letter-spacing: .16em; margin-top: 3px; }
  .header .brand svg { width: 24px; height: 24px; }
  .header .brand { gap: 6px; }
  .mkt { padding: 0 5px; gap: 4px; }   /* a long "CLOSED 13h 06m" pill must not cover the name */
  .mkt-state, .mkt-count { font-size: calc(10px * var(--ts, 1.1)); letter-spacing: .02em; }
  .mkt-dot { display: none; }
  /* the Safety Bias Audit table keeps four columns on a phone: tighter cells so none is cut off at 320px */
  #auditTable th, #auditTable td { padding-left: 5px; padding-right: 5px; }
  #auditTable th { letter-spacing: 0; }
}
@media (max-width: 340px) {
  .header .brand-text { display: none; }   /* only the very smallest phones: the name would run under the market pill */
}
@media (max-width: 380px) {
  .grid-4, .grid-3, .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
  .tape-view .tape-set + .tape-set { display: none; }
  .tape-view { overflow-x: auto; }
}

/* Charts: moving-average overlays, legend, horizontal bars, small buttons */
.chart .ov { fill: none; stroke-width: 1.4; }
.chart .ov.ov50 { stroke: var(--orange); stroke-dasharray: 5 3; }
.chart .ov.ov200 { stroke: var(--purple); stroke-dasharray: 2 3; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 6px; }
.legend .key { display: inline-block; width: 16px; height: 0; border-top: 2px solid var(--accent-text); vertical-align: middle; }
.legend .key.k50 { border-top: 2px dashed var(--orange); }
.legend .key.k200 { border-top: 2px dotted var(--purple); }
.bars { display: grid; gap: 7px; }
.bar-row { display: grid; grid-template-columns: minmax(90px, 180px) 1fr auto; gap: var(--s2); align-items: center; font-size: calc(12px * var(--ts, 1.1)); }
.bar-label { color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 6px; background: var(--panel-3); border-radius: 3px; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 3px; background: var(--accent-text); }
.bar-fill.pos { background: var(--green); }
.bar-fill.neg { background: var(--red); }
.bar-fill.mid { background: var(--accent-text); }
.bar-fill.low { background: var(--muted); }
.bar-value { color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: calc(11.5px * var(--ts, 1.1)); }
tr.clickable { cursor: pointer; }
@media (max-width: 520px) {
  .bar-row { grid-template-columns: minmax(96px, 38%) 1fr auto; }
  .bar-label { white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
}

/* Chart upgrade: candles, panes, levels, session shading, crosshair */
.stock-chart .chart-area { display: grid; gap: 2px; }
.chart.price { height: 280px; }
.chart.pane { height: 72px; }
.chart .candle.up, .chart .wick.up { fill: var(--green); stroke: var(--green); }
.chart .candle.down, .chart .wick.down { fill: var(--red); stroke: var(--red); }
.chart .wick { stroke-width: 1; }
.chart .vol.up { fill: rgba(46, 204, 143, .32); }
.chart .vol.down { fill: rgba(255, 107, 122, .32); }
.chart .sess.pre { fill: rgba(106, 166, 255, .09); }
.chart .sess.post { fill: rgba(179, 156, 255, .11); }
.chart .lvl { stroke-width: 1; stroke-dasharray: 4 3; }
.chart .lvl.l20 { stroke: var(--muted); }
.chart .lvl.l52 { stroke: var(--text-2); stroke-dasharray: 1 3; }
.chart .lvl.prev { stroke: var(--accent-text); stroke-dasharray: 2 2; }
.chart .lvl.entry { stroke: var(--green); }
.chart .lvl.invalid { stroke: var(--red); }
.chart .zone.entry { fill: rgba(46, 204, 143, .09); }
.chart .lvl-label { font-size: calc(9px * var(--ts, 1.1)); fill: var(--text-2); }
.chart .lvl-label.entry { fill: var(--green); }
.chart .lvl-label.invalid { fill: var(--red); }
.chart .ov.ovspy { stroke: var(--text-2); stroke-width: 1.2; }
.chart .ov.ovrsi { stroke: var(--accent-text); }
.chart .ov.ovmacd { stroke: var(--accent-text); }
.chart .ov.ovsig { stroke: var(--orange); }
.chart .hist.up { fill: rgba(46, 204, 143, .5); }
.chart .hist.down { fill: rgba(255, 107, 122, .5); }
.chart .band { stroke-dasharray: 2 3; }
.chart .pane-title { font-size: calc(9px * var(--ts, 1.1)); fill: var(--muted); }
.chart .crosshair { stroke: var(--text-2); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .crossdot { fill: var(--accent-text); }
.readout { min-height: 20px; color: var(--text-2); margin: 6px 0; font: calc(12px * var(--ts, 1.1)) var(--mono); }
.legend .key.kspy { border-top: 2px solid var(--text-2); }
.legend .key.kpre { display: inline-block; width: 14px; height: 10px; border: 0; background: rgba(106, 166, 255, .22); }
/* the pop-up already has a fixed width, so the chart fills it; a wider minimum pushed the price numbers off the phone screen */
.modal .stock-chart { min-width: 0; max-width: 100%; }
.modal .stock-chart svg.chart { width: 100%; max-width: 100%; }

/* Option chain */
table.chain td.itm { background: rgba(106, 166, 255, .08); }
table.chain tr.pick td { background: rgba(46, 204, 143, .12); }

/* Run banner: progress and result of a page button on a phone (instead of the full-screen chat) */
.run-banner { position: fixed; top: calc(var(--header-h) + 8px); left: 0; right: 0; margin: 0 auto; width: min(720px, calc(100vw - 20px)); z-index: 60; background: var(--panel-2); border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: var(--radius); padding: 10px 12px; font-size: calc(13px * var(--ts, 1.1)); box-shadow: var(--shadow); display: grid; gap: var(--s2); max-height: 40vh; overflow-y: auto; }
.run-banner.run { border-left-color: var(--accent); }
.run-banner.ok { border-left-color: var(--green); }
.run-banner.bad { border-left-color: var(--red); }
.run-banner .run-text { overflow-wrap: anywhere; }
.run-banner .run-title { display: flex; align-items: center; gap: var(--s2); font-size: calc(15px * var(--ts, 1.1)); }
.run-banner .run-clock { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.run-banner .run-sub { margin-top: 2px; color: var(--muted); }
.run-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--muted); flex: none; }
.run-banner.run .run-dot { background: var(--accent); animation: run-pulse 1.1s ease-in-out infinite; }
.run-banner.ok .run-dot { background: var(--green); }
.run-banner.bad .run-dot { background: var(--red); }
@keyframes run-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .run-banner.run .run-dot { animation: none; } }

/* Agent Inbox */
.finding { border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; background: var(--panel-2); }
.finding.read { opacity: .65; }
.finding p { margin: 6px 0; }
.stack { display: grid; gap: 10px; }

/* ---------- Steady, the coach (drawer, "I'm lost" button, dashboard strip) ---------- */
.chat.steady { width: min(460px, 100vw); }
.chat.steady .chat-head { gap: 12px; padding: 12px 16px; }
.steady-mark, .st-strip-mark { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; color: var(--cyan);
  background: linear-gradient(135deg, rgba(34, 211, 238, .26), rgba(47, 140, 255, .26)); border: 1px solid rgba(34, 211, 238, .45); }
.steady-mark svg, .st-strip-mark svg { width: 22px; height: 22px; }
.steady-title { display: grid; line-height: 1.15; min-width: 0; }
.steady-title h2 { margin: 0; font-size: calc(18px * var(--ts, 1.1)); letter-spacing: .02em; }
.steady-sub { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); }
.steady-tabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-bottom: 1px solid var(--border); background: var(--bg-2); }
.st-tab { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 4px; background: none; border: 0;
  border-bottom: 2px solid transparent; color: var(--muted); font-weight: 600; font-size: calc(13.5px * var(--ts, 1.1)); cursor: pointer; }
.st-tab svg { width: 16px; height: 16px; flex: none; }
.st-tab:hover { color: var(--text); }
/* four tabs share a 320px drawer: drop the icons there so the longest word (Playbook) fits its own button in any font */
@media (max-width: 400px) { .st-tab { padding: 0 2px; font-size: calc(13px * var(--ts, 1.1)); } .st-tab svg { display: none; } }
.st-tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--cyan); background: linear-gradient(180deg, transparent, rgba(34, 211, 238, .08)); }
.steady-pane { display: none; flex: 1 1 auto; min-height: 0; flex-direction: column; gap: 12px; overflow-y: auto; padding: 14px 16px 22px; }
.steady-pane.active { display: flex; }
#pane-ask { padding: 0; gap: 0; overflow: hidden; }
#pane-ask .chat-log { min-height: 0; }
.st-loading { padding: 22px 4px; }
.st-card { background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--border); border-radius: 12px; padding: 13px 14px; min-width: 0; }
.st-card h3 { margin: 2px 0 4px; font-size: calc(16px * var(--ts, 1.1)); }
.st-card p { margin: 0 0 8px; }
.st-label { font-size: calc(10.5px * var(--ts, 1.1)); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.st-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-row .spacer { flex: 1; }
.st-hello { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.st-hello p { margin: 0; font-size: calc(15px * var(--ts, 1.1)); font-weight: 600; }
.st-foot { margin: 2px 0 0; text-align: center; }
.warn-text { color: var(--orange); }
.st-clock { font-size: calc(34px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -.01em; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.st-next { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--border); }
.st-says { border-color: rgba(34, 211, 238, .45); box-shadow: inset 3px 0 0 var(--cyan);
  background: linear-gradient(135deg, rgba(34, 211, 238, .12), rgba(47, 140, 255, .06) 55%, var(--panel)); }
.st-says p { color: var(--text-2); font-size: calc(13px * var(--ts, 1.1)); }
.st-lost-card { border-color: rgba(167, 139, 250, .45); box-shadow: inset 3px 0 0 var(--purple); }
.st-steps { list-style: none; margin: 0; padding: 0; display: grid; }
.st-step { display: grid; grid-template-columns: 14px 74px minmax(0, 1fr); gap: 0 10px; padding: 0 0 14px; position: relative; }
.st-step:last-child { padding-bottom: 0; }
.st-step::before { content: ""; position: absolute; left: 6px; top: 18px; bottom: 0; width: 2px; background: var(--border); }
.st-step:last-child::before { display: none; }
.st-dot { position: relative; z-index: 1; width: 14px; height: 14px; margin-top: 3px; border-radius: 50%; display: grid; place-items: center; font-size: calc(9px * var(--ts, 1.1)); font-weight: 800;
  border: 2px solid var(--border-strong); background: var(--bg-2); }
.st-step.now .st-dot { border-color: var(--orange); background: var(--orange-soft); box-shadow: 0 0 0 4px rgba(245, 158, 11, .12); }
.st-step.next .st-dot { border-color: var(--accent); }
.st-step.later .st-dot { border-style: dashed; }
.st-step.done .st-dot { border-color: var(--green); background: var(--green); color: #04210f; }
.st-step.done .st-dot svg { width: 9px; height: 9px; }
.st-when { font-size: calc(12px * var(--ts, 1.1)); font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 2px; }
.st-step.now .st-when { color: var(--orange); }
.st-title { font-weight: 650; font-size: calc(14px * var(--ts, 1.1)); overflow-wrap: anywhere; }
.st-step.done .st-title { color: var(--text-2); text-decoration: line-through; text-decoration-color: rgba(129, 147, 178, .5); }
.st-body .btn-row { margin-top: 8px; }
.st-steps.compact .st-step { grid-template-columns: 22px minmax(0, 1fr); }
.st-steps.compact .st-dot { width: 22px; height: 22px; margin-top: 0; font-size: calc(12px * var(--ts, 1.1)); color: var(--text); }
.st-steps.compact .st-step::before { left: 10px; top: 26px; }
.st-setups { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.st-setup { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; }
.st-mark { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-3); color: var(--muted); }
.st-mark svg { width: 14px; height: 14px; }
.st-setup.ok .st-mark { background: var(--green-soft); color: var(--green); }
.st-setup.todo .st-mark { background: var(--yellow-soft); color: var(--yellow); }
.st-setup.warn .st-mark { background: var(--orange-soft); color: var(--orange); }
.st-setup .chip { margin-left: 6px; font-size: calc(10px * var(--ts, 1.1)); padding: 1px 7px; vertical-align: 1px; }
.st-progress { height: 6px; border-radius: 4px; background: var(--panel-3); overflow: hidden; margin: 8px 0 2px; }
.st-progress-fill { display: block; height: 100%; border-radius: 4px; background: linear-gradient(90deg, var(--cyan), var(--green)); }
.st-how { margin-top: 6px; }
.st-how > summary { cursor: pointer; font-size: calc(12.5px * var(--ts, 1.1)); color: var(--cyan); font-weight: 600; }
.st-how p { margin: 6px 0 8px; }
.st-how ol { margin: 6px 0; padding-left: 20px; color: var(--text-2); }
.st-render { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.st-days { display: grid; gap: 8px; }
.st-day { border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); padding: 0 12px; }
.st-day > summary { display: flex; align-items: center; gap: 8px; padding: 10px 0; cursor: pointer; list-style: none; }
.st-day > summary::-webkit-details-marker { display: none; }
.st-day > summary .spacer { flex: 1; }
.st-items { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 9px; }
.st-item { display: grid; grid-template-columns: 78px minmax(0, 1fr); gap: 8px; }
.st-item .chip { margin-top: 4px; font-size: calc(10px * var(--ts, 1.1)); padding: 1px 7px; }
.st-item.scheduled .st-when { color: var(--cyan); }
.st-item.earnings .st-when { color: var(--orange); }
.st-item.review .st-when { color: var(--purple); }
.st-item.off { opacity: .65; }
.st-off { margin: 0 0 10px; }
.st-strip { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 16px; padding: 12px 14px; border-radius: 12px;
  border: 1px solid rgba(34, 211, 238, .4); box-shadow: inset 3px 0 0 var(--cyan);
  background: linear-gradient(90deg, rgba(34, 211, 238, .12), rgba(47, 140, 255, .05) 60%, transparent); }
.st-strip-text { flex: 1 1 260px; min-width: 0; }
.st-strip-text .st-label { margin-bottom: 2px; }
.st-strip-text b { font-size: calc(15px * var(--ts, 1.1)); }
.st-fab { position: fixed; z-index: 35; right: 20px; bottom: 20px; display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 12px;
  border-radius: 999px; border: 1px solid rgba(34, 211, 238, .55); color: var(--text); font-weight: 700; cursor: pointer;
  background: linear-gradient(135deg, rgba(14, 40, 70, .96), rgba(8, 20, 40, .96)); box-shadow: 0 8px 26px rgba(0, 0, 0, .5), 0 0 0 4px rgba(34, 211, 238, .08); }
.st-fab svg { width: 22px; height: 22px; color: var(--cyan); }
.st-fab:hover { border-color: var(--cyan); }
.chat.open ~ .st-fab, body.no-steady-fab .st-fab { display: none; }   /* a full-screen page can add body.no-steady-fab */
.st-term { margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; background: var(--bg-2); padding: 10px 12px; font-size: calc(13.5px * var(--ts, 1.1)); }
.st-term p { margin: 6px 0; }
.st-def { display: grid; gap: 2px; margin: 8px 0; font-size: calc(13px * var(--ts, 1.1)); }
.st-def dt { margin-top: 6px; font-size: calc(10.5px * var(--ts, 1.1)); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.st-def dd { margin: 0; color: var(--text-2); overflow-wrap: anywhere; }
.st-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.st-chip { min-height: 32px; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--border-strong); background: var(--panel); color: var(--text-2); font-size: calc(12px * var(--ts, 1.1)); cursor: pointer; }
.st-chip:hover { border-color: var(--cyan); color: var(--text); }
.st-form { display: grid; grid-template-columns: minmax(0, 1fr); gap: 8px; }
.st-input { min-width: 0; display: flex; align-items: center; gap: 8px; padding: 4px 6px 4px 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: var(--panel); }
.st-input:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.st-input > svg { width: 18px; height: 18px; color: var(--muted); flex: none; }
.st-input input { flex: 1; min-width: 0; height: 38px; background: transparent; border: 0; outline: none; }
.st-form textarea, .st-copybox { width: 100%; min-height: 96px; padding: 10px 12px; resize: vertical; outline: none; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--border-strong); border-radius: 10px; }
.st-form textarea:focus, .st-copybox:focus { border-color: var(--accent); }
.st-copybox { min-height: 220px; font: calc(12.5px * var(--ts, 1.1))/1.5 var(--mono); }
.st-pack { display: grid; gap: 4px; }
.st-group { margin-top: 10px; }
.st-links, .st-fail { list-style: none; margin: 0; padding: 0; display: grid; }
.st-link { padding: 8px 0; border-bottom: 1px solid rgba(27, 42, 71, .6); }
.st-link:last-child { border-bottom: 0; }
.st-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.st-meta .chip { font-size: calc(10px * var(--ts, 1.1)); padding: 1px 7px; }
.st-fail li { padding: 6px 0; }
.st-how.bad > summary { color: var(--orange); }
.st-ideas { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.st-idea { display: grid; gap: 6px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--panel-2); }
.st-idea.done { opacity: .65; }
.st-idea-text { white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .chat.steady { width: 100vw; }
  .chat.steady .chat-head { padding-top: calc(12px + env(safe-area-inset-top)); }
  .steady-pane { padding: 12px 12px calc(22px + env(safe-area-inset-bottom)); }
  #pane-ask { padding: 0; }
  #pane-ask .chat-form { padding-bottom: calc(14px + env(safe-area-inset-bottom)); }
  /* On a phone the help button is a small round icon (its words stay for screen readers), so it hides less of the page. */
  .st-fab { right: 12px; bottom: calc(72px + env(safe-area-inset-bottom)); height: 44px; width: 44px; padding: 0; justify-content: center; gap: 0; }
  .st-fab span { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .st-step { grid-template-columns: 14px 64px minmax(0, 1fr); }
  .st-clock { font-size: calc(30px * var(--ts, 1.1)); }
  .st-strip { gap: 8px; }
  .st-strip-mark { display: none; }
  /* 16px stops iPhones zooming into the box */
  .st-input input, .st-form textarea { font-size: calc(16px * var(--ts, 1.1)); }
}

/* Watchlist & Alerts */
.wl-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.wl-chip { display: inline-flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; border: 1px solid var(--border); border-radius: 999px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.wl-chip a { font-weight: 700; text-decoration: none; }
.wl-chip.wl-guarded { border-color: var(--orange); }
.wl-flag { font-size: calc(10.5px * var(--ts, 1.1)); text-transform: uppercase; letter-spacing: .04em; color: var(--orange); }
.wl-x { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; border: 0; border-radius: 999px; background: transparent; color: var(--muted); cursor: pointer; }
.wl-x:hover, .wl-x:focus-visible { background: rgba(255, 255, 255, .08); color: var(--text); }
.wl-x svg { width: 14px; height: 14px; }
.wl-form { align-items: end; }
.wl-alert-form { display: grid; gap: 10px; }
.wl-table td, .wl-table th { vertical-align: top; }
@media (max-width: 860px) { .wl-x { width: 36px; height: 36px; } .wl-chip { padding-left: 12px; } }

/* Keyboard users see where they are on rows, chips and buttons that are not links. */
tr.clickable:focus-visible, .tab:focus-visible, .btn:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent-text); outline-offset: -2px; }

/* Steady's picks of the week + plain-English section notes */
.explain { margin: var(--s2) 0; max-width: 70ch; }
.pick-card { border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: var(--radius); padding: var(--s3); background: var(--panel-2); }
.pick-card.up { border-left-color: var(--green); }
.pick-card.down { border-left-color: var(--red); }
.pick-card h3 { margin: 0 0 var(--s2); font-size: calc(13px * var(--ts, 1.1)); letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.pick-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--s2); margin-bottom: var(--s2); }
.pick-sym { font-size: calc(24px * var(--ts, 1.1)); font-weight: 800; letter-spacing: .02em; }
.ol-steps { margin: var(--s2) 0 var(--s3) 18px; padding: 0; }

/* ---------- Ask the board ---------- */
.qa-form { display: flex; gap: var(--s2); align-items: flex-end; }
.qa-form .field { flex: 1; min-width: 0; }
.qa-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: var(--s2) 0; }
.qa-out { margin-top: var(--s2); }
.qa-text { margin: 0 0 6px; overflow-wrap: anywhere; }
.qa-rows { display: grid; gap: var(--s2); margin-top: var(--s2); }
.qa-row { border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: var(--radius); padding: var(--s2) var(--s3); background: var(--panel-2); display: grid; gap: 4px; min-width: 0; }
.qa-row.up { border-left-color: var(--green); }
.qa-row.down { border-left-color: var(--red); }
/* New hot stocks: the border and the move carry the direction; the sentences stay in the normal text colour */
#newHotPanel .qa-row.up, #newHotPanel .qa-row.down { color: var(--text); }
.qa-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.qa-sym { font-size: calc(18px * var(--ts, 1.1)); letter-spacing: .02em; }
.sc2-card.flash { box-shadow: 0 0 0 3px var(--accent); transition: box-shadow .3s; }
@media (max-width: 860px) { .qa-form { flex-wrap: wrap; } .qa-form .btn { width: 100%; } }

/* ---------- Recommended stock cards (sort, pin, hide, move) ---------- */
.sc2-controls { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); margin: var(--s3) 0; }
.sc2-controls select { min-height: 36px; flex: 1 1 150px; max-width: 260px; }
.sc2-controls label { flex: none; }
.sc2-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: var(--s3); }
.sc2-card { border: 1px solid var(--border-strong); border-left-width: 4px; border-radius: var(--radius); padding: var(--s3); background: var(--panel-2); display: grid; gap: var(--s2); align-content: start; min-width: 0; }
.sc2-card.up { border-left-color: var(--green); }
.sc2-card.down { border-left-color: var(--red); }
.sc2-card.pinned { box-shadow: 0 0 0 1px var(--accent-soft); }
.sc2-head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2); }
.sc2-sym { font-size: calc(22px * var(--ts, 1.1)); font-weight: 800; letter-spacing: .02em; }
.sc2-price { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.sc2-stance { font-size: calc(11px * var(--ts, 1.1)); font-weight: 700; letter-spacing: .04em; color: var(--muted); text-transform: uppercase; }
.sc2-sub { margin: 0; }
.sc2-pin { background: none; border: 0; color: var(--muted); font-size: calc(22px * var(--ts, 1.1)); line-height: 1; min-width: 40px; min-height: 40px; cursor: pointer; border-radius: var(--radius-sm); }
.sc2-pin.on { color: var(--accent-text); }
.sc2-list { margin: 0; display: grid; gap: 6px; }
.sc2-row { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: var(--s2); font-size: calc(13px * var(--ts, 1.1)); }
.sc2-row dt { color: var(--muted); }
.sc2-row dd { margin: 0; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; }
.sc2-row.stop dd { color: var(--red); }
.sc2-row.target dd { color: var(--green); }
.sc2-row.nv dd { color: var(--muted); font-style: italic; }
.sc2-row.warn dd { color: var(--orange); }
.sc2-why summary { cursor: pointer; font-size: calc(12px * var(--ts, 1.1)); color: var(--muted); }
.sc2-actions { margin-top: var(--s2); }
@media (max-width: 860px) { .sc2-grid { grid-template-columns: minmax(0, 1fr); } .sc2-row { grid-template-columns: 96px minmax(0, 1fr); } }

/* Agent Operations */
#opsSchedules tr.ops-bad td:first-child { box-shadow: inset 3px 0 0 var(--danger, #c0392b); }
#opsSchedules .chips { display: flex; flex-wrap: wrap; gap: 4px; }
.ops-recent li { margin: 2px 0; }

/* Portfolio 1: advisor label under the ticker, freshness under the price */

/* A symbol in a report table opens its chart: it reads as a link without shouting. */
.rep-table a.sym-link { color: inherit; text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--cyan); }
.rep-table a.sym-link:hover, .rep-table a.sym-link:focus-visible { color: var(--cyan); text-decoration-style: solid; }
.term-livenote { margin-left: 8px; white-space: nowrap; }

/* Stock Screener */
.screener-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: var(--s2) var(--s3); align-items: end; margin: var(--s3) 0; }
.screener-form .field input, .screener-form .field select { width: 100%; }
.screener-form .check { display: flex; align-items: center; gap: 6px; font-size: calc(13px * var(--ts, 1.1)); }
.screener-form .btn-row { grid-column: 1 / -1; }

/* ---- Light appearance. Dark is the default above. "Auto" follows the phone; Settings can pin Light or Dark. ---- */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { color-scheme: light; --bg: #f4f6fa; --bg-2: #eef1f6; --panel: #ffffff; --panel-2: #f6f8fb; --panel-3: #eaeef4;
    --border: #d9dfe8; --border-strong: #c3ccd9; --border-hi: #9fb0c6; --text: #121a27; --text-2: #3a475b; --muted: #566478;
    --accent-hi: #1d4fd8; --accent-text: #1f56d6; --accent-soft: rgba(41, 98, 255, 0.10);
    --green: #0b7a53; --green-soft: rgba(11, 122, 83, 0.10); --red: #c0212f; --red-soft: rgba(192, 33, 47, 0.09);
    --orange: #9a5b00; --orange-soft: rgba(154, 91, 0, 0.11); --yellow: #7d6000; --yellow-soft: rgba(125, 96, 0, 0.11);
    --purple: #5b3fc4; --purple-soft: rgba(91, 63, 196, 0.10); --gray-soft: rgba(86, 100, 120, 0.10);
    --shadow: 0 10px 28px rgba(20, 30, 50, 0.16);
    --link-hover: #1d4fd8; }
}
:root[data-theme="light"] { color-scheme: light; --bg: #f4f6fa; --bg-2: #eef1f6; --panel: #ffffff; --panel-2: #f6f8fb; --panel-3: #eaeef4;
  --border: #d9dfe8; --border-strong: #c3ccd9; --border-hi: #9fb0c6; --text: #121a27; --text-2: #3a475b; --muted: #566478;
  --accent-hi: #1d4fd8; --accent-text: #1f56d6; --accent-soft: rgba(41, 98, 255, 0.10);
  --green: #0b7a53; --green-soft: rgba(11, 122, 83, 0.10); --red: #c0212f; --red-soft: rgba(192, 33, 47, 0.09);
  --orange: #9a5b00; --orange-soft: rgba(154, 91, 0, 0.11); --yellow: #7d6000; --yellow-soft: rgba(125, 96, 0, 0.11);
  --purple: #5b3fc4; --purple-soft: rgba(91, 63, 196, 0.10); --gray-soft: rgba(86, 100, 120, 0.10);
  --shadow: 0 10px 28px rgba(20, 30, 50, 0.16);
  --link-hover: #1d4fd8; }
@media (prefers-color-scheme: light) { :root:not([data-theme="dark"]) .term { --tc-bg: #ffffff; --tc-axis-bg: #ffffff; --tc-grid: rgba(60, 80, 110, 0.10); --tc-grid-day: rgba(60, 80, 110, 0.22); --tc-border: #d9dfe8;
    --tc-text: #1b2433; --tc-axis: #566478; --tc-up: #0b8f6f; --tc-down: #d6333f; --tc-line: #2962ff; --tc-cross: rgba(40, 55, 80, 0.6);
    --tc-tag: #44546e; --tc-ext: rgba(60, 80, 140, 0.06); --tc-prev: #6b7a95; --tc-boll: #2563eb; --tc-vwap: #c026d3; --tc-rsi: #7c3aed;
    --tc-macd: #0284c7; --tc-signal: #d97706; --tc-atr: #b45309; --tc-sma1: #d97706; --tc-sma2: #0284c7; --tc-sma3: #7c3aed; --tc-ema1: #0891b2; --tc-ema2: #db2777;; } :root:not([data-theme="dark"]) .tape-cell.old .tc-asof { color: #8a6a1f; } }
:root[data-theme="light"] .term { --tc-bg: #ffffff; --tc-axis-bg: #ffffff; --tc-grid: rgba(60, 80, 110, 0.10); --tc-grid-day: rgba(60, 80, 110, 0.22); --tc-border: #d9dfe8;
    --tc-text: #1b2433; --tc-axis: #566478; --tc-up: #0b8f6f; --tc-down: #d6333f; --tc-line: #2962ff; --tc-cross: rgba(40, 55, 80, 0.6);
    --tc-tag: #44546e; --tc-ext: rgba(60, 80, 140, 0.06); --tc-prev: #6b7a95; --tc-boll: #2563eb; --tc-vwap: #c026d3; --tc-rsi: #7c3aed;
    --tc-macd: #0284c7; --tc-signal: #d97706; --tc-atr: #b45309; --tc-sma1: #d97706; --tc-sma2: #0284c7; --tc-sma3: #7c3aed; --tc-ema1: #0891b2; --tc-ema2: #db2777;; }
:root[data-theme="light"] .tape-cell.old .tc-asof { color: #8a6a1f; }
.theme-switch { display: flex; gap: var(--s2); flex-wrap: wrap; }
.theme-switch .btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--text); }

/* Listen (read aloud) */
.view-tools { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; }
.listen-btn svg { width: 15px; height: 15px; }
.listen-btn[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.reading-now { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: var(--radius-sm); background: var(--accent-soft); }
.readbar { position: fixed; z-index: 60; left: var(--s3); right: var(--s3); bottom: calc(var(--s3) + env(safe-area-inset-bottom)); display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap;
  padding: var(--s2) var(--s3); background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.readbar[hidden] { display: none; }
.readbar .reading-text { flex: 1 1 100%; min-width: 0; color: var(--text-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 768px) { .readbar { bottom: calc(64px + var(--s2) + env(safe-area-inset-bottom)); } }

/* Bigger, bolder text must never push a page past the edge of a narrow phone: long chips, buttons and notes wrap instead. */
.chip, .btn { max-width: 100%; }
.small { overflow-wrap: anywhere; }
@media (max-width: 400px) {
  .chip { white-space: normal; height: auto; min-height: 18px; line-height: 1.3; padding-block: 2px; text-align: left; }
  .btn { white-space: normal; height: auto; min-height: 30px; padding-block: 6px; line-height: 1.25; text-align: center; }
}

/* Home: quick actions and the ranked-ideas panel */
.home-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: var(--s2); margin-top: var(--s3); }
.home-action {
  display: flex; flex-direction: column; gap: 2px; padding: var(--s3); border: 1px solid var(--border); border-radius: 10px;
  background: var(--panel); color: var(--text); text-decoration: none; text-align: left; font: inherit; cursor: pointer; min-width: 0;
}
.home-action:hover, .home-action:focus-visible { border-color: var(--accent); }
.home-action b { font-size: calc(14px * var(--ts, 1.1)); overflow-wrap: anywhere; }
.home-action .muted { overflow-wrap: anywhere; }
.home-h { margin: var(--s3) 0 var(--s2); font-size: calc(13px * var(--ts, 1.1)); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
/* Data we use: ten category cards */
.data-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: var(--s3); }
.data-card { display: grid; align-content: start; gap: var(--s2); min-width: 0; padding: var(--s3); border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--panel-2, var(--panel)); }
.data-card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); flex-wrap: wrap; }
.data-card h3 { margin: 0; font-size: calc(15px * var(--ts, 1.1)); line-height: 1.25; }
.data-card p { margin: 0; }
.data-srcs { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.data-src { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); padding: 7px 0; border-top: 1px solid var(--border); min-width: 0; }
.data-src-main { display: grid; min-width: 0; }
.data-src .nm { font-weight: 600; font-size: calc(13px * var(--ts, 1.1)); overflow-wrap: anywhere; }
.data-src .chip { flex: none; }
.data-card .btn { justify-self: start; margin-top: 2px; }
.cot-spark { flex: none; width: 96px; height: 36px; align-self: center; overflow: hidden; }
.cot-spark .chart { width: 100%; height: 36px; margin: 0; }
/* Home: six one-line launcher tiles, then the ranked picks */
.glance-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); }
@media (max-width: 760px) { .glance-grid { grid-template-columns: 1fr 1fr; } }
.glance { display: grid; align-content: start; gap: 3px; min-width: 0; min-height: calc(92px * var(--ts, 1.1)); padding: 12px 12px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: linear-gradient(180deg, var(--panel), var(--bg-2)); color: inherit; text-decoration: none; box-shadow: var(--shadow); transition: border-color .15s, transform .15s; }
.glance:hover { border-color: var(--accent); transform: translateY(-1px); color: inherit; }
.glance .k { font-size: calc(10.5px * var(--ts, 1.1)); color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.glance .v { font-size: calc(22px * var(--ts, 1.1)); font-weight: 800; line-height: 1.1; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.glance .v.up { color: var(--green); }
.glance .v.down { color: var(--red); }
.glance .s { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--text-2); line-height: 1.3; overflow-wrap: anywhere; }
@media (max-width: 520px) { .glance-grid { grid-template-columns: 1fr 1fr; } }
.picks .list-item { align-items: flex-start; gap: 10px; padding: 10px 2px; }
.picks .rank { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: calc(13px * var(--ts, 1.1)); background: var(--accent-soft); color: var(--accent-text); margin-top: 2px; }
.picks .li-title { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: calc(15px * var(--ts, 1.1)); }
.picks .li-title b { font-size: calc(16px * var(--ts, 1.1)); }
.home-pick { text-decoration: none; color: inherit; min-width: 0; }
.home-pick .li-main { min-width: 0; overflow-wrap: anywhere; }
.cmp-lead { white-space: nowrap; }
.cal-day .li-title { flex-wrap: wrap; }

/* Breakout Watch stage lines and the Home strips (Mainframe 2.0, first slice) */
.bw-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 4px var(--s3); margin-top: var(--s2); }
.bw-meta span { overflow-wrap: anywhere; min-width: 0; }
.strip .list-item { padding: 6px 2px; }
.strip .li-title { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.strip .li-sub { overflow-wrap: anywhere; }

/* Before the Breakout: filter bar and risk list */
.filter-bar { display: flex; flex-wrap: wrap; gap: var(--s2) var(--s3); align-items: flex-end; }
.filter-bar .field { min-width: 140px; flex: 1 1 140px; margin: 0; }
.filter-bar .check { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; }
.risk-list { margin: 4px 0 0; padding-left: 18px; color: var(--muted); }
.pair { white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; margin-right: var(--s2); }

/* one line on Home: how current the data is; it updates by itself */
.fresh-line { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 4px 0 var(--s2); color: var(--text-2); }
.linkish { background: none; border: 0; padding: 6px 2px; min-height: 32px; color: var(--accent-text); font: inherit; font-weight: 700; cursor: pointer; text-decoration: underline; }

/* long label + long detail lists (Verify connections, credentials): name on one line, the detail under it, at any width
   and any text size, so the detail can never be squeezed into a one-letter column */
.kv.kv-stack { grid-template-columns: minmax(0, 1fr); gap: 2px; }
.kv.kv-stack dt { margin-top: var(--s2); color: var(--text); font-weight: 700; overflow-wrap: anywhere; }
.kv.kv-stack dt:first-child { margin-top: 0; }
.kv.kv-stack dd { text-align: left; color: var(--text-2); padding-bottom: var(--s2); border-bottom: 1px solid var(--border); }

/* wide tables keep readable columns and scroll sideways inside their box on a phone, instead of squeezing a column
   to a few letters at a large text size */
.table-wrap > table.wide { min-width: calc(560px * var(--ts, 1.1)); }
/* setup badges never shrink inside a flex row */
.setup { flex: none; }
/* the market pulse numbers fit the smallest phones at any text size */
@media (max-width: 380px) { .pulse-tile .v { font-size: calc(15px * var(--ts, 1.1)); } }

/* Home and Analyst Picks (home.js): calm cards, big symbols, colour pills, in the style of Webull and Robinhood */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: var(--s4); align-items: start; }
.home-col { display: grid; gap: var(--s4); align-content: start; min-width: 0; }
@media (max-width: 900px) { .home-grid { grid-template-columns: minmax(0, 1fr); } }
.rh-card { background: var(--panel); border: 1px solid var(--border); border-radius: calc(var(--radius) + 4px); padding: var(--s3) var(--s4) var(--s3); min-width: 0; }
.rh-head { display: flex; align-items: baseline; gap: var(--s2); padding-bottom: var(--s2); }
.rh-head .spacer { flex: 1; }
.rh-head h2 { margin: 0; font-size: calc(17px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.01em; }
.rh-more { font-size: calc(12.5px * var(--ts, 1.1)); font-weight: 600; color: var(--accent-text); text-decoration: none; white-space: nowrap; }
.rh-more:hover { text-decoration: underline; }
.rh-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s3); padding: 10px 2px; border-top: 1px solid var(--border); color: inherit; text-decoration: none; min-width: 0; }
.rh-row:first-of-type { border-top: 0; }
.rh-row:hover { background: var(--panel-2); border-radius: 10px; }
.rh-who { display: grid; gap: 1px; min-width: 0; }
.rh-sym { font-size: calc(16px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.01em; }
.rh-cap { font-size: calc(12px * var(--ts, 1.1)); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rh-nums { display: flex; align-items: center; justify-content: flex-end; gap: var(--s3); flex-wrap: wrap; min-width: 0; }
.rh-px { font-weight: 700; font-variant-numeric: tabular-nums; }
.rh-pill { display: inline-block; min-width: 4.4em; padding: 4px 10px; border-radius: 999px; font-size: calc(12.5px * var(--ts, 1.1)); font-weight: 700; text-align: center; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rh-pill.up { color: var(--green); background: var(--green-soft); }
.rh-pill.down { color: var(--red); background: var(--red-soft); }
.rh-pill.flat { color: var(--text-2); background: var(--panel-3); }
.rh-note { margin: var(--s2) 0 0; }
.rh-tabs { display: flex; gap: var(--s2); padding-bottom: var(--s2); flex-wrap: wrap; }
.rh-tab { appearance: none; border: 1px solid var(--border-strong); background: transparent; color: var(--text-2); border-radius: 999px; padding: 6px 14px; font: inherit; font-size: calc(13px * var(--ts, 1.1)); font-weight: 600; cursor: pointer; min-height: 36px; }
.rh-tab.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.rh-dist { display: inline-flex; width: 84px; height: 8px; border-radius: 999px; overflow: hidden; background: var(--panel-3); vertical-align: middle; gap: 1px; flex: none; }
.rh-dist i { display: block; min-width: 3px; }
.rh-dist .b { background: var(--green); }
.rh-dist .h { background: var(--muted); }
.rh-dist .s { background: var(--red); }
@media (max-width: 520px) { .rh-dist { display: none; } .rh-nums { gap: var(--s2); } .rh-cap { white-space: normal; } }

/* Data sources: one status page, one plain word per source */
.data-summary { display: grid; gap: 4px; }
.data-headline { margin: 0; font-size: calc(19px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.01em; }
.data-card-link { color: inherit; text-decoration: none; }
.data-card-link:hover h3 { color: var(--accent-text); }
.data-src-main .small { line-height: 1.3; }

/* The web-page look: open cards, bigger titles, quieter chrome. Every page inherits it. */
.panel { border-radius: 14px; padding: 0 var(--s4) var(--s4); border-color: var(--border); }
.panel-head { background: transparent; border-bottom: 0; margin: 0 0 var(--s2); padding: var(--s3) 0 0; }
.panel-head h2 { font-size: calc(16px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.01em; }
.view-head h1 { font-size: calc(26px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.02em; }
.view-head p { font-size: calc(14.5px * var(--ts, 1.1)); color: var(--text-2); max-width: 70ch; }
.btn { border-radius: 10px; }
.tabs .tab, .page-tabs .tab { border-radius: 999px; }
.notice { border-radius: 12px; }
.table-wrap { border-radius: 12px; }
/* The public site: nothing of the owner's is drawn */
.visitor #cmdForm, .visitor #cmdFormMobile, .visitor #bellBtn, .visitor .owner, .visitor #modeChip,
.visitor #lostBtn, .visitor .st-fab, .visitor #chat, .visitor .nav-foot { display: none !important; }
.visitor .fresh-line .linkish { display: none; }

/* =====================================================================================================================
   TradingView layout (Nov 2026). TradingView's palette and density, a symbol box in the top bar, a menu that folds to
   an icon rail, and a watchlist rail on the right of every page on a wide screen. Later rules win, so this block
   restyles everything above without touching the pages' own code.
   ===================================================================================================================== */
:root {
  --bg: #131722; --bg-2: #131722; --panel: #1e222d; --panel-2: #262b37; --panel-3: #2a2e39;
  --border: #2a2e39; --border-strong: #363a45; --border-hi: #4a4e5a;
  --text: #d1d4dc; --text-2: #b2b5be; --muted: #9b9ea8;
  --accent: #2962ff; --accent-hi: #1e53e5; --accent-text: #5b9cf6; --accent-soft: rgba(41, 98, 255, 0.18); --link-hover: #8bb8ff;
  --green: #26b29b; --green-soft: rgba(34, 171, 148, 0.14); --red: #ff737d; --red-soft: rgba(247, 82, 95, 0.14);
  --radius: 4px; --radius-sm: 3px; --radius-lg: 6px;
  --side-w: 208px; --rail-w: 300px;
}
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) { --bg: #ffffff; --bg-2: #f8f9fd; --panel: #ffffff; --panel-2: #f0f3fa; --panel-3: #e9ecf3;
    --border: #e0e3eb; --border-strong: #d1d4dc; --border-hi: #b2b5be; --text: #131722; --text-2: #434651; --muted: #5d606b;
    --accent-text: #1f55e0; --accent-soft: rgba(41, 98, 255, 0.10); --green: #05705f; --green-soft: rgba(8, 153, 129, 0.10);
    --red: #c8202e; --red-soft: rgba(242, 54, 69, 0.09); }
}
:root[data-theme="light"] { --bg: #ffffff; --bg-2: #f8f9fd; --panel: #ffffff; --panel-2: #f0f3fa; --panel-3: #e9ecf3;
  --border: #e0e3eb; --border-strong: #d1d4dc; --border-hi: #b2b5be; --text: #131722; --text-2: #434651; --muted: #5d606b;
  --accent-text: #1f55e0; --accent-soft: rgba(41, 98, 255, 0.10); --green: #05705f; --green-soft: rgba(8, 153, 129, 0.10);
  --red: #c8202e; --red-soft: rgba(242, 54, 69, 0.09); }
body { background: var(--bg); color: var(--text); }

/* the top bar: logo, symbol box, (owner) command box, then the market clock and buttons */
.header { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s3); background: var(--bg); backdrop-filter: none; }
.header .brand-wrap { flex: none; }
/* on a phone (no symbol box in the bar) the name may shrink before the header can push the page wider */
@media (max-width: 520px) {
  .header .brand-wrap { flex: 0 1 auto; min-width: 0; }
  .header .brand-name, .header .brand-sub { white-space: nowrap; overflow: hidden; text-overflow: clip; }
}
.header .cmd { flex: 1 1 auto; max-width: 520px; order: 3; }
.header .header-right { margin-left: auto; order: 4; flex: none; }
.sym-search { order: 2; position: relative; display: flex; align-items: center; flex: 0 0 210px; min-width: 0; }
.sym-search input { width: 100%; height: 32px; padding: 0 10px 0 32px; border-radius: 999px; border: 1px solid var(--border-strong);
  background: var(--panel-2); color: var(--text); font: inherit; font-size: calc(13.5px * var(--ts, 1.1)); font-weight: 600; letter-spacing: .02em; }
.sym-search input::placeholder { color: var(--muted); font-weight: 500; letter-spacing: 0; }
.sym-search input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--panel); }
.sym-search .icon-search { position: absolute; left: 11px; width: 15px; height: 15px; color: var(--muted); pointer-events: none; }
.cmd input { height: 32px; border-radius: 999px; }
.rail-toggle { display: none; }

/* the menu: dense rows, a blue bar on the page you are on */
.sidebar { background: var(--bg); border-right: 1px solid var(--border); padding: var(--s2) 6px var(--s3); }
.nav-item { height: 34px; border-radius: 4px; font-size: calc(13.5px * var(--ts, 1.1)); }
.nav-item.active { background: var(--panel-3); box-shadow: inset 3px 0 0 var(--accent); }
.nav-sub { border-radius: 4px; }
.nav-sub.active { background: var(--panel-3); }
.nav-fold { display: flex; align-items: center; gap: 10px; width: 100%; margin-top: var(--s2); padding: 6px 10px; min-height: 32px; border: 0;
  border-radius: 4px; background: transparent; color: var(--muted); font: inherit; font-size: calc(12.5px * var(--ts, 1.1)); cursor: pointer; text-align: left; }
.nav-fold:hover { background: var(--panel-2); color: var(--text); }
.nav-fold-ic { width: 16px; text-align: center; font-weight: 800; }

/* pages: flat panels, thin borders, TradingView's corners */
@media (min-width: 861px) { .main { padding: var(--s3) var(--s4) 96px; } }
.panel, .rh-card { border-radius: 6px; background: var(--panel); border-color: var(--border); }
.panel-head h2, .rh-head h2 { font-size: calc(15px * var(--ts, 1.1)); font-weight: 700; }
.view-head h1 { font-size: calc(22px * var(--ts, 1.1)); font-weight: 700; letter-spacing: -0.01em; }
.btn { border-radius: 4px; }
.notice, .table-wrap { border-radius: 6px; }
.rh-row:hover { border-radius: 4px; }
.rh-tab.on { background: var(--panel-3); border-color: var(--border-hi); color: var(--text); }
.glance { border-radius: 6px; }

/* the watchlist rail (rail.js): only on a wide screen, never on the Charts page (it has its own) */
.wl-rail { display: none; }
@media (min-width: 1280px) {
  body.rail-on .rail-toggle { display: grid; }
  body.rail-on:not(.rail-shut) .layout { grid-template-columns: var(--side-w) minmax(0, 1fr) var(--rail-w); }
  body.rail-on:not(.rail-shut) .wl-rail { display: flex; }
}
.wl-rail { position: sticky; top: var(--header-h); height: calc(100vh - var(--header-h)); flex-direction: column; min-width: 0;
  border-left: 1px solid var(--border); background: var(--bg); }
.wr-top { display: flex; align-items: center; gap: var(--s2); padding: 8px 10px 6px 14px; border-bottom: 1px solid var(--border); }
.wr-top h2 { margin: 0; font-size: calc(14px * var(--ts, 1.1)); font-weight: 700; }
.wr-top .spacer { flex: 1; }
.wr-refresh { width: 30px; height: 30px; }
.wr-list { overflow-y: auto; flex: 1; min-height: 0; padding: 0 6px var(--s3); }
.wr-cols, .wr-row { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto 62px; gap: 6px; align-items: center; }
.wr-cols { position: sticky; top: 0; z-index: 1; padding: 6px 8px 4px; background: var(--bg); color: var(--muted);
  font-size: calc(10.5px * var(--ts, 1.1)); letter-spacing: .06em; text-transform: uppercase; font-weight: 700; }
.wr-cols span:nth-child(2) { grid-column: 3; text-align: right; }
.wr-cols span:nth-child(3) { grid-column: 4; text-align: right; }
.wr-head { display: flex; align-items: center; gap: 8px; width: 100%; margin: 6px 0 2px; padding: 6px 8px; border: 0; border-radius: 4px;
  background: transparent; color: var(--text-2); font: inherit; font-size: calc(11px * var(--ts, 1.1)); letter-spacing: .06em;
  text-transform: uppercase; font-weight: 700; cursor: pointer; text-align: left; }
.wr-head:hover { background: var(--panel-2); color: var(--text); }
.wr-head .caret { display: inline-block; transition: transform .15s; }
.wr-head.folded .caret { transform: rotate(-90deg); }
.wr-gn { margin-left: auto; color: var(--muted); letter-spacing: 0; }
.wr-row { padding: 6px 8px; border-radius: 4px; color: var(--text); text-decoration: none; font-variant-numeric: tabular-nums;
  font-size: calc(13px * var(--ts, 1.1)); }
.wr-row:hover { background: var(--panel-2); color: var(--text); }
.wr-sym { font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.wr-tag { color: var(--muted); font-size: calc(11px * var(--ts, 1.1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wr-px { text-align: right; }
.wr-chg { text-align: right; font-weight: 700; }
.wr-chg.up { color: var(--green); }
.wr-chg.down { color: var(--red); }
.wr-note, .wr-empty { padding: 8px; margin: 0; }

/* the menu folded to icons (desktop only); a group's pages open beside it on hover or keyboard focus */
@media (min-width: 861px) {
  body.nav-folded { --side-w: 60px; }
  body.nav-folded .sidebar { overflow: visible; padding: var(--s2) 6px; align-items: stretch; }
  body.nav-folded .nav-item { justify-content: center; padding: 0; height: 40px; }
  body.nav-folded .nav-item svg { width: 20px; height: 20px; opacity: .9; }
  body.nav-folded .nav-label, body.nav-folded .nav-toggle, body.nav-folded .nav-foot { display: none; }
  body.nav-folded .nav-group { position: relative; }
  body.nav-folded .nav-group .nav-subs, body.nav-folded .nav-group.open .nav-subs { display: none; position: absolute; left: calc(100% + 6px); top: 0;
    z-index: 40; min-width: 210px; margin: 0; padding: 6px; border: 1px solid var(--border-strong); border-radius: 6px; background: var(--panel); box-shadow: var(--shadow); }
  body.nav-folded .nav-group:hover .nav-subs, body.nav-folded .nav-group:focus-within .nav-subs { display: grid; }
  body.nav-folded .nav-fold { justify-content: center; padding: 6px 0; }
}

/* phone and tablet: the symbol box shrinks, then steps aside for the bottom bar's Charts button */
@media (max-width: 860px) {
  .header { gap: var(--s2); padding: 0 var(--s2); }
  .sym-search { flex: 1 1 140px; max-width: 220px; }
  .nav-fold { display: none; }
}
@media (max-width: 520px) { .sym-search { display: none; } }

/* Home: the markets overview (home.js) */
.mk-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: var(--s2); }
.mk-card { display: grid; gap: 2px; padding: 10px 12px 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--panel);
  color: var(--text); text-decoration: none; min-width: 0; }
.mk-card:hover { border-color: var(--border-hi); color: var(--text); }
.mk-name { font-size: calc(12px * var(--ts, 1.1)); color: var(--text-2); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mk-last { font-size: calc(18px * var(--ts, 1.1)); font-weight: 700; font-variant-numeric: tabular-nums; }
.mk-chg { font-size: calc(12.5px * var(--ts, 1.1)); font-weight: 700; font-variant-numeric: tabular-nums; }
.mk-chg.up { color: var(--green); } .mk-chg.down { color: var(--red); } .mk-chg.flat { color: var(--muted); }
.mk-spark { width: 100%; height: 34px; display: block; margin-top: 2px; }
.mk-spark polyline { fill: none; stroke: var(--muted); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.mk-card.up .mk-spark polyline { stroke: var(--green); } .mk-card.down .mk-spark polyline { stroke: var(--red); }
.mk-asof { font-size: calc(10.5px * var(--ts, 1.1)); color: var(--muted); }
.heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 4px; }
.heat-cell { display: grid; gap: 1px; padding: 8px 10px; border-radius: 4px; color: #fff; text-decoration: none; min-width: 0; background: #4a4e5a; }
.heat-cell:hover { filter: brightness(1.12); color: #fff; }
.heat-cell b { font-size: calc(13px * var(--ts, 1.1)); }
.heat-cell span { font-size: calc(11.5px * var(--ts, 1.1)); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heat-cell .hv { font-weight: 700; font-variant-numeric: tabular-nums; }
.heat-cell.u3 { background: #056656; } .heat-cell.u2 { background: #0b7c6a; } .heat-cell.u1 { background: #3a7f73; }
.heat-cell.d1 { background: #8a3a43; } .heat-cell.d2 { background: #b0303d; } .heat-cell.d3 { background: #cc2433; }
.heat-cell.na { background: var(--panel-3); color: var(--text-2); }
@media (min-width: 1280px) { body.rail-on:not(.rail-shut) .home-watch { display: none; } }
@media (min-width: 1280px) { body.rail-on:not(.rail-shut) .st-fab { right: calc(var(--rail-w) + 16px); } }

/* Universal front page (Nov 2026): no system jargon in the chrome; top news on Home */
#modeChip { display: none !important; }
.news-row { display: grid; gap: 2px; padding: 10px 2px; border-top: 1px solid var(--border); color: var(--text); text-decoration: none; min-width: 0; }
.news-row:first-of-type { border-top: 0; }
.news-row:hover .news-title { color: var(--accent-text); }
.news-title { font-size: calc(14px * var(--ts, 1.1)); font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.news-meta { font-size: calc(12px * var(--ts, 1.1)); color: var(--muted); overflow-wrap: anywhere; }

/* Today's picks tags and the one-stock page (stock_page.js) */
.rh-tag { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: calc(11px * var(--ts, 1.1)); font-weight: 700;
  background: var(--panel-3); color: var(--text-2); white-space: nowrap; }
.rh-tag.new { background: var(--accent-soft); color: var(--accent-text); }
.sp-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); }
.sp-head .sp-tabs { flex: 1 1 100%; margin-top: 0; }
.sp-id { display: grid; gap: 2px; min-width: 0; }
.sp-sym { margin: 0; font-size: calc(30px * var(--ts, 1.1)); font-weight: 800; letter-spacing: -0.01em; }
.sp-quote { display: flex; align-items: baseline; gap: var(--s2); flex-wrap: wrap; }
.sp-price { font-size: calc(24px * var(--ts, 1.1)); font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-move { font-weight: 700; font-variant-numeric: tabular-nums; }
.sp-move.up { color: var(--green); } .sp-move.down { color: var(--red); }
.sp-asof { overflow-wrap: anywhere; }
.sp-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: var(--s3); align-items: start; }
.sp-main, .sp-side { display: grid; gap: var(--s3); min-width: 0; }
@media (max-width: 1000px) { .sp-layout { grid-template-columns: minmax(0, 1fr); } }
.sp-score { display: flex; align-items: center; gap: var(--s2); flex-wrap: wrap; margin-bottom: var(--s2); }
.sp-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 var(--s3); margin: var(--s2) 0; }
.sp-kv { display: flex; justify-content: space-between; gap: var(--s2); padding: 6px 0; border-bottom: 1px solid var(--border); min-width: 0; }
.sp-kv .k { color: var(--muted); font-size: calc(12.5px * var(--ts, 1.1)); }
.sp-kv .v { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.sp-kv .v.up { color: var(--green); } .sp-kv .v.down { color: var(--red); }
.sp-sub { margin: var(--s3) 0 4px; font-size: calc(13px * var(--ts, 1.1)); font-weight: 700; }
.sp-dates { margin: 0; padding-left: 18px; }
/* the smallest phones: a stock card's label sits above its value, so a long headline is never squeezed into a sliver */
@media (max-width: 400px) { .sc2-row { grid-template-columns: minmax(0, 1fr); gap: 0; } .sc2-row dd { margin-bottom: 4px; } }

/* the visitors' welcome at the top of Home (home.js welcome) */
.hero { background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 16%, var(--panel)), var(--panel) 70%);
  border: 1px solid var(--border); border-radius: calc(var(--radius) + 6px); padding: var(--s5, 24px) var(--s5, 24px) var(--s4);
  margin-bottom: var(--s4); min-width: 0; }
.hero-title { margin: 0 0 var(--s2); font-size: calc(30px * var(--ts, 1.1)); line-height: 1.15; font-weight: 800; letter-spacing: -0.02em; }
.hero-sub { margin: 0; max-width: 62ch; font-size: calc(15px * var(--ts, 1.1)); line-height: 1.5; color: var(--text); }
.hero-points { list-style: none; margin: var(--s4) 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.hero-point { display: flex; gap: var(--s2); align-items: flex-start; min-width: 0; }
.hero-point div { display: grid; gap: 2px; min-width: 0; }
.hero-point b { font-size: calc(14px * var(--ts, 1.1)); }
.hero-point span { font-size: calc(13px * var(--ts, 1.1)); line-height: 1.45; color: var(--muted); }
.hero-ico { flex: none; width: 20px; height: 20px; margin-top: 1px; color: var(--accent-text, var(--accent)); fill: none; stroke: currentColor; stroke-width: 2; }
.hero-cta { display: flex; flex-wrap: wrap; gap: var(--s2); margin-top: var(--s4); }
.hero-fine { margin: var(--s3) 0 0; font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); }
@media (max-width: 760px) {
  .hero { padding: var(--s4) var(--s3) var(--s3); }
  .hero-title { font-size: calc(23px * var(--ts, 1.1)); }
  .hero-points { grid-template-columns: minmax(0, 1fr); gap: var(--s2); margin-top: var(--s3); }
  .hero-point span { display: none; }   /* phones: the three titles only, so the market data stays near the top */
  .hero-cta .btn { flex: 1 1 140px; justify-content: center; }
}

/* Search on a phone: the bottom bar's Search opens the top bar's symbol box as a bar under the header */
@media (max-width: 520px) {
  body.sym-open .sym-search { display: flex; position: fixed; top: var(--sym-top, 64px); left: 12px; right: 12px; max-width: none;
    z-index: 70; flex: none; }
  body.sym-open .sym-search input { height: 44px; font-size: 16px; box-shadow: var(--shadow); background: var(--panel); }
}
.more-markets { margin: var(--s2) 0 0; }

/* Phones: nothing floats over the page, and the answer gets the room.
   - the round help button is gone (the Steady button in the header opens the same help);
   - the "Ask Scout OS" bar shows on Today only, not above every page;
   - in the chat, the suggestion buttons are one row you swipe sideways, so the answer is not squeezed. */
@media (max-width: 860px) {
  .st-fab { display: none !important; }
  body:not(.ask-here) .mobile-cmd { display: none; }
}
.chat-suggest { flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: none; padding-top: 2px; }
.chat-suggest::-webkit-scrollbar { display: none; }
.chat-suggest button { flex: none; white-space: nowrap; }

/* Track record card on Today */
.tr-nums { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s2); margin: var(--s1) 0 var(--s2); }
.tr-nums div { display: grid; gap: 2px; min-width: 0; }
.tr-nums b { font-size: calc(20px * var(--ts, 1.1)); font-weight: 800; }
.tr-nums span { font-size: calc(11.5px * var(--ts, 1.1)); color: var(--muted); }
.sp-watch.on { border-color: var(--accent); color: var(--accent-text); }

/* Phones: while Steady is open the page behind it does not scroll, and while you type the suggestion row steps aside
   so the answer and the box both fit above the keyboard. */
@media (max-width: 860px) {
  body.chat-open { overflow: hidden; }
  .chat:has(#chatInput:focus) .chat-suggest { display: none; }
}
