/* Dark theme. Colors are tokens; chart.js reads --panel, --grid, --text-muted, --up, --down, --sma-*. */
:root {
  color-scheme: dark;
  --bg: #12161c;
  --panel: #171c23;
  --panel-2: #1d232c;
  --border: #262d37;
  --border-strong: #38414d;
  --grid: #1f252e;
  --text: #e4e7ec;
  --text-muted: #9aa3af;
  --text-faint: #6b7480;
  --accent: #7fa7d9;
  --accent-strong: #5b8bc9;
  --up: #4cb782;
  --down: #e0655a;
  --up-soft: rgba(76, 183, 130, 0.30);
  --down-soft: rgba(224, 101, 90, 0.30);
  --sma-fast: #c9a54a;
  --sma-slow: #9b8fd6;
  --forecast: #5fb3c9;
  --forecast-band: rgba(95, 179, 201, 0.16);
  --calm: #4cb782;
  --neutral: #c9a54a;
  --stress: #e0655a;
  --unknown: #6b7480;
  --star: #c9a54a;
  --risk-mark: rgba(224, 101, 90, 0.16);
  /* line-chart series, checked for colorblind separation on --panel */
  --series-1: #3987e5;
  --series-2: #d95926;
  --series-3: #199e70;
  --series-4: #c98500;
  --series-5: #d55181;
  --series-6: #9085e9;
  --radius: 3px;
  --radius-sm: 2px;
  --sans: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.45;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent; }
body { margin: 0; min-height: 100vh; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; }
:focus-visible { outline: 1px solid var(--accent); outline-offset: 2px; }
code { font-size: 0.88em; background: var(--panel-2); border: 1px solid var(--border); padding: 0 5px; border-radius: var(--radius-sm); }
h1, h2, h3, h4 { margin: 0; }
h2 { font-size: 1rem; font-weight: 600; letter-spacing: -0.005em; color: var(--text); }
.muted { color: var(--text-muted); }
.small { font-size: 0.82rem; }
.strong { font-weight: 600; }
.right { text-align: right; }
.num, .tabular { font-variant-numeric: tabular-nums; }

/* --- top bar */
.topbar {
  display: flex; align-items: center; gap: 28px; flex-wrap: wrap;
  padding: 0 28px; position: sticky; top: 0; z-index: 10; min-height: 52px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.brand { font-weight: 600; color: var(--text); letter-spacing: -0.01em; font-size: 0.98rem; white-space: nowrap; }
.brand:hover { color: var(--text); text-decoration: none; }
.brand-mark { display: none; }
.topbar nav { display: flex; gap: 22px; align-self: stretch; }
.topbar nav a {
  display: flex; align-items: center; color: var(--text-muted); font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px; padding-top: 2px;
}
.topbar nav a:hover { color: var(--text); text-decoration: none; }
.topbar nav a.active { color: var(--text); border-bottom-color: var(--accent); }
/* day bar, beside the search box */
.day-nav { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.day-step {
  display: inline-flex; align-items: center; justify-content: center; width: 28px; height: 30px;
  color: var(--text-muted); font-size: 1.1rem; border-radius: var(--radius-sm);
}
.day-step:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
.day-step.disabled { color: var(--text-faint); background: none; }
.day-pick { margin: 0; }
.day-pick input {
  background: transparent; color: var(--text); color-scheme: dark; font: inherit; font-variant-numeric: tabular-nums;
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 4px 6px; height: 30px;
}
.day-nav.past .day-pick input { border-color: var(--neutral); color: var(--neutral); }
.day-today { margin-left: 6px; color: var(--accent); }
.day-banner {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: baseline; padding: 8px 28px;
  border-bottom: 1px solid var(--border); background: var(--panel); color: var(--text-muted); font-size: 0.85rem;
  padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right));
}
.day-banner strong { color: var(--neutral); font-weight: 600; }
.day-banner a { margin-left: auto; }
.symbol-search input { width: 200px; }
.health { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; color: var(--text-muted); }
.health:hover { color: var(--text); text-decoration: none; }
.health-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--calm); }
.health-error .health-dot { background: var(--stress); }
.health-error { color: var(--stress); }
.pulse { animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

/* --- layout */
main { max-width: 1320px; margin: 0 auto; padding: 8px 28px 64px; }
section { margin-top: 32px; }
.section-head {
  display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap;
  margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.section-head > :last-child:not(:first-child) { margin-left: auto; }
.section-head .muted { font-size: 0.85rem; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stack { display: grid; gap: 12px; }
.empty { color: var(--text-muted); padding: 16px 0; margin: 0; }
.skeleton { min-height: 120px; }
.skeleton.tall { min-height: 420px; }
.eyebrow { font-size: 0.8rem; color: var(--text-muted); font-weight: 500; }

.dash-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 32px; align-items: start; }
.dash-side > section:first-child { margin-top: 32px; }

/* --- controls */
input, select {
  font: inherit; color: var(--text); background: var(--panel);
  border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 6px 10px; outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
input::placeholder { color: var(--text-faint); }
button {
  font: inherit; font-weight: 500; cursor: pointer; color: var(--bg); background: var(--text);
  border: 1px solid var(--text); border-radius: var(--radius-sm); padding: 6px 14px;
}
button:hover { background: #fff; }
button.secondary, .segmented button {
  background: transparent; color: var(--text); border-color: var(--border-strong);
}
button.secondary:hover, .segmented button:hover { border-color: var(--text-muted); background: transparent; }
button.link { background: none; border: 0; padding: 0; color: var(--text-muted); font-size: 0.82rem; }
button.link:hover { color: var(--down); background: none; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.actions form { margin: 0; }
.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.segmented button { border: 0; border-radius: 0; padding: 5px 12px; color: var(--text-muted); }
.segmented button + button { border-left: 1px solid var(--border-strong); }
.segmented button.active { color: var(--text); background: var(--panel-2); }
form.stack { display: grid; gap: 10px; max-width: 420px; }
form.stack label { display: grid; gap: 4px; color: var(--text-muted); font-size: 0.85rem; }
form.inline { display: flex; gap: 8px; }
.form-row { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; }
.form-row label { display: grid; gap: 4px; color: var(--text-muted); font-size: 0.82rem; }
.form-row input { width: 130px; }
.form-row input.wide { width: 170px; }

/* Underlined tabs (index switch, watchlist groups); small outlined chips for filters. */
.tabs { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 12px; border-bottom: 1px solid var(--border); }
.tab {
  font-size: 0.88rem; padding: 6px 0; background: none; color: var(--text-muted); border: 0;
  border-bottom: 2px solid transparent; border-radius: 0; margin-bottom: -1px;
}
.tab:hover { color: var(--text); background: none; text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); background: none; }
.chip {
  font-size: 0.8rem; padding: 3px 9px; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); border: 1px solid var(--border);
}
.chip:hover { color: var(--text); border-color: var(--border-strong); background: transparent; }
.chip.active { color: var(--text); border-color: var(--text-muted); background: var(--panel-2); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }

/* --- tones */
.tone-calm { --tone: var(--calm); }
.tone-neutral { --tone: var(--neutral); }
.tone-stress { --tone: var(--stress); }
.tone-unknown { --tone: var(--unknown); }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); flex: none; }
.up { color: var(--up); }
.down { color: var(--down); }
/* Pre-market or after-hours move under a day move */
.ext-move { display: block; font-size: 0.74rem; font-weight: 500; white-space: nowrap; font-variant-numeric: tabular-nums; }
.move-big .ext-move { font-size: 0.85rem; margin-top: 2px; }
.ticker .ext-move { margin-top: 4px; }
.pill { display: inline-block; font-size: 0.86rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.pill-up { color: var(--up); }
.pill-down { color: var(--down); }

/* --- overview row: one ruled strip, cells divided by hairlines */
.overview {
  display: grid; grid-template-columns: 1.3fr 1.3fr repeat(4, 1fr);
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--panel); margin-top: 24px;
}
.overview > .card { border: 0; border-radius: 0; background: none; border-left: 1px solid var(--border); }
.overview > .card:first-child { border-left: 0; }
.overview > a { color: var(--text); }
.overview > a:hover { background: var(--panel-2); text-decoration: none; }
.mood-big { font-size: 1.5rem; font-weight: 600; letter-spacing: -0.015em; color: var(--tone); margin: 4px 0 14px; }
.meter { position: relative; height: 1px; background: var(--border-strong); margin: 10px 0 4px; }
.meter::before { content: ""; position: absolute; left: 50%; top: -4px; height: 9px; width: 1px; background: var(--text-faint); }
.meter-marker { position: absolute; top: -6px; width: 2px; height: 13px; transform: translateX(-50%); background: var(--tone, var(--text)); }
.meter-scale { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--text-faint); margin-top: 6px; font-variant-numeric: tabular-nums; }
.meter-scale span:nth-child(2) { color: var(--text-muted); }
.mood-counts { display: flex; gap: 14px; margin-top: 12px; font-size: 0.8rem; color: var(--text-muted); align-items: center; }
.sentiment-summary { grid-template-columns: repeat(3, 1fr); margin-top: 12px; }
#mood .method-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 440px), 1fr)); gap: 12px; margin-top: 12px; }
#mood .method-list > .method { margin: 0; }
.lede { max-width: 860px; margin: 0 0 4px; }
.br-divergence { margin: 12px 0 0; }
.card-note { margin: 12px 0 0; padding-top: 10px; border-top: 1px solid var(--border); font-size: 0.75rem; color: var(--text-faint); }
.dash-main .stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 250px), 1fr)); gap: 12px; }
.dash-main .briefing-mini h3 { font-size: 0.95rem; }
.count { display: inline-flex; align-items: center; gap: 6px; }

.ticker { display: flex; flex-direction: column; overflow: hidden; padding-bottom: 0; }
.ticker-head { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.ticker-sym { font-size: 0.75rem; color: var(--text-faint); }
.ticker-value { font-size: 1.4rem; font-weight: 500; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin: 6px 0 2px; }
.ticker .pill { align-self: flex-start; }
.ticker .spark { width: calc(100% + 32px); height: 40px; margin: 12px -16px 0; display: block; }

.spark polyline { fill: none; stroke-width: 1.25; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.spark polygon { stroke: none; }
.spark-up polyline { stroke: var(--up); }
.spark-up polygon { fill: rgba(76, 183, 130, 0.07); }
.spark-down polyline { stroke: var(--down); }
.spark-down polygon { fill: rgba(224, 101, 90, 0.07); }

.signals { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0; padding: 0; margin-top: 12px; }
.signal { display: flex; flex-direction: column; gap: 3px; padding: 10px 14px; color: var(--text); border-right: 1px solid var(--border); }
.signal:last-child { border-right: 0; }
a.signal:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.signal-label { display: flex; align-items: center; gap: 7px; font-size: 0.78rem; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.signal-value { font-size: 1rem; font-weight: 500; font-variant-numeric: tabular-nums; }

/* --- portfolio (compact) */
.portfolio-total { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 12px; }
.big-number { font-size: 1.5rem; font-weight: 500; letter-spacing: -0.015em; font-variant-numeric: tabular-nums; margin-top: 2px; }
.holdings { list-style: none; margin: 0; padding: 0; }
.holdings li {
  display: grid; grid-template-columns: 64px 1fr auto 64px; gap: 12px; align-items: center;
  padding: 8px 0; border-top: 1px solid var(--border); font-variant-numeric: tabular-nums;
}
.holding-sym { font-weight: 500; color: var(--text); }
.holding-bar { height: 2px; background: var(--border); }
.holding-bar span { display: block; height: 100%; background: var(--text-muted); }
.holdings .num { text-align: right; }

/* --- briefings */
.briefing-mini h3, .commentary-mini h3 { font-family: var(--serif); font-size: 1.05rem; line-height: 1.3; margin: 8px 0; font-weight: 600; }
.briefing-mini h3 a, .briefing h4 a, .commentary-mini h3 a { color: var(--text); }
.briefing-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.briefing-list { margin: 0; padding-left: 16px; line-height: 1.45; font-size: 0.88rem; color: var(--text-muted); }
.briefing-list li { margin-bottom: 5px; }
.briefing-list li::marker { color: var(--text-faint); }
.briefing-list a { color: var(--text-muted); }
.briefing-list a:hover { color: var(--text); }
.briefings { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.briefing h4 { margin: 8px 0; font-family: var(--serif); font-size: 1.12rem; line-height: 1.3; font-weight: 600; }
.subhead { font-size: 0.92rem; margin: 28px 0 10px; color: var(--text); font-weight: 600; }
.tag { font-size: 0.75rem; padding: 1px 6px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-muted); margin-left: 4px; white-space: nowrap; }
.tag.key { margin-left: 0; color: var(--star); border-color: rgba(201, 165, 74, 0.35); }
.tag.warn { color: var(--neutral); }
.key-star { color: var(--star); }

/* --- headlines */
.news-toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 4px; }
.headlines {
  list-style: none; margin: 0; padding: 0; max-height: 820px; overflow-y: auto;
  scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent;
}
.headlines li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.headlines li:last-child { border-bottom: 0; }
.headline-meta { display: flex; gap: 10px; align-items: center; font-size: 0.78rem; margin-bottom: 3px; color: var(--text-faint); }
.headline-meta .source { font-weight: 500; color: var(--text-muted); }
.headline-meta .feed { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; color: var(--text-faint); }
.headline-meta .muted { color: var(--text-faint); }
.headline { font-family: var(--serif); color: var(--text); font-weight: 500; line-height: 1.35; font-size: 1.04rem; }
.headline:hover { color: var(--text); text-decoration-color: var(--text-faint); }
.headline:visited { color: var(--text-muted); }
.summary {
  margin: 3px 0 0; color: var(--text-muted); font-size: 0.86rem; line-height: 1.45; max-width: 80ch;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tags { margin-top: 6px; display: flex; gap: 4px; flex-wrap: wrap; }
.tags .tag { margin-left: 0; color: var(--accent); border-color: rgba(127, 167, 217, 0.3); }
.more { margin-top: 12px; }

/* --- tables */
.table-wrap { overflow-x: auto; border-top: 1px solid var(--border); }
table.data { width: 100%; border-collapse: collapse; }
table.data th, table.data td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data th:first-child, table.data td:first-child { padding-left: 0; }
table.data th:last-child, table.data td:last-child { padding-right: 0; }
table.data tbody tr:hover td { background: rgba(255, 255, 255, 0.015); }
table.data thead th { color: var(--text-faint); font-weight: 500; font-size: 0.78rem; border-bottom-color: var(--border-strong); }
table.data .num { text-align: right; font-variant-numeric: tabular-nums; }
table.data .group-row th { font-size: 0.8rem; color: var(--text-muted); padding-top: 16px; }
table.data td.detail { white-space: normal; color: var(--text-muted); max-width: 560px; }
table.data td.wrap { white-space: normal; }
table.data .sym { font-weight: 500; color: var(--text); }
table.data .sym:hover { color: var(--accent); }
.markets .spark-col { width: 120px; text-align: right; }
.markets .spark { width: 96px; height: 24px; vertical-align: middle; }
.sub { color: var(--text-muted); font-size: 0.8rem; }
.totals { display: flex; gap: 28px; margin-bottom: 12px; font-variant-numeric: tabular-nums; }

.status { font-size: 0.8rem; font-weight: 500; }
.status::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: currentColor; margin-right: 6px; vertical-align: 1px; }
.status-ok { color: var(--calm); }
.status-running { color: var(--accent); }
.status-skipped, .status-interrupted { color: var(--neutral); }
.status-error { color: var(--stress); }
.error { color: var(--stress); }
.ok { color: var(--calm); }
.link-button { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; margin-left: auto; }
.steps { padding-left: 20px; line-height: 1.8; }

/* --- charts page */
.legend { display: flex; gap: 16px; margin-bottom: 10px; font-size: 0.85rem; }
.swatch { display: inline-block; width: 12px; height: 2px; vertical-align: middle; margin-right: 6px; }
.swatch.sma-fast { background: var(--sma-fast); }
.swatch.sma-slow { background: var(--sma-slow); }
.swatch.forecast { background: var(--forecast); }
.swatch.forecast-band { background: var(--forecast-band); height: 8px; }
.chart { height: 560px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.chart[hidden] { display: none; }

/* --- sentiment page */
.gauges {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
}
.gauge { display: block; color: var(--text); padding: 12px 14px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
a.gauge:hover { background: var(--panel); text-decoration: none; }
.gauge-label { color: var(--text-muted); font-size: 0.82rem; }
.gauge-value { font-size: 1.35rem; font-weight: 500; font-variant-numeric: tabular-nums; margin: 4px 0; }
.gauge-meta { display: flex; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.tone-pill { font-size: 0.8rem; color: var(--tone); font-weight: 500; }
.tone-pill::first-letter { text-transform: uppercase; }
.gauge-note { color: var(--text-faint); font-size: 0.78rem; margin-top: 6px; }
.mood {
  display: flex; gap: 28px; align-items: center; flex-wrap: wrap; margin-bottom: 16px;
  border-left: 2px solid var(--tone); padding: 4px 0 4px 16px;
}
.mood-label { font-size: 1.3rem; font-weight: 600; color: var(--tone); }
.mood-label .muted { font-size: 0.95rem; font-weight: 400; }
.mood-explain { flex: 1 1 420px; margin: 0; color: var(--text-muted); font-size: 0.9rem; line-height: 1.55; max-width: 80ch; }
.prose p { line-height: 1.6; margin: 0 0 10px; max-width: 78ch; }
.prose p:last-child { margin-bottom: 0; }
.method-list { display: grid; gap: 0; }
.method-list > * { min-width: 0; }
.method { border: 0; border-top: 1px solid var(--border); border-radius: 0; background: none; padding: 16px 0; }
.method-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
.method-head h3 { margin: 0; font-size: 1rem; font-weight: 600; }
.method-head h3::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--tone); margin-right: 8px; vertical-align: 2px; }
.method-head .gauge-value { font-size: 1.15rem; margin: 0; }
.method-head a { margin-left: auto; }
.method h4 { margin: 14px 0 4px; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); }
.method p { margin: 0; line-height: 1.55; max-width: 80ch; }
.bands { display: flex; gap: 8px; flex-wrap: wrap; }
.band { font-size: 0.85rem; padding: 3px 9px; border-radius: var(--radius-sm); border: 1px solid var(--border); color: var(--text-muted); }
.band b { color: var(--tone); font-weight: 600; margin-right: 4px; }
.band.active { border-color: var(--tone); color: var(--text); }

/* --- newsletters */
.newsletter-text { white-space: pre-wrap; word-break: break-word; font: inherit; line-height: 1.6; margin: 0; max-height: 70vh; overflow-y: auto; color: var(--text-muted); }
.nl-summary { display: flex; gap: 28px; flex-wrap: wrap; align-items: baseline; margin: 4px 0 0; }
.nl-summary .big-number { font-size: 1.3rem; }
.headlines .score-line { display: flex; gap: 10px; align-items: baseline; margin-top: 5px; font-size: 0.82rem; color: var(--text-muted); flex-wrap: wrap; }

/* --- news sentiment */
.pos { color: var(--up); }
.neg { color: var(--down); }
.flat { color: var(--neutral); }
/* Score: the number plus a tick on a short -1..+1 rule. The tick position comes from --at (0..100). */
.score-badge {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 500;
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.score-badge.low { opacity: 0.5; }
.score-scale { position: relative; display: inline-block; width: 32px; height: 9px; flex: none; }
.score-scale::before { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 1px; background: var(--border-strong); }
.score-scale::after { content: ""; position: absolute; left: 50%; top: 2px; height: 5px; width: 1px; background: var(--text-faint); }
.score-scale i { position: absolute; top: 0; height: 9px; width: 2px; left: calc(var(--at, 50) * 1%); transform: translateX(-50%); background: currentColor; }
.mood-news { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); }
.mood-news strong { font-size: 0.95rem; font-weight: 600; }
.pill-warn { color: var(--neutral); }
.news-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 420px), 1fr)); gap: 16px; margin-bottom: 16px; }
.news-today .mood-big { margin-bottom: 4px; }
.num-soft { font-weight: 400; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.divergence { display: grid; gap: 4px; margin-top: 14px; padding: 2px 0 2px 12px; border-left: 2px solid var(--text-faint); line-height: 1.5; }
.div-warn { border-left-color: var(--neutral); }
.div-warn strong { color: var(--neutral); }
.div-aligned { border-left-color: var(--calm); }
.day-bars { list-style: none; margin: 12px 0 8px; padding: 0; display: grid; gap: 8px; }
.day-bars li { display: grid; grid-template-columns: 52px 1fr 48px 32px; gap: 10px; align-items: center; font-variant-numeric: tabular-nums; }
.bar-track { position: relative; height: 6px; }
.bar-track::after { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border); }
.bar-track::before { content: ""; position: absolute; left: 50%; top: -2px; bottom: -2px; width: 1px; background: var(--text-faint); z-index: 1; }
.bar { position: absolute; top: 0; bottom: 0; background: var(--neutral); }
.bar.pos { background: var(--up); }
.bar.neg { background: var(--down); }
table.data.compact th, table.data.compact td { padding: 6px 6px; }
table.data.compact { margin-top: 8px; }
table.data tr.self-row td { background: var(--panel-2); font-weight: 500; }
table.data tr.summary-row td { color: var(--text-muted); border-top: 1px solid var(--border-strong); }
.contrib { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 12px; }
.contrib li { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: start; }
.contrib .headline { font-size: 0.95rem; }
.prompt { margin: 12px 0 0; }
.prompt summary { cursor: pointer; color: var(--accent); }
.prompt pre { white-space: pre-wrap; font-size: 0.82rem; line-height: 1.55; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px; color: var(--text-muted); }
.score-why { display: none; margin: 3px 0 0; font-size: 0.8rem; color: var(--text-faint); }
@media (hover: none) { .score-why { display: block; } }  /* touch screens can't hover the score */

/* --- sectors */
.sector-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); gap: 16px; align-items: start; }
.sector-card { display: grid; gap: 10px; scroll-margin-top: 90px; }
.sector-card:target { border-color: var(--accent); }
.sector-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.sector-head h3 { font-size: 1rem; font-weight: 600; }
.sector-meta { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.breadth { display: flex; height: 3px; gap: 2px; }
.breadth-up { background: var(--up); }
.breadth-down { background: var(--down); }
.breadth-scale { display: flex; justify-content: space-between; margin-top: -4px; font-variant-numeric: tabular-nums; }
.sector-news { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.movers { display: flex; gap: 6px; flex-wrap: wrap; }
.sector-stocks summary { cursor: pointer; color: var(--accent); font-size: 0.85rem; padding: 4px 0; }
.sector-stocks table { margin-top: 6px; }
.sector-stocks .company { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-stocks .table-scroll { max-height: 420px; overflow-y: auto; }
.sector-foot { margin-top: 16px; line-height: 1.55; max-width: 100ch; }
.sector-strip {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 200px), 1fr));
  border-top: 1px solid var(--border); border-left: 1px solid var(--border);
}
.sector-tile {
  display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 9px 12px; min-height: 42px;
  border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); color: var(--text);
}
.sector-tile:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.sector-name { font-size: 0.86rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-nums { display: flex; gap: 10px; align-items: center; font-size: 0.82rem; font-variant-numeric: tabular-nums; flex: none; }

/* --- commentary */
.commentary, .commentary-mini { display: grid; gap: 10px; }
.stance { margin: 0; line-height: 1.5; display: flex; gap: 10px; align-items: baseline; }
.points { margin: 0; padding-left: 20px; line-height: 1.55; color: var(--text-muted); max-width: 80ch; }
.points li { margin-bottom: 6px; }
.intro { margin: 0 0 14px; max-width: 78ch; line-height: 1.55; }

/* --- touch devices and narrow screens */
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; }
.table-scroll > table { min-width: 100%; }
.topbar { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right)); padding-top: env(safe-area-inset-top); }
main { padding-left: max(28px, env(safe-area-inset-left)); padding-right: max(28px, env(safe-area-inset-right));
       padding-bottom: max(64px, calc(env(safe-area-inset-bottom) + 32px)); }
/* Today's move (stock page) and unusual-move alerts (dashboard) */
.move-card { margin-bottom: 16px; }
.move-head { display: flex; gap: 18px; align-items: center; margin-bottom: 12px; }
.move-big { font-size: 1.9rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.move-kind { font-size: 0.85rem; padding: 2px 8px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); }
.kind-sector .move-kind, .kind-market .move-kind { color: var(--neutral); border-color: rgba(201, 165, 74, 0.4); }
.kind-company .move-kind, .kind-mixed .move-kind { color: var(--accent); border-color: rgba(127, 167, 217, 0.4); }
.move-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px 16px; padding: 10px 0; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.move-breakdown > div { display: flex; flex-direction: column; gap: 2px; }
.move-breakdown b { font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.move-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.move-chips .eyebrow { margin-right: 4px; }
.chip-static { font-size: 0.8rem; padding: 2px 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); }
.chip-static b { color: var(--text); font-weight: 500; }
.move-note { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--border); }
.move-note p:first-child { font-family: var(--serif); font-size: 1.02rem; margin: 0 0 4px; max-width: 900px; }
.move-alerts { list-style: none; margin: 0; padding: 0; }
.move-alerts li { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--border); }
.move-alerts li:last-child { border-bottom: 0; }
.move-alert-text { flex-basis: 100%; color: var(--text-muted); font-size: 0.9rem; }
#moves-alert:empty { display: none; }

/* Relationship map (stock page) */
.relmap-card { margin-bottom: 16px; }
.relmap { position: relative; display: grid; gap: 28px 48px; padding: 8px 0 12px;
  grid-template-columns: minmax(0, 1fr) minmax(150px, 210px) minmax(0, 1fr);
  grid-template-areas: "top top top" "left center right" "bottom bottom bottom"; }
.relmap-lines { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.rel-line { fill: none; stroke: var(--border-strong); stroke-width: 1.25; }
.rel-line-supplier { stroke: var(--series-3); }
.rel-line-customer { stroke: var(--series-1); }
.rel-line-partner { stroke: var(--series-6); stroke-dasharray: 4 3; }
.rel-line-person { stroke: var(--series-4); opacity: 0.6; }
.rel-line-peer { stroke: var(--text-faint); stroke-dasharray: 2 3; }
.rel-top { grid-area: top; display: flex; justify-content: center; }
.relmap-tools { display: flex; justify-content: flex-end; gap: 6px; font-size: 0.8rem; color: var(--text-faint); }
.rel-cat { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.rel-top .rel-cat { align-items: center; width: 100%; }
.rel-cat-head { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; max-width: 360px; text-align: left; padding-right: 28px !important;
  padding: 9px 12px; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius);
  color: var(--text); font: inherit; cursor: pointer; }
.rel-cat-head:hover, .rel-cat-head:focus, .rel-cat-head:active, .rel-cat-head:disabled { background: var(--panel-2); color: var(--text); }
.rel-person-head:hover, .rel-person-head:focus, .rel-person-head:active { background: none; color: inherit; }
.rel-cat-head:hover:not(:disabled) { border-color: var(--accent); }
.rel-cat.open > .rel-cat-head { border-color: var(--accent); }
.rel-cat-head:disabled { cursor: default; opacity: 0.75; }
.rel-cat-head::after { content: "+"; position: absolute; right: 10px; top: 8px; color: var(--text-faint); }
.rel-cat.open > .rel-cat-head::after { content: "−"; }
.rel-cat-head:disabled::after { content: ""; }
.rel-cat-title { font-size: 0.85rem; }
.rel-cat-title b { font-weight: 600; margin-left: 2px; }
.rel-cat-preview { font-size: 0.78rem; color: var(--text-muted); }
.rel-badge { color: var(--neutral); font-size: 0.78rem; }
.rel-items { display: flex; flex-direction: column; gap: 8px; }
.rel-top .rel-items { flex-direction: row; flex-wrap: wrap; justify-content: center; }
.rel-person-head { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; padding: 0; border: 0; background: none;
  color: inherit; font: inherit; text-align: left; cursor: pointer; }
.rel-person-links { display: flex; flex-direction: column; gap: 2px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--border); }
.rel-note { margin: 0; max-width: 340px; }
.rel-line-closed { opacity: 0.55; }
.rel-items[hidden], .rel-person-links[hidden] { display: none; }
.relmap-tools .link-button { margin-left: 0; }
.rel-left { grid-area: left; display: flex; flex-direction: column; gap: 8px; align-self: center; }
.rel-right { grid-area: right; display: flex; flex-direction: column; gap: 8px; align-self: center; }
.rel-center { grid-area: center; display: flex; align-items: center; justify-content: center; }
.rel-bottom { grid-area: bottom; display: flex; flex-wrap: wrap; justify-content: center; gap: 16px 48px; }
.rel-bottom .rel-cat { flex: 1 1 300px; align-items: center; }
.rel-line-subsidiary { stroke: var(--series-2); }
.rel-country { width: 100%; max-width: 420px; font-size: 0.85rem; border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--panel-2); padding: 6px 10px; }
.rel-country summary { cursor: pointer; }
.rel-country summary b { font-weight: 600; margin-left: 2px; }
.rel-sub-list { list-style: none; margin: 6px 0 2px; padding: 0; display: flex; flex-direction: column; gap: 3px; }
.rel-tag { font-size: 0.7rem; color: var(--neutral); border: 1px solid currentColor; border-radius: var(--radius-sm); padding: 0 4px; }
.rel-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.rel-node { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; font-size: 0.85rem;
  background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); }
.rel-person { max-width: 230px; }
.rel-insider { border-color: var(--border-strong); }
.rel-self { align-items: center; text-align: center; padding: 14px 18px; border-color: var(--accent); background: var(--panel); }
.rel-self strong { font-size: 1.2rem; }
.rel-group { font-size: 0.75rem; color: var(--text-faint); text-transform: none; margin-top: 4px; }
.rel-link { font-size: 0.78rem; color: var(--text-muted); }
.rel-flag { color: var(--neutral); }
.rel-flag a { color: var(--neutral); }
.rel-ticker { font-size: 0.72rem; color: var(--text-faint); }
.rel-share { font-size: 0.8rem; color: var(--text); font-variant-numeric: tabular-nums; }
.rel-peer { flex-direction: row; align-items: baseline; gap: 6px; }
.rel-corr { font-size: 0.75rem; font-variant-numeric: tabular-nums; padding: 0 4px; border-radius: var(--radius-sm);
  background: color-mix(in srgb, var(--series-1) calc(var(--corr) * 45%), transparent); }
.rel-empty { margin: 0; max-width: 320px; }
@media (max-width: 760px) {
  .relmap { grid-template-columns: 1fr; grid-template-areas: "top" "center" "left" "right" "bottom"; gap: 18px; }
}

/* Leadership, board and pay (stock page) */
#leadership .card { margin-bottom: 16px; }
.pay-table td.wrap { min-width: 200px; }
.officer-list li { margin-bottom: 8px; }
.pay-history td { border-top: 0; padding-top: 0; }
.pay-history table { margin: 4px 0 8px; }
.trade-buy td:nth-child(3) { color: var(--up); }
.trade-sale td:nth-child(3) { color: var(--down); }

/* Research upload on the stock page */
.dropzone { border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--panel); margin-bottom: 12px; }
.dropzone.over { border-color: var(--accent); background: var(--panel-2); }
.dropzone-label { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 18px 16px; cursor: pointer; }
.dropzone-label .small { flex-basis: 100%; }
.upload-list { list-style: none; margin: 0 0 12px; padding: 0; font-size: 0.86rem; }
.upload-list li { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; padding: 4px 0; border-bottom: 1px solid var(--border); }
.upload-list .status { min-width: 92px; }
.ok { color: var(--calm); }

/* Analysts */
.analyst-table td { vertical-align: top; }
.analyst-table td.wrap { min-width: 240px; max-width: 420px; }
.consensus { margin-bottom: 4px; }
.mix { display: flex; gap: 2px; height: 6px; width: 140px; margin-bottom: 4px; }
.mix span { display: block; min-width: 3px; }
.mix-strong_buy { background: var(--up); }
.mix-buy { background: var(--up-soft); }
.mix-hold { background: var(--border-strong); }
.mix-sell { background: var(--down-soft); }
.mix-strong_sell { background: var(--down); }
.analyst-list { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; }
.analyst-list li { margin: 0 0 6px; }
.analyst-list a { color: var(--text); }
.research-row td { border-top: 0; padding-top: 0; }
.research-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 0.86rem; }
.research-list li { margin: 0 0 4px; }
.research-list summary { cursor: pointer; display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: center; }
.research-list p { margin: 4px 0 8px 22px; max-width: 760px; color: var(--text-muted); }

/* Earnings calls */
.calls-summary { grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr)); }
.outcome-counts { list-style: none; margin: 4px 0 8px; padding: 0; display: flex; flex-wrap: wrap; gap: 8px 16px; }
.outcome { font-size: 0.78rem; padding: 1px 6px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); white-space: nowrap; }
.outcome.delivered { color: var(--up); border-color: var(--up-soft); }
.outcome.missed, .outcome.dropped { color: var(--down); border-color: var(--down-soft); }
.outcome.revised { color: var(--neutral); }
.guidance { font-size: 0.85rem; }
.guidance.raised, .guidance.initiated { color: var(--up); }
.guidance.lowered, .guidance.withdrawn { color: var(--down); }
.calls-table td, .promise-table td { vertical-align: top; }
.calls-table td.wrap, .promise-table td.wrap { min-width: 220px; max-width: 520px; }
.call-detail td { border-top: 0; padding-top: 0; }
.call-detail p { margin: 0 0 6px; color: var(--text-muted); max-width: 820px; }
.call-detail summary, .promise-table summary { cursor: pointer; }
.promise-table blockquote { margin: 6px 0 4px 12px; color: var(--text-muted); font-family: var(--serif); }

/* Company brief (stock page) */
#management .card { margin-bottom: 16px; }
.brief-headline { font-family: var(--serif); font-size: 1.12rem; line-height: 1.45; margin: 0 0 6px; max-width: 900px; }
.brief-list { margin: 4px 0 10px; padding-left: 18px; }
.brief-list li { margin: 3px 0; }
.brief-year h4 { margin: 10px 0 2px; }
.brief-year p { margin: 0; max-width: 900px; }
.timeline { list-style: none; margin: 4px 0 0; padding: 0; }
.timeline li { margin: 0 0 6px; }
.timeline .tag { margin: 0 6px 0 0; }
.quarter { border-top: 1px solid var(--border); padding: 8px 0; }
.quarter:first-of-type { border-top: 0; }
.quarter summary { cursor: pointer; display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.quarter > p { margin: 8px 0; max-width: 900px; }
.quarter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 4px 24px; }
.quarter-grid h4 { margin: 6px 0 2px; font-size: 0.85rem; color: var(--text-muted); font-weight: 500; }

/* Risk words */
mark.risk { background: var(--risk-mark); color: inherit; border-radius: var(--radius-sm); padding: 0 1px; }
.kw-spikes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px; }
.kw-spikes strong { color: var(--stress); font-size: 0.85rem; margin-right: 2px; }
.kw-chip { font-size: 0.8rem; padding: 2px 7px; border: 1px solid var(--border); border-radius: var(--radius-sm); color: var(--text-muted); }
.kw-chip b { color: var(--text); font-weight: 500; margin-left: 2px; }
.kw-chip.spike { border-color: var(--down-soft); color: var(--text); }
.kw-days { list-style: none; margin: 0; padding: 0; }
.kw-days li { display: grid; grid-template-columns: 52px 1fr 40px 36px; gap: 8px; align-items: center; padding: 3px 0; }
.kw-days li.current { color: var(--text); font-weight: 500; }
.kw-track { position: relative; height: 6px; background: var(--grid); }
.kw-fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--neutral); }
.kw-days li.current .kw-fill { background: var(--stress); }
.kw-chart { margin-bottom: 16px; }
.kw-legend { list-style: none; display: flex; flex-wrap: wrap; gap: 4px 16px; margin: 8px 0 4px; padding: 0; font-size: 0.82rem; color: var(--text-muted); }
.kw-legend li { display: flex; align-items: center; gap: 6px; }
.kw-swatch { display: inline-block; width: 14px; height: 2px; background: currentColor; flex: none; }
.kw-swatch.s1, .kw-line.s1, .kw-dot.s1 { color: var(--series-1); }
.kw-swatch.s2, .kw-line.s2, .kw-dot.s2 { color: var(--series-2); }
.kw-swatch.s3, .kw-line.s3, .kw-dot.s3 { color: var(--series-3); }
.kw-swatch.s4, .kw-line.s4, .kw-dot.s4 { color: var(--series-4); }
.kw-swatch.s5, .kw-line.s5, .kw-dot.s5 { color: var(--series-5); }
.kw-swatch.s6, .kw-line.s6, .kw-dot.s6 { color: var(--series-6); }
.kw-plot { padding: 10px 28px 26px 44px; }
.kw-area { position: relative; height: 220px; }
.kw-area svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.kw-area line, .kw-area polyline { vector-effect: non-scaling-stroke; }
.kw-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.kw-dot { stroke: currentColor; stroke-width: 8; stroke-linecap: round; }
.kw-ring { stroke: var(--panel); stroke-width: 12; stroke-linecap: round; }
.kw-grid { stroke: var(--grid); stroke-width: 1; }
.kw-grid.base { stroke: var(--border-strong); }
.kw-cross { stroke: var(--text-faint); stroke-width: 1; }
.kw-hit { fill: transparent; cursor: crosshair; touch-action: pan-y; }
.kw-ytick, .kw-xtick { position: absolute; font-size: 0.75rem; color: var(--text-faint); font-variant-numeric: tabular-nums; white-space: nowrap; pointer-events: none; }
.kw-ytick { right: calc(100% + 8px); transform: translateY(-50%); }
.kw-xtick { top: calc(100% + 6px); transform: translateX(-50%); }
.kw-xtick.current { color: var(--text-muted); font-weight: 500; }
@media (max-width: 640px) { .kw-area { height: 180px; } .kw-plot { padding-right: 18px; } }
.kw-tip { position: absolute; top: 0; z-index: 2; min-width: 190px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius); font-size: 0.8rem; pointer-events: none; }
.kw-tip-day { color: var(--text-muted); margin-bottom: 4px; }
.kw-tip-row { display: grid; grid-template-columns: 14px 1fr auto; gap: 8px; align-items: center; color: var(--text-muted); }
.kw-tip-row b { color: var(--text); font-weight: 500; font-variant-numeric: tabular-nums; }
.kw-table td { vertical-align: top; }
.kw-table td:first-child { white-space: normal; min-width: 130px; }
@media (max-width: 640px) {
  .kw-table th, .kw-table td { padding-left: 6px; padding-right: 6px; }
  .kw-table tr > :nth-child(4), .kw-table tr > :nth-child(5) { display: none; }  /* total and usual share */
  .kw-bars i { width: 4px; }
}
.kw-group th { text-align: left; font-weight: 500; color: var(--text-muted); padding-top: 12px; border-bottom: 1px solid var(--border-strong); }
.kw-context td { color: var(--text-muted); }
.kw-word summary { cursor: pointer; }
.kw-word[open] summary { margin-bottom: 4px; }
.kw-examples { margin: 0 0 6px; padding-left: 16px; font-size: 0.85rem; max-width: 560px; }
.kw-examples li { margin: 3px 0; }
.kw-examples a { color: var(--text); font-family: var(--serif); }
.kw-bars { display: inline-flex; align-items: flex-end; gap: 2px; height: 18px; vertical-align: middle; }
.kw-bars i { display: block; width: 5px; min-height: 1px; background: var(--border-strong); }
.kw-bars i.current { background: var(--stress); }
.kw-table tr:target td { background: var(--panel-2); }

@media (pointer: coarse) {
  input, select, textarea { font-size: 16px; }  /* smaller text makes iOS Safari zoom in on focus */
  button, .chip { min-height: 36px; }
  .tab { padding: 10px 0; }
  .segmented button { padding: 8px 14px; }
  a.row-link, table.data td a { display: inline-block; padding: 4px 0; }
}
@media (max-width: 1280px) {
  .dash-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
}
@media (max-width: 1300px) {  /* nine nav links don't fit beside the name and search: give them their own row */
  .topbar { gap: 0 18px; padding-top: max(8px, env(safe-area-inset-top)); }
  .topbar nav { order: 3; width: 100%; overflow-x: auto; scrollbar-width: none; -webkit-overflow-scrolling: touch; min-height: 40px; }
  .topbar nav::-webkit-scrollbar { display: none; }
  .topbar nav a { white-space: nowrap; }
}
@media (max-width: 1180px) {
  .overview { grid-template-columns: repeat(2, 1fr); }
  /* mood and news side by side on top; the four tickers form a 2x2 below */
  .overview > .card { border-left: 0; border-top: 1px solid var(--border); }
  .overview > .card:nth-child(even) { border-left: 1px solid var(--border); }
  .mood-card { border-top: 0 !important; }
  .sentiment-summary { grid-template-columns: 1fr; }
  .sentiment-summary > .card { border-left: 0 !important; border-top: 1px solid var(--border) !important; }
  .sentiment-summary > .card:first-child { border-top: 0 !important; }
  .signal { border-bottom: 1px solid var(--border); }
}
@media (max-width: 1023px) {
  .dash-grid { grid-template-columns: 1fr; }
  .topbar { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
  main { padding-left: max(20px, env(safe-area-inset-left)); padding-right: max(20px, env(safe-area-inset-right)); }
}
@media (max-width: 640px) {
  .topbar { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  main { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .symbol-search input { width: 120px; }
  .day-nav { margin-left: 0; order: 2; }
  .symbol-search { margin-left: auto; }
  .day-banner { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }
  .card { padding: 14px; }
  .ticker .spark { width: calc(100% + 28px); margin: 10px -14px 0; }
  .ticker-value { font-size: 1.2rem; }
  .signals { grid-template-columns: repeat(2, 1fr); }
  .signal:nth-child(2n) { border-right: 0; }
  .markets .spark-col { display: none; }
  table.data th, table.data td { padding: 8px 8px; }
  .chart { height: 420px; }
  .sector-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sector-tile { flex-direction: column; align-items: flex-start; gap: 4px; }
  .form-row input, .form-row input.wide { width: 100%; }
  .form-row label { flex: 1 1 40%; }
}

/* Economic agenda */
table.data tr.agenda-due td { color: var(--text-muted); }
.agenda-more { margin-top: 8px; }
.agenda-more summary { cursor: pointer; color: var(--text-muted); }
.agenda-ahead { display: grid; gap: 4px; margin-top: 12px; color: var(--text-muted); }
.agenda-ahead .eyebrow { margin-right: 6px; }

/* Sign-in pages */
.auth-page { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 420px; display: grid; gap: 12px; }
.auth-card h1 { font-size: 1.3rem; margin: 0; }
.auth-card .brand { color: var(--text-muted); font-weight: 600; }
.auth-card input { width: 100%; }
.nav-signout { display: flex; align-items: center; margin-left: auto; }
.nav-signout button { background: none; border: 0; padding: 0; color: var(--text-muted); font: inherit; font-weight: 500; cursor: pointer; }
.nav-signout button:hover { color: var(--text); background: none; }
.wrap-all { word-break: break-all; white-space: normal; }
