:root {
  --bg: #0a0e16;
  --bg-elevated: #0e1320;
  --card: #131926;
  --card-hover: #171f30;
  --border: #232b3a;
  --border-subtle: #1a2130;
  --text: #eaeef5;
  --text-secondary: #9aa5ba;
  --text-muted: #626d82;
  --accent: #4f8cff;
  --accent-bright: #6ea1ff;
  --accent-dim: #26365c;
  --accent-glow: rgba(79, 140, 255, 0.16);
  --green: #22c55e;
  --green-dim: rgba(34, 197, 94, 0.13);
  --red: #f0495c;
  --red-dim: rgba(240, 73, 92, 0.13);
  --amber: #f5a623;
  --amber-dim: rgba(245, 166, 35, 0.13);
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.45);
  --mono: "JetBrains Mono", "SFMono-Regular", Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* Day theme -- not a naive inversion: deeper/more saturated accent colors
   (blue/green/red/amber/purple) than the dark palette uses, since the
   same hue needs more weight to stay readable against white than it does
   against near-black. Softer shadows (light diffuse, not heavy black) and
   an off-white body (not pure white) so cards have somewhere to sit. */
:root[data-theme="light"] {
  --bg: #f6f7fa;
  --bg-elevated: #ffffff;
  --card: #ffffff;
  --card-hover: #f1f3f7;
  --border: #dfe3ea;
  --border-subtle: #e9ecf1;
  --text: #12151c;
  --text-secondary: #4c5567;
  --text-muted: #838ba0;
  --accent: #2f6fed;
  --accent-bright: #1a56db;
  --accent-dim: #b9d0fa;
  --accent-glow: rgba(47, 111, 237, 0.12);
  --green: #16a34a;
  --green-dim: rgba(22, 163, 74, 0.10);
  --red: #dc2626;
  --red-dim: rgba(220, 38, 38, 0.10);
  --amber: #b45309;
  --amber-dim: rgba(180, 83, 9, 0.10);
  --purple: #7c3aed;
  --shadow: 0 8px 24px rgba(16, 24, 40, 0.08);
  --shadow-lg: 0 24px 60px rgba(16, 24, 40, 0.14);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); }
body {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(79,140,255,0.10), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(167,139,250,0.07), transparent 55%),
    var(--bg);
}
:root[data-theme="light"] body {
  background:
    radial-gradient(1200px 600px at 15% -10%, rgba(47,111,237,0.06), transparent 60%),
    radial-gradient(1000px 500px at 100% 0%, rgba(124,58,237,0.04), transparent 55%),
    var(--bg);
}
a { color: inherit; }
::selection { background: var(--accent-glow); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 8px; }

.disclaimer-strip {
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 12.5px;
  text-align: center;
  padding: 8px 16px;
}
.disclaimer-strip strong { color: var(--amber); font-weight: 600; }

.shell { max-width: 1180px; margin: 0 auto; padding: 0 24px; }

header.hero {
  padding: 40px 24px 40px;
  border-bottom: 1px solid var(--border-subtle);
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; letter-spacing: -0.02em; white-space: nowrap; }
.brand-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 16px var(--accent); }

/* Sticky top nav */
.topnav {
  position: sticky; top: 0; z-index: 40;
  background: rgba(10,14,22,0.82); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-subtle);
}
:root[data-theme="light"] .topnav { background: rgba(255,255,255,0.82); }
.topnav-inner {
  max-width: 1180px; margin: 0 auto; padding: 13px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
}
.topnav-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.freshness-pill {
  font-size: 12px; color: var(--text-secondary); background: var(--card);
  border: 1px solid var(--border); padding: 6px 12px; border-radius: 100px;
  display: flex; align-items: center; gap: 7px; white-space: nowrap;
}
.live-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); box-shadow: 0 0 8px var(--green); flex-shrink: 0; }
.theme-toggle { display: flex; gap: 2px; background: var(--card); border: 1px solid var(--border); border-radius: 100px; padding: 3px; }
.theme-toggle-btn {
  border: none; background: transparent; color: var(--text-secondary); font-size: 12.5px; font-weight: 600;
  padding: 6px 12px; border-radius: 100px; cursor: pointer; font-family: var(--sans);
  display: flex; align-items: center; gap: 5px; transition: all .15s ease;
}
.theme-toggle-btn:hover { color: var(--text); }
.theme-toggle-btn.active { background: var(--accent); color: white; }
.run-select {
  background: var(--card); border: 1px solid var(--border); color: var(--text);
  font-size: 12.5px; font-weight: 600; padding: 8px 14px; border-radius: 100px; cursor: pointer;
  font-family: var(--sans); max-width: 260px;
}

.hero-title {
  max-width: 1180px; margin: 0 auto;
  font-size: 40px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.12;
  margin-bottom: 14px;
}
.hero-title .accent-text { color: var(--accent-bright); }
.hero-sub {
  max-width: 1180px; margin: 0 auto 32px;
  color: var(--text-secondary); font-size: 16.5px; max-width: 640px;
}

.stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  max-width: 1180px; margin: 0 auto;
}
.stat-card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-label { font-size: 12px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.06em; font-weight: 600; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; font-family: var(--mono); letter-spacing: -0.02em; }
.stat-value.green { color: var(--green); }
.stat-value.red { color: var(--red); }
.stat-value.muted { color: var(--text-muted); font-size: 15px; font-family: var(--sans); font-weight: 500; }
.stat-value-sub { font-size: 14px; color: var(--text-muted); font-family: var(--sans); font-weight: 500; }

/* Every page now supplies its own top spacing (the hero's own padding, or
   an explicit paddingTop on its root .shell), and .shell already carries
   horizontal padding -- so <main> itself only needs to reserve room before
   the footer. Giving it the old full padding box double-counted the
   horizontal inset (main's + .shell's) on every page below Home. */
main { padding-bottom: 80px; }

.section-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-title { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.section-desc { color: var(--text-muted); font-size: 13.5px; margin-top: 4px; }

.controls { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.pill-group { display: flex; gap: 6px; background: var(--card); border: 1px solid var(--border); border-radius: 100px; padding: 4px; }
.pill-btn {
  border: none; background: transparent; color: var(--text-secondary); font-size: 12.5px; font-weight: 600;
  padding: 6px 13px; border-radius: 100px; cursor: pointer; transition: all .15s ease; font-family: var(--sans);
}
.pill-btn:hover { color: var(--text); }
.pill-btn.active { background: var(--accent); color: white; }
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .big { font-size: 15px; margin-bottom: 6px; color: var(--text-secondary); }

.badge-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.badge {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 6px; white-space: nowrap;
}
.badge-trade { background: var(--green-dim); color: var(--green); }
.badge-watch { background: var(--amber-dim); color: var(--amber); }
.badge-long { background: var(--green-dim); color: var(--green); }
.badge-short { background: var(--red-dim); color: var(--red); }
.badge-neutral { background: rgba(154,165,186,0.13); color: var(--text-secondary); }
.badge-horizon { background: rgba(167,139,250,0.13); color: var(--purple); }

/* Opportunities table */
.table-scroll {
  overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--card);
}
.opp-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.opp-table th {
  position: sticky; top: 0; background: var(--bg-elevated); z-index: 1;
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); font-weight: 700; padding: 13px 16px; border-bottom: 1px solid var(--border);
  white-space: nowrap; user-select: none;
}
.opp-table th.sortable { cursor: pointer; transition: color .15s ease; }
.opp-table th.sortable:hover { color: var(--text-secondary); }
.opp-table th.col-right, .opp-table td.col-right { text-align: right; }
.opp-table th.col-left, .opp-table td.col-left { text-align: left; }
.sort-icon { display: inline-block; margin-left: 5px; font-size: 10px; }
.sort-icon.idle { opacity: 0.35; }
.sort-icon.active { color: var(--accent-bright); opacity: 1; }
.opp-table tbody tr { cursor: pointer; transition: background .12s ease; border-bottom: 1px solid var(--border-subtle); }
.opp-table tbody tr:last-child { border-bottom: none; }
.opp-table tbody tr:hover { background: var(--card-hover); }
.opp-table td { padding: 12px 16px; font-size: 13px; vertical-align: middle; }
.opp-table .mono { font-family: var(--mono); }
.cell-green { color: var(--green); }
.cell-red { color: var(--red); }
.cell-current { color: var(--accent-bright); font-weight: 600; }
.closed-tag {
  font-family: var(--sans); font-size: 9.5px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; margin-top: 2px;
}
.closed-tag.closed-target { color: var(--green); }
.closed-tag.closed-stop { color: var(--red); }
.ticker-cell { display: flex; align-items: center; gap: 10px; }
.ticker-cell-symbol { font-family: var(--mono); font-weight: 700; font-size: 13.5px; }
.ticker-cell-name { color: var(--text-muted); font-size: 11.5px; max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge-stack { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.conf-cell { display: flex; align-items: center; gap: 8px; justify-content: flex-end; }
.conf-track { height: 6px; background: var(--bg-elevated); border-radius: 4px; overflow: hidden; }
.conf-fill { height: 100%; background: linear-gradient(90deg, var(--accent-dim), var(--accent-bright)); border-radius: 4px; }
.conf-cell .conf-track { width: 46px; }
.chevron-col { width: 32px; }
.chevron-cell { color: var(--text-muted); font-size: 18px; transition: color .15s ease, transform .15s ease; }
.opp-table tbody tr:hover .chevron-cell { color: var(--accent-bright); transform: translateX(2px); }

/* Track record */
.track-record { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px; }
.tr-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 20px; }
.tr-stat { text-align: center; }
.tr-stat-value { font-family: var(--mono); font-size: 28px; font-weight: 700; }
.tr-stat-label { font-size: 12px; color: var(--text-muted); margin-top: 6px; }
.tr-caveat { background: var(--amber-dim); color: var(--amber); border-radius: var(--radius-sm); padding: 14px 18px; font-size: 13px; line-height: 1.6; }

/* Ticker detail overlay */
.detail-overlay {
  position: fixed; inset: 0; background: rgba(6,8,14,0.75); backdrop-filter: blur(4px);
  z-index: 50; display: flex; justify-content: center; overflow-y: auto; padding: 40px 16px;
  animation: fadeIn .15s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.detail-panel {
  background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 18px;
  max-width: 880px; width: 100%; height: fit-content; box-shadow: var(--shadow-lg);
}
.detail-header { display: flex; justify-content: space-between; align-items: center; padding: 26px 28px 20px; border-bottom: 1px solid var(--border-subtle); }
.detail-header-left { display: flex; align-items: center; gap: 14px; }
.detail-ticker { font-family: var(--mono); font-size: 24px; font-weight: 800; }
.detail-company { color: var(--text-muted); font-size: 13.5px; margin-top: 2px; }
.detail-price { font-family: var(--mono); font-size: 22px; font-weight: 700; text-align: right; }
.detail-price-asof { color: var(--text-muted); font-size: 11px; text-align: right; margin-top: 2px; }
.close-btn {
  position: absolute; top: 20px; right: 20px; background: var(--card); border: 1px solid var(--border);
  color: var(--text-secondary); width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 16px;
  display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { color: var(--text); border-color: var(--accent-dim); }
.detail-body { padding: 24px 28px 30px; }
.detail-section { margin-bottom: 28px; }
.detail-section:last-child { margin-bottom: 0; }
.detail-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted); font-weight: 700; margin-bottom: 12px; }
.progress-banner {
  display: flex; align-items: baseline; gap: 12px; padding: 12px 16px; border-radius: var(--radius-sm);
  margin-bottom: 16px; border: 1px solid var(--border-subtle);
}
.progress-banner.banner-open { background: var(--bg-elevated); }
.progress-banner.banner-target { background: var(--green-dim); border-color: rgba(34,197,94,0.25); }
.progress-banner.banner-stop { background: var(--red-dim); border-color: rgba(240,73,92,0.25); }
.progress-return { font-family: var(--mono); font-size: 20px; font-weight: 700; }
.progress-status { font-size: 12.5px; color: var(--text-secondary); font-weight: 500; }
.detail-loading { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 70px 20px; color: var(--text-muted); font-size: 13px; }

.chart-wrap { height: 280px; margin-bottom: 4px; }

/* ---------- chart toolbar ---------- */
.chart-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.chart-toolbar-right { display: flex; align-items: center; gap: 8px; }
.pill-group.tiny { gap: 2px; padding: 2px; }
.pill-group.tiny .pill-btn { padding: 4px 9px; font-size: 11px; }
.pill-btn.ghost { border: 1px solid var(--border); background: transparent; color: var(--text-secondary); border-radius: 999px; padding: 4px 10px; font-size: 11px; }
.pill-btn.ghost:hover { border-color: var(--accent); color: var(--accent); }
.chart-hint { font-size: 10.5px; color: var(--text-muted); text-align: right; margin-bottom: 10px; }

/* ---------- score breakdown ---------- */
.title-hint { font-size: 11px; color: var(--text-muted); font-weight: 400; text-transform: none; letter-spacing: 0; margin-left: 8px; }
.score-list { display: flex; flex-direction: column; gap: 8px; }
.score-row { display: grid; grid-template-columns: 128px 1fr 34px; align-items: center; gap: 10px; }
.score-label { font-size: 12px; color: var(--text-secondary); }
.score-track { height: 7px; background: var(--border-subtle); border-radius: 4px; overflow: hidden; }
.score-fill { height: 100%; border-radius: 4px; transition: width .35s cubic-bezier(.4,0,.2,1); }
.score-fill.s-high { background: linear-gradient(90deg, var(--green), var(--green)); }
.score-fill.s-mid { background: linear-gradient(90deg, var(--accent), var(--accent-bright)); }
.score-fill.s-low { background: linear-gradient(90deg, var(--amber), var(--amber)); }
.score-val { font-size: 12px; font-weight: 600; text-align: right; color: var(--text-secondary); }

/* ---------- rank reason ---------- */
.rank-reason { margin-top: 16px; padding: 12px 14px; background: var(--accent-glow); border-left: 3px solid var(--accent); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; font-size: 13px; line-height: 1.6; color: var(--text-secondary); }
.rank-reason-label { font-size: 10.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); font-weight: 700; margin-bottom: 5px; }

/* ---------- excursion (MFE/MAE) ---------- */
.excursion { margin: 14px 0 4px; }
.excursion-head, .excursion-vals { display: flex; justify-content: space-between; font-size: 10.5px; }
.excursion-head { color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 5px; }
.excursion-vals { margin-top: 5px; font-size: 11.5px; font-weight: 600; }
.excursion-bars { display: flex; align-items: center; height: 8px; }
.exc-side { flex: 1; height: 100%; background: var(--border-subtle); border-radius: 4px; display: flex; overflow: hidden; }
.exc-side.left { justify-content: flex-end; }
.exc-mid { width: 2px; height: 14px; background: var(--text-muted); margin: 0 3px; flex-shrink: 0; }
.exc-fill { height: 100%; }
.exc-fill.red { background: var(--red); border-radius: 4px 0 0 4px; }
.exc-fill.green { background: var(--green); border-radius: 0 4px 4px 0; }

/* ---------- search ---------- */
.search-trigger { display: flex; align-items: center; gap: 7px; background: var(--card); border: 1px solid var(--border); color: var(--text-muted); border-radius: 999px; padding: 6px 12px; font-size: 12px; font-family: var(--sans); cursor: pointer; transition: border-color .15s, color .15s; }
.search-trigger:hover { border-color: var(--accent); color: var(--text-secondary); }
.search-icon { font-size: 15px; line-height: 1; }
.kbd { font-family: var(--mono); font-size: 10px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; color: var(--text-muted); }

.search-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.55); backdrop-filter: blur(4px); z-index: 200; display: flex; justify-content: center; padding-top: 12vh; animation: fadeIn .12s ease; }
.search-panel { width: min(620px, 92vw); max-height: 70vh; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-lg); display: flex; flex-direction: column; overflow: hidden; animation: popIn .14s cubic-bezier(.4,0,.2,1); }
.search-input-row { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border-subtle); }
.search-input { flex: 1; background: transparent; border: none; outline: none; color: var(--text); font-size: 16px; font-family: var(--sans); }
.search-input::placeholder { color: var(--text-muted); }
.search-results { overflow-y: auto; flex: 1; padding: 6px; }
.search-result { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: var(--radius-sm); cursor: pointer; }
.search-result.active { background: var(--card-hover); }
.search-result.inert { cursor: default; opacity: .72; }
.search-result-main { flex: 1; min-width: 0; }
.search-result-symbol { font-family: var(--mono); font-weight: 700; font-size: 13.5px; }
.search-result-name { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-right { display: flex; gap: 5px; flex-shrink: 0; }
.search-empty { padding: 26px 20px; text-align: center; color: var(--text-muted); font-size: 13px; line-height: 1.6; }
.search-empty strong { color: var(--text-secondary); }
.search-foot { display: flex; gap: 14px; align-items: center; padding: 9px 14px; border-top: 1px solid var(--border-subtle); font-size: 10.5px; color: var(--text-muted); flex-wrap: wrap; }
.search-foot span { display: flex; align-items: center; gap: 4px; }

@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes popIn { from { opacity: 0; transform: translateY(-8px) scale(.985) } to { opacity: 1; transform: none } }

@media (max-width: 720px) {
  .search-trigger-text { display: none; }
  .score-row { grid-template-columns: 96px 1fr 30px; }
}

.kv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.kv-box { background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 10px 12px; }
.kv-key { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; margin-bottom: 3px; }
.kv-val { font-family: var(--mono); font-size: 14px; font-weight: 600; }
.thesis-full { color: var(--text-secondary); font-size: 14px; line-height: 1.7; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag { font-size: 11.5px; background: var(--card); border: 1px solid var(--border-subtle); color: var(--text-secondary); padding: 4px 10px; border-radius: 100px; }
.tag.risk { color: var(--red); border-color: rgba(240,73,92,0.2); }

.sentiment-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; margin-right: 4px; }
.sentiment-bullish .sentiment-dot { background: var(--green); }
.sentiment-bearish .sentiment-dot { background: var(--red); }
.sentiment-neutral .sentiment-dot, .sentiment-mixed .sentiment-dot { background: var(--text-muted); }

footer { border-top: 1px solid var(--border-subtle); padding: 36px 24px; text-align: center; }
.footer-disclaimer { max-width: 700px; margin: 0 auto 14px; color: var(--text-muted); font-size: 12px; line-height: 1.7; }
.footer-meta { color: var(--text-muted); font-size: 11.5px; }

.loading-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 14px; color: var(--text-muted); }
.spinner { width: 28px; height: 28px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

@media (max-width: 720px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .tr-grid { grid-template-columns: repeat(2, 1fr); }
  .hero-title { font-size: 30px; }
  .topnav-inner { padding: 12px 16px; }
}

/* ---------- sparklines ---------- */
.sparkline { display: block; overflow: visible; }
.spark-cell { width: 78px; }

/* ---------- mobile card layout ----------
   Replaces the ~1100px-wide opportunities table below 780px, where the
   table forced horizontal scrolling and the ticker scrolled out of view
   before you reached its numbers. */
.opp-cards { display: flex; flex-direction: column; gap: 10px; }
.opp-card {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 13px 14px;
  display: flex; flex-direction: column; gap: 11px;
  transition: border-color .15s, transform .06s;
}
.opp-card:active { transform: scale(0.995); }
.opp-card:hover { border-color: var(--accent-dim); }

.opp-card-top { display: flex; align-items: center; gap: 11px; }
.opp-card-id { flex: 1; min-width: 0; }
.opp-card-symbol { font-family: var(--mono); font-weight: 700; font-size: 15px; display: flex; align-items: center; gap: 7px; }
.opp-card-rank { font-size: 10.5px; font-weight: 600; color: var(--text-muted); background: var(--bg-elevated); border-radius: 4px; padding: 1px 5px; }
.opp-card-rank.carried-forward { color: var(--accent); background: var(--accent-glow); text-transform: uppercase; letter-spacing: 0.03em; }
.opp-card-name { font-size: 11.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.opp-card-badges { display: flex; flex-wrap: wrap; gap: 5px; }

.opp-card-levels { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.opp-card-levels > div { display: flex; flex-direction: column; gap: 2px; }
.lv-key { font-size: 9.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); }
.lv-val { font-size: 13px; font-weight: 600; }

.opp-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-top: 3px; border-top: 1px solid var(--border-subtle); }
.opp-card-return { font-size: 15px; font-weight: 700; }

/* ---------- narrow-viewport chrome ----------
   The hero previously filled an entire phone screen before any content
   appeared; these bring the ranked list above the fold. */
@media (max-width: 780px) {
  /* Must match header.hero's specificity -- a bare .hero loses to it and
     the padding override silently does nothing. */
  header.hero { padding: 20px 20px 16px; }
  .hero-title { font-size: 27px; line-height: 1.15; margin-bottom: 10px; }
  /* The full intro runs six lines on a phone, pushing the actual ideas
     under the fold. Three lines carry the point; the rest is in the footer. */
  .hero-sub {
    font-size: 13.5px; margin: 0 0 14px; max-width: none; line-height: 1.5;
    display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden;
  }
  .stats-row { grid-template-columns: repeat(2, 1fr); gap: 7px; }
  .stat-card { padding: 10px 12px; }
  .stat-label { margin-bottom: 4px; font-size: 10.5px; }
  .stat-value { font-size: 19px; }
  main { padding-bottom: 60px; }
  .shell { padding: 0 16px; }
  .section-desc { font-size: 12.5px; }
  .section-head { flex-direction: column; align-items: stretch; gap: 10px; margin-bottom: 14px; }
  .controls { flex-wrap: wrap; gap: 8px; }
  .topnav-inner { flex-wrap: wrap; gap: 10px 8px; }
  .topnav-right { flex-wrap: wrap; gap: 8px; width: 100%; }
  .run-select { flex: 1; min-width: 0; }
  .freshness-pill { order: 3; }
  .detail-overlay { padding: 12px 8px; }
  .detail-header, .detail-body { padding-left: 16px; padding-right: 16px; }
  .chart-wrap { height: 230px; }
  .kv-grid { grid-template-columns: repeat(auto-fill, minmax(108px, 1fr)); gap: 8px; }
}

/* ---------- methodology ---------- */
.methodology { border-top: 1px solid var(--border-subtle); margin-top: 44px; padding-top: 28px; }
.methodology-head {
  width: 100%; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  background: none; border: none; padding: 0; cursor: pointer; text-align: left;
  color: inherit; font: inherit;
}
.methodology-chevron { font-size: 22px; color: var(--text-muted); transition: transform .2s ease; line-height: 1; flex-shrink: 0; }
.methodology-chevron.open { transform: rotate(180deg); }
.methodology-body { margin-top: 24px; }
.method-stages { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px 28px; }
.method-stage { display: flex; gap: 13px; }
.method-num {
  font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--accent);
  background: var(--accent-glow); border-radius: 6px; padding: 3px 7px; height: fit-content; flex-shrink: 0;
}
.method-title { font-weight: 700; font-size: 14px; margin-bottom: 4px; }
.method-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.method-limits {
  margin-top: 28px; background: var(--card); border: 1px solid var(--border-subtle);
  border-radius: var(--radius); padding: 18px 20px;
}
.method-limits-title { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--amber); margin-bottom: 12px; }
.method-limits ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 9px; }
.method-limits li { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.method-limits strong { color: var(--text); font-weight: 600; }

/* Live-price indicator. The dot pulses only when quotes are actually
   arriving, so "live" is never claimed on a page showing stale numbers. */
.freshness-pill.live .live-dot { animation: livePulse 2s ease-in-out infinite; }
@keyframes livePulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.45; transform: scale(0.82); }
}

/* ---------- trade progress ----------
   Answers two questions the numbers alone can't: did price ever reach the
   entry (so was there a position at all), and did it reach the target. */
.trade-progress { display: flex; gap: 5px; flex-wrap: wrap; }
.progress-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px; font-weight: 600; padding: 3px 7px;
  border-radius: 5px; white-space: nowrap;
  border: 1px solid var(--border-subtle); color: var(--text-muted);
}
.chip-mark { font-size: 10px; line-height: 1; }
.progress-chip.unmet { opacity: 0.65; }
.progress-chip.hit.hit-entry  { background: var(--accent-glow); color: var(--accent); border-color: transparent; }
.progress-chip.hit.hit-target { background: var(--green-dim);  color: var(--green);  border-color: transparent; }
.progress-chip.hit.hit-stop   { background: var(--red-dim);    color: var(--red);    border-color: transparent; }

.opp-card-returns { text-align: right; }
.opp-card-return-label { font-size: 9.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }

.trade-progress { flex-wrap: nowrap; }
.return-cell { display: flex; flex-direction: column; align-items: flex-end; gap: 1px; }
.return-main { font-size: 13.5px; font-weight: 600; }
.return-sub { font-size: 10px; color: var(--text-muted); white-space: nowrap; }

/* The banner now carries two facts, not one: the headline return (since the
   call, assuming no fill) and what happened at the entry level. */
.progress-status { display: flex; flex-direction: column; gap: 1px; }
.progress-status-main { font-weight: 600; }
.progress-status-sub { font-size: 11.5px; color: var(--text-muted); }
.detail-panel .trade-progress { margin: -6px 0 14px; }
.return-sub-closed { color: var(--text-secondary); font-weight: 600; }

/* ---------- wider opportunities table ----------
   The 1180px shell suits prose, but the table carries 13 columns and was
   being squeezed to the point of horizontal scrolling on a desktop screen.
   Only the table widens -- the hero and methodology stay at a readable
   measure, since long lines of text are harder to read, not easier. */
.opportunities-wide {
  /* Breaks out of the 1180px .shell rather than being capped by it: a
     child cannot exceed its parent's max-width, so widening has to be done
     by re-centring on the viewport. */
  width: min(1720px, calc(100vw - 48px));
  margin-left: 50%;
  transform: translateX(-50%);
}
@media (max-width: 780px) {
  /* On a phone the cards already fill the width; the break-out would just
     fight the container. */
  .opportunities-wide { width: auto; margin-left: 0; transform: none; }
}

/* Give the columns that were being crushed a little room, and stop the
   company name forcing the ticker column wide. */
.opp-table .ticker-cell-name { max-width: 190px; }
.opp-table th, .opp-table td { white-space: nowrap; }
.opp-table .col-left.spark-cell { width: 84px; }

/* Between the phone breakpoint and ~1500px the 13 columns are just wider
   than the viewport. Trim the two most compressible things -- the company
   name and cell padding -- rather than reintroducing horizontal scroll. */
@media (min-width: 781px) and (max-width: 1520px) {
  .opp-table th, .opp-table td { padding-left: 9px; padding-right: 9px; }
  .opp-table .ticker-cell-name { max-width: 120px; }
  .opp-table .col-left.spark-cell { width: 70px; }
}

/* ==========================================================================
   Multi-page site: primary nav, market strip, and every page added beyond
   the original single-page ranked list. Sticks to the existing token set
   throughout -- no new raw colors, both themes inherited for free.
   ========================================================================== */

/* ---------- primary nav ---------- */
.topnav-left { display: flex; align-items: center; gap: 28px; min-width: 0; }
.primary-nav { display: flex; align-items: center; gap: 2px; }
.primary-nav-link {
  font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none;
  padding: 7px 12px; border-radius: 999px; transition: color .15s ease, background .15s ease;
  white-space: nowrap;
}
.primary-nav-link:hover { color: var(--text); background: var(--card); }
.primary-nav-link.active { color: var(--accent-bright); background: var(--accent-glow); }
.primary-nav-mobile { display: none; }

@media (max-width: 980px) {
  .primary-nav { display: none; }
  .primary-nav-mobile {
    display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 11px;
    -ms-overflow-style: none; scrollbar-width: none;
  }
  .primary-nav-mobile::-webkit-scrollbar { display: none; }
  .primary-nav-mobile-link {
    flex-shrink: 0; font-size: 12.5px; font-weight: 600; color: var(--text-muted);
    text-decoration: none; padding: 6px 13px; border-radius: 999px;
    background: var(--card); border: 1px solid var(--border);
  }
  .primary-nav-mobile-link.active { color: white; background: var(--accent); border-color: transparent; }
}

/* ---------- market strip ---------- */
.mstrip { background: var(--bg-elevated); border-bottom: 1px solid var(--border-subtle); }
.mstrip-inner {
  max-width: 1180px; margin: 0 auto; padding: 9px 24px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  overflow-x: auto; -ms-overflow-style: none; scrollbar-width: none;
}
.mstrip-inner::-webkit-scrollbar { display: none; }
.mstrip-indexes { display: flex; align-items: center; gap: 22px; flex-shrink: 0; }
.mstrip-index { display: flex; align-items: baseline; gap: 7px; font-size: 12px; white-space: nowrap; }
.mstrip-index-label { color: var(--text-muted); font-weight: 600; }
.mstrip-index-price { font-size: 12.5px; font-weight: 600; }
.mstrip-index-chg { font-size: 11.5px; }
.mstrip-right { display: flex; align-items: center; gap: 14px; flex-shrink: 0; font-size: 12px; }
.mstrip-breadth { display: flex; gap: 8px; font-family: var(--mono); font-size: 11.5px; }
.mstrip-vix { color: var(--text-muted); }
.mstrip-regime {
  font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 3px 8px; border-radius: 999px; background: rgba(154,165,186,0.13); color: var(--text-secondary);
}
.mstrip-regime.regime-risk_on { background: var(--green-dim); color: var(--green); }
.mstrip-regime.regime-risk_off { background: var(--red-dim); color: var(--red); }

@media (max-width: 780px) {
  .mstrip-inner { padding: 8px 16px; }
  .mstrip-indexes { gap: 16px; }
}

/* ---------- section links / two-column layout ---------- */
.section-link {
  background: none; border: none; color: var(--accent-bright); font-size: 13px; font-weight: 600;
  cursor: pointer; font-family: var(--sans); padding: 4px 0; white-space: nowrap;
}
.section-link:hover { text-decoration: underline; }
.two-col { display: grid; grid-template-columns: 1.3fr 1fr; gap: 20px; align-items: start; }
@media (max-width: 980px) {
  .two-col { grid-template-columns: 1fr; }
}
.stats-row.wrap { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }

/* ---------- generic panel (movers, sectors, leaderboard/earnings previews) ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 20px; }
.panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; }
.panel-title { font-size: 14.5px; font-weight: 700; }
.panel-sub { font-size: 11.5px; color: var(--text-muted); }
.panel-empty { color: var(--text-muted); font-size: 13px; padding: 20px 4px; text-align: center; }

.mini-table { width: 100%; border-collapse: collapse; }
.mini-table tr { cursor: pointer; border-bottom: 1px solid var(--border-subtle); transition: background .12s ease; }
.mini-table tr:last-child { border-bottom: none; }
.mini-table tr:hover { background: var(--card-hover); }
.mini-table td { padding: 8px 6px; font-size: 12.5px; vertical-align: middle; }
.mini-symbol { font-family: var(--mono); font-weight: 700; width: 64px; }
.mini-name { color: var(--text-muted); max-width: 1px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-price { text-align: right; padding-right: 10px !important; }
.mini-chg { text-align: right; white-space: nowrap; }
.mini-vol { text-align: right; white-space: nowrap; font-size: 11px; }

/* ---------- sector performance ---------- */
/* The underlying data has ~30 fine-grained sector labels, not the ~11
   standard GICS buckets -- scrolling internally keeps the panel roughly
   matched to Market Movers' height in the two-column row next to it,
   rather than stretching the whole row (and the empty space beside the
   shorter panel) to fit 30 rows. */
.sector-list { display: flex; flex-direction: column; gap: 9px; max-height: 420px; overflow-y: auto; padding-right: 4px; }
.sector-row { display: grid; grid-template-columns: 120px 1fr 56px; align-items: center; gap: 10px; }
.sector-name { font-size: 12px; color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sector-track { position: relative; height: 8px; background: var(--border-subtle); border-radius: 4px; }
.sector-mid { position: absolute; left: 50%; top: -2px; width: 1px; height: 12px; background: var(--text-muted); opacity: .4; }
.sector-fill { position: absolute; top: 0; height: 100%; border-radius: 3px; }
.sector-fill.pos { background: var(--green); }
.sector-fill.neg { background: var(--red); }
.sector-val { text-align: right; font-size: 11.5px; }

/* ---------- news cards / river ---------- */
.news-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.news-river { display: flex; flex-direction: column; gap: 10px; }
.news-card {
  background: var(--card); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  padding: 13px 15px;
}
.news-card.expandable { cursor: pointer; }
.news-card.expandable:hover { border-color: var(--accent-dim); }
/* :hover never fires on a touchscreen, so :active (which does) is the only
   feedback a phone gets that the tap registered at all. */
.news-card.expandable:active { border-color: var(--accent-dim); background: var(--bg-elevated); }
.news-card-top { display: flex; align-items: center; gap: 8px; margin-bottom: 7px; flex-wrap: wrap; }
.news-chevron {
  font-size: 14px; line-height: 1; color: var(--text-muted); flex-shrink: 0;
  transition: transform .18s ease;
}
.news-card.expanded .news-chevron { transform: rotate(180deg); color: var(--accent-bright); }
.news-event-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em;
  padding: 3px 8px; border-radius: 5px; background: rgba(154,165,186,0.13); color: var(--text-secondary);
}
.news-event-badge.eg-earnings { background: var(--accent-glow); color: var(--accent-bright); }
.news-event-badge.eg-dealmaking { background: var(--green-dim); color: var(--green); }
.news-event-badge.eg-regulatory { background: var(--red-dim); color: var(--red); }
.news-event-badge.eg-analyst { background: rgba(167,139,250,0.15); color: var(--purple); }
.news-sentiment { display: inline-flex; align-items: center; font-size: 11px; color: var(--text-muted); }
.news-time { font-size: 11px; color: var(--text-muted); margin-left: auto; white-space: nowrap; }
.importance-dots { display: inline-flex; gap: 2px; }
.imp-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--border); }
.imp-dot.lit { background: var(--amber); }
.news-card .news-headline { font-size: 13.5px; font-weight: 600; margin-bottom: 7px; line-height: 1.4; }
.news-card-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.news-source { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.news-tickers { display: flex; gap: 5px; flex-wrap: wrap; }
.news-ticker-chip {
  font-family: var(--mono); font-size: 10.5px; font-weight: 700; color: var(--accent-bright);
  background: var(--accent-glow); border: none; border-radius: 5px; padding: 2px 7px; cursor: pointer;
}
.news-ticker-chip:hover { background: var(--accent-dim); }
.news-compact-summary {
  margin-top: 7px; font-size: 12px; color: var(--text-secondary); line-height: 1.5;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.news-card.compact { padding: 12px 14px; }
.news-card.compact .news-headline { font-size: 13px; }
.news-summary { margin-top: 11px; padding-top: 11px; border-top: 1px solid var(--border-subtle); font-size: 12.5px; color: var(--text-secondary); line-height: 1.6; }
.news-key-facts { margin: 8px 0 0; padding-left: 18px; }
.news-key-facts li { margin-bottom: 3px; }
.news-impact { margin-top: 10px; }
.news-risks { margin-top: 10px; }

.news-filter-bar { display: flex; flex-direction: column; gap: 10px; margin-bottom: 20px; }
.news-search {
  background: var(--card); border: 1px solid var(--border); color: var(--text); border-radius: var(--radius-sm);
  padding: 10px 14px; font-size: 13.5px; font-family: var(--sans); outline: none; width: 100%; max-width: 420px;
}
.news-search:focus { border-color: var(--accent); }
.pill-group.wrap { flex-wrap: wrap; border-radius: var(--radius-sm); }
.load-more-row { display: flex; justify-content: center; margin-top: 20px; }
.loading-inline { display: flex; align-items: center; gap: 12px; color: var(--text-muted); font-size: 13px; justify-content: center; }

/* ---------- coverage table ---------- */
.range-bar { position: relative; width: 64px; height: 5px; background: var(--border-subtle); border-radius: 3px; }
.range-bar-fill { position: absolute; top: -2px; width: 2px; height: 9px; background: var(--accent-bright); border-radius: 1px; transform: translateX(-1px); }
.pagination { display: flex; align-items: center; justify-content: center; gap: 4px; margin-top: 20px; }
.page-btn {
  min-width: 30px; height: 30px; padding: 0 8px; border-radius: var(--radius-sm); border: 1px solid var(--border);
  background: var(--card); color: var(--text-secondary); font-family: var(--mono); font-size: 12px; cursor: pointer;
}
.page-btn:hover:not(:disabled) { border-color: var(--accent); color: var(--text); }
.page-btn.active { background: var(--accent); color: white; border-color: transparent; }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-ellipsis { color: var(--text-muted); padding: 0 4px; }

/* ---------- stock page ---------- */
.stock-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.stock-header-left { display: flex; align-items: center; gap: 14px; }
.stock-symbol-row { display: flex; align-items: center; gap: 9px; }
.stock-header-right { text-align: right; }
.stock-change { font-family: var(--mono); font-size: 14px; font-weight: 600; margin-top: 2px; }

.stock-quicknav {
  display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; margin-bottom: 22px;
  border-bottom: 1px solid var(--border-subtle); -ms-overflow-style: none; scrollbar-width: none;
}
.stock-quicknav::-webkit-scrollbar { display: none; }
.stock-quicknav-btn {
  flex-shrink: 0; background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600; font-family: var(--sans);
  padding: 8px 4px; margin-bottom: -1px; cursor: pointer; white-space: nowrap;
}
.stock-quicknav-btn:hover { color: var(--text-secondary); }
.stock-quicknav-btn.active { color: var(--accent-bright); border-bottom-color: var(--accent-bright); }

.stock-stat-row { margin-bottom: 30px; }
.range-bar-large { margin-top: 12px; max-width: 360px; }
.range-bar-large-track { position: relative; height: 6px; background: var(--border-subtle); border-radius: 3px; }
.range-bar-large-fill { position: absolute; top: -3px; width: 3px; height: 12px; background: var(--accent-bright); border-radius: 2px; transform: translateX(-1.5px); }
.range-bar-large-labels { display: flex; justify-content: space-between; margin-top: 5px; font-size: 10.5px; color: var(--text-muted); }

.analyst-summary { display: flex; align-items: baseline; gap: 10px; margin-bottom: 12px; }
.analyst-consensus-label { font-size: 18px; font-weight: 700; }
.small-note { font-size: 12px; margin-top: 10px; }

.earnings-next { padding: 12px 14px; background: var(--bg-elevated); border-radius: var(--radius-sm); border: 1px solid var(--border-subtle); }
.earnings-next-date { font-size: 17px; font-weight: 700; font-family: var(--mono); }
.earnings-last { margin-top: 4px; }

.filings-list { display: flex; flex-direction: column; gap: 2px; }
.filing-row {
  display: grid; grid-template-columns: 64px 90px 1fr auto; align-items: center; gap: 12px;
  padding: 10px 6px; border-bottom: 1px solid var(--border-subtle); text-decoration: none; color: inherit;
  font-size: 12.5px; border-radius: var(--radius-sm);
}
.filing-row:last-child { border-bottom: none; }
.filing-row:hover { background: var(--card-hover); }
.filing-form { font-weight: 700; color: var(--accent-bright); }
.filing-link { color: var(--accent-bright); font-size: 11.5px; white-space: nowrap; }

.history-list { display: flex; flex-direction: column; gap: 2px; }
.history-row {
  display: flex; align-items: center; gap: 10px; padding: 9px 6px;
  border-bottom: 1px solid var(--border-subtle); font-size: 12px; flex-wrap: wrap;
}
.history-row:last-child { border-bottom: none; }
.history-date { color: var(--text-muted); white-space: nowrap; }
.history-score { color: var(--text-secondary); width: 28px; }
.history-tags { display: flex; gap: 4px; flex-wrap: wrap; }
.history-levels { color: var(--text-secondary); white-space: nowrap; }
.history-reason { color: var(--text-muted); flex: 1; min-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 780px) {
  .stock-header { flex-direction: column; }
  .stock-header-right { text-align: left; }
  .filing-row { grid-template-columns: 1fr; gap: 4px; }
  .history-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  /* In column direction, a nowrap/ellipsis item stops stretching to the
     row's width and grows to its full unwrapped text width instead --
     that's what was pushing the whole page into horizontal overflow. */
  .history-reason {
    white-space: normal; overflow: visible; text-overflow: clip;
    min-width: 0; width: 100%;
  }
}

/* ---------- performance page ---------- */
.track-record.compact { padding: 22px 24px; }
.methodology.open-static { border-top: none; margin-top: 0; padding-top: 0; }
