/* ==========================================================================
   Stock Analysis — shared theme
   A dark, finance/market-terminal aesthetic shared by index.html and
   dashboard.html. Chart-facing colors (categorical, status, ink) are the
   validated dataviz palette; only decorative chrome (page plane, glow,
   grid texture) is custom-tinted toward a market-terminal navy.
   ========================================================================== */

:root {
  color-scheme: dark;

  /* RGB triplets for translucent overlays/shadows, so they can flip with the theme */
  --ov: 255, 255, 255;
  --surface-3: #14151a;
  --shade: 0, 0, 0;

  /* Decorative page chrome (not used for data encoding) */
  --page-plane: #05060a;
  --page-plane-2: #0a0e18;
  --grid-line: rgba(90, 130, 190, 0.07);

  /* Validated dataviz surfaces/ink (dark mode) */
  --surface-1: #1a1a19;
  --surface-2: #202024;
  --text-primary: #ffffff;
  --text-secondary: #c3c2b7;
  --text-muted: #898781;
  --hairline: rgba(var(--ov), 0.10);
  --gridline-chart: #2c2c2a;
  --baseline: #383835;

  /* Panel identity colors — fixed by entity (S&P vs Nasdaq), never by rank */
  --sp-color: #3987e5;      /* categorical slot 1, dark */
  --sp-color-soft: rgba(57, 135, 229, 0.14);
  --ndx-color: #d95926;     /* categorical slot 2, dark */
  --ndx-color-soft: rgba(217, 89, 38, 0.14);

  /* Status (fixed, never themed) */
  --good: #0ca30c;
  --critical: #e66767;

  --font-ui: system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;

  --radius: 14px;
  --shadow-card: 0 1px 0 rgba(var(--ov), 0.04) inset, 0 12px 30px rgba(var(--shade), 0.55);
  --shadow-card-hover: 0 1px 0 rgba(var(--ov), 0.06) inset, 0 20px 44px rgba(var(--shade), 0.65);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--page-plane);
  color: var(--text-primary);
  font-family: var(--font-ui);
}

body {
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 1200px 600px at 15% -10%, rgba(57,135,229,0.10), transparent 60%),
    radial-gradient(ellipse 900px 500px at 100% 0%, rgba(217,89,38,0.08), transparent 55%),
    repeating-linear-gradient(0deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(90deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px),
    linear-gradient(180deg, var(--page-plane-2), var(--page-plane) 340px);
  background-attachment: fixed;
}

a { color: inherit; }

/* ---------------- Nav bar ---------------- */

.site-nav {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 28px;
  background: rgba(9, 11, 18, 0.78);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  border-bottom: 1px solid var(--hairline);
}

.site-nav__brand {
  display: flex;
  align-items: baseline;
  gap: 10px;
  font-weight: 700;
  letter-spacing: 0.01em;
  text-decoration: none;
  font-size: 16px;
}

.site-nav__brand .dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 10px rgba(12,163,12,0.9);
  display: inline-block;
}

.site-nav__brand small {
  color: var(--text-muted);
  font-weight: 500;
  font-size: 12px;
}

.site-nav__links {
  display: flex;
  gap: 4px;
}

.site-nav__links a {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 999px;
  transition: color .15s ease, background .15s ease;
}

.site-nav__links a:hover { color: var(--text-primary); background: rgba(var(--ov), 0.06); }
.site-nav__links a.active {
  color: var(--text-primary);
  background: rgba(var(--ov), 0.10);
  box-shadow: 0 0 0 1px var(--hairline) inset;
}

/* ---------------- Ticker tape ---------------- */

.ticker-tape {
  overflow: hidden;
  border-bottom: 1px solid var(--hairline);
  background: linear-gradient(180deg, rgba(var(--ov), 0.03), transparent);
  white-space: nowrap;
  position: relative;
}
.ticker-tape::before, .ticker-tape::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 60px;
  z-index: 2;
  pointer-events: none;
}
.ticker-tape::before { left: 0; background: linear-gradient(90deg, var(--page-plane), transparent); }
.ticker-tape::after { right: 0; background: linear-gradient(270deg, var(--page-plane), transparent); }

.ticker-tape__track {
  display: inline-flex;
  gap: 28px;
  padding: 9px 0;
  animation: tape-scroll 90s linear infinite;
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.ticker-tape:hover .ticker-tape__track { animation-play-state: paused; }

.ticker-tape__item { color: var(--text-secondary); cursor: pointer; text-decoration: none; transition: opacity .12s ease; }
.ticker-tape__item:hover { opacity: 0.65; text-decoration: underline; }
.ticker-tape__item b { color: var(--text-primary); margin-right: 6px; }
.ticker-tape__item.up { color: var(--good); }
.ticker-tape__item.down { color: var(--critical); }

@keyframes tape-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}

/* ---------------- Layout ---------------- */

.page {
  max-width: 1360px;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.page-head { margin-bottom: 28px; }
.page-head h1 {
  font-size: 30px;
  margin: 0 0 8px;
  letter-spacing: -0.01em;
}
.page-head p {
  color: var(--text-secondary);
  max-width: 760px;
  line-height: 1.55;
  margin: 0;
}

/* ---------------- Cards (3D-ish depth) ---------------- */

.card {
  background: var(--surface-1);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
  border: 1px solid var(--hairline);
  transform: translateZ(0);
  transition: transform .22s cubic-bezier(.2,.8,.2,1), box-shadow .22s ease, border-color .22s ease;
}
/* ---------------- Filter bar ---------------- */

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  padding: 18px 22px;
  margin-bottom: 26px;
}

.filter-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 150px;
}
.filter-field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  font-weight: 600;
}

.filter-field select,
.filter-field input[type="text"],
.filter-field input[type="search"] {
  background: rgba(var(--ov), 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 9px 11px;
  font-size: 13.5px;
  font-family: var(--font-ui);
  min-width: 160px;
}
.filter-field select:focus,
.filter-field input:focus {
  outline: none;
  border-color: rgba(57,135,229,0.65);
  box-shadow: 0 0 0 3px rgba(57,135,229,0.18);
}

/* The dropdown's own option list is browser-chrome, not styled by the
   select's background — without this, options can render unreadable
   (e.g. light text on a light system background) until hovered. */
.filter-field select option {
  background: var(--surface-3);
  color: var(--text-primary);
}

.reset-btn {
  margin-left: auto;
  background: rgba(var(--ov), 0.05);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, transform .15s ease;
}
.reset-btn:hover { background: rgba(var(--ov), 0.10); transform: translateY(-1px); }
.reset-btn:active { transform: translateY(0); }

/* ---------------- Dashboard tabs ---------------- */

.dash-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 22px;
}
.dash-tab {
  background: rgba(var(--ov), 0.03);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  border-radius: 10px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.dash-tab:hover { color: var(--text-primary); background: rgba(var(--ov), 0.06); }
.dash-tab.active {
  color: var(--text-primary);
  background: rgba(57,135,229,0.14);
  border-color: rgba(57,135,229,0.45);
}
.dash-view { display: none; }
.dash-view.active { display: block; }

/* A 2-up chart row for the Overview tab's combined charts */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: start;
  gap: 18px;
}
@media (max-width: 900px) { .chart-row { grid-template-columns: 1fr; } }

/* Stat tiles */
.stat-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}
@media (max-width: 640px) { .stat-row { grid-template-columns: repeat(2, 1fr); } }

.stat-tile {
  background: rgba(var(--ov), 0.03);
  border: 1px solid var(--hairline);
  border-radius: 10px;
  padding: 12px 13px;
}
.stat-tile .label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.stat-tile .value {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 19px;
  font-weight: 700;
}
.stat-tile .value.up { color: var(--good); text-shadow: 0 0 14px rgba(12,163,12,0.35); }
.stat-tile .value.down { color: var(--critical); text-shadow: 0 0 14px rgba(230,103,103,0.35); }

/* Trading-terminal-style flash when a stat tile's number changes */
@keyframes flash-up-anim {
  0% { background: rgba(12,163,12,0.4); border-color: rgba(12,163,12,0.6); }
  100% { background: transparent; border-color: var(--hairline); }
}
@keyframes flash-down-anim {
  0% { background: rgba(230,103,103,0.4); border-color: rgba(230,103,103,0.6); }
  100% { background: transparent; border-color: var(--hairline); }
}
.stat-tile.flash-up { animation: flash-up-anim 1000ms ease-out; }
.stat-tile.flash-down { animation: flash-down-anim 1000ms ease-out; }

/* Chart cards inside a panel */
.chart-card {
  background: rgba(var(--ov), 0.025);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 16px 8px;
  margin-bottom: 14px;
}
.chart-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.chart-card__title { font-size: 13px; font-weight: 700; color: var(--text-secondary); }
.chart-card__hint { font-size: 11px; color: var(--text-muted); }
.chart-card canvas { max-width: 100%; }

/* Ranked lists (replaces a bar/scatter chart with a compact leaderboard) */
.rank-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 700px) { .rank-columns { grid-template-columns: 1fr; } }

.rank-col__head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 6px;
}
.rank-col__head .dot { width: 8px; height: 8px; border-radius: 50%; }
.rank-col--sp .dot { background: var(--sp-color); }
.rank-col--ndx .dot { background: var(--ndx-color); }

.rank-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 4px;
  cursor: pointer;
  border-bottom: 1px solid rgba(var(--ov), 0.045);
  transition: background .12s ease;
}
.rank-row:hover { background: rgba(var(--ov), 0.05); }
.rank-row .rank-num {
  width: 18px; flex-shrink: 0;
  font-family: var(--font-mono); font-size: 11px; color: var(--text-muted); text-align: right;
}
.rank-row .rank-name { width: 128px; flex-shrink: 0; min-width: 0; }
.rank-row .rank-name .t { font-family: var(--font-mono); font-weight: 700; font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rank-row .rank-name .c { font-size: 10.5px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: block; }
.rank-row .rank-bars { flex: 1; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.rank-row .mini-bar-track { position: relative; height: 7px; background: rgba(var(--ov), 0.06); border-radius: 4px; overflow: hidden; }
.rank-row .mini-bar-fill { position: absolute; top:0; left:0; bottom:0; border-radius: 4px; }
.rank-row .rank-value { width: 62px; flex-shrink: 0; text-align: right; font-family: var(--font-mono); font-size: 11.5px; }

/* Compact chip cloud (Sector Composition) */
.chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  cursor: pointer;
  background: rgba(var(--ov), 0.045);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  transition: background .12s ease, border-color .12s ease;
  white-space: nowrap;
}
.chip:hover { background: rgba(var(--ov), 0.09); }
.chip b { color: var(--text-primary); font-family: var(--font-mono); font-weight: 700; }
.rank-col--sp .chip { border-color: rgba(57,135,229,0.28); }
.rank-col--ndx .chip { border-color: rgba(217,89,38,0.28); }

/* Compact single-line comparison (Top 25 vs Full Pool) */
.compare-compact { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; }
.compare-compact .seg {
  color: var(--text-secondary);
  padding: 3px 10px;
  border-radius: 999px;
  border: 1px solid var(--hairline);
  cursor: pointer;
}
.compare-compact .seg b { font-family: var(--font-mono); color: var(--text-primary); margin-left: 5px; }
.compare-compact .mult {
  font-family: var(--font-mono); font-weight: 700; font-size: 11.5px;
  padding: 2px 8px; border-radius: 999px;
  background: rgba(12,163,12,0.14); color: var(--good);
}

/* Data table */
.data-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid var(--hairline);
  border-radius: 12px;
}
table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
}
.data-table thead th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  text-align: left;
  padding: 9px 10px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}
.data-table thead th:hover { color: var(--text-primary); }
.data-table tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(var(--ov), 0.045);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.data-table tbody td.company-cell { font-family: var(--font-ui); font-variant-numeric: normal; }
.data-table tbody tr { cursor: pointer; transition: background .12s ease; }
.data-table tbody tr:hover { background: rgba(var(--ov), 0.05); }
.data-table td.up { color: var(--good); }
.data-table td.down { color: var(--critical); }
.ticker-link { font-weight: 700; color: var(--text-primary); }

/* ---------------- Stock Explorer tab ---------------- */

.explorer-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 20px;
  align-items: start;
}
@media (max-width: 860px) { .explorer-layout { grid-template-columns: 1fr; } }

.index-toggle {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
}
.index-toggle button {
  flex: 1;
  background: rgba(var(--ov), 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
}
.index-toggle button.active.sp { background: var(--sp-color-soft); color: var(--sp-color); border-color: rgba(57,135,229,0.5); }
.index-toggle button.active.ndx { background: var(--ndx-color-soft); color: var(--ndx-color); border-color: rgba(217,89,38,0.5); }

.symbol-search {
  width: 100%;
  background: rgba(var(--ov), 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  margin-bottom: 10px;
}

.symbol-list {
  max-height: 560px;
  overflow-y: auto;
  border: 1px solid var(--hairline);
  border-radius: 10px;
}
.symbol-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 12px;
  cursor: pointer;
  border-bottom: 1px solid rgba(var(--ov), 0.045);
  transition: background .12s ease;
}
.symbol-row:hover { background: rgba(var(--ov), 0.05); }
.symbol-row.selected { background: rgba(57,135,229,0.14); }
.symbol-row .t { font-family: var(--font-mono); font-weight: 700; font-size: 13px; }
.symbol-row .c { font-size: 11px; color: var(--text-muted); }
.symbol-row .r { font-family: var(--font-mono); font-size: 12px; }

.range-toggle {
  display: flex;
  gap: 6px;
}
.range-toggle button {
  background: rgba(var(--ov), 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-secondary);
  border-radius: 7px;
  padding: 5px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
}
.range-toggle button.active { background: rgba(var(--ov), 0.14); color: var(--text-primary); }

.compare-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.compare-row input {
  flex: 1;
  background: rgba(var(--ov), 0.04);
  border: 1px solid var(--hairline);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 7px 10px;
  font-size: 12.5px;
}
.compare-row button {
  background: rgba(230,103,103,0.12);
  border: 1px solid rgba(230,103,103,0.35);
  color: var(--critical);
  border-radius: 8px;
  padding: 7px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.compare-row button:hover { background: rgba(230,103,103,0.2); }

.overlay-head {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 4px;
  padding-right: 40px;
}
.overlay-head .ticker { font-size: 26px; font-weight: 800; font-family: var(--font-mono); }
.overlay-head .company { font-size: 15px; color: var(--text-secondary); }
.overlay-sub { color: var(--text-muted); font-size: 12.5px; margin-bottom: 18px; }
.overlay-sub .pill {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}
.overlay-sub .pill.sp { background: var(--sp-color-soft); color: var(--sp-color); }
.overlay-sub .pill.ndx { background: var(--ndx-color-soft); color: var(--ndx-color); }

.overlay-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}
@media (max-width: 640px) { .overlay-stats { grid-template-columns: repeat(2, 1fr); } }

.overlay-chart {
  background: rgba(var(--ov), 0.025);
  border: 1px solid var(--hairline);
  border-radius: 12px;
  padding: 14px 16px 6px;
  margin-bottom: 18px;
}

.moves-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}
@media (max-width: 640px) { .moves-grid { grid-template-columns: 1fr; } }

.moves-col h4 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0 0 8px;
}
.moves-list { list-style: none; margin: 0; padding: 0; }
.moves-list li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(var(--ov), 0.05);
  font-family: var(--font-mono);
  font-size: 12.5px;
}
.moves-list li span:first-child { color: var(--text-secondary); }

/* Chart.js tooltip container override target */
.chartjs-tooltip-key { display:inline-block; width:8px; height:2px; margin-right:6px; vertical-align:middle; }

/* Loading state */
.loading-banner {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 13.5px;
}
.spinner {
  width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(var(--ov), 0.15);
  border-top-color: var(--sp-color);
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

footer.site-footer {
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
  padding: 30px 0 10px;
}

/* ==========================================================================
   Light theme (opt-in via the report page's theme toggle; dark stays the default)
   ========================================================================== */

:root[data-theme="light"] {
  color-scheme: light;
  --ov: 20, 30, 60;
  --surface-3: #eef0f6;
  --shade: 20, 30, 60;

  --page-plane: #f5f6fa;
  --page-plane-2: #ffffff;
  --grid-line: rgba(30, 60, 120, 0.06);

  --surface-1: #ffffff;
  --surface-2: #f0f2f7;
  --text-primary: #12141c;
  --text-secondary: #424859;
  --text-muted: #6a7082;
  --hairline: rgba(20, 30, 60, 0.14);
  --gridline-chart: #e3e6ee;
  --baseline: #c9cedb;

  --sp-color: #1f6fd1;
  --sp-color-soft: rgba(31, 111, 209, 0.12);
  --ndx-color: #c24a15;
  --ndx-color-soft: rgba(194, 74, 21, 0.12);
  --good: #0a8a0a;
  --critical: #d03a3a;

  --shadow-card: 0 1px 0 rgba(255,255,255,0.7) inset, 0 8px 24px rgba(20,30,60,0.10);
  --shadow-card-hover: 0 1px 0 rgba(255,255,255,0.8) inset, 0 14px 34px rgba(20,30,60,0.16);
}
:root[data-theme="light"] .site-nav { background: rgba(255, 255, 255, 0.82); }
:root[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 1200px 600px at 15% -10%, rgba(31,111,209,0.08), transparent 60%),
    radial-gradient(ellipse 900px 500px at 100% 0%, rgba(194,74,21,0.06), transparent 55%),
    repeating-linear-gradient(0deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px),
    repeating-linear-gradient(90deg, var(--grid-line) 0, var(--grid-line) 1px, transparent 1px, transparent 64px),
    linear-gradient(180deg, var(--page-plane-2), var(--page-plane) 340px);
}

/* ---------------- Theme toggle (shared by the report and the dashboard) ---------------- */
.site-nav__links { display: flex; align-items: center; }
.theme-toggle {
  margin-left: 6px; width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--hairline); cursor: pointer;
  background: rgba(var(--ov), 0.06); color: var(--text-primary);
  font-size: 16px; line-height: 1; transition: background .15s, transform .25s;
}
.theme-toggle:hover { background: rgba(var(--ov), 0.14); transform: rotate(20deg); }

/* ---------------- Calculator tab (dashboard) ---------------- */
.calc { padding: 22px 24px; border-radius: 14px; border: 1px solid var(--hairline);
  background: linear-gradient(135deg, rgba(57,135,229,0.10), rgba(217,89,38,0.08)); }
.calc__title { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.calc__sub { margin: 0 0 16px; font-size: 13px; color: var(--text-secondary); max-width: 760px; line-height: 1.5; }
.calc__controls { display: flex; flex-wrap: wrap; gap: 18px 28px; align-items: flex-end; margin-bottom: 18px; }
.calc__controls label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--text-muted); }
.calc__controls input[type=text], .calc__controls select { font: 700 15px var(--font-mono); color: var(--text-primary); background: rgba(var(--shade), 0.35);
  border: 1px solid var(--hairline); border-radius: 8px; padding: 8px 10px; min-width: 150px; }
.calc__money { display: flex; align-items: center; gap: 4px; } .calc__money b { font-family: var(--font-mono); }
.calc__date { font-family: var(--font-mono); color: var(--text-primary); font-weight: 700; }
.calc__controls input[type=range] { width: 260px; accent-color: var(--sp-color); }
.calc__out { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.calc__card { padding: 14px 16px; border-radius: 10px; background: rgba(var(--shade), 0.30); border: 1px solid var(--hairline); border-top: 3px solid var(--c); }
.calc__label { font-size: 11.5px; color: var(--text-secondary); margin-bottom: 6px; }
.calc__value { font-family: var(--font-mono); font-size: 24px; font-weight: 800; }
.calc__gain { font-family: var(--font-mono); font-size: 12.5px; margin-top: 4px; }
.calc__gain.up { color: var(--good); } .calc__gain.down { color: var(--critical); }
.calc .calc__note { margin: 16px 0 0; font-size: 12px; color: var(--text-muted); max-width: none; }
:root[data-theme="light"] .calc__controls input[type=text], :root[data-theme="light"] .calc__controls select { background: #fff; color: var(--text-primary); }
:root[data-theme="light"] .calc__card { background: rgba(255,255,255,0.7); }

/* Calculator additions: any-stock search, "worst pick" cards, growth chart */
.calc__controls input[list] { text-transform: uppercase; }
.calc__controls input[list]::placeholder { text-transform: none; font-weight: 400; }
.calc__msg { min-height: 14px; font-size: 11px; color: var(--critical); }
.calc__msg.info { color: var(--text-muted); }
.calc__chart { margin-top: 20px; padding: 16px 18px; border-radius: 12px; border: 1px solid var(--hairline); background: rgba(var(--shade), 0.18); }
.calc__chart-title { font-size: 12.5px; font-weight: 700; color: var(--text-secondary); margin-bottom: 10px; }
.calc__chart-box { position: relative; height: 320px; }
:root[data-theme="light"] .calc__chart { background: rgba(255,255,255,0.55); }
@media (max-width: 640px) { .calc__chart-box { height: 260px; } }
.calc__worst { margin-top: 20px; }
.calc__worst-title { font-size: 14px; font-weight: 800; margin-bottom: 4px; }
.calc__worst-sub { margin: 0 0 12px; font-size: 12.5px; color: var(--text-secondary); max-width: 760px; line-height: 1.5; }
.calc__card--worst { border-top-color: var(--critical); }
.calc__worst[hidden] { display: none; }
.calc__worst .calc__out { grid-template-columns: repeat(auto-fit, minmax(230px, 340px)); }
