/* Mobile-first, light/dark, colour-blind-safe (green/red always paired with an arrow or sign). */
:root {
  --bg: #f6f7f9; --surface: #ffffff; --surface-2: #f0f2f5; --border: #e3e6eb;
  --text: #1b1f24; --muted: #5d6673; --faint: #8a93a0;
  --accent: #2f6fde; --accent-ink: #2f6fde; --on-accent: #ffffff; --accent-soft: #e7effd;
  --up: #128a52; --up-soft: #e3f4ec; --down: #cf3a2f; --down-soft: #fbe9e7; --warn: #a86400; --warn-soft: #fbf0dd;
  --radius: 12px; --shadow: 0 1px 2px rgba(16, 24, 40, .06);
  --nav-h: 60px;
  /* Type scale (docs/DESIGN.md): seven sizes, nothing in between. 11 is the floor (Apple's caption2). */
  --fs-caption: 11px; --fs-label: 12px; --fs-small: 13px; --fs-body: 15px; --fs-title: 17px; --fs-page: 20px; --fs-hero: 26px; --fs-display: 36px;  /* display: the one headline number (new dashboard) */
  /* Spacing on a 4 px grid; between groups is always more than within a group */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px; --sp-5: 24px; --sp-6: 32px;
  --tap: 44px;  /* Apple's minimum touch target */
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2a313b;
    --text: #e8ebef; --muted: #a2abb7; --faint: #7a8491;
    --accent: #6ea0ff; --accent-ink: #6ea0ff; --on-accent: #0f1216; --accent-soft: #1d2a42;
    --up: #3ccf8e; --up-soft: #143326; --down: #ff7a6e; --down-soft: #3a1c1a; --warn: #f0b45a; --warn-soft: #3a2c14;
    --shadow: none; color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f1216; --surface: #171b21; --surface-2: #1f242c; --border: #2a313b;
  --text: #e8ebef; --muted: #a2abb7; --faint: #7a8491;
  --accent: #6ea0ff; --accent-ink: #6ea0ff; --on-accent: #0f1216; --accent-soft: #1d2a42;
  --up: #3ccf8e; --up-soft: #143326; --down: #ff7a6e; --down-soft: #3a1c1a; --warn: #f0b45a; --warn-soft: #3a2c14;
  --shadow: none; color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: var(--fs-body)/1.5 "Public Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding-bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 16px);
}
a { color: var(--accent-ink); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: var(--fs-page); margin: 0 0 4px; }
h2 { font-size: var(--fs-title); margin: 0 0 10px; }
h3 { font-size: var(--fs-body); margin: 0 0 8px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
p { margin: 0 0 8px; }
/* iPhone Safari. Text wraps between words; only a word too long for its whole box (a URL) breaks inside.
   Never `overflow-wrap: anywhere`: it lets tables shrink a column to one letter ("D/e/l/e/t/e", "2,235./00").
   Check every layout change with `python -m scripts.phone_check` (WebKit at 430 px). */
body { overflow-wrap: break-word; word-wrap: break-word; }
td.num, th, .num, .tabular, .levels b, td button, td .link, .money b { white-space: nowrap; }
td:first-child { min-width: 6.5em; }
img, svg, video, canvas, iframe { max-width: 100%; }
input, select, textarea { max-width: 100%; min-width: 0; }
.num, td.num, .tabular { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.clip { max-width: 150px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .faint { color: var(--faint); } .small { font-size: var(--fs-small); }

.topbar {
  position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; padding: 10px 16px;
}
.brand { font-weight: 700; color: var(--text); }
.topbar .spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-label); padding: 3px 9px; border-radius: 999px;
        background: var(--surface-2); color: var(--muted); max-width: 100%; white-space: normal; overflow-wrap: normal; }
.topbar .pill, td .pill { white-space: nowrap; }
.pill.live { background: var(--up-soft); color: var(--up); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--down-soft); color: var(--down); }
.pill.good { background: var(--up-soft); color: var(--up); }
.pill.info { background: var(--accent-soft); color: var(--accent-ink); }
.desktop-nav { display: none; gap: 4px; }
.desktop-nav a { color: var(--muted); padding: 6px 10px; border-radius: 8px; font-size: var(--fs-body); }
.desktop-nav a.on { color: var(--text); background: var(--surface-2); }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 10; height: calc(var(--nav-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--border);
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr);
}
.bottom-nav a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
                color: var(--muted); font-size: var(--fs-caption); text-decoration: none; }
.bottom-nav a.on { color: var(--accent-ink); font-weight: 700; }
/* The four tabs (docs/DESIGN.md): one colour each, a badge on Now for what needs a decision */
:root { --tab-now: #c2410c; --tab-watch: var(--accent-ink); --tab-latest: #237032; --tab-admin: var(--text); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --tab-now: #ff9a6b; --tab-latest: #6fd68f; } }
:root[data-theme="dark"] { --tab-now: #ff9a6b; --tab-latest: #6fd68f; }
.tabbar .tab { position: relative; font-size: var(--fs-caption); font-weight: 600; }
.tabbar .tab span { text-align: center; line-height: 1.2; }  /* "Mission Control" wraps on the laptop rail: keep it centred like the rest */
.tabbar .tab-now.on { color: var(--tab-now); } .tabbar .tab-watch.on { color: var(--tab-watch); }
.tabbar .tab-latest.on { color: var(--tab-latest); } .tabbar .tab-admin.on { color: var(--tab-admin); }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--tab-now); color: #ffffff; font: 700 var(--fs-caption)/18px inherit; text-align: center; font-style: normal; }
.bottom-nav svg { width: 22px; height: 22px; }

main { max-width: 1180px; margin: 0 auto; padding: 16px; }
.grid { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }  /* one column on phones that never grows past the screen */
.grid > *, .row > *, .sec-b, main { min-width: 0; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; box-shadow: var(--shadow); min-width: 0; }
.card + .card { margin-top: 12px; }
.grid > .card + .card { margin-top: 0; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.stack > * + * { margin-top: 8px; }

.up { color: var(--up); } .down { color: var(--down); } .flat { color: var(--muted); }
.up::before { content: "▲ "; font-size: var(--fs-label); } .down::before { content: "▼ "; font-size: var(--fs-label); }
.noarrow::before { content: none !important; }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tile { background: var(--surface-2); border-radius: 10px; padding: 10px; min-width: 0; }
.tile .label { font-size: var(--fs-label); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile .value { font-size: var(--fs-title); font-weight: 600; font-variant-numeric: tabular-nums; }
.tile .delta { font-size: var(--fs-small); font-variant-numeric: tabular-nums; }

.table-wrap { overflow-x: auto; margin: 0 -14px; padding: 0 14px; }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-body); }
th { text-align: left; font-weight: 600; color: var(--muted); font-size: var(--fs-label); padding: 6px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
td.num, th.num { text-align: right; white-space: nowrap; }
tr:last-child td { border-bottom: none; }

.pick { border: 1px solid var(--border); border-radius: 10px; padding: 12px; background: var(--surface); }
.pick + .pick { margin-top: 8px; }
.pick .sym { font-weight: 700; font-size: var(--fs-title); }
.levels { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; margin-top: 8px; }
.levels div { background: var(--surface-2); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.levels span { display: block; font-size: var(--fs-caption); color: var(--muted); }
.levels b { font-variant-numeric: tabular-nums; font-size: var(--fs-body); }
@media (max-width: 520px) { .levels { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Wide tables (tax) become label/value blocks on a phone instead of scrolling sideways */
@media (max-width: 520px) {
  table.stack-sm tr:first-child { display: none; }
  table.stack-sm tr { display: block; padding: 6px 0; border-bottom: 1px solid var(--border); }
  table.stack-sm td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 2px 0; min-width: 0; text-align: right; }
  table.stack-sm td::before { content: attr(data-label); color: var(--muted); font-size: var(--fs-label); text-align: left; white-space: normal; }
  table.stack-sm td[colspan] { display: block; text-align: left; }
  table.stack-sm td[colspan]::before { content: none; }
}
.prob { font-weight: 700; font-variant-numeric: tabular-nums; }
.bar { height: 6px; background: var(--surface-2); border-radius: 3px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); }

form.inline { display: inline; }
input, select, textarea, button {
  font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 9px 10px; min-height: var(--tap); max-width: 100%;
}
input, select, textarea { font-size: 16px; }  /* below 16px iPhone Safari zooms the page when a field is tapped */
/* Safari ignores height on its native dropdown: draw our own so selects match the fields beside them */
select { -webkit-appearance: none; appearance: none; padding-right: 30px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%238a93a0' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 10px center; }
textarea { width: 100%; min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .btn { background: var(--accent); color: var(--on-accent); border: none; font-weight: 600; cursor: pointer; display: inline-flex;
               align-items: center; justify-content: center; padding: 9px 14px; border-radius: 8px; min-height: var(--tap); }
.btn.secondary, button.secondary { background: var(--surface-2); color: var(--text); }
.btn.danger, button.danger { background: var(--down-soft); color: var(--down); }
button.link { background: none; color: var(--accent-ink); padding: 10px 0; min-height: 0; font-weight: 500; }  /* text-sized, padded to a fair tap area */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.form-grid label, .field { display: flex; flex-direction: column; gap: 4px; font-size: var(--fs-small); color: var(--muted); min-width: 0; }
.form-grid .full { grid-column: 1 / -1; }
.checks { display: flex; flex-wrap: wrap; gap: 6px; }
.checks label { display: inline-flex; gap: 6px; align-items: center; background: var(--surface-2); padding: 6px 10px; border-radius: 999px; font-size: var(--fs-small); color: var(--text); }
.checks input { min-height: auto; }

.chart { width: 100%; height: 300px; margin-top: 8px; }
.chart-sm { width: 100%; height: 240px; position: relative; }
.news-item { padding: 8px 0; border-bottom: 1px solid var(--border); }
.news-item:last-child { border-bottom: none; }
.news-item a { color: var(--text); }
.news-item .meta { font-size: var(--fs-label); color: var(--faint); }
.notice { background: var(--warn-soft); color: var(--warn); border-radius: 10px; padding: 10px 12px; font-size: var(--fs-body); }
.notice.good { background: var(--up-soft); color: var(--up); }
.empty { color: var(--muted); padding: 12px 0; }
.disclaimer { max-width: 1180px; margin: 8px auto 0; padding: 0 16px; font-size: var(--fs-label); color: var(--faint); }
details summary { cursor: pointer; color: var(--accent-ink); }
details.fb summary { color: var(--faint); margin-top: 4px; }
pre { white-space: pre-wrap; word-break: break-word; font-size: var(--fs-small); background: var(--surface-2); padding: 10px; border-radius: 8px; }
.spinner { width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Stock page: quote header, OHLC strip, range bars (Kite / Moneycontrol idioms) */
.big-price { font-size: var(--fs-hero); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.chg { display: inline-block; margin-top: 4px; padding: 2px 8px; border-radius: 6px; font-size: var(--fs-small); font-weight: 600; font-variant-numeric: tabular-nums; }
.chg-up { background: var(--up-soft); color: var(--up); } .chg-down { background: var(--down-soft); color: var(--down); }
.ohlc { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; margin-top: 12px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.ohlc > div { background: var(--surface); padding: 7px 10px; min-width: 0; }
.ohlc span { display: block; font-size: var(--fs-caption); color: var(--muted); }
.ohlc b { font-size: var(--fs-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.range { margin-top: 12px; }
.range-top { display: flex; justify-content: space-between; font-size: var(--fs-label); font-variant-numeric: tabular-nums; margin-bottom: 5px; }
.range-track { position: relative; height: 6px; border-radius: 3px; background: linear-gradient(90deg, var(--down-soft), var(--surface-2) 50%, var(--up-soft)); border: 1px solid var(--border); }
.range-track i { position: absolute; top: -5px; width: 2px; height: 14px; margin-left: -1px; background: var(--text); border-radius: 1px; }
.range-track i::after { content: ""; position: absolute; top: -5px; left: -4px; border: 5px solid transparent; border-top-color: var(--text); }

/* Compact quote header */
.qh { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; }
.qh h1 { margin: 0; font-size: var(--fs-hero); letter-spacing: -.01em; }
.qh-name p { margin: 2px 0 0; max-width: none; }
.qh-price { text-align: right; }
.qh-meta { margin-top: 10px; }
.qh-actions { margin-top: 10px; }
button.sm, .btn.sm { min-height: 36px; padding: 6px 12px; font-size: var(--fs-small); }

/* Progressive disclosure: closed sections whose summary line carries the key number */
.attention h2 { margin-bottom: 8px; }
.sections { display: flex; flex-direction: column; gap: 8px; }
details.sec { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
details.sec > summary { list-style: none; display: grid; grid-template-columns: auto minmax(0, 1fr) 16px; align-items: center; gap: 10px;
                        padding: 13px 14px; cursor: pointer; color: var(--text); min-height: 48px; }
details.sec > summary::-webkit-details-marker { display: none; }
details.sec > summary::after { content: ""; width: 8px; height: 8px; border-right: 2px solid var(--faint); border-bottom: 2px solid var(--faint);
                               transform: rotate(45deg); transition: transform .15s; justify-self: end; margin-top: -4px; }
details.sec[open] > summary::after { transform: rotate(-135deg); margin-top: 4px; }
details.sec > summary:hover { background: var(--surface-2); border-radius: var(--radius); }
details.sec[open] > summary { border-bottom: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
.sec-t { font-weight: 600; font-size: var(--fs-body); }
.sec-s { color: var(--muted); font-size: var(--fs-small); text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-variant-numeric: tabular-nums; }
.sec-b { padding: 12px 14px 14px; }
.sub { margin-top: 12px; }
details.more-inline { margin-top: 10px; }
details.more-inline > summary { font-size: var(--fs-small); color: var(--accent-ink); }
.warn-t { color: var(--warn); }
@media (prefers-reduced-motion: reduce) { details.sec > summary::after { transition: none; } }

/* Section tabs: sticky chips under the top bar */
.tabs { position: sticky; top: 49px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 8px 2px; margin: 0 -2px; background: var(--bg); scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--muted); font-size: var(--fs-small); }
.tabs a:hover { color: var(--text); text-decoration: none; }
[id] { scroll-margin-top: 104px; }

/* Per-stock notes */
.note { font-size: var(--fs-body); padding: 8px 10px; border-left: 3px solid var(--border); background: var(--surface-2); border-radius: 0 8px 8px 0; }
.note + .note { margin-top: 6px; }
.note-good { border-left-color: var(--up); } .note-bad { border-left-color: var(--down); }
.note-warn { border-left-color: var(--warn); } .note-info { border-left-color: var(--accent); }

/* Chart controls */
.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 2px; }
.seg button { background: none; color: var(--muted); min-height: 36px; padding: 4px 10px; font-size: var(--fs-label); font-weight: 600; border-radius: 6px; }
.seg button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.seg a { display: inline-flex; align-items: center; min-height: 36px; color: var(--muted); padding: 6px 12px; font-size: var(--fs-small); font-weight: 600; border-radius: 6px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.ma-toggle { display: inline-flex; align-items: center; gap: 4px; color: var(--muted); margin-right: 10px; }
.ma-toggle input { min-height: auto; }
.sw { display: inline-block; width: 14px; height: 3px; border-radius: 2px; }
.sw20 { background: #e0a100; } .sw50 { background: #8a5cf6; } .sw200 { background: #0ea5b7; }

/* Technical gauge and tallies (ET / Moneycontrol idiom) */
.gauge-wrap { text-align: center; }
.gauge { width: 100%; max-width: 260px; display: block; margin: 0 auto; }
.g-seg { fill: none; stroke-width: 14; }
.g-ss { stroke: var(--down); } .g-s { stroke: var(--down-soft); } .g-b { stroke: var(--up-soft); } .g-sb { stroke: var(--up); }
.g-needle { stroke: var(--text); stroke-width: 3; stroke-linecap: round; } .g-hub { fill: var(--text); }
.g-txt { font-size: var(--fs-caption); fill: var(--faint); }
.gauge-label { font-size: var(--fs-page); font-weight: 700; margin-top: 2px; }
.tally { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 10px 0 6px; text-align: left; }
.tally > div { background: var(--surface-2); border-radius: 10px; padding: 8px 10px; font-size: var(--fs-small); }
.tally span { display: block; font-size: var(--fs-caption); color: var(--muted); }
.sig { font-size: var(--fs-caption); font-weight: 600; padding: 2px 7px; border-radius: 999px; text-transform: capitalize; }
.sig-bullish { background: var(--up-soft); color: var(--up); } .sig-bearish { background: var(--down-soft); color: var(--down); }
.sig-neutral { background: var(--surface-2); color: var(--muted); }
table.pivots th, table.pivots td { padding: 6px 4px; font-size: var(--fs-label); }

/* Support / resistance ladder */
.ladder { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.lad { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.4fr) auto; gap: 8px; padding: 6px 10px; font-size: var(--fs-small); font-variant-numeric: tabular-nums; border-bottom: 1px solid var(--border); }
.lad:last-child { border-bottom: none; }
.lad-resistance .lad-p { color: var(--up); } .lad-support .lad-p { color: var(--down); }
.lad-price { background: var(--accent-soft); font-weight: 700; }
.lad-l { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lad-d { color: var(--faint); }

@media (min-width: 720px) {
  .ohlc { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .form-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chart { height: 420px; }
}
@media (min-width: 960px) {
  body { padding-bottom: 24px; }
  /* Laptop: the tabs become a slim rail on the left; pages use the width beside it */
  .tabbar { top: 0; bottom: 0; right: auto; width: 88px; height: auto; padding: 64px 10px 16px; display: flex; flex-direction: column;
            gap: 6px; border-top: 0; border-right: 1px solid var(--border); z-index: 9; }
  .tabbar .tab { padding: 10px 0; border-radius: 12px; font-size: var(--fs-label); min-height: 60px; }
  .tabbar .tab.on { background: var(--surface-2); }
  .tab-badge { top: 4px; left: auto; right: 8px; }
  main, .disclaimer { margin-left: max(88px, calc((100vw - 1180px) / 2 + 44px)); }
  .grid.main-side { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}

/* Dashboard: key numbers strip, attention links, compact watchlist rows, quote lists */
.keys { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.key { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); min-width: 0; }
.key:hover { text-decoration: none; background: var(--accent-soft); }
.key span { font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.key b { font-size: var(--fs-body); font-variant-numeric: tabular-nums; white-space: nowrap; }
.key i { font-style: normal; font-size: var(--fs-label); font-variant-numeric: tabular-nums; }
.note-link { display: block; color: var(--text); }
.note-link:hover { text-decoration: none; background: var(--accent-soft); }
.wl { display: flex; flex-direction: column; }
.wl-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 2px; border-bottom: 1px solid var(--border); color: var(--text); }
.wl-row:last-child { border-bottom: none; }
.wl-row:hover { text-decoration: none; background: var(--surface-2); }
.wl-name { display: flex; flex-direction: column; min-width: 0; }
.wl-name small { color: var(--faint); font-size: var(--fs-label); max-width: none; }
.wl-price { display: flex; flex-direction: column; align-items: flex-end; font-variant-numeric: tabular-nums; }
.wl-price small { font-size: var(--fs-label); }
.qlist { display: flex; flex-direction: column; }
.qlist > div { display: grid; grid-template-columns: minmax(0, 1fr) auto 72px; gap: 10px; padding: 5px 0; border-bottom: 1px solid var(--border); font-size: var(--fs-small); font-variant-numeric: tabular-nums; }
.qlist > div:last-child { border-bottom: none; }
.qlist span { color: var(--muted); max-width: none; } .qlist i { font-style: normal; text-align: right; }
.chart-sm { height: 220px; }
@media (min-width: 720px) { .keys { grid-template-columns: repeat(6, minmax(0, 1fr)); } }
@media (max-width: 560px) {
  details.sec > summary { grid-template-columns: minmax(0, 1fr) 16px; row-gap: 2px; }
  details.sec > summary .sec-t { grid-column: 1; }
  details.sec > summary .sec-s { grid-column: 1; grid-row: 2; text-align: left; white-space: normal; }
  details.sec > summary::after { grid-column: 2; grid-row: 1 / span 2; }
}

/* Theme selector in the top bar */
.ts { position: relative; }
.ts-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 3px 10px 3px 4px; border-radius: 999px;
          border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-small); font-weight: 600; }
.ts-btn:hover { background: var(--surface-2); }
.ts-dot { width: 22px; height: 22px; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); background: conic-gradient(var(--accent) 0 50%, var(--bg) 0); }
.ts-pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 30; width: 304px; max-width: calc(100vw - 24px); padding: 14px;
          background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 12px 32px rgba(0,0,0,.18); }
.ts-pop h5 { margin: 0 0 6px; font-size: var(--fs-caption); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ts-modes { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); background: var(--surface-2); border-radius: 9px; padding: 3px; margin-bottom: 14px; }
.ts-modes button { background: none; color: var(--muted); min-height: 36px; padding: 4px 0; font-size: var(--fs-label); border-radius: 7px; }
.ts-modes button[aria-pressed="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.12); }
.ts-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 10px; }
.ts-sw { aspect-ratio: 1; min-height: 0; padding: 0; border-radius: 50%; box-shadow: 0 0 0 1px var(--border); }
.ts-sw[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent-ink); }
.ts-name { margin: 12px 0 0; font-size: var(--fs-label); color: var(--muted); min-height: 19px; }
@media (max-width: 420px) { .ts-btn .ts-label { display: none; } .ts-btn { padding: 3px; } }

/* Holdings strip on the dashboard's first card: your own money above the fold */
.money { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; margin-top: 12px; padding: 10px 12px;
  border-radius: 10px; background: var(--accent-soft); color: var(--text); }
.money:hover { text-decoration: none; }
.money span { display: flex; flex-direction: column; min-width: 0; }
.money small { font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.money b { font-size: var(--fs-title); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* Laptop: side-by-side cards instead of one long column */
@media (min-width: 960px) { .grid.book-top { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; } }

/* Ideas: a card per stock on phones, a scannable table row on laptops; detail opens under its own row */
.ideas { margin-top: 4px; }
.idea-head { display: none; }
details.idea { border-top: 1px solid var(--border); }
details.idea > summary { list-style: none; cursor: pointer; display: grid; gap: 2px 10px; padding: 10px 2px;
  grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "sym q" "rs stop" "px qty"; align-items: center; }
details.idea > summary::-webkit-details-marker { display: none; }
details.idea > summary { color: var(--text); }
.idea-sym b { color: var(--accent); }
details.idea > summary:hover { background: var(--surface-2); }
details.idea[open] > summary { background: var(--surface-2); }
.idea-sym { grid-area: sym; display: flex; flex-direction: column; min-width: 0; }
.idea-sym small { color: var(--faint); font-size: var(--fs-label); max-width: none; }
.idea-sym small.vol-good { color: var(--up); } .idea-sym small.vol-warn { color: var(--warn); } .idea-sym small.vol-bad { color: var(--down); }
.idea-q { grid-area: q; justify-self: end; }
.idea-rs { grid-area: rs; font-size: var(--fs-small); } .idea-stop { grid-area: stop; font-size: var(--fs-small); text-align: right; }
.idea-px { grid-area: px; font-size: var(--fs-small); text-align: left; } .idea-qty { grid-area: qty; font-size: var(--fs-small); text-align: right; }
.idea-loss { display: none; }
.idea-rs i, .idea-stop i, .idea-px i, .idea-qty i { font-style: normal; color: var(--muted); }
.idea-body { padding: 4px 2px 14px; }
.glossary p + p { margin-top: 4px; }
@media (min-width: 960px) {
  .idea-head, details.idea > summary { display: grid; grid-template-columns: minmax(0, 2.2fr) 70px 110px 100px 170px 70px 110px;
    grid-template-areas: none; gap: 10px; align-items: center; }
  .idea-head { padding: 0 2px 6px; }
  .idea-head span:nth-child(n+4) { text-align: right; }
  .idea-sym, .idea-q, .idea-rs, .idea-px, .idea-stop, .idea-qty, .idea-loss { grid-area: auto; }
  .idea-q { justify-self: start; }
  .idea-rs i, .idea-stop i, .idea-px i, .idea-qty i { display: none; }
  .idea-px, .idea-qty { text-align: right; } .idea-loss { display: block; text-align: right; font-size: var(--fs-small); }
  .idea-body { max-width: 760px; }
}

/* Mock trading strip on the dashboard */
.paper-strip { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; color: var(--text); }
.paper-strip span { display: flex; flex-direction: column; min-width: 0; }
.paper-strip small { font-size: var(--fs-caption); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.paper-strip b { font-size: var(--fs-body); font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Left sidebar: "Your pages" (ranked nightly by use) and every group, from nav.py. A drawer on phones and
   tablets; a fixed column on wide screens that the ☰ button collapses (remembered per browser). */
.side-btn { background: transparent; color: var(--text); border: 1px solid var(--border); border-radius: 8px; min-height: 40px;
            min-width: 44px; padding: 0 8px; font-size: var(--fs-page); line-height: 1; }
.side { position: fixed; top: 0; bottom: 0; left: 0; z-index: 40; width: min(280px, 86vw); overflow-y: auto; background: var(--surface);
        border-right: 1px solid var(--border); padding: 12px 10px calc(var(--nav-h) + 24px); transform: translateX(-105%);
        transition: transform .18s ease; box-shadow: var(--shadow); }
body.side-open .side { transform: none; }
.side-scrim { position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, .35); }
.side-group { border-bottom: 1px solid var(--border); padding: 4px 0; }
.side-group > summary { cursor: pointer; font-size: var(--fs-label); font-weight: 600; color: var(--muted); text-transform: uppercase;
                        letter-spacing: .04em; padding: 8px 6px; list-style: none; }
.side-group > summary::-webkit-details-marker { display: none; }
.side-group > summary::after { content: "▸"; float: right; color: var(--faint); }
.side-group[open] > summary::after { content: "▾"; }
.side a { display: block; padding: 8px 10px; border-radius: 8px; color: var(--text); font-size: var(--fs-body); min-height: 36px; }
.side a:hover { background: var(--surface-2); text-decoration: none; }
.side a.on { background: var(--surface-2); color: var(--accent-ink); font-weight: 600; }
.side-note { font-size: var(--fs-caption); color: var(--faint); margin: 4px 10px 6px; }
.side a.side-foot { font-size: var(--fs-small); color: var(--muted); }
@media (prefers-reduced-motion: reduce) { .side { transition: none; } }
@media (min-width: 1100px) {
  .side { top: 49px; left: 88px; width: 220px; transform: translateX(-140%); box-shadow: none; z-index: 5; padding-bottom: 24px; }
  body.side-pinned .side { transform: none; }
  body.side-pinned main, body.side-pinned .disclaimer { margin-left: max(324px, calc((100vw - 1180px) / 2 + 88px)); }
  .side-scrim { display: none; }
}
/* More page */
.more-list { display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; }
@media (min-width: 720px) { .more-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.more-item { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border-radius: 10px; background: var(--surface-2); color: var(--text); min-width: 0; }
.more-item:hover { text-decoration: none; filter: brightness(.98); }
.admin-group { border-color: var(--accent); }

/* A pick's setup is a sentence: secondary text under the symbol, not a pill (pills are one- to three-word states) */
.pick-setup { color: var(--muted); font-size: var(--fs-small); margin: var(--sp-1) 0 0; }

/* ---- Page transitions: pages slide and fade into each other instead of flashing (Safari 18.2+, Chrome) ---- */
@view-transition { navigation: auto; }
.topbar { view-transition-name: topbar; }
.bottom-nav { view-transition-name: tabbar; }
::view-transition-old(root) { animation: 120ms ease-out both v2-fade-out; }
::view-transition-new(root) { animation: 160ms ease-out both v2-fade-in; }
@keyframes v2-fade-out { to { opacity: 0; } }
@keyframes v2-fade-in { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { ::view-transition-old(root), ::view-transition-new(root) { animation: none; } }

/* ---- Home-screen app (standalone): keep clear of the notch and the home indicator ---- */
@media (display-mode: standalone) { .topbar { padding-top: calc(10px + env(safe-area-inset-top)); } }

/* ---- The new dashboard (/preview): numbers first, data as visuals (docs/DESIGN.md) ---- */
.v2 { display: flex; flex-direction: column; gap: var(--sp-3); }
.v2-note { margin: 0; }
.v2-card { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: var(--sp-4); box-shadow: var(--shadow); }
.v2-label { margin: 0; font-size: var(--fs-label); color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.v2-num { font-variant-numeric: tabular-nums; white-space: nowrap; transition: color .3s; }
/* A figure or line that just changed eases in (16 Nov 2026: smooth, not a flash) */
.just-updated { animation: just-updated .7s ease-out; }
@keyframes just-updated { from { opacity: .35; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) { .just-updated { animation: none; } }

.v2-hero { border-radius: 20px; padding: var(--sp-5) var(--sp-4); color: var(--text);
  background: linear-gradient(135deg, var(--accent-soft), var(--surface) 70%); border: 1px solid var(--border); }
.v2-big { margin: var(--sp-1) 0 var(--sp-3); font-size: var(--fs-display); font-weight: 700; line-height: 1.1; letter-spacing: -.02em; }
.v2-hero-row { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-2); }
.v2-hero-row > span { display: flex; flex-direction: column; gap: 2px; font-weight: 600; font-size: var(--fs-title); }
.v2-hero-row small { font-size: var(--fs-label); color: var(--muted); font-weight: 500; }

.v2-market { display: flex; justify-content: space-between; gap: var(--sp-3); align-items: center; }
.v2-market { flex-wrap: wrap; }
.v2-market-l { min-width: 180px; flex: 1; }
.v2-mid { margin: 2px 0 var(--sp-2); font-size: var(--fs-page); font-weight: 700; display: flex; gap: var(--sp-2); align-items: center; flex-wrap: wrap; }
.v2-gauge { text-align: center; flex: none; }
.v2-gauge p { margin: 0; }
.v2-gauge-track, .v2-gauge-fill { fill: none; stroke-width: 9; stroke-linecap: round; }
.v2-gauge-track { stroke: var(--surface-2); }
.v2-gauge-fill { stroke: var(--accent); }
.v2-gauge-needle { stroke: var(--text); stroke-width: 2.5; stroke-linecap: round; }
.v2-gauge-hub { fill: var(--text); }
.v2-gauge-n { font-size: var(--fs-page); font-weight: 700; margin-top: -6px !important; }

.v2-spark { flex: none; overflow: visible; }
.v2-spark polyline { fill: none; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.v2-spark polygon { stroke: none; opacity: .12; }
.v2-spark.up polyline { stroke: var(--up); } .v2-spark.up polygon { fill: var(--up); }
.v2-spark.down polyline { stroke: var(--down); } .v2-spark.down polygon { fill: var(--down); }
.v2-spark.wide { width: 100%; height: 36px; }

.v2-row { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); color: var(--text); min-height: var(--tap); }
.v2-row:hover { text-decoration: none; background: var(--surface-2); }
.v2-row-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.v2-row-l small { font-size: var(--fs-label); }
.v2-row-r { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; text-align: right; flex: none; }
.v2-row-r small { font-size: var(--fs-label); }
.v2-chip { font-size: var(--fs-label); font-weight: 600; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); white-space: nowrap; }
.v2-chip.up { background: var(--up-soft); } .v2-chip.down { background: var(--down-soft); }
.v2-act { align-self: flex-start; font-size: var(--fs-label); font-weight: 600; padding: 1px 7px; border-radius: 6px; background: var(--surface-2); color: var(--muted); }
.v2-act-hold, .v2-view-buy { background: var(--up-soft); color: var(--up); }
.v2-act-watch { background: var(--warn-soft); color: var(--warn); }
.v2-act-exit, .v2-view-avoid { background: var(--down-soft); color: var(--down); }
.v2-act-trim { background: var(--accent-soft); color: var(--accent-ink); }

.v2-pick { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); color: var(--text); }
.v2-pick:hover { text-decoration: none; }
.v2-pick-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; flex: 1; }
.v2-ring { flex: none; }
.v2-ring-track, .v2-ring-fill { fill: none; stroke-width: 5; }
.v2-ring-track { stroke: var(--surface-2); }
.v2-ring-fill { stroke: var(--accent); stroke-linecap: round; }
.v2-ring text { font-size: 11px; font-weight: 700; fill: var(--text); font-family: inherit; }
.v2-ladder { position: relative; height: 10px; border-radius: 5px; background: var(--surface-2); margin: 6px 0 2px; }
.v2-ladder i { position: absolute; top: 0; bottom: 0; }
.v2-ladder-loss { background: var(--down-soft); border-radius: 5px 0 0 5px; }
.v2-ladder-entry { background: var(--faint); }
.v2-ladder-gain { background: var(--up-soft); border-radius: 0 5px 5px 0; }
.v2-ladder-last { position: absolute; top: -4px; width: 4px; height: 18px; margin-left: -2px; border-radius: 2px; background: var(--text); }
.v2-ladder-legend { display: flex; justify-content: space-between; font-variant-numeric: tabular-nums; }

.v2-heat { display: grid; grid-template-columns: repeat(auto-fill, minmax(124px, 1fr)); gap: 6px; }
.v2-tile { border-radius: 12px; padding: 10px; display: flex; flex-direction: column; gap: 2px; min-height: 76px; border: 1px solid var(--border); }
.v2-tile-n { font-size: var(--fs-label); font-weight: 600; line-height: 1.25; }
.v2-tile b { font-size: var(--fs-title); font-variant-numeric: tabular-nums; }
.v2-tile small { font-size: var(--fs-label); color: var(--muted); }
.v2-on-strong { color: var(--text); }
@media (min-width: 900px) { .v2 { max-width: 760px; } .v2.tabpage { max-width: none; } }

/* ---- Tab pages (Now, Watch, Latest, Admin) ---- */
.tab-head { display: flex; flex-direction: column; gap: 2px; }
.tab-kicker { margin: 0; font-size: var(--fs-small); color: var(--muted); font-weight: 600; }
.tab-title { margin: 0; font-size: var(--fs-hero); font-weight: 800; letter-spacing: -.02em; }
.now-money { border-radius: 20px; padding: var(--sp-5) var(--sp-4); background: #0f1b2d; color: #ffffff; display: flex; flex-direction: column; gap: var(--sp-2); }
.now-money-label { font-size: var(--fs-label); color: #a9b6cf; font-weight: 600; }
.now-money-big { font-size: var(--fs-display); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.now-money .up { color: #7ee2a8; } .now-money .down { color: #ff9a8b; }
.now-money-row { display: flex; flex-wrap: wrap; gap: var(--sp-2) var(--sp-5); font-size: var(--fs-small); color: #c7d2e6; }
.vs { margin-top: var(--sp-2); padding-top: var(--sp-2); border-top: 1px solid var(--border); }
.vs-row { display: flex; justify-content: space-between; gap: var(--sp-3); font-size: var(--fs-small); padding: 2px 0; }
.now-money .vs { border-top-color: rgba(255, 255, 255, .14); color: #c7d2e6; }
.now-money .vs .faint { color: #a9b6cf; } .now-money .vs b:not(.up):not(.down):not(.faint) { color: #ffffff; }
.now-cols { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--sp-4); }
@media (min-width: 960px) { .now-cols { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); align-items: start; } }
.now-acts { display: flex; flex-direction: column; gap: var(--sp-3); }
.now-acts h2 { margin: 0; }
.now-act { display: flex; gap: var(--sp-3); padding: var(--sp-4); border-radius: 16px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); box-shadow: var(--shadow); }
.now-act:hover { text-decoration: none; border-color: var(--accent); }
.now-bad { border-color: color-mix(in srgb, var(--down) 35%, var(--border)); }
.now-ico { flex: none; width: 36px; height: 36px; border-radius: 18px; display: flex; align-items: center; justify-content: center; }
.now-ico svg { width: 18px; height: 18px; }
.now-bad .now-ico { background: var(--down-soft); color: var(--down); }
.now-warn .now-ico { background: var(--warn-soft); color: var(--warn); }
.now-info .now-ico { background: var(--accent-soft); color: var(--accent-ink); }
.now-good .now-ico { background: var(--up-soft); color: var(--up); }
.now-act-body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.now-act-body b { font-size: var(--fs-body); }
.now-act-body > span { font-size: var(--fs-small); color: var(--muted); line-height: 1.45; }
.now-act-body .now-act-go { color: var(--accent-ink); font-weight: 700; }
.now-act-body > .now-new { align-self: flex-start; font-size: var(--fs-label); font-weight: 700; line-height: 1.2; white-space: nowrap; }  /* not seen yet: what the Now badge counts */
.now-calm { margin: 0; padding: var(--sp-4); border-radius: 16px; background: var(--up-soft); color: var(--text); }
.tab-links { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--sp-2); }
.tab-link { display: flex; flex-direction: column; gap: 2px; padding: var(--sp-3); border-radius: 14px; background: var(--surface);
  border: 1px solid var(--border); color: var(--text); min-height: var(--tap); }
.tab-link:hover { text-decoration: none; border-color: var(--accent); }
.tab-link b { font-size: var(--fs-body); }
.tab-link span { font-size: var(--fs-label); color: var(--muted); line-height: 1.35; }
.feed-item { display: flex; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); color: var(--text); }
.feed-item:first-of-type { border-top: 0; }
.feed-dot { flex: none; width: 8px; height: 8px; border-radius: 4px; background: var(--tab-latest); margin-top: 7px; }
.feed-body { display: flex; flex-direction: column; gap: 3px; min-width: 0; flex: 1; }
.feed-meta { font-size: var(--fs-label); color: var(--muted); font-weight: 600; }
.progress { height: 8px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--tab-latest); border-radius: 4px; }
.adm-status { display: flex; gap: var(--sp-3); align-items: center; }
.adm-ok { flex: none; width: 48px; height: 48px; border-radius: 24px; display: flex; align-items: center; justify-content: center; }
.adm-ok svg { width: 24px; height: 24px; }
.adm-ok.good { background: var(--up-soft); color: var(--up); } .adm-ok.bad { background: var(--down-soft); color: var(--down); }
.adm-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-2); }
@media (min-width: 960px) { .adm-tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } .now-cols .adm-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.adm-tile { display: flex; flex-direction: column; gap: 3px; padding: var(--sp-3); border-radius: 14px; background: var(--surface); border: 1px solid var(--border); color: var(--text); }
.adm-tile:hover { text-decoration: none; border-color: var(--accent); }
.adm-tile small { font-size: var(--fs-label); color: var(--muted); font-weight: 600; }
.adm-tile b { font-size: var(--fs-title); }
.adm-tile span { font-size: var(--fs-label); color: var(--muted); }

/* ---- The stock page: price, the verdict in one line, your position, the quarter in words, then the detail ---- */
.stock-hero { display: flex; flex-direction: column; gap: 2px; }
.stock-price { margin: 4px 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--sp-2); font-size: var(--fs-hero); font-weight: 800; }
.stock-verdict { display: flex; flex-direction: column; gap: 4px; padding: var(--sp-4); border-radius: 16px; border: 1px solid var(--border); }
.stock-verdict b { font-size: var(--fs-title); }
.stock-verdict span { font-size: var(--fs-small); color: var(--muted); line-height: 1.45; }
.verdict-good { background: var(--up-soft); } .verdict-bad { background: var(--down-soft); }
.verdict-warn { background: var(--warn-soft); } .verdict-info { background: var(--accent-soft); }
.stock-pos-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); margin-top: var(--sp-3); }
@media (min-width: 720px) { .stock-pos-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stock-pos-grid span { display: flex; flex-direction: column; gap: 2px; }
.stock-pos-grid small { font-size: var(--fs-label); color: var(--muted); }
.stock-pos-grid b { font-size: var(--fs-title); }
.stock-plus { margin: 4px 0; display: flex; gap: 8px; }
.stock-sub { margin: var(--sp-4) 0 0; font-size: var(--fs-label); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.watch-search { display: flex; gap: var(--sp-2); }
.watch-search input { flex: 1; min-width: 0; }
.watch-jump { position: sticky; top: 49px; z-index: 5; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; background: var(--bg); scrollbar-width: none; }
.watch-jump::-webkit-scrollbar { display: none; }
.watch-jump a { flex: none; display: inline-flex; align-items: center; min-height: 36px; padding: 6px 14px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--border); color: var(--text); font-size: var(--fs-small); font-weight: 600; }
.watch-jump a:hover { text-decoration: none; border-color: var(--accent); }
[id^="w-"] { scroll-margin-top: 110px; }
.flow-row { display: flex; align-items: center; gap: var(--sp-3); padding: 6px 0; }
.flow-row > b:first-child { width: 36px; font-size: var(--fs-small); }
.flow-row > b:last-child { width: 108px; text-align: right; font-size: var(--fs-small); }
.flow-bar { position: relative; flex: 1; height: 12px; border-radius: 6px; background: var(--surface-2); }
.flow-bar i { position: absolute; top: 0; bottom: 0; border-radius: 6px; }
.flow-bar i.up { background: var(--up); } .flow-bar i.down { background: var(--down); }
/* Now: "At a glance", one row per stock (owner, 2 Nov) */
.gl-h { margin: var(--sp-4) 0 0; }
.gl-row { display: flex; justify-content: space-between; gap: var(--sp-3); padding: var(--sp-3) 0; border-top: 1px solid var(--border); color: var(--text); min-height: var(--tap); }
.gl-row:hover { text-decoration: none; background: var(--surface-2); }
.gl-l { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gl-l b { font-size: var(--fs-body); }
.gl-l small { font-size: var(--fs-label); color: var(--muted); line-height: 1.35; }
.gl-l .gl-status { color: var(--text); }
.gl-r { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; flex: none; text-align: right; font-size: var(--fs-small); }
.gl-r b { font-size: var(--fs-body); }
.now-news { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.now-news a { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border-radius: 10px; background: var(--surface-2); color: var(--text); font-size: var(--fs-small); line-height: 1.35; }
.now-news a:hover { text-decoration: none; }
.now-news small { font-size: var(--fs-label); color: var(--muted); }
/* Offline mode banner (app.js) */
.offline-bar { position: fixed; left: 12px; right: 12px; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 10px); z-index: 30;
  padding: 10px 14px; border-radius: 12px; background: #0f1b2d; color: #ffffff; font-size: var(--fs-small); box-shadow: 0 6px 20px rgba(0, 0, 0, .2); }
@media (min-width: 960px) { .offline-bar { left: auto; right: 24px; bottom: 24px; max-width: 420px; } }

.brand { display: inline-flex; align-items: center; gap: 8px; }
.brand-mark { width: 26px; height: 26px; flex: none; border-radius: 6px; }
/* The logo's rising line draws itself while a saved page fetches its fresh figures (owner, 16 Nov 2026) */
.brand.is-updating .brand-mark path:last-child { stroke-dasharray: 130; animation: brand-draw 1.2s ease-in-out infinite; }
@keyframes brand-draw { 0% { stroke-dashoffset: 130; } 55% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: -130; } }
@media (prefers-reduced-motion: reduce) { .brand.is-updating .brand-mark path:last-child { animation: none; opacity: .5; } }
.brand-r { color: #a8761c; }
:root[data-theme="dark"] .brand-r { color: #e0b04a; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .brand-r { color: #e0b04a; } }

/* Blue / orange for up and down (owner, 4 Nov: colour-blind safe, as Futubull and Robinhood offer). Arrows stay. */
:root[data-updown="bo"] { --up: #1f62c4; --up-soft: #e3edfb; --down: #b85c0a; --down-soft: #fbecdc; }
:root[data-updown="bo"][data-theme="dark"] { --up: #6ea8ff; --up-soft: #17263f; --down: #ffa257; --down-soft: #3a2614; }
@media (prefers-color-scheme: dark) { :root[data-updown="bo"]:not([data-theme="light"]) { --up: #6ea8ff; --up-soft: #17263f; --down: #ffa257; --down-soft: #3a2614; } }
:root[data-updown="bo"] .now-money .up { color: #8fbcff; } :root[data-updown="bo"] .now-money .down { color: #ffb173; }

/* Now: rows open in place (charges and why); each section says how fresh it is (owner, 4 Nov) */
.gl-item > summary { list-style: none; cursor: pointer; }
.gl-item > summary::-webkit-details-marker { display: none; }
.gl-item[open] > summary { background: var(--surface-2); }
.gl-detail { padding: var(--sp-2) var(--sp-3) var(--sp-3); background: var(--surface-2); font-size: var(--fs-small); color: var(--muted); }
.gl-detail p { margin: 0 0 var(--sp-1); color: var(--text); }
.gl-asof { margin-left: 6px; font-size: var(--fs-label); font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--muted); white-space: nowrap; }
.now-money .gl-asof { margin-left: auto; color: #a9b6cf; }
[data-live-section] { transition: opacity .3s; }
[data-live-section].is-stale { opacity: .72; }
[data-sym].is-stale, li.is-stale, tr.is-stale { opacity: .6; } /* one stuck price dims its own row only */
.is-stale .gl-asof { color: var(--warn); font-weight: 700; }
.now-money.is-stale .gl-asof { color: #f0b45a; }

.gl-sort { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin: var(--sp-3) 0 0; }
.gl-sort button { min-height: 36px; padding: 4px 12px; border-radius: 18px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: var(--fs-small); }
.gl-sort button[aria-pressed="true"] { background: var(--text); color: var(--surface); border-color: var(--text); }
.gl-remove { margin-left: var(--sp-4); }

/* Each part says when it last updated; one that could not be refreshed dims on its own (5 Nov) */
.part-at { display: block; margin-top: 6px; font-size: 11px; text-align: right; }
.part-failed { opacity: .7; }
.part-failed > .part-at { color: var(--warn); font-weight: 700; }

/* Add to home screen banner (app.js): top of the page, closable */
.a2hs { display: flex; align-items: center; gap: 10px; padding: 8px 12px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-size: var(--fs-body); }
.a2hs img { border-radius: 8px; flex: none; }
.a2hs-t { flex: 1; min-width: 0; }
.a2hs-x { flex: none; background: none; border: 0; font-size: 1.4rem; line-height: 1; padding: 4px 8px; color: inherit; cursor: pointer; }

/* ---- 15 Nov 2026: back button on every page under a tab, shortcut grid, mock-run tabs, More in Admin, build record ---- */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: var(--tap); font-weight: 600; color: var(--accent-ink); }
.back:hover { text-decoration: none; }
.back svg { width: 18px; height: 18px; flex: none; }
.shortcuts { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3) var(--sp-1); padding: var(--sp-3) var(--sp-2);
  border-radius: 14px; background: var(--surface); border: 1px solid var(--border); }
@media (min-width: 960px) { .shortcuts { grid-template-columns: repeat(8, minmax(0, 1fr)); } }
.shortcut { display: flex; flex-direction: column; align-items: center; gap: 6px; min-height: 64px; font-size: var(--fs-label); font-weight: 600;
  color: var(--text); text-align: center; line-height: 1.25; }
.shortcut:hover { text-decoration: none; color: var(--accent-ink); }
.shortcut-ico { width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); color: var(--accent-ink); display: flex;
  align-items: center; justify-content: center; }
.shortcut-ico svg { width: 20px; height: 20px; }
.runtabs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; padding: 3px; border-radius: 12px; background: var(--surface-2); }
.runtabs a { display: flex; align-items: center; justify-content: center; min-height: 40px; border-radius: 9px; font-size: var(--fs-small);
  font-weight: 600; color: var(--muted); text-align: center; }
.runtabs a:hover { text-decoration: none; }
.runpanel { display: none; scroll-margin-top: 240px; }
.runpanel:target, .runpanels:not(:has(.runpanel:target)) .runpanel:first-child { display: block; }
.stack:has(#run-month:target) .runtabs a[href="#run-month"], .stack:has(#run-weekly:target) .runtabs a[href="#run-weekly"],
.stack:has(#run-intraday:target) .runtabs a[href="#run-intraday"], .stack:has(#run-index:target) .runtabs a[href="#run-index"],
.stack:not(:has(.runpanel:target)) .runtabs a:first-child { background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.more-row { display: flex; justify-content: center; align-items: center; min-height: var(--tap); margin-top: var(--sp-2);
  border-top: 1px solid var(--border); font-weight: 600; }
.more-links { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-top: var(--sp-2); }
.more-link { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface-2); color: var(--text); font-weight: 600; font-size: var(--fs-small); }
.more-link:hover { text-decoration: none; border-color: var(--accent); }
.jump { align-self: flex-start; display: inline-flex; align-items: center; min-height: 36px; padding: 0 12px; margin-top: var(--sp-2);
  border-radius: 18px; background: var(--accent-soft); color: var(--accent-ink); font-size: var(--fs-small); font-weight: 600; }
.jump:hover { text-decoration: none; }
#more { scroll-margin-top: 80px; }
.month-nav { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2); }
.month-nav b { font-size: var(--fs-title); }
.month-nav span { min-width: 60px; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 4px 12px; border-radius: 18px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-size: var(--fs-small); white-space: nowrap; }
.chip:hover { text-decoration: none; }
.chip.on { background: var(--text); color: var(--surface); border-color: var(--text); font-weight: 600; }
.builds-card { padding: 0; overflow: hidden; }
table.builds td { vertical-align: top; }
table.builds .builds-d { white-space: nowrap; color: var(--muted); font-size: var(--fs-small); }
table.builds .pill { white-space: nowrap; }
.builds-find { display: flex; align-items: center; gap: var(--sp-2); }
.builds-find input[type="search"] { max-width: 320px; }
.wide-only { display: none; }
@media (min-width: 960px) {
  .narrow-only { display: none; }
  .wide-only { display: revert; }
  form.wide-only { display: flex; }
}
