/* ═══════════════════════════════════════════════════════════════
   SymbolQuant — Enterprise Dark Theme
   Finviz-inspired professional financial data UI
   ═══════════════════════════════════════════════════════════════ */

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design Tokens ──────────────────────────────────────────── */
:root {
  /* Page */
  --bg:          #0e1117;
  --surface:     #161b22;
  --surface-2:   #21262d;
  --surface-3:   #2d333b;
  --border:      #30363d;
  --border-lt:   #3d444d;
  --border-dk:   #21262d;

  /* Text */
  --text:        #e6edf3;
  --text-2:      #8b949e;
  --text-3:      #6e7681;
  --text-inv:    #ffffff;

  /* Semantic */
  --green:       #3fb950;
  --green-dim:   #238636;
  --green-bg:    #0d1f12;
  --red:         #f85149;
  --red-dim:     #b91c1c;
  --red-bg:      #1f0d0d;
  --blue:        #58a6ff;
  --blue-dim:    #1f6feb;
  --blue-bg:     #0d1f36;
  --yellow:      #e3b341;
  --orange:      #f0883e;
  --teal:        #39d0d8;
  --teal-dk:     #22b8c0;

  /* Navigation */
  --nav-bg:      #010409;
  --nav-border:  #21262d;
  --topbar-h:    42px;

  /* Heatmap palette */
  --hm-dn4:  #7f1d1d;
  --hm-dn3:  #991b1b;
  --hm-dn2:  #b91c1c;
  --hm-dn1:  #dc2626;
  --hm-neu:  #2d333b;
  --hm-up1:  #14532d;
  --hm-up2:  #15803d;
  --hm-up3:  #16a34a;
  --hm-up4:  #22c55e;

  font-family: -apple-system, 'Segoe UI', 'Helvetica Neue', Arial, sans-serif;
  font-size: 13px;
  font-weight: 400;
  line-height: 1.5;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}

html, body { min-height: 100%; background: var(--bg); }
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font: inherit; border: none; background: none; }
input, select { font: inherit; }

* { scrollbar-width: thin; scrollbar-color: #3d444d transparent; }
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #3d444d; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #484f58; }

/* ═══════════════════════════════════════════════════════════════
   TOPBAR
   ═══════════════════════════════════════════════════════════════ */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--topbar-h);
  background: var(--nav-bg);
  border-bottom: 1px solid var(--nav-border);
  display: flex; align-items: center; gap: 0; padding: 0 14px;
}

/* ── Brand wordmark ──
   The logo IS the wordmark: Σ as the styled first letter of "ΣymbolQuant".
   This way the brand-mark flows seamlessly into the rest of the name instead
   of sitting in a separate square container next to it. */
.topbar-logo {
  display: inline-flex;
  align-items: center;
  gap: 0;
  text-decoration: none;
  flex-shrink: 0;
  margin-right: 12px;
  height: 100%;
  padding: 0 4px 0 2px;
}
.topbar-logo:hover { text-decoration: none; }
.topbar-logo:hover .brand-mark { transform: translateY(-1px); }

/* The Σ — sized as a small-caps lead-in, gradient-filled to anchor the brand */
.brand-mark {
  font-family: 'Cambria Math', 'Latin Modern Math', 'STIX Two Math',
               -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  font-size: 23px;
  font-weight: 900;
  line-height: 1;
  background: linear-gradient(135deg, #39d0d8 0%, #2997e9 50%, #1f6feb 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  letter-spacing: -0.5px;
  margin-right: 1px;
  display: inline-block;
  position: relative;
  top: 1px;                /* nudge so Σ baseline aligns with the wordmark */
  transition: transform 0.18s ease;
  text-shadow: none;
}

/* Rest of the wordmark — the "ymbol" + "Quant" half */
.logo-word {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -0.25px;
  white-space: nowrap;
  line-height: 1;
}
.logo-word em {
  font-style: normal;
  color: var(--teal);
  font-weight: 800;
}

/* Hide any legacy mark renderings so cached pages don't render a duplicate */
.logo-mark-svg,
.logo-sq,
.logo-mark { display: none !important; }
.logo-plain { color: var(--text-2); font-weight: 400; }

/* Nav links */
.topbar-nav {
  display: flex; align-items: center; gap: 0;
  flex-shrink: 0; margin-right: 12px;
}
.tn, .tn-link {
  display: inline-flex; align-items: center;
  padding: 0 10px; height: var(--topbar-h);
  font-size: 12px; font-weight: 600; letter-spacing: 0.2px;
  color: var(--text-2); text-decoration: none;
  border-bottom: 2px solid transparent;
  transition: color 0.12s, border-color 0.12s;
  white-space: nowrap;
}
.tn:hover, .tn-link:hover { color: var(--text); text-decoration: none; }
.tn.active, .tn-link.active { color: var(--text); border-bottom-color: var(--teal); }
.tn.tn-dim, .tn-link.tn-dim { color: var(--text-3); }
.tn.tn-dim:hover { color: var(--text-2); }

/* Topbar search */
.topbar-search, .search-wrap {
  position: relative; flex: 1; max-width: 380px; margin-left: auto;
}
.topbar-search input, .search-wrap input {
  width: 100%; padding: 6px 10px 6px 28px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); font-size: 12px; font-family: inherit;
  outline: none; border-radius: 4px; transition: border-color 0.12s;
}
.topbar-search input::placeholder, .search-wrap input::placeholder { color: var(--text-3); }
.topbar-search input:focus, .search-wrap input:focus {
  border-color: var(--blue-dim); background: var(--surface-3);
}
.tsearch-icon, .search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); font-size: 13px; pointer-events: none;
}

/* Search dropdown */
.search-dropdown {
  display: none; position: absolute; top: calc(100% + 3px); left: 0; right: 0; z-index: 1000;
  background: var(--surface); border: 1px solid var(--border-lt);
  max-height: 340px; overflow-y: auto;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
  border-radius: 4px;
}
.search-dropdown.open { display: block; }
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
  cursor: pointer; font-size: 12px;
}
.search-result:hover, .search-result.selected { background: var(--surface-2); }
.search-result:last-child { border-bottom: none; }
.ticker-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.5px;
  color: #fff; background: var(--blue-dim);
  padding: 2px 6px; min-width: 44px; text-align: center;
  flex-shrink: 0; border-radius: 2px;
}
.company-name { color: var(--text); flex: 1; font-size: 12px; }
.cik-label { color: var(--text-3); font-size: 10px; flex-shrink: 0; }

/* Spinner */
.spinner {
  display: inline-block; width: 16px; height: 16px;
  border: 2px solid var(--border-lt); border-top-color: var(--blue);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════════════
   HOME PAGE — NEW LAYOUT
   ═══════════════════════════════════════════════════════════════ */
.page-home { padding-top: var(--topbar-h); background: var(--bg); }
.home-main { }

/* ── Index Charts Row ── */
.idx-charts-row {
  display: flex; gap: 0;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.idx-card {
  flex: 1; min-width: 180px;
  padding: 10px 14px 8px;
  border-right: 1px solid var(--border);
  position: relative;
  cursor: default;
  transition: background 0.12s;
}
.idx-card:last-child { border-right: none; }
.idx-card:hover { background: var(--surface); }
.idx-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 2px;
}
.idx-name {
  font-size: 11px; font-weight: 700; color: var(--text-2);
  text-transform: uppercase; letter-spacing: 0.4px;
}
.idx-date { font-size: 10px; color: var(--text-3); }
.idx-nums {
  display: flex; align-items: baseline; gap: 8px;
  margin-bottom: 4px;
}
.idx-price {
  font-size: 16px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}
.idx-chg {
  font-size: 12px; font-weight: 600;
}
.idx-card.up .idx-chg { color: var(--green); }
.idx-card.dn .idx-chg { color: var(--red); }
.idx-canvas {
  display: block; width: 100%; height: 56px;
  margin-top: 2px;
}

/* ── Breadth Bar ── */
.breadth-bar {
  display: flex; align-items: center; gap: 0;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 6px 14px;
  font-size: 12px; flex-wrap: wrap;
}
.breadth-stat {
  display: flex; align-items: center; gap: 6px;
  padding: 0 14px 0 0;
}
.breadth-divider {
  width: 1px; height: 20px; background: var(--border);
  margin: 0 14px 0 0; flex-shrink: 0;
}
.bstat-label { color: var(--text-2); font-size: 11px; }
.bstat-val { font-weight: 700; font-size: 13px; }
.bstat-green { color: var(--green); }
.bstat-red   { color: var(--red); }
.bstat-bar-wrap {
  width: 80px; height: 6px; background: var(--red-dim);
  border-radius: 3px; overflow: hidden;
}
.bstat-bar-fill {
  height: 100%; background: var(--green-dim);
  border-radius: 3px; transition: width 0.4s;
}
.bstat-sentiment { gap: 6px; }
.bstat-sent-label { font-weight: 700; font-size: 12px; color: var(--text-2); }

/* ── 2-column home layout ── */
.home-cols {
  display: grid;
  grid-template-columns: 1fr 420px;
  min-height: 700px;
  gap: 0;
  border-bottom: 1px solid var(--border);
}
.home-left {
  border-right: 1px solid var(--border);
  overflow: hidden;
}
.home-right {
  display: flex; flex-direction: column;
  background: var(--bg);
  min-height: 600px;
}

/* ── Movers tables ── */
.movers-row {
  display: grid; grid-template-columns: 1fr 1fr;
  border-bottom: 1px solid var(--border);
}
.movers-row-2 { border-bottom: 1px solid var(--border); }
.mover-panel {
  border-right: 1px solid var(--border);
}
.mover-panel:last-child { border-right: none; }
.mp-hd {
  display: flex; align-items: baseline; gap: 8px;
  padding: 7px 10px 5px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.mp-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.2px;
  color: var(--text);
}
.mp-title.up { color: var(--green); }
.mp-title.dn { color: var(--red); }
.mp-sub { font-size: 10px; color: var(--text-3); }

/* Movers table */
.mp-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
}
.mp-table thead th {
  padding: 4px 8px; text-align: right;
  font-size: 10px; font-weight: 600; color: var(--text-3);
  background: var(--surface); border-bottom: 1px solid var(--border);
  white-space: nowrap;
}
.mp-table thead th.mpt-l { text-align: left; }
.mp-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.mp-table tbody tr:last-child { border-bottom: none; }
.mp-table tbody tr:hover { background: var(--surface-2); }
.mp-table td {
  padding: 5px 8px; text-align: right;
  color: var(--text); white-space: nowrap;
}
.mp-table td.mpt-l { text-align: left; }
.mp-table td a {
  color: var(--blue); font-weight: 700; font-size: 12px;
}
.mp-table td a:hover { text-decoration: underline; }
.mp-table td .mpt-name {
  display: block; font-size: 10px; color: var(--text-3);
  margin-top: 1px;
}
.mp-table td.mpt-green { color: var(--green); font-weight: 600; }
.mp-table td.mpt-red   { color: var(--red);   font-weight: 600; }
.mpt-signal {
  display: inline-block; font-size: 10px; font-weight: 600;
  padding: 1px 5px; border-radius: 2px; white-space: nowrap;
}
.mpt-signal.up { background: var(--green-bg); color: var(--green); }
.mpt-signal.dn { background: var(--red-bg);   color: var(--red); }
.mp-loading { padding: 12px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ── News section ── */
.news-section {
  padding: 0;
}
.ns-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 10px 5px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.ns-title { font-size: 12px; font-weight: 700; color: var(--text); }
.ns-sub { font-size: 10px; color: var(--text-3); }
.news-list { padding: 0; }
.news-item {
  padding: 9px 12px 8px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.news-item:last-child { border-bottom: none; }
.news-item:hover { background: var(--surface); }
.news-item a {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text); line-height: 1.4; margin-bottom: 3px;
}
.news-item a:hover { color: var(--blue); text-decoration: none; }
.news-meta {
  display: flex; gap: 8px; font-size: 10px; color: var(--text-3);
}
.news-src { color: var(--text-2); font-weight: 600; }
.news-loading { padding: 16px; text-align: center; color: var(--text-3); font-size: 12px; }

/* ── Heatmap card (right column) ── */
.heatmap-card {
  flex: 1; display: flex; flex-direction: column;
  height: 100%;
}
.hm-card-hd {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 8px 10px 6px;
}
.hm-controls-row {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-bottom: 6px;
}

/* Kind / TF button groups (used on both home & old heatmap header) */
.hm-kind-group, .hm-tf-group {
  display: flex; border: 1px solid var(--border); border-radius: 3px;
  overflow: hidden;
}
.hm-kind-btn, .hm-tf-btn {
  padding: 4px 9px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border-right: 1px solid var(--border);
  transition: color 0.1s, background 0.1s;
}
.hm-kind-btn:last-child, .hm-tf-btn:last-child { border-right: none; }
.hm-kind-btn:hover, .hm-tf-btn:hover { color: var(--text); background: var(--surface-3); }
.hm-kind-btn.active, .hm-tf-btn.active {
  color: var(--text-inv); background: var(--blue-dim);
}
.hm-tf-label { font-size: 10px; color: var(--text-3); display: none; }
.hm-etf-select {
  padding: 3px 6px; font-size: 11px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 3px; outline: none; max-width: 130px;
}

/* ETF badge */
.hm-etf-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 10px; color: var(--text-3); margin-bottom: 4px;
}
.hm-badge-dot {
  width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0;
}
.hm-badge-dot.live   { background: var(--green); }
.hm-badge-dot.static { background: var(--text-3); }

/* Legend */
.hm-legend {
  display: flex; gap: 6px; align-items: center;
}
.hml {
  padding: 2px 7px; border-radius: 2px; font-size: 10px;
  font-weight: 600; color: #fff;
}
.hml.dn4 { background: var(--hm-dn4); }
.hml.dn3 { background: var(--hm-dn3); }
.hml.dn2 { background: var(--hm-dn2); }
.hml.dn1 { background: var(--hm-dn1); }
.hml.neu { background: var(--hm-neu); color: var(--text-2); }
.hml.up1 { background: var(--hm-up1); }
.hml.up2 { background: var(--hm-up2); }
.hml.up3 { background: var(--hm-up3); }
.hml.up4 { background: var(--hm-up4); }

/* Old legend classes */
.hm-leg { padding: 2px 7px; border-radius: 2px; font-size: 10px; font-weight: 600; color: #fff; }
.hm-leg-dn3 { background: var(--hm-dn3); }
.hm-leg-dn1 { background: var(--hm-dn1); }
.hm-leg-neu { background: var(--hm-neu); color: var(--text-2); }
.hm-leg-up1 { background: var(--hm-up2); }
.hm-leg-up3 { background: var(--hm-up4); }

/* Heatmap board */
.heatmap-board-wrap {
  flex: 1; position: relative; overflow: hidden;
  background: var(--bg); min-height: 340px;
}
#heatmapBoard {
  position: absolute; inset: 0;
}
.hm-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; height: 100%; color: var(--text-3); font-size: 13px;
}

/* Heatmap tiles */
.hm-sector-group {
  position: absolute; box-sizing: border-box;
  border: 1px solid rgba(255,255,255,0.06);
}
.hm-sector-label {
  position: absolute; top: 0; left: 0; right: 0;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.6);
  text-transform: uppercase; letter-spacing: 0.4px;
  padding: 2px 5px; background: rgba(0,0,0,0.3);
  pointer-events: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis;
}
.hm-tile {
  position: absolute; box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.25);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer;
  transition: filter 0.12s, border-color 0.12s;
  border-radius: 1px;
}
.hm-tile:hover { border-color: rgba(255,255,255,0.4); filter: brightness(1.15); z-index: 2; }
/* tile-content: centered by default; top-row tiles re-anchor to top */
.hm-tile-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  pointer-events: none; width: 100%; padding: 2px 3px;
  text-align: center;
}
.hm-tile-content:has(.hm-tile-top) {
  align-items: flex-start; justify-content: flex-start;
  padding: 3px 0 2px;
}
.hm-ticker {
  font-size: 11px; font-weight: 800; letter-spacing: 0.2px;
  text-align: center; line-height: 1.1;
  pointer-events: none; white-space: nowrap;
}
.hm-pct {
  font-size: 10px; font-weight: 600; opacity: 0.9;
  pointer-events: none; white-space: nowrap;
}
.hm-name {
  font-size: 9px; opacity: 0.7; text-align: center;
  pointer-events: none; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; width: 100%; padding: 0 3px;
}
.hm-spark {
  position: absolute; bottom: 0; left: 0; right: 0;
  pointer-events: none; opacity: 0.5;
}

/* Axis annotations */
.hm-axis-hi, .hm-axis-lo {
  position: absolute; font-size: 8px; font-weight: 600;
  opacity: 0.55; pointer-events: none;
}
.hm-axis-hi { top: 2px; right: 3px; }
.hm-axis-lo { bottom: 2px; left: 3px; }
.hm-date-start, .hm-date-end {
  position: absolute; font-size: 8px; opacity: 0.45; pointer-events: none;
}
.hm-date-start { bottom: 2px; left: 3px; }
.hm-date-end   { bottom: 2px; right: 3px; }

/* Old heatmap wrapper used on legacy layout */
.heatmap-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.snap-title { font-size: 13px; font-weight: 700; color: var(--text); }
.hm-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.heatmap-legend { display: flex; gap: 6px; margin-left: auto; }
.sector-heatmap, .home-hero { /* legacy selectors */ }

/* ─── Movers panels (legacy home.js classes) ─── */
.movers-grid {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 0; border-bottom: 1px solid var(--border);
}
.movers-panel {
  border-right: 1px solid var(--border);
}
.movers-panel:last-child { border-right: none; }
.mp-header {
  padding: 7px 10px; background: var(--surface);
  border-bottom: 1px solid var(--border);
  font-size: 12px; font-weight: 700;
  display: flex; align-items: baseline; gap: 6px;
}
.mp-header .mp-sub { font-size: 10px; color: var(--text-3); font-weight: 500; }
.mp-header.mp-up     { color: var(--green); }
.mp-header.mp-down   { color: var(--red); }
.mp-header.mp-active { color: var(--text); }
.mp-body { }

/* ── Market Snapshot table ── */
.snap-section {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.snap-hd, .snap-header {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.snap-sub, .snap-note { font-size: 11px; color: var(--text-3); }
.snap-shuffle, .shuffle-btn {
  margin-left: auto;
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: 1px solid var(--border); border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.snap-shuffle:hover, .shuffle-btn:hover { color: var(--text); background: var(--surface-3); }

.snap-table-wrap { overflow-x: auto; }
.snap-table, .market-snapshot table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  white-space: nowrap;
}
.snap-table thead th, .sth {
  padding: 6px 10px; text-align: right;
  background: var(--surface); color: var(--text-3);
  font-size: 11px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.sth-l, .snap-table thead th.sth-l { text-align: left; }
.sth-r { text-align: right; }
.snap-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.snap-table tbody tr:hover { background: var(--surface); }
.snap-table tbody td {
  padding: 6px 10px; text-align: right; color: var(--text); font-size: 12px;
}
.snap-table tbody td:first-child, .snap-table tbody td.td-l { text-align: left; }
.snap-loading {
  text-align: center; padding: 24px; color: var(--text-3); font-size: 13px;
}
.snap-loading .spinner { margin-right: 8px; }
.td-ticker a { color: var(--blue); font-weight: 700; }
.td-ticker a:hover { text-decoration: underline; }
.td-sector { color: var(--text-2); }
.td-up { color: var(--green); font-weight: 600; }
.td-dn { color: var(--red);   font-weight: 600; }

/* Market snapshot legacy */
.market-snapshot { background: var(--bg); border-bottom: 1px solid var(--border); }

/* ── Site footer ── */
.site-footer, .home-footer {
  background: var(--nav-bg); border-top: 1px solid var(--border);
  padding: 14px 16px; font-size: 11px; color: var(--text-3);
}
.footer-inner { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.footer-sep { color: var(--border-lt); }
.site-footer a, .home-footer a { color: var(--text-2); }
.site-footer a:hover, .home-footer a:hover { color: var(--blue); }

/* Indices bar (old layout — kept for compatibility) */
.indices-bar {
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
  display: flex; flex-wrap: nowrap; align-items: center;
  overflow-x: auto; padding: 0;
}
.idx-loading { padding: 9px 14px; color: var(--text-3); font-size: 12px; }
.idx-item {
  display: flex; align-items: baseline; gap: 6px;
  padding: 9px 16px; border-right: 1px solid var(--border);
  white-space: nowrap; flex-shrink: 0; font-size: 12px;
}
.idx-name { color: var(--text-2); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.idx-level { color: var(--text); font-weight: 700; font-size: 13px; }
.idx-item.pos .idx-chg, .idx-item.pos .idx-pct { color: var(--green); }
.idx-item.neg .idx-chg, .idx-item.neg .idx-pct { color: var(--red); }

/* Popular chips (kept for backward compat) */
.home-popular { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; padding: 10px 16px; }
.pop-label { font-size: 11px; color: var(--text-3); font-weight: 600; }
.popular-chip {
  padding: 4px 10px; font-size: 11px; font-weight: 700;
  color: var(--text-2); border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 3px; transition: all 0.12s;
}
.popular-chip:hover { border-color: var(--blue); color: var(--blue); background: var(--blue-bg); }

/* ═══════════════════════════════════════════════════════════════
   MAPS PAGE
   ═══════════════════════════════════════════════════════════════ */
.page-maps {
  padding-top: var(--topbar-h); height: 100vh;
  display: flex; flex-direction: column;
  background: var(--bg); overflow: hidden;
}

.maps-layout {
  display: flex; flex: 1; overflow: hidden;
}

.maps-sidebar {
  width: 170px; flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--border);
  overflow-y: auto; padding: 0;
}
.msb-section {
  padding: 10px 10px 8px;
  border-bottom: 1px solid var(--border);
}
.msb-label {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.4px;
  margin-bottom: 6px;
}
.msb-btn {
  display: block; width: 100%;
  padding: 5px 8px; margin-bottom: 3px;
  font-size: 12px; font-weight: 500; text-align: left;
  color: var(--text-2); background: none;
  border: 1px solid transparent; border-radius: 3px;
  transition: color 0.1s, background 0.1s;
}
.msb-btn:hover { color: var(--text); background: var(--surface-2); }
.msb-btn.active { color: var(--text); background: var(--blue-bg); border-color: var(--blue-dim); }
.msb-legend { display: flex; flex-direction: column; gap: 4px; }
.msb-leg-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--text-2); }
.msb-swatch { width: 16px; height: 14px; border-radius: 2px; flex-shrink: 0; }
.msb-swatch.dn4 { background: var(--hm-dn4); }
.msb-swatch.dn2 { background: var(--hm-dn2); }
.msb-swatch.neu { background: var(--hm-neu); }
.msb-swatch.up2 { background: var(--hm-up3); }
.msb-swatch.up4 { background: var(--hm-up4); }
.msb-search {
  width: 100%; padding: 5px 8px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 3px; outline: none;
}
.msb-search:focus { border-color: var(--blue-dim); }
.msb-status {
  padding: 10px; font-size: 10px; color: var(--text-3);
  border-top: 1px solid var(--border);
}

.maps-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

.maps-controls {
  display: flex; align-items: center; justify-content: space-between;
  padding: 6px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border); gap: 12px;
}
.mc-left { display: flex; align-items: center; gap: 10px; }
.mc-right { display: flex; align-items: center; gap: 8px; }
.mc-view-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-2); border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 3px;
}
.mc-view-btn.active { color: var(--text); background: var(--blue-bg); border-color: var(--blue-dim); }
.mc-sep { color: var(--border-lt); }
.mc-info { font-size: 11px; color: var(--text-3); }
.mc-tf { display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden; }
.mc-tf-btn {
  padding: 4px 9px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.mc-tf-btn:last-child { border-right: none; }
.mc-tf-btn.active { color: var(--text-inv); background: var(--blue-dim); }
.mc-fullscreen {
  padding: 4px 8px; font-size: 14px;
  color: var(--text-3); border: 1px solid var(--border);
  background: var(--surface-2); border-radius: 3px;
}
.mc-fullscreen:hover { color: var(--text); background: var(--surface-3); }

.maps-board-wrap {
  flex: 1; position: relative; overflow: hidden; background: var(--bg);
}
.maps-board {
  position: absolute; inset: 0; overflow: hidden;
}
.maps-loading {
  display: flex; align-items: center; justify-content: center;
  gap: 8px; height: 100%; color: var(--text-3); font-size: 13px;
}

/* Map sector blocks */
.map-sector-block {
  position: absolute; box-sizing: border-box;
  border: 2px solid rgba(255,255,255,0.05);
}
.map-sector-label {
  height: 20px; line-height: 20px;
  padding: 0 6px; font-size: 10px; font-weight: 700;
  color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 0.4px; background: rgba(0,0,0,0.4);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.map-sector-tiles { position: relative; }

/* Map tiles */
.map-tile {
  position: absolute; box-sizing: border-box;
  border: 1px solid rgba(0,0,0,0.3);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  overflow: hidden; cursor: pointer;
  transition: filter 0.1s, border-color 0.1s;
  border-radius: 1px;
}
.map-tile:hover { border-color: rgba(255,255,255,0.5); filter: brightness(1.18); z-index: 10; }
.map-tile.hlt   { border: 2px solid #fff !important; filter: brightness(1.2); z-index: 10; }
.map-tile-ticker { font-size: 12px; font-weight: 800; text-align: center; line-height: 1.1; pointer-events: none; }
.map-tile-pct    { font-size: 10px; font-weight: 600; opacity: 0.9; pointer-events: none; }
.map-tile-name   { font-size: 9px; opacity: 0.65; text-align: center; width: 100%; padding: 0 3px; pointer-events: none; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.map-spark { position: absolute; bottom: 0; left: 0; right: 0; pointer-events: none; }

/* Map tooltip */
.map-tooltip {
  position: absolute; z-index: 100;
  background: var(--surface); border: 1px solid var(--border-lt);
  border-radius: 6px; padding: 10px 12px;
  width: 210px; font-size: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  pointer-events: none;
}
.mtt-header { display: flex; align-items: baseline; gap: 6px; margin-bottom: 4px; }
.mtt-ticker { font-size: 14px; font-weight: 800; color: var(--text); }
.mtt-name   { font-size: 10px; color: var(--text-2); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mtt-price-row { display: flex; align-items: baseline; gap: 8px; margin-bottom: 8px; }
.mtt-price { font-size: 16px; font-weight: 700; color: var(--text); }
.mtt-chg   { font-size: 12px; font-weight: 600; }
.mtt-chg.up { color: var(--green); }
.mtt-chg.dn { color: var(--red); }
.mtt-meta { margin-bottom: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 8px; font-size: 11px; }
.mtt-lbl { color: var(--text-3); }
.mtt-spark { display: block; width: 100%; height: 50px; margin-bottom: 6px; }
.mtt-hint { font-size: 10px; color: var(--text-3); text-align: center; }

/* ═══════════════════════════════════════════════════════════════
   SCREENER PAGE
   ═══════════════════════════════════════════════════════════════ */
.screener-page {
  padding-top: var(--topbar-h); background: var(--bg);
  min-height: 100vh;
}

.scr-header {
  padding: 14px 16px 10px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.scr-title { font-size: 18px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.scr-sub { font-size: 12px; color: var(--text-3); }

.scr-layout { display: grid; grid-template-columns: 200px 1fr; }

.scr-filters {
  background: var(--surface); border-right: 1px solid var(--border);
  padding: 12px 10px;
}
.scr-filter-group { margin-bottom: 16px; }
.scr-fg-title {
  font-size: 10px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 5px;
}
.scr-input {
  width: 100%; padding: 6px 8px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 3px; outline: none;
  transition: border-color 0.1s;
}
.scr-input:focus { border-color: var(--blue-dim); }
select.scr-input { appearance: none; }
.scr-reset {
  width: 100%; padding: 7px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 3px;
  transition: all 0.1s;
}
.scr-reset:hover { color: var(--text); background: var(--surface-3); }

/* Filter section separator label */
.scr-fg-section {
  font-size: 9px; font-weight: 800; letter-spacing: 0.6px;
  text-transform: uppercase; color: var(--text-3);
  padding: 10px 0 4px; margin-top: 4px;
  border-top: 1px solid var(--border-dk);
}

/* Dual input (min/max side by side) */
.scr-dual-input { display: flex; gap: 6px; }
.scr-dual-input .scr-input { flex: 1; }

/* Column toggle chips */
.scr-col-toggles {
  display: flex; gap: 4px; flex-wrap: wrap; margin-right: 6px;
}
.scr-col-toggle {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px; font-size: 10px; font-weight: 600;
  color: var(--text-3); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 10px;
  cursor: pointer; user-select: none; transition: all 0.1s;
}
.scr-col-toggle input { display: none; }
.scr-col-toggle.active { color: var(--teal); border-color: var(--teal-dk); background: rgba(57,208,216,0.07); }
.scr-col-toggle:hover { border-color: var(--border-lt); color: var(--text-2); }

.scr-results { overflow: hidden; }
.scr-results-hd {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.scr-rh-title { font-size: 13px; font-weight: 700; color: var(--text); }
.csv-btn {
  margin-left: auto; padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 3px;
}
.csv-btn:hover { color: var(--text); background: var(--surface-3); }

.scr-table-wrap { overflow: auto; height: calc(100vh - 185px); }
.scr-table {
  width: 100%; border-collapse: collapse; font-size: 12px; white-space: nowrap;
}
.scr-table thead th {
  padding: 6px 10px; text-align: right;
  background: var(--surface); color: var(--text-3);
  font-size: 11px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 1; cursor: pointer;
  user-select: none; transition: color 0.1s;
}
.scr-table thead th:hover { color: var(--text); }
.scr-table thead th.sth-l, .scr-table thead th.sth-active { }
.scr-table thead th.sth-active { color: var(--blue); }
.scr-table tbody tr {
  border-bottom: 1px solid var(--border); transition: background 0.1s;
}
.scr-table tbody tr:hover { background: var(--surface); }
.scr-table tbody td {
  padding: 5px 10px; text-align: right; color: var(--text);
}
.scr-table tbody td.td-l { text-align: left; }
.scr-table tbody td a {
  color: var(--blue); font-weight: 700;
}
.scr-table tbody td a:hover { text-decoration: underline; }
.scr-table tbody td.td-up { color: var(--green); font-weight: 600; }
.scr-table tbody td.td-dn { color: var(--red);   font-weight: 600; }
.scr-no-results { padding: 32px; text-align: center; color: var(--text-3); }
#scrCount { color: var(--text-2); }

/* ═══════════════════════════════════════════════════════════════
   COMPANY / FINANCIAL STATEMENTS PAGE
   ═══════════════════════════════════════════════════════════════ */
.company-page {
  padding-top: var(--topbar-h); background: var(--bg); min-height: 100vh;
}

/* Company header */
.co-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 16px 20px;
}
.co-title-row {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap;
  margin-bottom: 6px;
}
.co-ticker {
  font-size: 24px; font-weight: 800; color: var(--text);
  letter-spacing: -0.5px;
}
.co-name {
  font-size: 16px; font-weight: 600; color: var(--text-2);
}
.co-meta {
  font-size: 12px; color: var(--text-3);
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.co-meta-sep { color: var(--border-lt); }

/* Key metrics bar */
.co-metrics {
  display: flex; gap: 24px; flex-wrap: wrap;
}
.co-metric { display: flex; flex-direction: column; }
.co-metric-label {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.4px; margin-bottom: 2px;
}
.co-metric-val {
  font-size: 18px; font-weight: 700; color: var(--text);
  letter-spacing: -0.3px;
}
.co-metric-val.up { color: var(--green); }
.co-metric-val.dn { color: var(--red); }
.co-metric-sub {
  font-size: 11px; color: var(--text-3); margin-top: 1px;
}

/* Company nav tabs */
.co-tabs {
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; gap: 0; overflow-x: auto;
  padding: 0 16px;
}
.co-tab {
  padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s; white-space: nowrap;
  cursor: pointer;
}
.co-tab:hover { color: var(--text); }
.co-tab.active { color: var(--text); border-bottom-color: var(--blue); }

/* Financial data table */
.fin-table-wrap { overflow-x: auto; }
.fin-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  white-space: nowrap;
}
.fin-table thead th {
  padding: 6px 10px; text-align: right;
  background: var(--surface); color: var(--text-3);
  font-size: 11px; font-weight: 600;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0;
}
.fin-table thead th.fth-l { text-align: left; }
.fin-table tbody tr { border-bottom: 1px solid var(--border); }
.fin-table tbody tr:hover { background: var(--surface); }
.fin-table tbody td {
  padding: 5px 10px; text-align: right; color: var(--text);
}
.fin-table tbody td.ftd-l { text-align: left; }
.fin-table tbody td.ftd-label { color: var(--text-2); font-weight: 600; }
.fin-table tbody td.ftd-section {
  background: var(--surface-2); font-weight: 700; color: var(--text);
  text-transform: uppercase; font-size: 10px; letter-spacing: 0.4px;
}
.fin-table .pos-yoy { color: var(--green); font-size: 10px; }
.fin-table .neg-yoy { color: var(--red);   font-size: 10px; }

/* Chart container */
.chart-section {
  background: var(--bg); padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.chart-title {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 12px;
}
.chart-canvas { background: var(--surface); border-radius: 4px; border: 1px solid var(--border); }

/* Chart.js dark theme overrides */
.chartjs-wrap { position: relative; }

/* Mode toggle (annual / quarterly) */
.mode-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}
.mode-btn {
  padding: 5px 12px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border-right: 1px solid var(--border);
}
.mode-btn:last-child { border-right: none; }
.mode-btn.active { color: var(--text-inv); background: var(--blue-dim); }

/* Metric selector pills */
.metric-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.metric-pill {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px;
  transition: all 0.1s;
}
.metric-pill:hover { color: var(--text); border-color: var(--border-lt); }
.metric-pill.active { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-dim); }

/* Price box */
.price-box {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 6px; padding: 12px 16px; margin-bottom: 16px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.pb-price { font-size: 28px; font-weight: 800; color: var(--text); letter-spacing: -0.5px; }
.pb-chg { font-size: 14px; font-weight: 600; }
.pb-chg.up { color: var(--green); }
.pb-chg.dn { color: var(--red); }
.pb-52 { font-size: 11px; color: var(--text-3); }

/* Loading skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 3px; height: 14px; display: inline-block;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Error state */
.error-state {
  padding: 32px; text-align: center;
  color: var(--text-3); font-size: 13px;
}
.error-state strong { color: var(--red); display: block; margin-bottom: 8px; font-size: 16px; }

/* Badge */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 7px; border-radius: 10px; font-size: 10px; font-weight: 700;
}
.badge-green { background: var(--green-bg); color: var(--green); }
.badge-red   { background: var(--red-bg);   color: var(--red); }
.badge-blue  { background: var(--blue-bg);  color: var(--blue); }
.badge-gray  { background: var(--surface-2); color: var(--text-3); }

/* Tooltip (for chart hover, etc.) */
.sq-tooltip {
  background: var(--surface); border: 1px solid var(--border-lt);
  border-radius: 4px; padding: 8px 12px; font-size: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5); pointer-events: none;
  position: fixed; z-index: 9999; max-width: 200px;
}

/* ═══════════════════════════════════════════════════════════════
   COMPANY PAGE — legacy class aliases (company.html uses these)
   ═══════════════════════════════════════════════════════════════ */

/* Alias for .company-page */
.co-page {
  padding-top: var(--topbar-h); background: var(--bg);
  min-height: 100vh; color: var(--text);
}

/* Header */
.co-header {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 12px 20px; display: flex; align-items: flex-start;
  justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.co-id { display: flex; flex-direction: column; gap: 3px; }
.co-name {
  font-size: 20px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; margin: 0;
}
.co-ticker-badge {
  display: inline-flex; align-items: center;
  background: var(--blue-dim); color: #fff;
  font-size: 11px; font-weight: 800; letter-spacing: 0.5px;
  padding: 2px 8px; border-radius: 3px; margin-top: 2px;
  align-self: flex-start;
}
/* .co-meta already defined but add alias */
.co-pricing {
  display: flex; flex-direction: column; align-items: flex-end;
}
.co-price {
  font-size: 26px; font-weight: 800; color: var(--text);
  letter-spacing: -0.5px;
}
.co-price-change {
  font-size: 13px; font-weight: 600; margin-top: 2px;
}
.co-price-change.up  { color: var(--green); }
.co-price-change.dn  { color: var(--red); }
.co-price-change.pos { color: var(--green); }
.co-price-change.neg { color: var(--red); }

/* Key stats table */
.stats-tbl {
  width: 100%; border-collapse: collapse;
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.stats-tbl td { padding: 7px 14px; font-size: 12px; }
.st-lbl {
  color: var(--text-3); font-weight: 600;
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.3px;
  white-space: nowrap;
}
.st-val {
  color: var(--text); font-weight: 700;
  padding-right: 24px !important; font-size: 13px;
}

/* Section nav (tab bar) */
.section-nav {
  display: flex; gap: 0; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 16px;
}
.sec-tab {
  padding: 10px 14px; font-size: 12px; font-weight: 600;
  color: var(--text-2); border-bottom: 2px solid transparent;
  transition: color 0.1s, border-color 0.1s; white-space: nowrap;
  cursor: pointer; background: none; border-top: none;
  border-left: none; border-right: none;
}
.sec-tab:hover { color: var(--text); }
.sec-tab.active { color: var(--text); border-bottom-color: var(--blue); }

/* Metric nav (sub-tabs) */
.metric-nav {
  display: flex; gap: 6px; flex-wrap: wrap;
  padding: 10px 16px;
  background: var(--bg); border-bottom: 1px solid var(--border);
}
.metric-pill-btn, .metric-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: all 0.1s;
}
.metric-pill-btn:hover, .metric-btn:hover { color: var(--text); border-color: var(--border-lt); }
.metric-pill-btn.active, .metric-btn.active { color: var(--blue); background: var(--blue-bg); border-color: var(--blue-dim); }
.metric-sep { color: var(--border-lt); margin: 0 2px; }

/* Main content */
.co-main {
  padding: 0;
  background: var(--bg);
}
.loading-state {
  display: flex; align-items: center; gap: 8px;
  padding: 40px; color: var(--text-3); font-size: 13px;
  justify-content: center;
}

/* ═══════════════════════════════════════════════════════════════
   COMPANY PAGE — dynamic content (generated by company.js)
   ═══════════════════════════════════════════════════════════════ */

/* ── Panel header (above overview grid / metric panel) ── */
.panel-header {
  padding: 16px 20px 10px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.panel-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  letter-spacing: -0.2px;
}
.panel-sub {
  font-size: 11px; color: var(--text-3); margin-top: 3px;
}

/* ── Overview KPI grid ── */
.overview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  border-bottom: 1px solid var(--border);
}
@media (max-width: 860px) {
  .overview-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 560px) {
  .overview-grid { grid-template-columns: 1fr; }
}

.overview-card {
  padding: 14px 18px; cursor: pointer;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  transition: background 0.12s;
  display: flex; flex-direction: column; gap: 3px;
  position: relative; overflow: hidden;
}
.overview-card:nth-child(3n) { border-right: none; }
.overview-card:hover { background: var(--surface-2); }

.ov-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.4px; color: var(--text-3);
}
.ov-value {
  font-size: 18px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px; line-height: 1.1;
}
.ov-yoy {
  font-size: 11px; color: var(--text-2); display: flex; align-items: center; gap: 4px;
}
.ov-spark {
  position: absolute; bottom: 0; right: 0;
  width: 80px; height: 36px; opacity: 0.6;
  pointer-events: none;
}

/* ── Chart card (wraps the Chart.js canvas) ── */
.chart-card {
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0;
}
.chart-card-hd {
  display: flex; align-items: flex-start;
  justify-content: space-between; flex-wrap: wrap; gap: 10px;
  padding: 14px 20px 10px;
  border-bottom: 1px solid var(--border-dk);
}
.chart-title {
  font-size: 13px; font-weight: 700; color: var(--text);
}
.chart-sub {
  font-size: 11px; color: var(--text-3); margin-top: 2px;
}
.chart-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.chart-wrap {
  position: relative; height: 320px;
  padding: 12px 16px 8px;
}
.chart-wrap canvas { width: 100% !important; height: 100% !important; }

/* ── Range selector (5Y / 10Y / 20Y / MAX) ── */
.range-selector {
  display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}
.range-btn {
  padding: 4px 10px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border-right: 1px solid var(--border);
  transition: all 0.1s; cursor: pointer;
}
.range-btn:last-child { border-right: none; }
.range-btn:hover { color: var(--text); background: var(--surface-3); }
.range-btn.active { color: var(--text-inv); background: var(--blue-dim); border-color: var(--blue-dim); }

/* ── Mode note ("Annual only" label for valuation metrics) ── */
.mode-note {
  font-size: 10px; font-weight: 600; color: var(--text-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 3px; padding: 4px 9px; white-space: nowrap;
}

/* ── Data card (table below the chart) ── */
.data-card {
  background: var(--surface); border-bottom: 1px solid var(--border);
  margin-top: 1px;
}
.data-card-hd {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 20px; border-bottom: 1px solid var(--border-dk);
  font-size: 12px; font-weight: 600; color: var(--text-2);
}
.data-table-wrap {
  overflow-x: auto; max-height: 480px; overflow-y: auto;
}

/* ── Data table (metric + price tables) ── */
.data-table {
  width: 100%; border-collapse: collapse; font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.data-table thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--surface-2); color: var(--text-2);
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.3px; padding: 7px 14px; text-align: right;
  border-bottom: 1px solid var(--border); white-space: nowrap;
}
.data-table thead th:first-child { text-align: left; }
.data-table tbody td {
  padding: 6px 14px; text-align: right; color: var(--text);
  border-bottom: 1px solid var(--border-dk);
}
.data-table tbody td:first-child { text-align: left; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: none; }

/* ── Statement table overrides ── */
.stmt-table { min-width: 700px; }
.stmt-table thead th:first-child { min-width: 210px; }
.stmt-table tbody td { font-size: 11px; padding: 5px 14px; }
.stmt-label {
  text-align: left !important; color: var(--text-2);
  font-weight: 500; white-space: nowrap;
}

/* Statement row types */
.row-hi {
  background: rgba(88,166,255,0.06);
}
.row-hi .stmt-label {
  color: var(--text); font-weight: 700;
}
.row-hi td { border-top: 1px solid var(--border); }

.row-total {
  background: var(--surface-2);
}
.row-total .stmt-label {
  color: var(--text); font-weight: 700;
}

.indent-1 .stmt-label { padding-left: 26px !important; }

.stmt-group-hd td {
  background: var(--bg) !important;
  color: var(--text-3); font-size: 9px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.6px;
  padding: 8px 14px 4px !important;
  border-top: 1px solid var(--border-dk) !important;
  border-bottom: none !important;
}

/* ── Empty state (no data message) ── */
.empty-state {
  padding: 32px 20px; text-align: center;
  color: var(--text-3); font-size: 12px; font-style: italic;
}

/* ── YoY / change badges ── */
.yoy-pos {
  color: var(--green); font-weight: 600; font-size: 11px;
}
.yoy-neg {
  color: var(--red); font-weight: 600; font-size: 11px;
}
.yoy-flat {
  color: var(--text-3); font-size: 11px;
}

/* ═══════════════════════════════════════════════════════════════
   UTILITY — color helpers used across home/screener/company
   ═══════════════════════════════════════════════════════════════ */
.pos { color: var(--green); font-weight: 600; }
.neg { color: var(--red);   font-weight: 600; }

/* Index card color states */
.idx-card.pos .idx-chg { color: var(--green); }
.idx-card.neg .idx-chg { color: var(--red); }
.idx-chg.pos { color: var(--green); }
.idx-chg.neg { color: var(--red); }

/* ── Signal badges (movers tables) ── */
.sig {
  display: inline-block; font-size: 10px; font-weight: 700;
  padding: 1px 5px; border-radius: 2px; white-space: nowrap;
}
.sig-bull2 { background: var(--green-bg); color: var(--green); }
.sig-bull  { background: rgba(35,134,54,0.25); color: var(--green); }
.sig-bear2 { background: var(--red-bg); color: var(--red); }
.sig-bear  { background: rgba(185,28,28,0.25); color: var(--red); }
.sig-neut  { background: var(--surface-2); color: var(--text-3); }

/* Movers table ticker link */
.mpt-tk {
  color: var(--blue); font-weight: 700; font-size: 12px;
  text-decoration: none;
}
.mpt-tk:hover { text-decoration: underline; }

/* ── Market Snapshot table cells ── */
.st-ticker a { color: var(--blue); font-weight: 700; }
.st-ticker a:hover { text-decoration: underline; }
.st-name a   { color: var(--text); }
.st-name a:hover { color: var(--blue); }
.st-sector   { color: var(--text-2); }
.st-num      { text-align: right; color: var(--text); }
.st-chg      { text-align: right; font-weight: 600; }
.st-chg.pos  { color: var(--green); }
.st-chg.neg  { color: var(--red); }
.st-pct      { font-size: 10px; opacity: 0.8; }
.snap-table tbody tr.alt { background: rgba(255,255,255,0.02); }

/* ── Heatmap sector labels ── */
.hm-sec-lbl {
  position: absolute; display: flex; align-items: center;
  gap: 6px; pointer-events: none; z-index: 1;
  overflow: hidden;
}
.hm-sec-name {
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,0.55);
  text-transform: uppercase; letter-spacing: 0.4px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.hm-sec-cap {
  font-size: 9px; color: rgba(255,255,255,0.3); white-space: nowrap;
}

.hm-cap { opacity: 0.7; }
.hm-tile-nolink { cursor: default; }

/* ── Date range overlay on heatmap tiles ── */
.hm-date-range {
  position: absolute; bottom: 2px; right: 3px;
  font-size: 8px; opacity: 0.45; pointer-events: none;
  color: rgba(255,255,255,0.9); white-space: nowrap;
}

/* ── News title link (overrides .news-item a when class is present) ── */
.news-title {
  display: block; font-size: 12px; font-weight: 500;
  color: var(--text); line-height: 1.4; margin-top: 3px;
  text-decoration: none;
}
.news-title:hover { color: var(--blue); text-decoration: none; }
.news-age { color: var(--text-3); font-size: 10px; }

/* ═══════════════════════════════════════════════════════════════
   COMPANY PAGE — Macrotrends-style two-tier nav + chart panels
   ═══════════════════════════════════════════════════════════════ */

/* ── Primary tab row (Prices | Financials | Revenue & Profit …) ── */
.co-primary-tabs {
  display: flex; flex-wrap: nowrap; overflow-x: auto;
  background: var(--surface); border-bottom: 1px solid var(--border);
  padding: 0 16px; gap: 0; scrollbar-width: none;
}
.co-primary-tabs::-webkit-scrollbar { display: none; }

.cpt-btn {
  flex-shrink: 0;
  padding: 11px 16px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.1px;
  color: var(--text-2);
  background: none;
  border: none; border-bottom: 3px solid transparent;
  cursor: pointer; white-space: nowrap;
  transition: color 0.12s, border-color 0.12s;
}
.cpt-btn:hover { color: var(--text); }
.cpt-btn.active { color: var(--teal); border-bottom-color: var(--teal); }

/* ── Secondary tab row (metric selector) ── */
.co-secondary-tabs {
  display: flex; flex-wrap: nowrap; overflow-x: auto;
  background: var(--bg); border-bottom: 1px solid var(--border);
  padding: 8px 16px; gap: 6px; scrollbar-width: none;
  min-height: 42px; align-items: center;
}
.co-secondary-tabs::-webkit-scrollbar { display: none; }
.co-secondary-tabs:empty { display: none; }

.cst-btn {
  flex-shrink: 0;
  padding: 4px 12px;
  font-size: 11px; font-weight: 600;
  color: var(--text-2);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; cursor: pointer; white-space: nowrap;
  transition: all 0.12s;
}
.cst-btn:hover { color: var(--text); border-color: var(--border-lt); background: var(--surface-2); }
.cst-btn.active { color: var(--teal); background: rgba(57,208,216,0.08); border-color: var(--teal-dk); }

/* ── Format bar (Annual / Quarterly selector) ── */
.co-format-bar {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 16px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}

.co-fmt-select {
  padding: 4px 10px 4px 8px;
  font-size: 12px; font-weight: 600;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 3px; outline: none;
  appearance: none;
  cursor: pointer; transition: border-color 0.12s;
}
.co-fmt-select:focus { border-color: var(--teal-dk); }
.co-fmt-select:disabled { opacity: 0.45; cursor: not-allowed; }

.co-fmt-note { font-size: 11px; color: var(--text-3); }

/* ── Mode toggle (Annual / Quarterly inline pill-group) ── */
.macro-mode-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}

/* ── Price panel ── */
.macro-price-wrap {
  background: var(--surface); border-bottom: 1px solid var(--border);
}

.macro-chart-hd {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 20px 12px;
  border-bottom: 1px solid var(--border-dk);
}

.macro-chart-title {
  font-size: 14px; font-weight: 700; color: var(--text);
  letter-spacing: -0.2px;
}
.macro-chart-sub {
  font-size: 11px; color: var(--text-3); margin-top: 3px;
}

.macro-chart-controls {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}

/* Candlestick / Line toggle */
.macro-view-toggle {
  display: flex; border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}
.mvt-btn {
  padding: 4px 11px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border-right: 1px solid var(--border); cursor: pointer;
  transition: color 0.1s, background 0.1s;
}
.mvt-btn:last-child { border-right: none; }
.mvt-btn:hover { color: var(--text); background: var(--surface-3); }
.mvt-btn.active { color: var(--text-inv); background: var(--blue-dim); }

/* Candlestick canvas area */
.macro-candle-wrap {
  position: relative; width: 100%; height: 360px;
  overflow: hidden;
}
.macro-candle-wrap canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── 3-panel stacked charts section ── */
.macro-charts-section {
  background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 0;
}

.macro-chart-panel {
  border-bottom: 1px solid var(--border-dk);
  padding: 0;
}
.macro-chart-panel:last-child { border-bottom: none; }

.macro-chart-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.5px; color: var(--text-3);
  padding: 8px 16px 4px;
}

.macro-chartbox {
  position: relative; width: 100%;
  padding: 0 12px 8px;
}
.macro-chartbox canvas { display: block; width: 100% !important; height: 100% !important; }

/* ── Statement panel ── */
.macro-stmt-header {
  display: flex; align-items: flex-start; justify-content: space-between;
  flex-wrap: wrap; gap: 10px;
  padding: 14px 20px 12px;
  background: var(--surface); border-bottom: 1px solid var(--border);
}

.macro-stmt-table {
  overflow-x: auto; background: var(--surface);
}
.macro-stmt-table .data-table { min-width: 700px; }

/* Wide table — sticky first column */
.macro-wide-tbl thead th:first-child,
.macro-wide-tbl tbody td:first-child {
  position: sticky; left: 0; z-index: 1;
  background: var(--surface-2);
}
.macro-wide-tbl tbody tr:hover td:first-child {
  background: var(--surface-3);
}

/* YoY % row inside statements */
.stmt-yoy-row td {
  padding: 3px 14px !important;
  font-size: 10px; background: rgba(0,0,0,0.15) !important;
  border-bottom: 1px solid var(--border-dk) !important;
}
.stmt-yoy-row .stmt-label {
  font-weight: 500; font-size: 10px; font-style: italic;
  padding-left: 26px !important;
}

/* Clickable statement row */
.stmt-clickable:hover { background: rgba(88,166,255,0.05) !important; cursor: pointer; }
.stmt-clickable:hover .stmt-label { color: var(--blue); }

/* ── Key Ratios 3-column grid ── */
.key-ratios-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0;
  background: var(--bg);
}
@media (max-width: 900px) {
  .key-ratios-grid { grid-template-columns: 1fr; }
}
@media (max-width: 1200px) {
  .key-ratios-grid { grid-template-columns: repeat(2, 1fr); }
}

.kr-card {
  background: var(--surface);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  overflow: hidden;
}
.kr-card:nth-child(3n) { border-right: none; }
.kr-card .data-card-hd {
  font-size: 12px; font-weight: 700; color: var(--text);
  background: var(--surface-2);
}

/* ─────────────────────────────────────────────────────────────
   RESPONSIVE
   ───────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .home-cols { grid-template-columns: 1fr; }
  .home-right { min-height: 400px; border-right: none; }
  .home-left  { border-right: none; }
  .heatmap-board-wrap { min-height: 360px; }
}
@media (max-width: 900px) {
  .movers-row { grid-template-columns: 1fr; }
  .mover-panel { border-right: none; }
  .maps-sidebar { width: 140px; }
  .scr-layout { grid-template-columns: 1fr; }
  .scr-filters { border-right: none; border-bottom: 1px solid var(--border); padding: 10px; display: flex; flex-wrap: wrap; gap: 10px; }
  .scr-filter-group { flex: 1; min-width: 140px; margin-bottom: 0; }
}
@media (max-width: 680px) {
  .idx-charts-row { flex-direction: column; }
  .topbar-nav .tn:not(.active) { display: none; }
  .home-cols { grid-template-columns: 1fr; }
  .maps-sidebar { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   HOME PAGE — OVERHAUL (heatmap hero + 4-column movers)
   ═══════════════════════════════════════════════════════════════ */

/* ── Index row: breadth inline ── */
.idx-charts-row { flex-wrap: nowrap; align-items: stretch; }
.idx-breadth {
  flex: 0 0 auto; min-width: 200px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  padding: 8px 14px;
  border-left: 1px solid var(--border);
  background: var(--nav-bg);
}
.ib-adv-row, .ib-hi-lo-row, .ib-sent-row {
  display: flex; align-items: center; gap: 5px; font-size: 11px;
}
.ib-label { font-size: 10px; color: var(--text-3); font-weight: 600; white-space: nowrap; }
.ib-sep { color: var(--border-lt); }
.ib-sent-row canvas { flex-shrink: 0; }

/* ── Heatmap Hero (full-width feature section) ── */
.heatmap-hero {
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.hm-hero-hd {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.hm-hero-title-row {
  display: flex; align-items: baseline; gap: 8px;
  margin-right: 4px;
}
.hm-hero-title {
  font-size: 13px; font-weight: 700; color: var(--text);
  letter-spacing: -0.2px;
}
.hm-hero-sub {
  font-size: 11px; color: var(--text-3);
}
.hm-hero-legend {
  margin-left: auto;
}
/* Override hero board height — taller now that we render ~140 tickers */
.heatmap-hero .heatmap-board-wrap {
  height: 680px;
  min-height: 480px;
}

/* ── Finviz-style tile top row (ticker + price) ── */
.hm-tile-top {
  display: flex; align-items: baseline; justify-content: space-between;
  width: 100%; padding: 0 4px 1px;
  gap: 3px; line-height: 1.1;
}
.hm-price {
  font-weight: 600; opacity: 0.8;
  pointer-events: none; white-space: nowrap;
  color: rgba(255,255,255,0.85);
}

/* ── 4-column movers grid ── */
.home-movers {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.home-movers .mover-panel {
  border-right: 1px solid var(--border);
}
.home-movers .mover-panel:last-child {
  border-right: none;
}

/* ── Hide old 2-col home layout ── */
.home-cols { display: none !important; }
.breadth-bar { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   SCREENER — HORIZONTAL FILTER BAR (replaces sidebar)
   ═══════════════════════════════════════════════════════════════ */

/* Override old sidebar layout — make it single-column */
.scr-layout { display: flex !important; flex-direction: column !important; }
.scr-filters { display: none !important; }
.scr-header  { display: none !important; }

/* ── Sticky filter bar ── */
.scr-top {
  position: sticky; top: var(--topbar-h); z-index: 100;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.scr-head-row {
  display: flex; align-items: baseline; gap: 10px;
  padding: 8px 14px 6px;
  border-bottom: 1px solid var(--border-dk);
}
.scr-head-row .scr-title {
  font-size: 14px; font-weight: 700; color: var(--text); margin-bottom: 0;
}
.scr-head-row .scr-sub {
  font-size: 11px; color: var(--text-3); margin: 0;
}

/* Filter bar (horizontal row of inputs) */
.scr-filterbar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 6px;
  padding: 8px 14px 9px;
}
.scr-fb-cell {
  display: flex; flex-direction: column; gap: 3px;
}
.scr-fb-label {
  font-size: 9px; font-weight: 700; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.5px;
}
/* Narrow the inputs for the horizontal bar */
.scr-fb-cell .scr-input {
  height: 28px; padding: 3px 7px; font-size: 12px;
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text); border-radius: 3px; outline: none;
  transition: border-color 0.1s;
  width: auto; min-width: 90px;
}
.scr-fb-cell .scr-input:focus { border-color: var(--blue-dim); }
.scr-fb-search { min-width: 130px !important; }
.scr-fb-num    { min-width: 70px !important; max-width: 80px; }

.scr-dual-input { display: flex; gap: 4px; }
.scr-dual-input .scr-input { min-width: 62px !important; max-width: 70px; }

/* Vertical separator */
.scr-fb-sep {
  width: 1px; height: 28px; background: var(--border);
  align-self: flex-end; flex-shrink: 0; margin: 0 2px;
}

/* Actions cell (Reset button) */
.scr-fb-actions {
  display: flex; align-items: flex-end;
  margin-left: auto;
}
.scr-fb-actions .scr-reset {
  height: 28px; padding: 0 12px; font-size: 11px; font-weight: 600;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 3px;
  transition: color 0.1s, background 0.1s; width: auto;
}
.scr-fb-actions .scr-reset:hover { color: var(--text); background: var(--surface-3); }

/* Results: full-width with taller scroll area */
.screener-page .scr-results { flex: 1; }
.screener-page .scr-table-wrap {
  height: calc(100vh - 172px);
  overflow: auto;
}

/* ── Screener results header ── */
.screener-page .scr-results-hd {
  padding: 7px 14px;
}

/* ── Responsive tweaks for new layout ── */
@media (max-width: 1100px) {
  .home-movers { grid-template-columns: repeat(2, 1fr); }
  .home-movers .mover-panel:nth-child(2) { border-right: none; }
  .home-movers .mover-panel:nth-child(3) { border-top: 1px solid var(--border); }
  .heatmap-hero .heatmap-board-wrap { height: 540px; }
}
@media (max-width: 720px) {
  .home-movers { grid-template-columns: 1fr; }
  .home-movers .mover-panel { border-right: none !important; border-top: 1px solid var(--border); }
  .heatmap-hero .heatmap-board-wrap { height: 320px; }
  .idx-breadth { display: none; }
  .scr-filterbar { flex-direction: column; align-items: stretch; }
  .scr-fb-cell .scr-input { width: 100% !important; min-width: unset !important; max-width: unset !important; }
  .scr-fb-sep { display: none; }
}

/* ═══════════════════════════════════════════════════════════════
   FINVIZ-MATCH OVERHAUL (heatmap colors, tiles, index charts,
   breadth gauges, sector/industry labels)
   ═══════════════════════════════════════════════════════════════ */

/* ── Heatmap palette overrides (vivid Finviz greens/reds) ── */
:root {
  --hm-dn4:  #891610;
  --hm-dn3:  #a91f19;
  --hm-dn2:  #831c17;
  --hm-dn1:  #641814;
  --hm-neu:  #2a3340;
  --hm-up1:  #1c6d27;
  --hm-up2:  #1f852f;
  --hm-up3:  #26b53e;
  --hm-up4:  #2bcb45;
}

/* ── Index charts row: bigger Finviz-style cards ── */
.idx-charts-row {
  flex-wrap: nowrap !important;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.idx-card {
  flex: 1 1 0;
  min-width: 240px;
  padding: 9px 10px 8px 14px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  cursor: default;
  transition: background 0.12s;
  overflow: visible;
}
.idx-card:last-child { border-right: none; }
.idx-card:hover { background: #1a2230; }
.idx-card .idx-top {
  display: flex !important;
  align-items: center;
  gap: 8px;
  padding-right: 6px;
  margin-bottom: 6px;
  flex-shrink: 0;
  min-height: 22px;
}
.idx-card .idx-name {
  font-size: 13px !important;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.35px;
  text-transform: uppercase;
}
.idx-card .idx-date {
  font-size: 10px;
  color: var(--text-3);
  font-weight: 500;
  letter-spacing: 0.2px;
}
.idx-card .idx-chg {
  margin-left: auto;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.idx-card.pos .idx-chg { color: var(--green); }
.idx-card.neg .idx-chg { color: var(--red); }
/* Hide the old idx-nums/idx-price block — we now show the change inline at top */
.idx-card .idx-nums,
.idx-card .idx-price { display: none !important; }
.idx-card .idx-canvas {
  display: block;
  width: 100%;
  height: 140px;
  flex-shrink: 0;
}

/* ── Breadth Gauges Row (Finviz-style) ── */
.breadth-row {
  display: flex;
  background: var(--nav-bg);
  border-bottom: 1px solid var(--border);
}
.brth-gauge {
  flex: 1;
  padding: 9px 16px;
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.brth-gauge:last-child { border-right: none; }
.brth-label-row {
  display: flex; justify-content: space-between;
  font-size: 11px; font-weight: 700;
  letter-spacing: 0.2px;
}
.brth-label-row .brth-l-lbl { color: var(--green); }
.brth-label-row .brth-r-lbl { color: var(--red); }
.brth-val-row {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-2);
}
.brth-val-row .brth-l-val { color: var(--green); font-weight: 600; }
.brth-val-row .brth-r-val { color: var(--red);   font-weight: 600; }
.brth-bar-wrap {
  height: 5px;
  background: var(--red-dim);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 2px;
}
.brth-bar-fill {
  height: 100%;
  background: var(--green-dim);
  border-radius: 2px;
  transition: width 0.5s ease;
}
.brth-gauge-sent {
  flex: 0 0 auto;
  min-width: 200px;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 8px 18px;
}
.brth-gauge-sent canvas {
  width: 78px;
  height: 44px;
  flex-shrink: 0;
}
.brth-sent-info {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px;
}
.brth-sent-label {
  font-size: 13px; font-weight: 800; color: var(--text);
  letter-spacing: 0.2px;
}
.brth-sent-label.pos { color: var(--green); }
.brth-sent-label.neg { color: var(--red); }
.brth-sent-pct {
  font-size: 10px; color: var(--text-3); white-space: nowrap;
}

/* Hide old breadth bar elements that may still be in legacy templates */
.idx-breadth, .breadth-bar { display: none !important; }

/* ═══════════════════════════════════════════════════════════════
   HEATMAP — Finviz-clean tiles, sector/industry labels
   ═══════════════════════════════════════════════════════════════ */

.heatmap-hero .heatmap-board-wrap {
  background: #0a0d12;
}
#heatmapBoard { background: #0a0d12; }

/* Sector label — clean uppercase strip across top of sector group */
.hm-sec-lbl {
  position: absolute;
  display: flex; align-items: center;
  padding: 0 5px;
  background: rgba(0,0,0,0.55);
  border-bottom: 1px solid rgba(255,255,255,0.05);
  pointer-events: none;
  overflow: hidden;
  z-index: 3;
}
.hm-sec-lbl .hm-sec-name {
  font-size: 9px; font-weight: 800;
  color: rgba(220, 226, 232, 0.88);
  letter-spacing: 0.55px;
  text-transform: uppercase;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.hm-sec-lbl .hm-sec-cap {
  margin-left: auto;
  font-size: 8.5px;
  color: rgba(139, 148, 158, 0.7);
  white-space: nowrap;
}

/* Industry sub-label — slimmer, less prominent */
.hm-ind-lbl {
  position: absolute;
  display: flex; align-items: center;
  padding: 0 4px;
  background: rgba(0,0,0,0.35);
  font-size: 8px; font-weight: 700;
  color: rgba(170, 178, 188, 0.75);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  pointer-events: none;
  overflow: hidden;
  white-space: nowrap; text-overflow: ellipsis;
  z-index: 2;
}

/* Tiles — bold white text, no clutter */
.hm-tile {
  border: 1px solid rgba(0,0,0,0.45) !important;
  border-radius: 0 !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-decoration: none !important;
  color: #fff !important;
}
.hm-tile:hover {
  border-color: rgba(255,255,255,0.55) !important;
  filter: brightness(1.18);
  z-index: 5;
  text-decoration: none !important;
}
.hm-tile-content {
  position: relative; z-index: 2;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  width: 100%; padding: 1px 3px;
  text-align: center;
  pointer-events: none;
  line-height: 1.05;
}
.hm-tile-content:has(.hm-tile-top) {
  /* no-op now; ticker+price top row is gone */
  align-items: center; justify-content: center;
}
.hm-tile .hm-ticker {
  font-weight: 800 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  letter-spacing: 0.2px;
  line-height: 1;
  margin-bottom: 2px;
  max-width: 100%;
  padding: 0 2px;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  /* Layered shadow for strong contrast on every background tier */
  text-shadow:
    0 0 1px rgba(0,0,0,0.95),
    0 1px 2px rgba(0,0,0,0.75),
    0 2px 4px rgba(0,0,0,0.45);
}

/* Rotated ticker for tall-narrow tiles where horizontal display would clip.
   Floats out of the flex flow, centered, rotated -90° so it reads bottom-up. */
.hm-tile .hm-ticker.hm-ticker-vert {
  position: absolute;
  left: 50%;
  top: 50%;
  margin: 0;
  max-width: none;
  width: auto;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
  z-index: 3;
  pointer-events: none;
  letter-spacing: 0.5px;
}
.hm-tile .hm-pct {
  font-weight: 700 !important;
  color: #ffffff !important;
  opacity: 1 !important;
  line-height: 1;
  max-width: 100%;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  text-shadow:
    0 0 1px rgba(0,0,0,0.85),
    0 1px 2px rgba(0,0,0,0.65);
}
.hm-tile .hm-name {
  font-weight: 500 !important;
  color: rgba(255,255,255,0.78) !important;
  opacity: 1 !important;
  margin-top: 2px;
  max-width: 100%;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  padding: 0 2px;
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
.hm-tile .hm-spark {
  position: absolute; left: 0; right: 0; bottom: 0;
  width: 100%;
  height: 62%;
  pointer-events: none;
  z-index: 1;
  display: block;
}

/* Hide old leftover tile elements */
.hm-tile .hm-cap,
.hm-tile .hm-axis-hi,
.hm-tile .hm-axis-lo,
.hm-tile .hm-date-range,
.hm-tile .hm-date-start,
.hm-tile .hm-date-end,
.hm-tile .hm-tile-top,
.hm-tile .hm-price { display: none !important; }

/* Responsive tweaks for index cards */
@media (max-width: 1100px) {
  .idx-card { min-width: 200px; }
  .idx-card .idx-canvas { height: 100px; }
}
@media (max-width: 720px) {
  .idx-charts-row { flex-wrap: wrap !important; }
  .idx-card { min-width: 50%; flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .breadth-row { flex-wrap: wrap; }
  .brth-gauge { flex: 1 1 50%; border-bottom: 1px solid var(--border); }
  .brth-gauge-sent { flex: 1 1 100%; min-width: unset; }
}

/* ── Industry label polish: better fit, less aggressive uppercase ── */
.hm-ind-lbl {
  letter-spacing: 0.35px !important;
  font-size: 8.5px !important;
  text-overflow: ellipsis;
  background: linear-gradient(to bottom, rgba(0,0,0,0.45), rgba(0,0,0,0.15)) !important;
}
.hm-sec-lbl {
  background: linear-gradient(to bottom, rgba(0,0,0,0.7), rgba(0,0,0,0.25)) !important;
}
.hm-sec-lbl .hm-sec-name {
  text-shadow: 0 1px 2px rgba(0,0,0,0.8);
}

/* ── Heatmap board background: black for max contrast ── */
.heatmap-hero .heatmap-board-wrap,
#heatmapBoard {
  background: #050810 !important;
}

/* ── SEO content block (crawler + user friendly) ── */
.seo-block {
  background: var(--surface);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 18px 16px;
}
.seo-inner {
  display: grid;
  grid-template-columns: 2fr 1.2fr 1.5fr;
  gap: 28px;
  max-width: 1400px;
  margin: 0 auto;
}
.seo-col h2.seo-h,
.seo-col h3.seo-h {
  font-size: 13px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.2px;
  margin-bottom: 8px;
}
.seo-col p {
  font-size: 12px;
  color: var(--text-2);
  line-height: 1.6;
}
.seo-col strong { color: var(--text); }
.seo-list {
  list-style: none;
  display: flex; flex-direction: column; gap: 4px;
}
.seo-list li {
  font-size: 11px;
  color: var(--text-3);
}
.seo-list a {
  color: var(--blue);
  font-weight: 600;
}
.seo-list a:hover { text-decoration: underline; }
.seo-list-grid {
  display: grid !important;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px !important;
}
@media (max-width: 980px) {
  .seo-inner { grid-template-columns: 1fr; gap: 14px; }
}
.seo-hint {
  margin-top: 8px;
  font-size: 12px;
}
.seo-hint a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}
.seo-hint a:hover { text-decoration: underline; }

/* ── Index card hover lift ── */
.idx-card {
  cursor: pointer !important;
  position: relative;
}
.idx-card::after {
  content: '';
  position: absolute; left: 0; right: 0; bottom: 0;
  height: 2px; background: var(--blue-dim);
  transform: scaleX(0); transform-origin: left;
  transition: transform 0.18s ease;
}
.idx-card:hover::after { transform: scaleX(1); }

/* ── Polish movers tables ── */
.home-movers .mover-panel {
  background: var(--surface);
}
.home-movers .mp-hd {
  padding: 8px 10px 6px;
}
.home-movers .mp-table {
  font-size: 11.5px;
}
.home-movers .mp-table td a.mpt-tk {
  font-weight: 800;
  color: var(--blue);
}

/* ═══════════════════════════════════════════════════════════════
   HEATMAP HOVER TOOLTIP (Finviz-style industry breakdown)
   ═══════════════════════════════════════════════════════════════ */
.hm-hover {
  position: fixed;
  z-index: 9000;
  width: 320px;
  background: #0d1219;
  border: 1px solid #2d3340;
  border-radius: 7px;
  box-shadow: 0 12px 36px rgba(0,0,0,0.7), 0 2px 6px rgba(0,0,0,0.4);
  padding: 0;
  display: none;
  pointer-events: auto;
  font-size: 11px;
  color: var(--text);
}
.hm-hover.visible { display: block; }

.hmh-head {
  padding: 8px 12px;
  background: #161c26;
  border-bottom: 1px solid #2d3340;
  border-radius: 7px 7px 0 0;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.55px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.hmh-focus {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #21262d;
}
.hmh-focus-l { flex: 1; min-width: 0; }
.hmh-focus-r { text-align: right; flex-shrink: 0; }
.hmh-focus-name {
  font-size: 13px; font-weight: 700; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.hmh-focus-meta {
  font-size: 10.5px; color: var(--text-3);
  display: flex; gap: 5px; flex-wrap: wrap;
}
.hmh-focus-meta .pos { color: var(--green); font-weight: 700; }
.hmh-focus-meta .neg { color: var(--red);   font-weight: 700; }
.hmh-sep { color: var(--border-lt); }
.hmh-focus-px {
  font-size: 16px; font-weight: 800; color: var(--text);
  letter-spacing: -0.3px;
}
.hmh-focus-cap {
  font-size: 10px; color: var(--text-3); margin-top: 1px;
}

.hmh-list {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}
.hmh-row {
  display: grid;
  grid-template-columns: 54px 1fr 64px 64px;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  font-size: 11px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.1s;
}
.hmh-row:hover {
  background: #1a2230;
  text-decoration: none;
}
.hmh-row.focused {
  background: rgba(88,166,255,0.10);
  box-shadow: inset 3px 0 0 var(--blue);
}
.hmh-tk {
  font-weight: 800; color: var(--blue);
  font-size: 11px; letter-spacing: 0.3px;
}
.hmh-spark {
  width: 100%; height: 18px;
}
.hmh-px {
  text-align: right; font-weight: 600; color: var(--text);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.hmh-cap {
  text-align: right; font-weight: 600; color: var(--text-2);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.hmh-pct {
  text-align: right; font-weight: 700;
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}
.hmh-pct.pos { color: var(--green); }
.hmh-pct.neg { color: var(--red); }

.hmh-foot {
  padding: 6px 12px;
  background: #11151c;
  border-top: 1px solid #21262d;
  border-radius: 0 0 7px 7px;
  font-size: 9.5px;
  color: var(--text-3);
  text-align: center;
  letter-spacing: 0.2px;
}

/* ── Better signal pills ── */
.sig {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.3px;
  white-space: nowrap;
}
.sig.sig-bull2 { background: rgba(63,185,80,0.22);  color: #5cd96e; }
.sig.sig-bull  { background: rgba(63,185,80,0.14);  color: #3fb950; }
.sig.sig-bear2 { background: rgba(248,81,73,0.22);  color: #ff7b72; }
.sig.sig-bear  { background: rgba(248,81,73,0.14);  color: #f85149; }
.sig.sig-neut  { background: rgba(139,148,158,0.12); color: var(--text-3); }

/* ═══════════════════════════════════════════════════════════════
   SITE-WIDE NITPICKY POLISH
   ═══════════════════════════════════════════════════════════════ */

/* Snapshot table: alternating rows + cleaner pct display */
.snap-table tbody tr.alt { background: rgba(255,255,255,0.015); }
.snap-table tbody tr:hover { background: rgba(88,166,255,0.04) !important; }
.snap-table tbody td .st-pct {
  font-size: 11px;
  color: inherit;
  opacity: 0.85;
  margin-left: 3px;
}
.snap-table tbody td.st-chg { font-weight: 600; }
.snap-table tbody td.st-chg.pos { color: var(--green); }
.snap-table tbody td.st-chg.neg { color: var(--red); }
.snap-table tbody td.st-ticker a {
  font-weight: 800; color: var(--blue);
}
.snap-table tbody td.st-name a {
  font-weight: 500; color: var(--text);
}
.snap-table tbody td.st-name a:hover { color: var(--blue); }
.snap-table tbody td.st-sector { color: var(--text-3); font-size: 11px; }

/* Movers tables: signal pill alignment & ticker color */
.mp-table td .mpt-tk {
  font-weight: 800;
  color: var(--blue);
  letter-spacing: 0.2px;
}
.mp-table td.mpt-r.pos { color: var(--green); font-weight: 600; }
.mp-table td.mpt-r.neg { color: var(--red);   font-weight: 600; }

/* Breadth gauge: tighter label + value spacing */
.brth-gauge {
  gap: 4px;
  padding: 10px 16px;
}
.brth-label-row { font-size: 11px; }
.brth-val-row   { font-size: 10.5px; }
.brth-bar-wrap  { height: 6px; }

/* Heatmap controls header: tighter group spacing */
.hm-hero-hd { padding: 10px 14px; }
.hm-kind-group, .hm-tf-group {
  border-radius: 4px;
  height: 28px;
}
.hm-kind-btn, .hm-tf-btn {
  padding: 0 12px;
  height: 100%;
  font-size: 11.5px;
  display: inline-flex;
  align-items: center;
}
.hm-hero-title { font-size: 14px; }
.hm-hero-sub   { font-size: 11.5px; padding: 2px 8px; background: rgba(88,166,255,0.08); border-radius: 3px; color: var(--blue); }
.hm-etf-select { height: 28px; font-size: 12px; padding: 0 8px; }

/* Hero legend: pill style */
.hm-hero-legend .hml {
  padding: 3px 8px;
  font-size: 10px;
  border-radius: 3px;
}

/* ETF badge alignment */
#hmEtfBadge {
  margin-bottom: 0;
  padding: 2px 8px;
  background: rgba(88,166,255,0.06);
  border-radius: 3px;
  font-size: 10.5px;
}

/* Topbar nav: tighter spacing, better active state */
.topbar-nav .tn {
  padding: 0 12px;
  letter-spacing: 0.3px;
}
.topbar-nav .tn.active {
  border-bottom-width: 2px;
  font-weight: 700;
  color: var(--text);
}

/* Search input: cleaner focus state */
.topbar-search input:focus {
  background: var(--surface-3);
  box-shadow: 0 0 0 2px rgba(31,111,235,0.15);
}

/* Screener filter bar: cleaner separators + sticky header polish */
.scr-top {
  box-shadow: 0 1px 0 var(--border), 0 4px 12px rgba(0,0,0,0.25);
}
.scr-fb-sep {
  background: linear-gradient(to bottom, transparent, var(--border), transparent);
}
.scr-fb-label {
  font-size: 9.5px;
  color: var(--text-3);
}

/* Footer: tighter, more polished */
.site-footer {
  padding: 16px 18px;
}
.footer-inner {
  max-width: 1400px;
  margin: 0 auto;
  gap: 10px;
}
.footer-inner a {
  padding: 2px 8px;
  border-radius: 3px;
  background: var(--surface-2);
  color: var(--text-2);
  font-size: 11px;
  font-weight: 600;
  transition: color 0.1s, background 0.1s;
}
.footer-inner a:hover {
  color: var(--blue);
  background: var(--surface-3);
  text-decoration: none;
}

/* SEO block: tighter spacing on small screens, better hierarchy */
.seo-block { padding: 24px 18px; }
.seo-col h2.seo-h, .seo-col h3.seo-h {
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
}
.seo-col h2.seo-h { color: var(--text); font-size: 13px; }
.seo-col p { font-size: 12.5px; }

/* Spinner inside heatmap loading: better centering */
.hm-loading {
  font-size: 12px;
  letter-spacing: 0.3px;
  color: var(--text-2);
}

/* Snap section header: better hierarchy */
.snap-hd {
  padding: 10px 16px;
}
.snap-title { font-size: 14px; }
.snap-sub   { font-size: 11px; color: var(--text-3); margin-left: 4px; }

/* Index card animated underline color matches direction */
.idx-card.pos::after { background: var(--green); }
.idx-card.neg::after { background: var(--red); }

/* Mover panel last column (sector / signal) - keep text on one line */
.mp-table td.mpt-l { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100px; }

/* Better visual hierarchy on movers headers */
.home-movers .mp-title {
  font-size: 12.5px;
  font-weight: 800;
  letter-spacing: 0.2px;
}

/* Snapshot table empty/loading state */
.snap-loading {
  padding: 32px;
  font-size: 13px;
}

/* ETF list select: dark dropdown */
select.hm-etf-select option { background: var(--surface); color: var(--text); }

/* Better fitness: tile content gets a hair more padding so text doesn't kiss edge */
.hm-tile-content { padding: 3px 4px; }
