:root {
  --bg: #0f1117;
  --bg2: #161b27;
  --bg3: #1c2333;
  --border: rgba(99,179,237,0.1);
  --border2: rgba(99,179,237,0.22);
  --blue: #3b9eff;
  --blue-dim: rgba(59,158,255,0.15);
  --blue-glow: rgba(59,158,255,0.08);
  --green: #22d3a5;
  --red: #f56565;
  --amber: #f6ad55;
  --text: #e2e8f0;
  --muted: #718096;
  --dim: #2d3748;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", Inter, system-ui, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, system-ui, sans-serif;
  --mono: 'JetBrains Mono', 'Fira Code', monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  min-height: 100vh;
  overflow-x: hidden;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--display);
}

/* SCROLLBAR */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--dim); border-radius: 2px; }

/* LAYOUT */
.app { display: flex; flex-direction: column; min-height: 100vh; }

/* MARKET MOVER NEWS BANNER */
.mm-banner {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.mm-banner-calm {
  background: transparent;
}
.mm-banner-bull  { background: rgba(34,211,165,0.06); }
.mm-banner-bear  { background: rgba(229,62,62,0.06); }
.mm-signal {
  display: flex; align-items: center; gap: 8px; flex-shrink: 0;
}
.mm-light {
  width: 11px; height: 11px; border-radius: 50%; flex-shrink: 0;
  animation: mmPulse 2s ease-in-out infinite;
}
.mm-light-bull  { background: var(--green); box-shadow: 0 0 8px rgba(34,211,165,0.7); }
.mm-light-bear  { background: var(--red);   box-shadow: 0 0 8px rgba(229,62,62,0.7); }
.mm-light-calm  { background: var(--muted); box-shadow: none; animation: none; }
@keyframes mmPulse {
  0%,100% { opacity: 1; }
  50%      { opacity: 0.45; }
}
.mm-rating {
  font-size: 10px; font-family: var(--mono); font-weight: 700;
  letter-spacing: 0.1em; text-transform: uppercase;
  padding: 2px 8px; border-radius: 4px; flex-shrink: 0;
}
.mm-rating-bull  { color: var(--green); background: rgba(34,211,165,0.12); border: 1px solid rgba(34,211,165,0.3); }
.mm-rating-bear  { color: var(--red);   background: rgba(229,62,62,0.12);  border: 1px solid rgba(229,62,62,0.3); }
.mm-rating-calm  { color: var(--muted); background: transparent; border: 1px solid var(--border); }
.mm-divider { width: 1px; height: 20px; background: var(--border); flex-shrink: 0; }
.mm-headline {
  font-size: 12px; color: var(--text); font-weight: 500;
  line-height: 1.4; flex: 1; min-width: 0;
}
.mm-headline a { color: var(--text); text-decoration: none; }
.mm-headline a:hover { color: var(--blue); text-decoration: underline; }
.mm-reason {
  font-size: 11px; color: var(--muted); flex-shrink: 0;
  font-style: italic; max-width: 260px;
}
.mm-chg {
  font-size: 11px; font-family: var(--mono); font-weight: 700; flex-shrink: 0;
}
@media (max-width: 768px) {
  .mm-reason { display: none; }
  .mm-banner { padding: 8px 14px; gap: 8px; }
}

/* MARKET INDICES ROW */
.indices-row {
  display: flex; align-items: stretch;
  height: 50px; background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  overflow: hidden;
  min-width: 0;
}
.indices-row-track {
  display: flex; align-items: stretch;
  flex: 1; min-width: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none; /* Firefox */
}
.indices-row-track::-webkit-scrollbar { display: none; } /* Chrome/Safari */
/* Tablet / iPad / phone portrait: full-page refresh (right); hidden on large desktop */
.indices-page-refresh-wrap {
  display: none;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
  padding: 0 10px 0 8px;
  border-left: 1px solid var(--border);
  background: var(--bg2);
}
@media (min-width: 768px) and (max-width: 1366px) {
  .indices-page-refresh-wrap { display: flex; }
}
@media (max-width: 767px) and (orientation: portrait) {
  .indices-page-refresh-wrap { display: flex; }
}
.indices-page-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 23px;
  height: 21px;
  margin: 0;
  padding: 0;
  font-size: 12px;
  line-height: 1;
  color: var(--blue);
  background: rgba(99, 179, 237, 0.1);
  border: 1px solid rgba(99, 179, 237, 0.35);
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--display);
  transition: background 0.12s ease, border-color 0.12s ease;
}
.indices-page-refresh-btn:hover {
  background: rgba(99, 179, 237, 0.18);
  border-color: rgba(99, 179, 237, 0.55);
}
.indices-page-refresh-btn:active {
  transform: scale(0.96);
}
.idx-item {
  display: flex; align-items: center; gap: 9px;
  flex: 1; min-width: 160px; padding: 0 20px;
  border-right: 1px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  transition: background 0.12s ease;
}
.idx-item:hover { background: rgba(99, 179, 237, 0.06); }
.idx-item:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: -2px;
}
.idx-item:last-child { border-right: none; }
.idx-label {
  font-size: 11px; font-weight: 700;
  color: var(--muted); letter-spacing: 0.07em; white-space: nowrap; flex-shrink: 0;
}
.mkt-price {
  font-family: var(--mono); font-size: 16px; font-weight: 600;
  color: var(--text); white-space: nowrap;
}
.mkt-chg { font-size: 13px; font-weight: 500; white-space: nowrap; }

/* TOP NAV */
nav {
  display: flex; align-items: center; gap: 0;
  height: 48px; padding: 0 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 100;
}
.nav-logo {
  font-family: var(--mono);
  font-size: 15px; font-weight: 700;
  color: var(--blue);
  letter-spacing: -0.02em;
  margin-right: 28px;
  white-space: nowrap;
  display: flex; align-items: center; gap: 8px;
  text-decoration: none;
}
.nav-logo:hover { opacity: 0.8; }
.nav-logo-icon { width: 28px; height: 28px; flex-shrink: 0; }
.nav-tabs { display: flex; gap: 2px; }
.nav-data { position: relative; display: inline-flex; }
.nav-data-menu {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 190px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--border2);
  background: rgba(22, 27, 39, 0.98);
  box-shadow: 0 18px 48px rgba(0,0,0,0.55);
  display: none;
  z-index: 1200;
}
.nav-data.open .nav-data-menu { display: block; }
.nav-data-item {
  width: 100%;
  text-align: left;
  padding: 9px 10px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  font-family: var(--display);
}
.nav-data-item:hover { background: rgba(59, 158, 255, 0.08); }
.nav-tab.nav-tab--data::after {
  content: '▾';
  margin-left: 8px;
  font-size: 11px;
  opacity: 0.75;
}
.nav-tab {
  padding: 6px 14px; border-radius: 4px;
  font-size: 15px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted); cursor: pointer;
  transition: color 0.15s, background 0.15s;
  border: none; background: none;
}
.nav-tab:hover { color: var(--text); background: var(--bg3); }
.nav-tab.active { color: var(--blue); background: var(--blue-dim); }
.nav-tab.nav-tab--quant-admin {
  color: #e53e3e;
}
.nav-tab.nav-tab--quant-admin:hover {
  color: #ff8585;
  background: rgba(229, 62, 62, 0.1);
}
.nav-tab.nav-tab--quant-admin.active {
  color: #e53e3e;
  background: rgba(229, 62, 62, 0.14);
}
.nav-data-item.nav-tab--quant-admin { color: #e53e3e; }
.nav-data-item.nav-tab--quant-admin:hover { color: #ff8585; background: rgba(229, 62, 62, 0.10); }
.nav-data-item.nav-tab--cleanpd { color: #22d3a5; }
.nav-data-item.nav-tab--cleanpd:hover { color: #6ee7b7; background: rgba(34, 211, 165, 0.10); }

.nav-right { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.market-status {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; font-family: var(--mono);
  color: var(--muted);
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.4} }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
#nav-clock { font-family: var(--mono); font-size: 11px; color: var(--muted); min-width: 70px; }

/* SEARCH BAR */
.search-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 20px;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  justify-content: flex-start;
}
.ticker-wrap { position: relative; }
.ticker-prefix {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  font-family: var(--mono); font-size: 13px; color: var(--blue); font-weight: 600;
  pointer-events: none;
}
#tickerInput {
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--text); font-family: var(--mono); font-size: 15px; font-weight: 700;
  padding: 7px 12px 7px 26px; border-radius: 6px; outline: none;
  width: 110px; letter-spacing: 0.04em;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#tickerInput:focus { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-glow); }
#tickerInput::placeholder { color: var(--dim); font-size: 11px; font-weight: 400; text-transform: none; letter-spacing: 0; }
.search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; min-width: 280px;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 1000; overflow: hidden;
}
.search-result {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 14px; cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid var(--border);
}
.search-result:last-child { border-bottom: none; }
.search-result:hover, .search-result.active { background: var(--bg3); }
.search-result-symbol {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--blue); min-width: 56px;
}
.search-result-name {
  font-size: 11px; color: var(--muted); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.btn-analyze {
  background: var(--blue); color: #fff; border: none;
  font-family: var(--font); font-size: 12px; font-weight: 600; letter-spacing: 0.04em;
  padding: 7px 18px; border-radius: 6px; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.btn-analyze:hover { opacity: 0.88; }
.btn-analyze:active { transform: scale(0.97); }
.btn-analyze:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-compare {
  background: var(--bg3);
  color: var(--muted);
  border: 1px solid var(--border2);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 7px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
  flex-shrink: 0;
}
.btn-compare:hover { border-color: rgba(229, 62, 62, 0.45); color: var(--text); }
.btn-compare.is-on {
  background: rgba(229, 62, 62, 0.18);
  border-color: rgba(229, 62, 62, 0.75);
  color: #fca5a5;
}
.btn-compare.is-on:hover { background: rgba(229, 62, 62, 0.28); color: #fecaca; }
.btn-compare:disabled { opacity: 0.45; cursor: not-allowed; }

/* Compare in chart toolbar: match .tf-select shape; active = red */
.chart-toolbar-compare-wrap {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
}
.chart-toolbar .btn-js2000 {
  -webkit-appearance: none;
  appearance: none;
  flex-shrink: 0;
  min-height: 30px;
  padding: 4px 10px;
  border-radius: 5px;
  border: 1px solid var(--blue);
  background: var(--blue-dim);
  color: var(--blue);
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.chart-toolbar .btn-js2000:hover:not(:disabled) {
  border-color: rgba(99, 179, 237, 0.45);
  color: var(--text);
}
.chart-toolbar .btn-js2000.is-on {
  border-color: rgba(34, 211, 165, 0.65);
  background: rgba(34, 211, 165, 0.12);
  color: #6ee7b7;
}
.chart-toolbar .btn-js2000:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}
.chart-toolbar .btn-compare.tf-compare-btn {
  -webkit-appearance: none;
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  min-height: 30px;
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: normal;
  text-transform: none;
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid var(--blue);
  background: var(--blue-dim);
  color: var(--blue);
  line-height: 1.2;
}
.chart-toolbar .btn-compare.tf-compare-btn:hover {
  background-color: rgba(59, 158, 255, 0.15);
  border-color: var(--blue);
  color: var(--text);
}
.chart-toolbar .btn-compare.tf-compare-btn.is-on {
  background: rgba(229, 62, 62, 0.12);
  border-color: rgba(229, 62, 62, 0.85);
  color: #f87171;
}
.chart-toolbar .btn-compare.tf-compare-btn.is-on:hover {
  background: rgba(229, 62, 62, 0.2);
  border-color: #f87171;
  color: #fecaca;
}

.ext-quotes-bar { display: flex; gap: 0; align-items: center; overflow-x: auto; scrollbar-width: none; flex: 1; }
.ext-quotes-bar::-webkit-scrollbar { display: none; }
.eq-item { display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 3px 16px; white-space: nowrap; flex-shrink: 0; }
.eq-top { display: flex; align-items: baseline; gap: 6px; }
.eq-ticker { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); }
.eq-price { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--text); }
.eq-chg { font-family: var(--mono); font-size: 10px; font-weight: 600; }
.eq-session { font-size: 8px; font-weight: 700; letter-spacing: 0.08em; color: var(--muted); text-transform: uppercase; }
.qt {
  font-family: var(--mono); font-size: 11px; font-weight: 600;
  color: var(--muted); cursor: pointer; padding: 3px 8px;
  border: 1px solid var(--border); border-radius: 4px; background: none;
  transition: color 0.15s, border-color 0.15s;
}
.qt:hover { color: var(--blue); border-color: var(--blue); }

.ticker-info {
  margin-left: auto; display: flex; align-items: center; gap: 16px;
  font-family: var(--mono);
}
.ti-price { font-size: 18px; font-weight: 700; }
.ti-change { font-size: 12px; font-weight: 500; }
.ti-name { font-size: 11px; color: var(--muted); max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stats-bar { display: flex; gap: 12px; padding: 12px 16px; border-bottom: 1px solid rgba(99,179,237,0.08); align-items: stretch; }
.stat-card { flex: 1; background: rgba(28,35,51,0.7); border: 1px solid rgba(99,179,237,0.12); border-radius: 10px; padding: 14px 18px; display: flex; flex-direction: column; gap: 2px; }
.stat-card-sm { flex: 0.8; }
.stat-stack { display: flex; flex-direction: column; gap: 6px; flex: 0.8; }
.stat-card-mini { padding: 7px 12px; gap: 0; }
.stat-card-mini .stat-card-value { font-size: 17px; margin: 2px 0 0; }
.stat-card-mini .stat-card-spark { margin-top: 3px; }
.stat-card-mini .stat-card-spark svg { width: 100%; height: 22px; }
/* Gauge stack */
.stat-stack-gauge { flex: 1.4; }
.stat-stack-gauge .peg-gauge-card,
.stat-stack-gauge .fg-gauge-card { flex: 1; }
.stat-stack-gauge .peg-gauge-value { font-size: 20px; }
.stat-stack-gauge .peg-gauge-top { margin: 2px 0 6px; }
.stat-stack-gauge .peg-gauge-zones { margin-top: 3px; }
.stat-stack-gauge .fg-arc { max-width: 90px; }
/* News panel in stats bar */
.stat-news-card { flex: 2.5; overflow: hidden; position: relative; }
.stat-news-list { overflow-y: auto; height: calc(100% - 18px); display: flex; flex-direction: column; margin-top: 6px; }
.stat-news-item { padding: 5px 0; border-bottom: 1px solid rgba(99,179,237,0.07); cursor: pointer; flex-shrink: 0; }
.stat-news-item:last-child { border-bottom: none; }
.stat-news-headline { font-size: 11px; line-height: 1.35; color: var(--text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.stat-news-item:hover .stat-news-headline { color: var(--blue); }
.stat-news-meta { font-size: 9px; color: var(--muted); margin-top: 2px; }
.news-list-modal-header { display: flex; align-items: center; padding: 18px 18px 0 24px; }
.ni-label { font-size: 9px; color: var(--blue); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; margin-bottom: 5px; font-family: var(--display); }
.ni-text { font-size: 13px; color: var(--text); line-height: 1.7; opacity: 0.9; margin-bottom: 4px; }
#priceActionWidget { margin-bottom: 6px; flex-shrink: 0; }
.pa-link { display: inline-flex; align-items: center; gap: 6px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; font-family: var(--display); color: var(--muted); background: none; border: none; cursor: pointer; padding: 3px 0; text-decoration: none; }
.pa-link:hover { color: var(--text); }
.pa-link.pa-ready { color: var(--blue); }
.pa-link.pa-ready:hover { color: var(--text); }
.stat-news-more { padding: 6px 0 2px; }
.stat-news-more button { background: none; border: none; color: var(--blue); font-size: 11px; cursor: pointer; padding: 0; font-family: var(--display); letter-spacing: 0.06em; opacity: 0.9; text-transform: uppercase; }
.stat-news-more button:hover { opacity: 1; }
.stat-card-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.stat-card-value { font-size: 24px; font-weight: 700; font-family: var(--mono); color: var(--text); margin: 4px 0; }
.stat-card-spark { margin-top: 4px; width: 100%; }

/* PEG GAUGE CARD */
.peg-gauge-card { flex: 1.4; justify-content: space-between; position: relative; }
.peg-gauge-top { display: flex; align-items: baseline; gap: 10px; margin: 4px 0 10px; }
.peg-gauge-value { font-size: 28px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.peg-gauge-signal { font-size: 11px; font-weight: 700; font-family: var(--mono); letter-spacing: 0.06em; padding: 2px 8px; border-radius: 4px; border: 1px solid; }
.peg-gauge-track-wrap { display: flex; flex-direction: column; gap: 4px; }
.peg-gauge-track {
  position: relative; height: 10px; border-radius: 6px;
  background: linear-gradient(to right, #22d3a5 0%, #48bb78 25%, #f6ad55 50%, #fc8181 75%, #e53e3e 100%);
  overflow: visible;
}
.peg-gauge-needle {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  width: 4px; height: 20px; background: #fff;
  border-radius: 2px; box-shadow: 0 0 6px rgba(0,0,0,0.6);
  transition: left 0.8s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.peg-gauge-ticks { display: flex; justify-content: space-between; font-size: 9px; color: var(--muted); font-family: var(--mono); letter-spacing: 0.06em; margin-top: 2px; }
.peg-gauge-zones { display: flex; justify-content: space-between; margin-top: 6px; }
.pz { font-size: 9px; font-family: var(--mono); opacity: 0.6; }
.pz-bull { color: #22d3a5; }
.pz-mid  { color: #f6ad55; }
.pz-bear { color: #e53e3e; }

/* ── FEAR & GREED GAUGE ──────────────────────────────────── */
.fg-gauge-card { flex: 1.3; justify-content: space-between; }
.fg-gauge-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; margin: 2px 0 0; }
.fg-arc { width: 100%; max-width: 130px; }
.fg-arc-bg  { stroke: rgba(255,255,255,0.07); }
.fg-arc-ef  { stroke: #e53e3e; }
.fg-arc-f   { stroke: #f6813d; }
.fg-arc-n   { stroke: #f6e05e; }
.fg-arc-g   { stroke: #9ae67e; }
.fg-arc-eg  { stroke: #22d3a5; }
.fg-score-wrap { display: flex; flex-direction: column; align-items: center; margin-top: -4px; }
.fg-score { font-size: 26px; font-weight: 700; font-family: var(--mono); color: var(--text); line-height: 1; }
.fg-label { font-size: 10px; font-weight: 700; letter-spacing: 0.07em; text-transform: uppercase; margin-top: 2px; }
.fg-zones { display: flex; justify-content: space-between; margin-top: 4px; }
.fg-z { font-size: 8px; font-family: var(--mono); opacity: 0.55; }
.fg-z-ef { color: #e53e3e; }
.fg-z-n  { color: #f6e05e; }
.fg-z-eg { color: #22d3a5; }

.up { color: var(--green); }
.down { color: var(--red); }
.neutral { color: var(--muted); }

/* MAIN BODY */
.main-body { display: flex; flex: 1; min-height: 600px; }

/* LEFT PANEL */
.left-panel { width: 220px; min-width: 220px; border-right: 1px solid var(--border); display: flex; flex-direction: column; }
.panel-header { padding: 10px 14px; border-bottom: 1px solid var(--border); font-size: 10px; font-weight: 600; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; }
.panel-header button { font-size: 10px; color: var(--blue); background: none; border: none; cursor: pointer; font-weight: 500; }
.panel-header button.scanner-refresh-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  line-height: 1;
}
.panel-header button.scanner-refresh-spin {
  animation: scanner-refresh-spin 0.75s linear infinite;
  pointer-events: none;
  opacity: 0.85;
}
@keyframes scanner-refresh-spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.scanner-list { flex: 1; overflow-y: auto; max-height: calc(100vh - 140px); }
.scanner-row {
  display: grid; grid-template-columns: 58px 1fr 62px;
  align-items: center; padding: 7px 14px; gap: 4px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background 0.12s;
  position: relative;
}
.scanner-row:hover { background: var(--bg3); }
.scanner-row.active { background: var(--blue-dim); border-left: 2px solid var(--blue); padding-left: 12px; }
.sr-ticker { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text); }
.sr-price { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.sr-chg { font-family: var(--mono); font-size: 10px; color: var(--muted); font-weight: 600; text-align: left; line-height: 1.2; margin-top: 1px; }
.sr-hl { font-size: 10px; color: var(--muted); }
.sr-date { font-family: var(--mono); font-size: 11.15px; font-weight: 700; }
.sr-vol { font-size: 10px; color: var(--muted); grid-column: 1 / -1; }

/* ── Earnings Popup ────────────────────────────────────────── */
#earningsPopup { position:absolute; inset:0; height:auto; z-index:200; background:var(--bg2); padding:14px 14px 10px; display:flex; flex-direction:column; pointer-events:none; box-sizing:border-box; overflow:hidden; border-radius:10px; }
#earningsPopup.epop-locked { pointer-events:auto; box-shadow:0 0 0 1px var(--border2); }
.epop-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:12px; flex-shrink:0; gap:8px; }
#epopTitle { font-size:10px; font-weight:700; letter-spacing:0.06em; text-transform:uppercase; color:var(--muted); white-space:nowrap; }
#epopTicker { font-size:9px; color:var(--muted); white-space:nowrap; flex-shrink:0; }
.epop-close-btn { background:none; border:none; cursor:pointer; color:var(--muted); font-size:17px; line-height:1; padding:0 2px; margin-left:auto; transition:color 0.1s; flex-shrink:0; }
.epop-close-btn:hover { color:var(--text); }
.im-card.im-hoverable { cursor:default; background:#273046; border-color:rgba(114,206,255,0.25); transition: border-color 0.15s, background 0.15s; }
.im-card.im-hoverable:hover { background:#2d3a53; border-color:#72ceff; }

/* ── Watchlist ─────────────────────────────────────────────── */
.wl-header { gap: 6px; }
/* Custom watchlist dropdown */
.wl-dropdown { flex: 1; min-width: 0; position: relative; }
.wl-dropdown-trigger { display: flex; align-items: center; justify-content: space-between; gap: 4px; background: var(--bg2); color: var(--text); border: 1px solid var(--border); border-radius: 5px; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; padding: 4px 6px; cursor: pointer; text-transform: uppercase; user-select: none; font-family: var(--display); }
.wl-dropdown-trigger:hover, .wl-dropdown-trigger.open { border-color: var(--blue); }
.wl-dropdown-trigger.active { color: var(--blue); }
.wl-dropdown-caret { font-size: 7px; opacity: 0.5; flex-shrink: 0; }
.wl-dropdown-menu { position: absolute; top: calc(100% + 3px); left: 0; right: 0; background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; z-index: 500; display: none; box-shadow: 0 6px 20px rgba(0,0,0,0.5); overflow: hidden; }
.wl-dropdown-menu.open { display: block; }
.wl-menu-item { display: flex; align-items: center; justify-content: space-between; padding: 7px 10px; font-size: 11px; color: var(--text); cursor: pointer; gap: 4px; font-family: var(--font); }
.wl-menu-item:hover { background: var(--bg3); }
.wl-menu-item.active { color: var(--blue); }
.wl-menu-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.wl-menu-sep { border-top: 1px solid var(--border); margin: 2px 0; }
.wl-menu-new { color: var(--green); font-weight: 600; }
.wl-menu-rename { flex-shrink: 0; background: none; border: none; color: var(--muted); font-size: 11px; cursor: pointer; padding: 2px 4px; border-radius: 3px; line-height: 1; }
.wl-menu-rename:hover { color: var(--blue); background: rgba(99,179,237,0.1); }
.wl-menu-delete { flex-shrink: 0; background: none; border: none; color: var(--red) !important; font-size: 10px; cursor: pointer; padding: 2px 4px; border-radius: 3px; opacity: 1; line-height: 1; }
.wl-menu-delete:hover { background: rgba(229,62,62,0.15); }
.wl-remove { position: absolute; top: 2px; right: 2px; width: 14px; height: 14px; background: rgba(229,62,62,0.15); border: none; color: var(--red); font-size: 9px; line-height: 1; cursor: pointer; opacity: 0; transition: opacity 0.15s; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 3px; }
.scanner-row:hover .wl-remove { opacity: 1; }
.wl-empty { padding: 24px 14px; text-align: center; color: var(--muted); font-size: 11px; line-height: 1.7; }

/* CENTER PANEL */
.center-panel { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* CHART AREA */
.chart-area { height: 340px; min-height: 340px; flex-shrink: 0; position: relative; background: var(--bg); border-bottom: 1px solid var(--border); overflow: hidden; }
#priceChartArea { display: flex; flex-direction: column; }
#priceChartArea .chart-wrap { flex: 1; min-height: 0; height: auto; }
.chart-ts-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
  min-width: 0;
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
}
.chart-ts-row .main-chart-ts {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 0 4px 14px;
  border-bottom: none;
  background: transparent;
}
.main-chart-ts {
  flex-shrink: 0;
  padding: 5px 14px 4px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  background: var(--bg2);
  border-bottom: 1px solid var(--border);
  letter-spacing: 0.03em;
}
#valueGraphArea { display: flex; flex-direction: column; overflow: hidden; }
#valueGraphArea .chart-wrap { flex: 1; height: auto; }
.chart-toolbar { display: flex; align-items: center; gap: 8px; padding: 6px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.chart-toolbar-overlays { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ct-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.ct-btn { font-size: 11px; font-weight: 500; color: var(--muted); background: none; border: 1px solid var(--border); border-radius: 3px; padding: 2px 8px; cursor: pointer; transition: all 0.12s; }
.ct-btn:hover, .ct-btn.active { color: var(--blue); border-color: var(--blue); background: var(--blue-dim); }
.tf-select { font-size: 12px; font-weight: 600; font-family: var(--mono); color: var(--blue); background: var(--blue-dim); border: 1px solid var(--blue); border-radius: 5px; padding: 4px 10px; cursor: pointer; outline: none; appearance: none; -webkit-appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%233b9eff'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; padding-right: 24px; }
.tf-select:hover { background-color: rgba(59,158,255,0.15); color: var(--text); }
.chart-toolbar .tf-select {
  box-sizing: border-box;
  min-height: 30px;
  line-height: 1.2;
}
.chart-wrap { position: relative; height: calc(100% - 33px); }
#mainChart { width: 100%; height: 100%; }

/* INDICATOR SUBCHARTS */
.indicator-panel { height: 110px; border-bottom: 1px solid var(--border); position: relative; background: var(--bg); }
.ind-label { position: absolute; top: 6px; left: 10px; font-size: 10px; font-weight: 600; color: var(--muted); letter-spacing: 0.08em; z-index: 1; }
.ind-label span { color: var(--blue); }
#rsiChart, #macdChart { width: 100%; height: 100%; }

/* BOTTOM DATA — single key-levels card (full width of center column) */
.bottom-data {
  flex: 0 0 auto;
  padding: 12px 14px 14px;
  display: block;
  width: 100%;
  box-sizing: border-box;
}
.bottom-data .data-card {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

/* RIGHT PANEL */
.right-panel { width: 300px; min-width: 300px; border-left: 1px solid var(--border); display: flex; flex-direction: column; }
.right-tabs { display: flex; border-bottom: 1px solid var(--border); }
.right-tab { flex: 1; padding: 10px 0; text-align: center; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); cursor: pointer; transition: color 0.12s, border-color 0.12s; border-bottom: 2px solid transparent; }
.right-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
.right-content { flex: 1; overflow-y: auto; }

/* AI PANEL */
.ai-panel { padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.conviction-ring-wrap { display: flex; align-items: center; gap: 14px; }
.conviction-ring { position: relative; width: 72px; height: 72px; flex-shrink: 0; }
.conviction-ring svg { transform: rotate(-90deg); }
.conviction-num { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.conviction-val { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--blue); line-height: 1; }
.conviction-lbl { font-size: 9px; color: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.bias-badge { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; letter-spacing: 0.08em; padding: 4px 10px; border-radius: 4px; text-transform: uppercase; }
.bias-badge.long { background: rgba(34,211,165,0.12); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.bias-badge.short { background: rgba(245,101,101,0.12); color: var(--red); border: 1px solid rgba(245,101,101,0.3); }
.bias-badge.neutral { background: rgba(113,128,150,0.12); color: var(--muted); border: 1px solid var(--border2); }

.levels-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.level-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 8px 10px; }
.lc-label { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; margin-bottom: 3px; }
.lc-val { font-family: var(--mono); font-size: 13px; font-weight: 700; }
.lc-val.entry { color: var(--amber); }
.lc-val.target { color: var(--green); }
.lc-val.stop { color: var(--red); }
.lc-val.rr { color: var(--blue); }

.scores-list { display: flex; flex-direction: column; gap: 6px; }
.score-row { display: flex; align-items: center; gap: 8px; }
.score-name { font-size: 11px; color: var(--muted); width: 90px; flex-shrink: 0; }
.score-bar-bg { flex: 1; height: 3px; background: var(--dim); border-radius: 2px; }
.score-bar { height: 100%; border-radius: 2px; transition: width 0.8s ease; }
.score-num { font-family: var(--mono); font-size: 11px; font-weight: 600; min-width: 28px; text-align: right; }

.thesis-text { font-size: 12px; line-height: 1.7; color: var(--text); }
.section-title { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px; }

.bullet-list { display: flex; flex-direction: column; gap: 5px; }
.bullet-item { display: flex; align-items: flex-start; gap: 7px; font-size: 11px; color: var(--muted); line-height: 1.5; }
.bullet-dot { width: 5px; height: 5px; border-radius: 50%; flex-shrink: 0; margin-top: 5px; }
.bullet-dot.green { background: var(--green); }
.bullet-dot.red { background: var(--red); }

/* NEWS PANEL */
.news-list { padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.news-item { border-bottom: 1px solid var(--border); padding-bottom: 10px; }
.news-item:last-child { border-bottom: none; }
.news-headline { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; margin-bottom: 4px; cursor: pointer; }
.news-headline:hover { color: var(--blue); }
.news-meta { font-size: 10px; color: var(--muted); }


/* DATA CARDS */
.data-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; padding: 12px; }
.dc-title { font-size: 10px; font-weight: 600; letter-spacing: 0.1em; color: var(--muted); text-transform: uppercase; margin-bottom: 10px; }
.dc-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 16px;
  align-items: center;
}
@media (max-width: 520px) {
  .dc-grid { grid-template-columns: 1fr; gap: 8px; }
}
.dc-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 6px 0;
  border-bottom: 1px solid rgba(99, 179, 237, 0.07);
}
/* Top row (Support 1 & 2); bottom row (Resist 1 & 2) has no underline */
.dc-row:nth-child(3),
.dc-row:nth-child(4) {
  border-bottom: none;
}
.dc-key {
  font-size: 11px;
  color: var(--muted);
  flex: 1 1 auto;
  min-width: 0;
}
.dc-val {
  font-family: var(--mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.dc-val.up { color: var(--green); }
.dc-val.down { color: var(--red); }

/* OHLC BAR */
.ohlc-bar { display: flex; gap: 16px; padding: 6px 14px; background: var(--bg2); border-bottom: 1px solid var(--border); font-family: var(--mono); font-size: 11px; }

/* Cross-portfolio positions for the analyzed ticker */
.cross-pf-holdings {
  padding: 8px 14px 10px;
  background: rgba(99,179,237,0.04);
  border-bottom: 1px solid var(--border);
  font-size: 11px;
}
.cross-pf-holdings-title {
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); text-transform: uppercase; margin-bottom: 8px;
}
.cross-pf-grid {
  display: flex; flex-wrap: wrap; gap: 8px;
}
.cross-pf-card {
  border: 1px solid var(--border2);
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--bg);
  min-width: 0;
  max-width: 100%;
  flex: 1 1 200px;
}
.cross-pf-name {
  font-weight: 600; color: var(--blue); font-size: 12px; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cross-pf-meta { color: var(--muted); font-size: 10px; line-height: 1.4; margin-bottom: 6px; }
.cross-pf-pnl-row { font-family: var(--mono); font-size: 11px; display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: baseline; }
.cross-pf-pnl-lbl { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: 0.04em; }
.cross-pf-opt-tag {
  font-size: 10px;
  color: var(--amber);
  font-family: var(--mono);
  margin-top: 2px;
  line-height: 1.35;
}
.cross-pf-opt-tag .cross-pf-dte { color: var(--amber); }
.cross-pf-opt-tag .sr-date { color: var(--text); font-weight: 700; }
.ohlc-item { display: flex; gap: 5px; }
.ohlc-lbl { color: var(--muted); }
.ohlc-val { font-weight: 600; }

/* LOADING */
.loading-overlay {
  position: absolute; inset: 0; background: rgba(15,17,23,0.85);
  display: none; align-items: center; justify-content: center;
  flex-direction: column; gap: 12px; z-index: 50;
}
.loading-overlay.active { display: flex; }
.loading-spinner { width: 28px; height: 28px; border: 2px solid var(--border2); border-top-color: var(--blue); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 12px; color: var(--muted); letter-spacing: 0.06em; }

/* WATCHLIST */

/* ERROR */
.error-toast { background: rgba(245,101,101,0.1); border: 1px solid rgba(245,101,101,0.3); border-radius: 5px; padding: 10px 14px; color: var(--red); font-size: 12px; margin: 12px; }
.notice-toast-global {
  position: fixed;
  top: 60px;
  right: 20px;
  z-index: 999;
  max-width: 360px;
  padding: 12px 14px;
  background: var(--bg2);
  border: 1px solid rgba(34, 211, 165, 0.45);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  animation: fadeIn 0.2s ease;
}

/* EMPTY STATE */
.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 10px; color: var(--muted); }
.empty-state .big { font-size: 32px; opacity: 0.3; }
.empty-state p { font-size: 12px; }

/* INSIDER PANEL */
.insider-summary {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
  padding: 12px 14px; border-bottom: 1px solid var(--border);
}
.insider-stat { background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 10px 12px; }
.is-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 4px; }
.is-val { font-family: var(--mono); font-size: 16px; font-weight: 700; }
.is-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.is-val.buy { color: var(--green); }
.is-val.sell { color: var(--red); }

.insider-sentiment-bar {
  margin: 0 14px 12px; padding: 10px 12px;
  background: var(--bg3); border: 1px solid var(--border); border-radius: 5px;
}
.isb-label { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; display: flex; justify-content: space-between; }
.isb-track { height: 6px; background: var(--dim); border-radius: 3px; overflow: hidden; }
.isb-fill { height: 100%; border-radius: 3px; transition: width 0.8s ease; }

.insider-list { padding: 0 14px 14px; display: flex; flex-direction: column; gap: 6px; }
.insider-item {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; padding: 8px 12px;
  border-left: 3px solid transparent;
  transition: border-color 0.12s;
}
.insider-item.buy { border-left-color: var(--green); }
.insider-item.sell { border-left-color: var(--red); }
.ii-top { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 6px; gap: 6px; }
.ii-name { font-size: 12px; font-weight: 600; color: var(--text); }
.ii-title { font-size: 10px; color: var(--muted); margin-top: 1px; }
.ii-badge {
  font-size: 10px; font-weight: 700; letter-spacing: 0.06em;
  padding: 2px 7px; border-radius: 3px; flex-shrink: 0; text-transform: uppercase;
}
.ii-badge.buy { background: rgba(34,211,165,0.12); color: var(--green); border: 1px solid rgba(34,211,165,0.25); }
.ii-badge.sell { background: rgba(245,101,101,0.12); color: var(--red); border: 1px solid rgba(245,101,101,0.25); }
.ii-bottom { display: flex; gap: 16px; }
.ii-stat { display: flex; flex-direction: column; gap: 2px; }
.ii-label { font-size: 9px; color: var(--muted); letter-spacing: 0.07em; text-transform: uppercase; }
.ii-val { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--text); }
.ii-est { font-weight: 400; font-size: 9px; color: var(--muted); }

/* BLOCK TRADE FEED */
.block-feed-section { border-top: 1px solid var(--border); background: var(--bg2); padding: 20px 24px; }
.block-feed-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.block-feed-title { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 10px; }
.block-feed-title::before { content: ''; display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; }
.company-modal .block-feed-section { padding-top: 34px; }
.company-modal .block-feed-header { padding-right: 48px; }
.block-feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
.block-trade-card { background: var(--bg3); border: 1px solid rgba(34,211,165,0.15); border-left: 3px solid var(--green); border-radius: 8px; padding: 14px 16px; }
.btc-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.btc-ticker { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--green); }
.btc-value { font-family: var(--mono); font-size: 14px; font-weight: 700; color: var(--text); }
.btc-buyer { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.btc-buyer span { color: var(--text); font-weight: 600; }
.btc-meta { display: flex; gap: 16px; font-size: 11px; color: var(--muted); font-family: var(--mono); }
.block-feed-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 30px; }

/* SECTION ROW (Gainers + Inflow Ratio) */
.section-row { border-top: 1px solid var(--border); background: var(--bg2); padding: 20px 24px; }
.section-row-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.section-row-title { font-size: 12px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); display: flex; align-items: center; gap: 10px; font-family: var(--display); }
.live-dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 6px var(--green); animation: pulse 2s infinite; flex-shrink: 0; }
.section-row-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }

/* Global indices grid: 6 across on wide screens */
.global-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); }
.global-grid-note {
  font-size: 12px;
  color: var(--muted);
  margin: 2px 2px -4px;
  line-height: 1.45;
}
.global-grid-group {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(59,158,255,0.08);
  border: 1px solid rgba(59,158,255,0.18);
  color: rgba(99,179,237,0.95);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.section-row-empty { text-align: center; color: var(--muted); font-size: 12px; padding: 20px; grid-column: 1/-1; }

/* BUFFETT CRITERIA CARDS */
.buffett-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px 10px;
  cursor: pointer; transition: border-color 0.15s, transform 0.1s;
  display: flex; flex-direction: column; gap: 3px;
}
.buffett-card:hover { border-color: var(--green); transform: translateY(-1px); }
.bc-top { display: flex; justify-content: space-between; align-items: center; }
.bc-ticker { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--text); }
.bc-discount { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.bc-price { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.bc-fair { font-size: 11px; color: var(--muted); }
.bc-fair span { color: var(--green); font-family: var(--mono); font-weight: 600; }
.bc-quality { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.bc-quality span { font-size: 9px; font-family: var(--mono); color: var(--green); background: rgba(34,211,165,0.08); border: 1px solid rgba(34,211,165,0.2); border-radius: 3px; padding: 1px 4px; }
.bc-detail { font-size: 10px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.bc-author { font-size: 9px; color: var(--blue); letter-spacing: 0.06em; margin-top: 5px; opacity: 0.7; }

/* TICKER CARD */
.ticker-card {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 14px 10px;
  cursor: pointer; transition: border-color 0.15s, transform 0.1s;
  display: flex; flex-direction: column; gap: 4px;
  position: relative; overflow: hidden;
}
.ticker-card:hover { border-color: var(--blue); transform: translateY(-1px); }
.ticker-card.inflow-card:hover { border-color: var(--green); }
.global-grid .ticker-card { cursor: default; }
.global-grid .ticker-card.global-closed .tc-ticker {
  color: rgba(113, 128, 150, 0.85);
}
.global-grid .ticker-card.global-closed .uv-badge {
  opacity: 0.65;
}
.global-header-actions { display: flex; align-items: center; gap: 10px; }
.global-tf-select {
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  font-family: var(--display);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
}
.global-tf-select:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(99,179,237,0.15); }

.global-compare { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.global-left { padding-right: 0; }
.global-right { min-width: 0; }

.global-chart-wrap {
  background: rgba(28,35,51,0.55);
  border: 1px solid rgba(99,179,237,0.12);
  border-radius: 12px;
  padding: 14px 14px 10px;
}
.global-chart-title { font-family: var(--display); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }
.global-chart-sub { font-family: var(--font); font-size: 11px; color: var(--muted); margin-top: 4px; }
.global-chart-canvas { height: 340px; margin-top: 10px; position: relative; }
.global-chart-canvas canvas { width: 100% !important; height: 100% !important; }

.global-legend { margin-top: 12px; background: rgba(28,35,51,0.35); border: 1px solid rgba(99,179,237,0.10); border-radius: 12px; padding: 12px 14px; }
.global-legend-title { font-family: var(--display); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text); }
.global-legend-empty { font-size: 11px; color: var(--muted); margin-top: 6px; }
.global-legend-list { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.global-legend-header { opacity: 0.85; }
.global-legend-header .glh {
  font-family: var(--display);
  font-size: 9px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.global-legend-header .global-legend-swatch { opacity: 0; }
.global-legend-header .global-legend-remove { opacity: 0; pointer-events: none; }
.global-legend-header .global-legend-name,
.global-legend-header .global-legend-region,
.global-legend-header .global-legend-sym { text-align: left; }
.global-legend-header .global-legend-pct,
.global-legend-header .global-legend-top { text-align: right; }
.global-legend-row {
  display: grid;
  grid-template-columns: 12px 1fr 140px 86px 64px 72px 24px;
  gap: 10px;
  align-items: center;
}
.global-legend-left { display: contents; }
.global-legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(0,0,0,0.25); }
.global-legend-name { font-size: 12px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.global-legend-right { display: contents; }
.global-legend-pct { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); min-width: 76px; text-align: right; }
.global-legend-top { font-family: var(--mono); font-size: 11px; font-weight: 700; color: var(--muted); min-width: 54px; text-align: right; }
.global-legend-region { font-family: var(--font); font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left; }
.global-legend-sym { font-family: var(--mono); font-size: 10px; color: var(--muted); flex-shrink: 0; }
.global-legend-remove {
  width: 24px; height: 24px; padding: 0; border: none; border-radius: 6px;
  background: rgba(229, 62, 62, 0.12); color: var(--red); font-size: 12px; line-height: 1;
  cursor: pointer; flex-shrink: 0; font-family: var(--display);
  transition: background 0.12s, color 0.12s;
}
.global-legend-remove:hover { background: rgba(229, 62, 62, 0.22); color: #fca5a5; }

.global-event-panel {
  background: rgba(28,35,51,0.45);
  border: 1px solid rgba(99,179,237,0.12);
  border-radius: 12px;
  padding: 14px 14px;
}
.global-event-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.global-event-kicker { font-family: var(--display); font-size: 10px; font-weight: 900; letter-spacing: 0.12em; text-transform: uppercase; color: var(--blue); }
.global-event-headline { font-family: var(--display); font-size: 16px; font-weight: 800; color: var(--text); margin-top: 6px; line-height: 1.25; }
.global-event-meta { font-size: 11px; color: var(--muted); margin-top: 6px; }
.global-event-snippet { margin-top: 10px; font-size: 12px; color: var(--text); opacity: 0.92; line-height: 1.6; }
.global-event-link { margin-top: 8px; font-size: 12px; }
.global-event-link a { color: var(--blue); text-decoration: none; font-weight: 700; }
.global-event-link a:hover { text-decoration: underline; }
.global-event-essay { margin-top: 12px; padding-top: 12px; border-top: 1px solid rgba(99,179,237,0.10); }
.global-event-status { font-size: 12px; color: var(--muted); }
.global-event-text { white-space: pre-wrap; line-height: 1.8; font-size: 13px; color: var(--text); }

.global-grid .ticker-card { cursor: pointer; }
.global-grid .ticker-card.global-selected { border-color: rgba(99,179,237,0.55); box-shadow: 0 0 0 3px rgba(99,179,237,0.10); }

@media (max-width: 980px) {
  .global-chart-canvas { height: 300px; }
}

@media (max-width: 1200px) {
  .global-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .global-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.tc-top-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 2px; }
.tc-rank { font-size: 10px; color: var(--muted); font-family: var(--display); letter-spacing: 0.10em; text-transform: uppercase; }
.uv-badge { font-size: 9px; font-weight: 800; letter-spacing: 0.10em; padding: 2px 5px; border-radius: 3px; font-family: var(--display); text-transform: uppercase; }
.uv-unusual { background: rgba(99,179,237,0.15); color: var(--blue); }
.uv-highvol { background: rgba(107,114,128,0.2); color: var(--muted); }
.ticker-card.unusual-card { background: rgba(99,179,237,0.09); border-color: rgba(99,179,237,0.25); }
.tc-ticker { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.tc-price { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--muted); }
.tc-change { font-family: var(--mono); font-size: 15px; font-weight: 700; }
.tc-ratio { font-family: var(--mono); font-size: 15px; font-weight: 700; color: var(--green); }
.tc-detail { font-size: 10px; color: var(--muted); font-family: var(--font); }
.tc-vol-ratio { font-family: var(--mono); font-size: 14px; font-weight: 700; }
.tc-vol-detail { font-size: 10px; color: var(--muted); margin-top: 2px; font-family: var(--font); }
.tc-cta { font-size: 10px; color: var(--blue); letter-spacing: 0.10em; margin-top: 4px; font-family: var(--display); text-transform: uppercase; }

/* PEG BADGE */
.peg-badge {
  display: flex; align-items: center; justify-content: space-between;
  padding: 4px 8px; border-radius: 4px; margin-top: 8px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  border: 1px solid; letter-spacing: 0.04em;
}
.peg-label { font-weight: 700; }
.peg-val { opacity: 0.75; font-size: 9px; }
.peg-strong-bull { background: rgba(34,211,165,0.12); border-color: rgba(34,211,165,0.45); color: #22d3a5; }
.peg-bull        { background: rgba(72,187,120,0.10); border-color: rgba(72,187,120,0.35); color: #48bb78; }
.peg-neutral     { background: rgba(246,173,85,0.10); border-color: rgba(246,173,85,0.35); color: #f6ad55; }
.peg-bear        { background: rgba(252,129,129,0.10); border-color: rgba(252,129,129,0.35); color: #fc8181; }
.peg-strong-bear { background: rgba(229,62,62,0.10);  border-color: rgba(229,62,62,0.40);  color: #e53e3e; }

/* INSIGHT PANEL */
.insight-section { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.insight-section:last-child { border-bottom: none; }
.insight-section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); margin-bottom: 12px; }
.insight-metrics { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }
.im-card { background: var(--bg3); border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px; }
.im-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.1em; font-weight: 800; margin-bottom: 3px; font-family: var(--display); }
.im-value { font-family: var(--font); font-size: 13px; font-weight: 700; color: var(--text); }
.momentum-wrap { display: flex; align-items: center; gap: 14px; }
.momentum-score { font-family: var(--mono); font-size: 42px; font-weight: 800; line-height: 1; min-width: 56px; }
.momentum-right { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.momentum-label { font-size: 13px; font-weight: 700; font-family: var(--mono); letter-spacing: 0.06em; }
.momentum-bar-track { height: 8px; background: var(--bg3); border-radius: 4px; overflow: hidden; border: 1px solid var(--border); }
.momentum-bar-fill { height: 100%; border-radius: 4px; transition: width 0.8s ease; }
.momentum-detail { font-size: 9px; color: var(--muted); letter-spacing: 0.04em; }
.iv-grid { display: flex; flex-direction: column; gap: 6px; }
.iv-row { display: flex; justify-content: space-between; align-items: center; padding: 4px 0; border-bottom: 1px solid rgba(255,255,255,0.04); }
.iv-row:last-child { border-bottom: none; }
.iv-key { font-size: 11px; color: var(--muted); }
.iv-val { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--text); }
.iv-signal { margin-top: 10px; font-size: 12px; font-weight: 700; font-family: var(--mono); letter-spacing: 0.06em; }

/* COMPANY MODAL */
.company-modal-overlay {
  position: fixed; inset: 0; background: rgba(10,13,20,0.85);
  display: flex; align-items: center; justify-content: center;
  z-index: 500; backdrop-filter: blur(4px);
}

/* Above company modal (500), guide (1000), DCF (2000) so article reader is always visible */
#newsModal.company-modal-overlay,
#newsListModal.company-modal-overlay {
  z-index: 2200;
}
.company-modal {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; width: 560px; max-width: calc(100vw - 40px);
  max-height: 80vh; position: relative;
  display: flex; flex-direction: column;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
.company-modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; border: none; color: var(--muted);
  font-size: 16px; cursor: pointer; z-index: 1; padding: 4px 8px;
  border-radius: 4px; transition: color 0.12s, background 0.12s;
}
.company-modal-close:hover { color: var(--text); background: var(--bg3); }
.os-scanner-refresh {
  position: absolute; top: 14px; right: 56px;
  background: none; border: none; color: var(--blue);
  font-size: 15px; cursor: pointer; z-index: 2; padding: 4px 10px;
  border-radius: 4px; transition: color 0.12s, background 0.12s;
}
.os-scanner-refresh:hover { color: #90cdf4; background: var(--bg3); }
/* Options scanner: toolbar must not sit under absolute ↻ / ✕ */
.os-modal-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 10px;
  padding-right: 100px;
}
.os-modal-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.company-modal-body { overflow-y: auto; padding: 24px; display: flex; flex-direction: column; gap: 16px; }

.cm-header { display: flex; align-items: flex-start; gap: 14px; padding-bottom: 16px; border-bottom: 1px solid var(--border); }
.cm-logo { width: 44px; height: 44px; object-fit: contain; border-radius: 8px; background: var(--bg3); flex-shrink: 0; }
.cm-header-info { flex: 1; min-width: 0; }
.cm-ticker { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--blue); }
.cm-name { font-size: 14px; font-weight: 600; color: var(--text); margin-top: 2px; }
.cm-industry { font-size: 11px; color: var(--muted); margin-top: 3px; }
.cm-price-block { text-align: right; flex-shrink: 0; padding-right: 32px; }
.cm-price { font-family: var(--mono); font-size: 22px; font-weight: 700; color: var(--text); }
.cm-change { font-family: var(--mono); font-size: 13px; font-weight: 600; margin-top: 2px; }
.cm-change-dollar { margin-top: 4px; }
.cm-change-pct { font-size: 12px; opacity: 0.9; }

.cm-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.cm-stat { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; display: flex; flex-direction: column; gap: 3px; }
.cm-stat-lbl { font-size: 10px; color: var(--muted); letter-spacing: 0.08em; text-transform: uppercase; }
.cm-stat-val { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); }

.cm-section-title { font-size: 10px; font-weight: 700; letter-spacing: 0.12em; color: var(--muted); text-transform: uppercase; margin-bottom: -4px; }

.cm-peers { display: flex; flex-wrap: wrap; gap: 6px; }
.cm-peer-btn {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--text); background: var(--bg3); border: 1px solid var(--border);
  border-radius: 5px; padding: 5px 12px; cursor: pointer;
  transition: color 0.12s, border-color 0.12s;
}
.cm-peer-btn:hover { color: var(--blue); border-color: var(--blue); }

.cm-news { display: flex; flex-direction: column; gap: 8px; }
.cm-news-item { background: var(--bg3); border: 1px solid var(--border); border-radius: 6px; padding: 10px 12px; cursor: pointer; transition: border-color 0.12s, background 0.12s, box-shadow 0.12s; }
.cm-news-item:hover { border-color: var(--blue); }
.cm-news-item.cm-news-item--selected {
  border-color: var(--blue);
  background: rgba(99, 179, 237, 0.08);
  box-shadow: inset 0 0 0 1px rgba(99, 179, 237, 0.25);
}

/* In-app article reader (iframe + fallback) */
.news-reader-modal { max-height: 92vh; }
.news-reader-body { padding: 16px 20px 20px; gap: 0; }
.news-reader-meta { font-size: 10px; color: var(--blue); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 8px; }
.news-reader-title { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 12px; }
.news-reader-body-main { font-size: 13px; color: var(--text); line-height: 1.65; }
.news-reader-body-main .news-reader-note { font-size: 11px; color: var(--muted); line-height: 1.45; margin-bottom: 12px; }
.news-reader-snippet--lead {
  font-size: 14px;
  line-height: 1.7;
  opacity: 0.95;
  margin-bottom: 16px;
  padding: 12px 14px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 8px;
  border-left: 3px solid var(--blue);
}
.news-reader-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 6px; }
.news-reader-actions { margin-top: 0; flex: 1; }
.news-reader-open-tab {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 10px 16px; border-radius: 6px; font-size: 12px; font-weight: 600;
  background: var(--bg3); border: 1px solid var(--border); color: var(--blue);
  text-decoration: none; transition: border-color 0.12s, background 0.12s;
}
.news-reader-open-tab--primary {
  width: 100%;
  box-sizing: border-box;
  padding: 12px 16px;
  font-size: 13px;
  background: rgba(59, 158, 255, 0.12);
  border-color: rgba(59, 158, 255, 0.45);
}
.news-reader-open-tab:hover { border-color: var(--blue); background: rgba(99, 179, 237, 0.08); }
.news-reader-open-tab--primary:hover { background: rgba(59, 158, 255, 0.2); }

/* Bullish/Bearish pill in news reader (bottom-left) */
.news-impact-pill {
  position: static;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 12px;
  border-radius: 999px;
  border: 1px solid var(--border2);
  background: rgba(113, 128, 150, 0.12);
  color: var(--muted);
  flex-shrink: 0;
}
.news-impact-pill--bull { border-color: rgba(34,211,165,0.35); background: rgba(34,211,165,0.10); color: var(--green); }
.news-impact-pill--bear { border-color: rgba(245,101,101,0.35); background: rgba(245,101,101,0.10); color: var(--red); }
.news-impact-pill--neutral { border-color: rgba(113,128,150,0.30); background: rgba(113,128,150,0.10); color: var(--muted); }
.news-impact-pill--loading { opacity: 0.7; }
.cm-news-headline { font-size: 12px; font-weight: 500; color: var(--text); line-height: 1.4; margin-bottom: 4px; }
.cm-news-meta { font-size: 10px; color: var(--muted); }

/* FOOTER */
.site-footer {
  background: var(--bg2);
  border-top: 1px solid var(--border);
  padding: 18px 22px;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px 24px;
}
.footer-main {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 14px;
  flex: 1;
  min-width: 0;
}
.footer-brand { font-size: 13px; font-weight: 700; color: var(--text); letter-spacing: 0.05em; white-space: nowrap; }
.footer-brand span { color: var(--blue); }
.footer-legal-links {
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 12px;
}
.footer-legal-links a {
  color: var(--muted);
  text-decoration: none;
  font-size: 12px;
  white-space: nowrap;
}
.footer-legal-links a:hover { color: var(--blue); }
.footer-copy-line {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}
.footer-disclaimer {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  flex-shrink: 0;
  max-width: 240px;
}
.footer-disclaimer-line {
  display: block;
  font-size: 10px;
  color: var(--muted);
  line-height: 1.4;
}
.footer-copy { font-size: 11px; color: var(--muted); }
.footer-links { display: flex; gap: 20px; font-size: 11px; color: var(--muted); }

/* PEG card — hint to scroll stats bar for Latest News (touch / narrow layouts) */
.peg-slide-hint {
  display: none;
  position: absolute;
  top: 5px;
  right: 8px;
  z-index: 2;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--blue);
  font-family: var(--display);
  pointer-events: none;
  line-height: 1.25;
  text-align: right;
  max-width: 52%;
}
.peg-slide-arrow { display: inline-block; margin-right: 4px; opacity: 0.95; }
@media (max-width: 1280px) {
  .peg-slide-hint { display: block; }
  .peg-gauge-card .stat-card-label { padding-right: 4.75rem; }
}

/* Footer: narrow phones — stack; disclaimer lines stay readable */
@media (max-width: 520px) {
  .site-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }
  .footer-disclaimer {
    align-items: flex-start;
    text-align: left;
    max-width: none;
    width: 100%;
    order: 3;
  }
  .footer-main { order: 1; width: 100%; }
}

/* ── VALUE GRAPH ────────────────────────────────────────────── */
.vg-toggle-btn {
  background: var(--bg3); border: 1px solid var(--border2);
  color: var(--muted); border-radius: 5px; padding: 4px 12px;
  cursor: pointer; font-size: 11px; white-space: nowrap;
  transition: all 0.15s;
}
.vg-toggle-btn:hover, .vg-toggle-btn.active { border-color: var(--amber); color: var(--amber); }
.vg-year-btns { display: flex; gap: 4px; }
.vg-yr {
  background: var(--bg3); border: 1px solid var(--border);
  color: var(--muted); border-radius: 4px; padding: 3px 10px;
  cursor: pointer; font-size: 11px; transition: all 0.12s;
}
.vg-yr:hover { border-color: var(--amber); color: var(--amber); }
.vg-yr.active { border-color: var(--amber); color: var(--amber); background: rgba(246,173,85,0.1); }
.vg-legend { display: flex; gap: 14px; align-items: center; margin-left: 16px; }
.vl { font-size: 10px; color: var(--muted); }
.vl-green { color: #22d3a5; }
.vl-orange { color: #f6ad55; }
.vl-blue { color: #3b9eff; }
.vl-white { color: #e2e8f0; }
.vg-stats-bar {
  display: flex; gap: 0; border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.vg-stat {
  flex: 1; padding: 8px 14px; display: flex; flex-direction: column; gap: 2px;
  border-right: 1px solid var(--border);
}
.vg-stat:last-child { border-right: none; }
.vg-stat-lbl { font-size: 9px; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }
.vg-stat-val { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); }
.vg-orange { color: #f6ad55; }
.vg-blue { color: #3b9eff; }

/* ── DCF MODAL ─────────────────────────────────────────────── */
.dcf-overlay {
  position: fixed; inset: 0; z-index: 2000;
  background: rgba(10,12,20,0.92);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 20px; overflow-y: auto;
  animation: fadeIn 0.18s ease;
}
.dcf-modal-wrap {
  background: var(--bg2); border: 1px solid var(--border2);
  border-radius: 12px; width: 100%; max-width: 1160px;
  display: flex; flex-direction: column; overflow: hidden;
}
.dcf-hdr {
  display: flex; align-items: flex-start; justify-content: space-between;
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  background: var(--bg3);
}
.dcf-hdr-title {
  font-family: var(--mono); font-size: 13px; font-weight: 700;
  color: var(--blue); letter-spacing: 0.06em; margin-bottom: 4px;
}
.dcf-hdr-sub { font-size: 11px; color: var(--muted); }
.dcf-close-btn {
  background: transparent; border: 1px solid var(--border2);
  color: var(--muted); border-radius: 6px; padding: 6px 14px;
  cursor: pointer; font-size: 12px; white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
}
.dcf-close-btn:hover { color: var(--text); border-color: var(--text); }
.dcf-body {
  display: grid; grid-template-columns: 300px 1fr;
  gap: 0; min-height: 560px;
}
.dcf-inputs {
  padding: 20px; border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 4px;
  background: var(--bg);
}
.dcf-results { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dcf-section-title {
  font-size: 10px; font-weight: 600; color: var(--muted);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px;
}
.dcf-scenarios { display: flex; gap: 8px; }
.dcf-scenario {
  flex: 1; padding: 7px 4px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--bg2); color: var(--muted); cursor: pointer;
  font-size: 11px; transition: all 0.15s; text-align: center;
}
.dcf-scenario:hover { border-color: var(--blue); color: var(--text); }
.dcf-scenario.active { border-color: var(--blue); background: var(--blue-dim); color: var(--blue); }
.dcf-field { margin-bottom: 12px; }
.dcf-field label {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 11px; color: var(--muted); margin-bottom: 6px;
}
.dcf-field-val { color: var(--blue); font-weight: 600; font-family: var(--mono); }
.dcf-field input[type="number"] {
  width: 100%; background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; color: var(--text);
  font-family: var(--mono); font-size: 13px;
}
.dcf-field input[type="number"]:focus { outline: none; border-color: var(--blue); }
.dcf-field input[type="range"] {
  width: 100%; accent-color: var(--blue); cursor: pointer; height: 4px;
}
.dcf-formula-note {
  font-size: 10px; color: var(--muted); line-height: 1.8;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px 12px; margin-top: 4px;
}

/* FCF source badge */
.dcf-src-badge { font-size: 9px; font-weight: 700; letter-spacing: 0.06em; padding: 1px 6px; border-radius: 3px; vertical-align: middle; }
.dcf-src-fcf { background: rgba(34,211,165,0.15); color: #22d3a5; border: 1px solid rgba(34,211,165,0.3); }
.dcf-src-eps { background: rgba(246,173,85,0.15); color: #f6ad55; border: 1px solid rgba(246,173,85,0.3); }

/* Reliability warning */
.dcf-warn {
  font-size: 11px; line-height: 1.6; color: #f6ad55;
  background: rgba(246,173,85,0.08); border: 1px solid rgba(246,173,85,0.25);
  border-radius: 6px; padding: 8px 12px; margin-bottom: 10px;
}

/* Sensitivity table */
.dcf-sens-table th { background: var(--bg3); color: var(--muted); font-size: 9px; letter-spacing: 0.06em; }
.dcf-sens-table td:first-child { color: var(--muted); font-size: 10px; white-space: nowrap; }
.dcf-sens-table td { font-family: var(--mono); font-size: 11px; text-align: center; }

.dcf-summary-cards {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px;
  margin-bottom: 4px;
}
.dcf-scard {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 8px; padding: 12px 14px;
}
.dcf-scard-blue { border-color: var(--blue); background: var(--blue-dim); }
.dcf-scard-label { font-size: 10px; color: var(--muted); letter-spacing: 0.06em; margin-bottom: 6px; text-transform: uppercase; }
.dcf-scard-value { font-family: var(--mono); font-size: 18px; font-weight: 700; color: var(--text); }
.dcf-scard-blue .dcf-scard-value { color: var(--blue); }
.dcf-chart-wrap { height: 220px; }
.dcf-table-wrap { overflow-x: auto; border-radius: 6px; border: 1px solid var(--border); }
.dcf-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.dcf-table thead { background: var(--bg3); }
.dcf-table th {
  padding: 8px 12px; text-align: right; color: var(--muted);
  font-size: 10px; font-weight: 600; letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
}
.dcf-table th:first-child { text-align: left; }
.dcf-table td { padding: 7px 12px; text-align: right; border-bottom: 1px solid var(--border); color: var(--text); font-family: var(--mono); }
.dcf-table td:first-child { text-align: left; color: var(--muted); font-family: var(--font); }
.dcf-table tr:last-child td { border-bottom: none; }

/* ── TABLET / IPAD (769px–1280px) — side-by-side layout; fix indices + intel crowding ── */
@media (max-width: 1280px) and (min-width: 769px) {
  /* Indices: vertical stack inside each chip so label/price/chg never overlap */
  .indices-row {
    height: auto;
    min-height: 44px;
    align-items: stretch;
    overflow: hidden;
  }
  .indices-row-track {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .indices-row-track::-webkit-scrollbar { display: none; }
  .idx-item {
    flex: 0 0 auto;
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    min-width: 100px;
    max-width: 150px;
    padding: 5px 11px;
  }
  .idx-label { font-size: 10px; line-height: 1.2; }
  .mkt-price { font-size: 14px; line-height: 1.25; }
  .mkt-chg { font-size: 11px; line-height: 1.25; }

  .left-panel { width: 190px; min-width: 190px; }
  .right-panel { width: 260px; min-width: 260px; }

  nav { padding: 0 12px; }
  .nav-logo { font-size: 13px; margin-right: 12px; }
  .nav-tab { padding: 6px 9px; font-size: 14px; }
  .nav-tabs {
    flex: 1 1 auto;
    min-width: 0;
    overflow-x: auto;
    overflow-y: hidden;
    flex-wrap: nowrap;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .nav-tabs::-webkit-scrollbar { display: none; }

  /* Analytics Intelligence: grid layout — Deep Dive full-width under hint */
  #intelRow .intel-row-hdr {
    display: grid;
    grid-template-columns: auto auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 6px 8px;
    padding: 8px 10px;
  }
  #intelRow .intel-row-icon { grid-column: 1; grid-row: 1; }
  #intelRow .intel-row-title { grid-column: 2; grid-row: 1; }
  #intelRow .intel-ticker-badge { grid-column: 3; grid-row: 1; justify-self: start; min-width: 0; }
  #intelRow .intel-row-caret { grid-column: 4; grid-row: 1; justify-self: end; }
  #intelRow .intel-row-hint {
    grid-column: 1 / -1;
    grid-row: 2;
    flex: unset;
    font-size: 9px;
    line-height: 1.35;
  }
  #intelRow .intel-deep-dive-btn {
    grid-column: 1 / -1;
    grid-row: 3;
    max-width: none;
    width: 100%;
    box-sizing: border-box;
    justify-content: flex-start;
    min-height: 30px;
  }

  /* Portfolio Analytics: benchmark row below title row */
  #portfolioRow .intel-row-hdr {
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
  }
  #portfolioRow .intel-row-icon { order: 1; }
  #portfolioRow .intel-row-title { order: 2; }
  #portfolioRow .pf-badge { order: 3; }
  #portfolioRow .intel-row-caret { order: 4; margin-left: auto; }
  #portfolioRow .pf-bench-wrap {
    order: 5;
    flex: 1 1 100%;
    margin-left: 0;
    margin-right: 0;
    flex-wrap: wrap;
  }


  .insight-metrics { grid-template-columns: 1fr 1fr; gap: 6px; }
  .im-card { padding: 7px 10px; }
  .im-label { font-size: 8px; }
  .im-value { font-size: 12px; }

  .stats-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding: 8px 10px;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stat-stack,
  .stat-stack-gauge,
  .stat-news-card { flex: 0 0 auto; }
}

/* ── MOBILE RESPONSIVE ─────────────────────────────────────── */
@media (max-width: 768px) {
  /* Nav: smaller, wrap gracefully */
  nav { padding: 0 12px; gap: 0; flex-wrap: wrap; height: auto; min-height: 48px; }
  .nav-logo { font-size: 12px; margin-right: 8px; }
  .nav-right { gap: 6px; }
  #nav-clock { font-size: 10px; min-width: 56px; }
  .market-status { font-size: 10px; }

  /* Search bar: stack on mobile */
  .search-bar { flex-wrap: wrap; padding: 8px 12px; gap: 6px; }
  #tickerInput { width: 110px; font-size: 13px; }
  .ext-quotes-bar { max-width: 100%; }
  .ticker-info { flex-wrap: wrap; }

  /* Main body: stack vertically */
  .main-body { flex-direction: column; height: auto; overflow: visible; }

  /* Left scanner: collapse on mobile — show as horizontal strip */
  .left-panel {
    width: 100%;
    max-width: 100%;
    height: auto;
    max-height: 240px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .scanner-list {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    align-items: flex-start;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 0;
    min-height: 0;
    padding-bottom: 4px;
  }
  /* Same 3-col grid as desktop; anchor all columns to the bottom so price / H:L / chg
     line up across horizontally scrolled cards (center alignment caused drift). */
  .scanner-row {
    flex-shrink: 0;
    min-width: 90px;
    height: 100px;
    border-bottom: none;
    border-right: 1px solid var(--border);
    align-items: end;
    padding: 8px 10px;
    box-sizing: border-box;
  }
  .scanner-row > div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    align-self: end;
  }
  .sr-ticker { font-size: 13.122px; line-height: 1.2; }
  .sr-price { font-size: 13.122px; }
  .sr-chg { font-size: 13.122px; text-align: left; line-height: 1.2; margin-top: 0; align-self: end; }
  .sr-hl { font-size: 13.122px; line-height: 1.2; align-self: end; }
  .sr-pos-val { font-size: 13.122px; }
  .sr-ticker .sr-date { font-size: 13.122px; font-weight: 700; }
  .panel-header { padding: 6px 12px; }

  /* Center panel: full width */
  .center-panel { width: 100%; min-width: 0; overflow-x: hidden; }

  /* Stats bar: horizontal scroll on mobile */
  .stats-bar {
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 8px;
    padding: 8px 10px;
    align-items: stretch;
  }
  .stats-bar::-webkit-scrollbar { display: none; }
  .stat-stack { flex: 0 0 auto; min-width: 150px; flex-direction: column; }
  .stat-stack-gauge { flex: 0 0 auto; min-width: 190px; flex-direction: column; }
  .stat-news-card { flex: 0 0 auto; min-width: 230px; }
  .stat-card { flex: 0 0 auto; }
  .stat-card-mini { flex: 1; }
  .peg-gauge-card { min-width: 0; }
  .fg-gauge-card { min-width: 0; }

  /* Charts: full width, slightly shorter */
  .chart-area { min-height: 220px; }
  .chart-wrap canvas { max-height: 220px; }
  .chart-toolbar { flex-wrap: wrap; gap: 4px; padding: 6px 10px; font-size: 10px; }
  /* Hide "TIMEFRAME:" label — frees enough space for all 4 controls on one line */
  .chart-toolbar .ct-label { display: none; }
  .tf-select { font-size: 10px; }
  .chart-toolbar .tf-select { min-height: 28px; padding: 3px 20px 3px 7px; }
  .chart-toolbar .btn-compare.tf-compare-btn { font-size: 10px; padding: 4px 8px; min-height: 28px; }
  .chart-toolbar .btn-js2000 { font-size: 10px; padding: 4px 7px; min-height: 28px; }
  /* Keep the 3 action buttons snug together */
  .chart-toolbar-compare-wrap { gap: 4px; }
  .vg-toggle-btn { margin-left: 0; }
  .vg-legend { display: none; }
  .vg-year-btns { gap: 4px; }

  /* RSI/MACD panels */
  .indicator-panel { padding: 4px 10px; }
  .indicator-panel canvas { height: 50px !important; }

  /* Bottom data (key levels) */
  .bottom-data { padding: 10px 12px 12px; }

  /* Right panel: stack below chart, full width */
  .right-panel { width: 100%; border-left: none; border-top: 1px solid var(--border); }
  .right-tabs { gap: 0; }
  .right-tab { font-size: 11px; padding: 8px 10px; flex: 1; text-align: center; }
  .right-content { max-height: none; overflow-y: visible; padding-bottom: 16px; }

  /* Section rows below: full width, horizontally scrollable grid */
  .section-row { padding: 12px; }
  .section-row-grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
  .ticker-card { padding: 10px; }

  /* Block feed: stack cards */
  .block-feed-grid { grid-template-columns: 1fr; gap: 8px; padding: 10px; }
  .block-feed-section { padding: 10px 12px; }

  /* Modals: full width */
  .company-modal { max-width: calc(100vw - 24px); margin: 12px; border-radius: 10px; }
  .dcf-modal-wrap { max-width: 100%; border-radius: 8px; }
  .dcf-body { grid-template-columns: 1fr; min-height: auto; }
  .dcf-inputs { border-right: none; border-bottom: 1px solid var(--border); }
  .dcf-summary-cards { grid-template-columns: repeat(2, 1fr); }

  /* OHLC bar */
  .ohlc-bar { flex-wrap: wrap; gap: 6px; padding: 6px 10px; }
  .ohlc-item { font-size: 11px; }

  /* Footer: padding only — row + right disclaimer preserved (stack at max-width: 520px) */
  .site-footer { padding: 14px 12px; }

  /* Indices row — stack label/price/change vertically so nothing overlaps */
  .indices-row { height: 54px; overflow: hidden; }
  .indices-row-track { min-height: 54px; }
  .idx-item {
    flex-direction: column;
    align-items: flex-start;
    justify-content: center;
    gap: 1px;
    min-width: 130px;
    padding: 0 14px;
  }
  .idx-label { font-size: 10px; }
  .mkt-price { font-size: 15px; }
  .mkt-chg   { font-size: 12px; }

  /* Nav: 2-row layout — logo+right on row1, scrollable tabs on row2 */
  .nav-tabs {
    order: 10; /* push to second row */
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
    flex-wrap: nowrap;
    padding: 0;
    border-top: 1px solid var(--border);
  }
  .nav-tabs::-webkit-scrollbar { display: none; }
  .nav-tab { flex-shrink: 0; font-size: 14px; padding: 7px 12px; }

  /* Intel 2-col grid → single column on mobile */
  #intelContent { grid-template-columns: 1fr; }
  .intel-section { border-right: none; }
  .intel-body.open { max-height: none; }
  .intel-row-hdr { flex-wrap: wrap; row-gap: 6px; }
  .intel-deep-dive-btn { max-width: 100%; }

  /* Global markets legend: hide overflow columns */
  .global-legend-row {
    grid-template-columns: 12px 1fr 60px 24px;
  }
  .global-legend-region,
  .global-legend-sym,
  .global-legend-top { display: none; }
  .global-legend-header .glh:nth-child(4),
  .global-legend-header .glh:nth-child(5),
  .global-legend-header .glh:nth-child(6) { display: none; }

  /* Guide modal: full-screen, hide sidebar nav */
  .guide-overlay { padding: 0; align-items: flex-start; }
  .guide-modal {
    max-width: 100%;
    max-height: 100dvh;
    border-radius: 0;
    width: 100%;
  }
  .guide-nav { display: none; }

  /* Portfolio KPI grid: 2 columns on small screens */
  .pf-kpi-grid { grid-template-columns: 1fr 1fr; }

  /* Portfolio table: allow horizontal scroll */
  .pf-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

  /* EFM: tighten column grid to fit */
  .efm-col-headers,
  .efm-signal-row { grid-template-columns: 1fr 64px 38px 30px; gap: 4px; }

  /* Section row grids: 2 columns minimum */
  .section-row-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .global-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── PHONE-ONLY (≤ 480px) — extra tightening ────────────────────── */
@media (max-width: 480px) {
  /* Hide non-essential nav-right items to free space */
  .nav-right > a[href="/"] { display: none; }
  #nav-clock { display: none; }
  #market-status-text { display: none; }

  /* Nav logo: compress */
  .nav-logo { font-size: 11px; margin-right: 6px; }
  .nav-logo-icon { width: 22px; height: 22px; }

  /* Tabs: slightly smaller text */
  .nav-tab { font-size: 13px; padding: 7px 10px; }

  /* Ticker input: use more of the width */
  #tickerInput { width: 90px; font-size: 13px; }

  /* Stat cards: min-width slightly smaller */
  .stat-card { min-width: 100px; }
  .stat-stack { min-width: 130px; }
  .stat-news-card { min-width: 200px; }

  /* Scanner rows: tighter */
  .scanner-row { min-width: 80px; }

  /* Right tabs: tiny text */
  .right-tab { font-size: 10px; padding: 7px 6px; }

  /* Section cards */
  .section-row { padding: 10px; }
  .section-row-title { font-size: 11px; }

  /* Block feed */
  .block-feed-section { padding: 10px; }

  /* DCF modal: full width on phone */
  .dcf-overlay { padding: 0; }
  .dcf-modal-wrap { border-radius: 0; }
  .dcf-summary-cards { grid-template-columns: 1fr 1fr; }

  /* Company modal */
  .company-modal { max-width: 100%; margin: 0; border-radius: 12px 12px 0 0; align-self: flex-end; }
  .company-modal-overlay { align-items: flex-end; }

  /* Footer: minimal */
  .footer-links { display: none; }
}
/* ── LANDSCAPE PHONE ─────────────────────────────────────────── */
/* Phones sideways only (height ≤ 500px). Tablets, desktop, and   */
/* portrait mobile are completely unaffected.                      */
/* JS (updateLandscapeMode) moves #scannerList into .indices-row   */
/* so both form one combined scrollable strip.                     */
@media (orientation: landscape) and (max-height: 500px) {

  /* ── Hide everything not needed ── */
  nav                { display: none !important; }
  .search-bar        { display: none !important; }
  .ohlc-bar          { display: none !important; }
  #statsBar          { display: none !important; }
  .chart-toolbar     { display: none !important; }
  .bottom-data       { display: none !important; }
  .site-footer       { display: none !important; }
  .right-tabs        { display: none !important; }
  #panel-insight, #panel-ai,
  #panel-sec, #panel-insider,
  #panel-efm         { display: none !important; }

  /* ── Row 1: Indices — horizontal scroll (phone landscape: no tablet refresh btn) ── */
  .indices-page-refresh-wrap { display: none !important; }
  .indices-row {
    height: 44px; flex-shrink: 0;
    overflow: hidden;
  }
  .indices-row-track {
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .indices-row-track::-webkit-scrollbar { display: none; }
  .idx-item  { min-width: 90px; padding: 0 10px; flex-shrink: 0; }
  .idx-label { font-size: 10px; }
  .mkt-price { font-size: 14px; }
  .mkt-chg   { font-size: 12px; }

  /* ── Row 2: Scanner — horizontal scroll ── */
  .left-panel {
    display: flex !important;
    width: 100%; max-width: 100%;
    height: auto; max-height: 44px;
    border-right: none; border-bottom: 1px solid var(--border);
    flex-shrink: 0; flex-direction: column;
  }
  .panel-header { display: none; } /* hide "Market Scanner" label to save space */
  .scanner-list {
    flex-direction: row;
    overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    max-height: 44px; height: 44px;
  }
  .scanner-list::-webkit-scrollbar { display: none; }
  .scanner-row {
    flex-shrink: 0; min-width: 88px; height: 44px;
    border-bottom: none; border-right: 1px solid var(--border);
    align-items: end;
    padding: 4px 10px;
    box-sizing: border-box;
  }
  .scanner-row > div:first-child {
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    min-width: 0;
    align-self: end;
  }
  .scanner-row .sr-chg { margin-top: 0; align-self: end; }
  .scanner-row .sr-hl { align-self: end; line-height: 1.15; }

  /* ── Layout: full viewport column ── */
  .layout { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

  /* ── Main body: single full-width column ── */
  .main-body {
    flex-direction: column;
    flex: 1; min-height: 0;
    overflow-y: auto; overflow-x: hidden;
  }

  /* Hide right panel entirely — news goes below MACD */
  .right-panel { display: none !important; }

  /* Center: full width, chart → RSI → MACD → news */
  .center-panel {
    flex: 1; min-width: 0; width: 100%;
    display: flex; flex-direction: column;
    overflow: visible;
  }

  /* Chart spans full width and fills most of the height */
  .chart-area {
    flex: 1; height: auto; min-height: 140px;
    width: 100%;
  }
  .chart-wrap { height: 100%; }
  .chart-wrap canvas { max-height: none; }

  /* RSI + MACD compact below chart */
  .indicator-panel { padding: 2px 10px; flex-shrink: 0; }
  .indicator-panel canvas { height: 42px !important; }

  /* News flows below MACD, full width, no scroll limit */
  #panel-news {
    display: block !important;
    padding: 0; border-top: 1px solid var(--border);
  }
  .news-list     { padding: 0 12px; display: flex; flex-direction: column; gap: 0; }
  .news-item     { padding: 7px 0; border-bottom: 1px solid rgba(99,179,237,0.07); cursor: pointer; }
  .news-headline { font-size: 12px; line-height: 1.3; }
  .news-meta     { font-size: 10px; margin-top: 2px; }
}

.dcf-table tr:hover td { background: var(--bg3); }

/* ── EFM PANEL ───────────────────────────────────────────────── */
.efm-panel { padding: 16px; }
.efm-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--border); }
.efm-ticker { font-family: var(--mono); font-size: 16px; font-weight: 700; color: var(--text); }
.efm-score-big { font-family: var(--mono); font-size: 36px; font-weight: 700; line-height: 1; }
.efm-badge-signal { background: var(--green); color: #0d1117; padding: 2px 10px; border-radius: 10px; font-size: 10px; font-weight: 700; letter-spacing: .08em; }
.efm-badge-none { background: var(--bg2); color: var(--muted); padding: 2px 10px; border-radius: 10px; font-size: 10px; border: 1px solid var(--border); }
.efm-col-headers { display: grid; grid-template-columns: 1fr 80px 40px 36px; gap: 6px; font-size: 9px; letter-spacing: .1em; color: var(--muted); text-transform: uppercase; padding: 4px 0 6px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.efm-signal-row { display: grid; grid-template-columns: 1fr 80px 40px 36px; gap: 6px; align-items: center; padding: 5px 0; border-bottom: 1px solid rgba(255,255,255,.04); }
.efm-signal-label { font-size: 11px; color: var(--text); }
.efm-signal-score { font-family: var(--mono); font-size: 12px; font-weight: 700; text-align: center; }
.efm-weight-val { font-family: var(--mono); font-size: 10px; color: var(--muted); text-align: right; }

/* EFM signal trigger on search input + analyze button */
#tickerInput.efm-signal-active { border-color: #63b3ed !important; color: #63b3ed !important; box-shadow: 0 0 0 2px rgba(99,179,237,.2); }
.btn-analyze.efm-btn-active { background: #1e3a5f !important; color: #63b3ed !important; border: 1px solid #63b3ed !important; letter-spacing: .04em; }
.btn-analyze.earnings-today { background: rgba(34,197,94,0.15) !important; color: #22c55e !important; border: 1px solid rgba(34,197,94,0.5) !important; letter-spacing: .04em; }

/* ── GUIDE MODAL ─────────────────────────────────────────────── */
.guide-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.75);
  z-index: 1000; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.guide-modal {
  background: var(--bg2); border: 1px solid var(--border2);
  /* Match landing guide page content width */
  border-radius: 12px; width: 100%; max-width: 1100px;
  max-height: 88vh; display: flex; flex-direction: column;
  overflow: hidden; box-shadow: 0 24px 64px rgba(0,0,0,0.6);
  position: relative;
}
/* Gov. Contracts + Quant iframe modals: tall panel (88vh + 5in); height not just max-height so the shell doesn’t shrink to content */
#govContractsModal .guide-modal,
#quantModal .guide-modal,
#quantResearchModal .guide-modal {
  --govcx-modal-h: min(calc(88vh + 5in), calc(100dvh - 20px));
  height: var(--govcx-modal-h);
  max-height: var(--govcx-modal-h);
}
#govContractsModal .guide-body.guide-body-frame,
#quantModal .quant-body.guide-body-frame,
#quantResearchModal .quant-body.guide-body-frame {
  flex: 1;
  min-height: 0;
}

/* Quant + QuantOne: horizontal shell (sidebar + iframe) */
#quantModal .guide-modal.quant-shell,
#quantResearchModal .guide-modal.quant-shell {
  flex-direction: row;
  align-items: stretch;
  padding: 0;
  overflow: hidden;
  max-width: min(1180px, calc(100vw - 24px));
}
.quant-sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  padding: 52px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.quant-nav-btn {
  text-align: left;
  padding: 10px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--display);
  border-left: 3px solid transparent;
}
.quant-nav-btn:hover {
  color: var(--text);
  background: rgba(59, 158, 255, 0.06);
}
.quant-nav-btn.active {
  color: var(--blue);
  border-left-color: var(--blue);
  background: var(--blue-dim);
}
/* Quant modal: admin session — red nav (.quant-modal--admin + data attr; !important beats any stray button rules) */
#quantModal.quant-modal--admin .quant-sidebar .quant-nav-btn,
#quantModal[data-quant-admin='1'] .quant-sidebar .quant-nav-btn {
  color: #e53e3e !important;
}
#quantModal.quant-modal--admin .quant-sidebar .quant-nav-btn:hover,
#quantModal[data-quant-admin='1'] .quant-sidebar .quant-nav-btn:hover {
  color: #ff8585 !important;
  background: rgba(229, 62, 62, 0.1) !important;
}
#quantModal.quant-modal--admin .quant-sidebar .quant-nav-btn.active,
#quantModal[data-quant-admin='1'] .quant-sidebar .quant-nav-btn.active {
  color: #e53e3e !important;
  border-left-color: #e53e3e !important;
  background: rgba(229, 62, 62, 0.14) !important;
}
#quantModal .quant-body,
#quantResearchModal .quant-body {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  min-height: 0;
}
@media (max-width: 640px) {
  #quantModal .guide-modal.quant-shell,
  #quantResearchModal .guide-modal.quant-shell {
    flex-direction: column;
    max-height: min(calc(88vh + 2in), calc(100dvh - 16px));
  }
  .quant-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    padding: 48px 12px 8px;
    border-right: none;
    border-bottom: 1px solid var(--border);
    gap: 6px;
  }
  .quant-nav-btn {
    flex: 1 1 auto;
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 8px 10px;
    text-align: center;
  }
  .quant-nav-btn.active {
    border-left: none;
    border-bottom-color: var(--blue);
  }
  #quantModal.quant-modal--admin .quant-sidebar .quant-nav-btn.active,
  #quantModal[data-quant-admin='1'] .quant-sidebar .quant-nav-btn.active {
    border-bottom-color: #e53e3e !important;
  }
}
.guide-header {
  padding: 20px 24px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.guide-title { font-size: 16px; font-weight: 700; color: var(--blue); letter-spacing: 0.04em; }
.guide-subtitle { font-size: 11px; color: var(--muted); flex: 1; }
.guide-close {
  background: none; border: 1px solid var(--border2); color: var(--muted);
  width: 28px; height: 28px; border-radius: 6px; cursor: pointer;
  font-size: 13px; display: flex; align-items: center; justify-content: center;
}
.guide-close:hover { color: var(--text); border-color: var(--text); }
.guide-body {
  display: flex; flex: 1; overflow: hidden; min-height: 0;
}
.guide-body-frame { padding: 0; }
.guide-frame {
  width: 100%;
  height: 100%;
  border: 0;
  flex: 1;
  background: var(--bg);
}
.guide-close-float{
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  background: rgba(13,17,23,0.55);
  backdrop-filter: blur(6px);
}
.guide-nav {
  width: 185px; flex-shrink: 0; padding: 16px 0;
  border-right: 1px solid var(--border); overflow-y: auto;
  display: flex; flex-direction: column;
  min-height: 0;
}
.guide-nav a.active { color: var(--blue); border-left-color: var(--blue); background: rgba(99,179,237,0.08); }
.guide-nav a {
  display: block; width: 100%; box-sizing: border-box;
  padding: 7px 18px; font-size: 11px; color: var(--muted);
  text-decoration: none; transition: color 0.15s, background 0.15s;
  border-left: 2px solid transparent;
}
.guide-nav a:hover { color: var(--text); background: rgba(99,179,237,0.06); border-left-color: var(--blue); }
.guide-content {
  flex: 1; overflow-y: auto; padding: 24px 28px;
  display: flex; flex-direction: column; gap: 0;
}
.guide-content section {
  padding-bottom: 32px; margin-bottom: 32px;
  border-bottom: 1px solid var(--border);
}
.guide-content section:last-child { border-bottom: none; }
.guide-content h2 {
  font-size: 15px; font-weight: 700; color: var(--blue);
  margin: 0 0 12px; letter-spacing: 0.02em;
}
.guide-content p { font-size: 13px; color: var(--text); line-height: 1.7; margin: 0 0 10px; }
.guide-content ul { margin: 8px 0 12px 18px; padding: 0; }
.guide-content li { font-size: 13px; color: var(--text); line-height: 1.7; margin-bottom: 6px; }
.guide-content strong { color: var(--text); }
.guide-example {
  background: rgba(99,179,237,0.06); border: 1px solid rgba(99,179,237,0.18);
  border-left: 3px solid var(--blue); border-radius: 6px;
  padding: 12px 14px; margin: 12px 0; font-size: 12px;
  color: var(--muted); line-height: 1.7;
}
.ge-label {
  font-size: 10px; font-weight: 700; color: var(--blue);
  letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 6px;
}

/* Guide Visual Mockups */
.gm-statsbar {
  display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0;
  background: #0d1117; border: 1px solid #30363d;
  border-radius: 8px; padding: 14px;
}
.gm-stat-card {
  background: #161b27; border: 1px solid #30363d; border-radius: 7px;
  padding: 10px 14px; min-width: 90px; flex: 1;
}
.gm-stat-label { font-size: 9px; color: #6b7280; letter-spacing: 0.1em; text-transform: uppercase; margin-bottom: 4px; font-family: var(--display); }
.gm-stat-value { font-family: var(--mono); font-size: 16px; font-weight: 700; color: #e6edf3; }
.gm-stat-sub { font-size: 9px; font-weight: 600; margin-top: 2px; }

.gm-macd-wrap {
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px;
  padding: 14px; margin: 14px 0;
}
.gm-macd-label { font-size: 10px; color: #6b7280; font-family: var(--display); margin-bottom: 8px; letter-spacing: 0.1em; text-transform: uppercase; }
.gm-macd-svg { width: 100%; height: 90px; display: block; }
.gm-macd-legend { display: flex; gap: 14px; margin-top: 8px; font-size: 10px; font-family: var(--font); flex-wrap: wrap; color: #6b7280; }

.gm-dcf-wrap {
  display: flex; gap: 12px; align-items: center; margin: 14px 0;
  background: #0d1117; border: 1px solid #30363d; border-radius: 8px; padding: 14px;
  flex-wrap: wrap;
}
.gm-dcf-col { flex: 1; min-width: 180px; }
.gm-dcf-output { background: rgba(34,211,165,0.04); border: 1px solid rgba(34,211,165,0.15); border-radius: 6px; padding: 8px 12px; }
.gm-dcf-title { font-size: 10px; color: #6b7280; letter-spacing: 0.08em; text-transform: uppercase; margin-bottom: 8px; font-weight: 600; }
.gm-dcf-row { display: flex; justify-content: space-between; font-size: 11px; font-family: var(--font); padding: 3px 0; color: #6b7280; border-bottom: 1px solid #21262d; }
.gm-dcf-row:last-child { border-bottom: none; }
.gm-dcf-verdict { font-weight: 700; padding-top: 6px; margin-top: 4px; border-top: 1px solid #30363d !important; }
.gm-dcf-arrow { font-size: 20px; color: #30363d; flex-shrink: 0; }

.guide-disclaimer-small {
  font-size: 11.7px; color: #6b7280; font-style: italic; margin-top: 8px;
}

/* ── ANALYTICS INTELLIGENCE ─────────────────────────────────── */
/* Row header (above Latest News) */
.intel-row-hdr {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; cursor: pointer; user-select: none;
  background: var(--bg2); border-bottom: 1px solid var(--border);
  border-top: 1px solid var(--border);
  transition: background 0.12s;
}
.intel-row-hdr:hover { background: rgba(99,179,237,0.05); }
.intel-row-icon { font-size: 13px; color: var(--blue); }
.intel-row-title {
  font-size: 11px; font-weight: 700; color: var(--text);
  letter-spacing: 0.06em; text-transform: uppercase;
  font-family: var(--display);
}
.intel-row-hint {
  font-size: 10px;
  color: var(--muted);
  flex: 1;
  min-width: 0;
  text-align: left;
}
.intel-row-caret { font-size: 11px; color: var(--muted); flex-shrink: 0; }
.intel-deep-dive-btn {
  display: inline-flex;
  align-items: center;
  max-width: min(100%, 280px);
  flex-shrink: 0;
  margin: 0;
  padding: 3px 9px;
  font-family: var(--font);
  font-size: 10px;
  font-weight: 600;
  color: var(--blue);
  letter-spacing: 0.04em;
  background: rgba(99, 179, 237, 0.06);
  border: 1px solid rgba(99, 179, 237, 0.35);
  border-radius: 5px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
  text-align: left;
}
.intel-deep-dive-btn:hover {
  background: rgba(99, 179, 237, 0.12);
  border-color: rgba(99, 179, 237, 0.55);
}
.intel-deep-dive-label { flex-shrink: 0; white-space: nowrap; }
.intel-deep-dive-sep { flex-shrink: 0; color: var(--muted); font-weight: 500; }
.intel-deep-dive-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  color: var(--text);
}

/* Research Deep Dive modal (AI report) */
.deep-dive-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0, 0, 0, 0.72);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right)) max(16px, env(safe-area-inset-bottom))
    max(16px, env(safe-area-inset-left));
}
.deep-dive-panel {
  width: 100%;
  max-width: 936px;
  max-height: min(88vh, 920px);
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.55);
}
.deep-dive-brand {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 14px 16px 12px;
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}
.deep-dive-logo {
  width: 56px;
  height: 56px;
  border-radius: 10px;
  object-fit: contain;
}
.deep-dive-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.deep-dive-title {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text);
  font-family: var(--display);
}
.deep-dive-close {
  background: transparent;
  border: 1px solid var(--border2);
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  width: 34px;
  height: 34px;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
}
.deep-dive-close:hover {
  color: var(--text);
  border-color: var(--border);
}
.deep-dive-meta {
  font-size: 11px;
  color: var(--muted);
  padding: 8px 16px 0;
  font-family: var(--mono);
}
.deep-dive-body {
  flex: 1;
  min-height: 120px;
  overflow-y: auto;
  padding: 12px 16px 16px;
  font-size: 12px;
  line-height: 1.65;
  color: var(--text);
  word-break: break-word;
}
.dd-prose {
  margin-bottom: 14px;
}
.dd-prose div { line-height: 1.6; }
.dd-list { margin: 4px 0 8px 16px; padding: 0; }
.dd-list li { margin-bottom: 4px; line-height: 1.5; }
.dd-heading { color: var(--blue); font-size: 12px; font-weight: 700; margin: 12px 0 6px; text-transform: uppercase; letter-spacing: 0.05em; }
.dd-img-wrap { margin: 10px 0; }
.dd-chart-img { max-width: 100%; border-radius: 6px; border: 1px solid var(--border); }
.dd-prose:last-child { margin-bottom: 0; }
.dd-table {
  width: 100%;
  border-collapse: collapse;
  margin: 10px 0 16px;
  font-size: 11px;
}
.dd-table th {
  background: var(--bg3);
  color: var(--blue);
  font-weight: 700;
  text-align: left;
  padding: 7px 10px;
  border: 1px solid var(--border);
  white-space: nowrap;
}
.dd-table td {
  padding: 6px 10px;
  border: 1px solid var(--border);
  color: var(--text);
}
.dd-table tbody tr:nth-child(odd) td { background: rgba(255,255,255,.03); }
.dd-table tbody tr:hover td { background: rgba(99,179,237,.07); }
.dd-charts-section { margin-top: 24px; border-top: 1px solid var(--border); padding-top: 16px; }
.dd-charts-heading { font-size: 11px; font-weight: 700; color: var(--blue); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 14px; }
.dd-chart-wrap { margin-bottom: 20px; }
.dd-chart-title { font-size: 10px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.dd-canvas-wrap { height: 200px; position: relative; }
.deep-dive-actions {
  padding: 10px 16px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-shrink: 0;
}
.deep-dive-copy {
  background: rgba(99, 179, 237, 0.12);
  border: 1px solid rgba(99, 179, 237, 0.4);
  color: var(--blue);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 8px 16px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--display);
}
.deep-dive-copy:hover {
  background: rgba(99, 179, 237, 0.2);
}

/* Body: 2-column grid of sections */
#intelRowBody { background: var(--bg); border-bottom: 1px solid var(--border); }
#intelContent { display: grid; grid-template-columns: 1fr 1fr; }

/* Right-panel Intel header (kept for reuse) */
.intel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px 8px; border-bottom: 1px solid var(--border);
}
.intel-ticker-badge {
  font-family: var(--mono); font-size: 11px; font-weight: 700;
  color: var(--blue); background: rgba(99,179,237,0.08);
  border: 1px solid rgba(99,179,237,0.25); border-radius: 5px;
  padding: 2px 7px; flex-shrink: 0;
}
.intel-subtitle { font-size: 10px; color: var(--muted); }

.gex-table-wrap { overflow-x: auto; }
.gex-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--mono); }
.gex-th { padding: 7px 10px; text-align: left; font-size: 9px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; user-select: none; }
.gex-th:hover { color: var(--text); }
.gex-th-active { color: var(--blue) !important; }
.gex-td { padding: 7px 10px; border-bottom: 1px solid rgba(255,255,255,0.04); white-space: nowrap; color: var(--text); }
.gex-td-ticker { font-weight: 700; font-size: 12px; color: var(--text); }
.gex-row { cursor: pointer; transition: background 0.1s; }
.gex-row:hover td { background: rgba(99,179,237,0.06); }
.gex-row-hot td { background: rgba(246,173,85,0.06); }
.gex-row-hot:hover td { background: rgba(246,173,85,0.12); }
.gex-badge { display: inline-block; font-size: 9px; font-weight: 700; padding: 2px 6px; border-radius: 3px; letter-spacing: 0.06em; }
.gex-badge-pos { background: rgba(34,211,165,0.15); color: var(--green); }
.gex-badge-neg { background: rgba(229,62,62,0.15); color: var(--red); }
.gex-explain { font-size: 10px; color: var(--muted); line-height: 1.5; margin-bottom: 10px; padding: 6px 8px; background: rgba(255,255,255,0.025); border-radius: 4px; }
.gex-metrics { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; margin-bottom: 10px; }
.gex-metric { background: var(--bg3); border: 1px solid var(--border); border-radius: 5px; padding: 7px 9px; }
.gex-metric-label { font-size: 9px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 3px; }
.gex-metric-val { font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--text); }
.gex-legend { display: flex; align-items: center; gap: 4px; font-size: 9px; color: var(--muted); flex-wrap: wrap; }
.gex-legend-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0; }
.gex-col-tip { display: none; position: fixed; z-index: 9999; background: #1c2233; border: 1px solid rgba(255,255,255,0.12); color: var(--text); font-size: 11px; font-weight: 400; font-family: var(--mono); letter-spacing: 0; text-transform: none; line-height: 1.55; padding: 9px 12px; border-radius: 6px; max-width: 260px; white-space: normal; pointer-events: none; box-shadow: 0 6px 20px rgba(0,0,0,0.55); }

.intel-section {
  border-bottom: 1px solid var(--border);
  border-right: 1px solid var(--border);
}
.intel-section-hdr {
  display: flex; align-items: center; gap: 7px;
  padding: 9px 12px; cursor: pointer; user-select: none;
  transition: background 0.12s;
}
.intel-section-hdr:hover { background: rgba(255,255,255,0.03); }
.intel-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--blue); flex-shrink: 0;
}
.intel-section-title {
  font-size: 11px; font-weight: 600; color: var(--text);
  letter-spacing: 0.03em; flex: 1;
}
.intel-load-btn {
  background: rgba(99,179,237,0.1); border: 1px solid rgba(99,179,237,0.3);
  color: var(--blue); font-size: 10px; font-family: var(--mono);
  padding: 3px 9px; border-radius: 4px; cursor: pointer;
  transition: background 0.12s, border-color 0.12s; flex-shrink: 0;
}
.intel-load-btn:hover { background: rgba(99,179,237,0.2); border-color: var(--blue); }
.intel-load-btn:disabled { opacity: 0.5; cursor: default; }
.intel-load-btn.intel-btn-close { color: var(--red); border-color: rgba(229,62,62,0.4); background: rgba(229,62,62,0.08); }
.intel-load-btn.intel-btn-close:hover { background: rgba(229,62,62,0.18); border-color: var(--red); }
.intel-load-btn.intel-btn-reload { color: var(--muted); border-color: rgba(107,114,128,0.3); background: rgba(107,114,128,0.08); }
.intel-caret { font-size: 10px; color: var(--muted); flex-shrink: 0; }

.intel-body {
  display: none; padding: 10px 14px 12px;
}
.intel-body.open { display: block; max-height: calc(100vh - 140px); overflow-y: auto; }

.intel-placeholder { font-size: 11px; color: var(--muted); font-style: italic; }
.intel-loading {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; color: var(--muted);
}
.intel-spin {
  width: 12px; height: 12px; border-radius: 50%;
  border: 2px solid var(--border); border-top-color: var(--blue);
  animation: spin 0.7s linear infinite; display: inline-block;
}
.intel-error { font-size: 11px; color: var(--red); }
.intel-empty { font-size: 11px; color: var(--muted); font-style: italic; }
.intel-meta { font-size: 10px; color: var(--muted); margin-bottom: 8px; }
.intel-verdict {
  font-size: 11px; color: var(--text); font-style: italic;
  border-left: 2px solid var(--blue); padding-left: 8px;
  margin-bottom: 10px; line-height: 1.5;
}
.intel-lbl {
  font-size: 9px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; margin-bottom: 4px;
}
.intel-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.intel-ul { margin: 0 0 0 14px; padding: 0; }
.intel-li { font-size: 10px; color: var(--text); line-height: 1.6; margin-bottom: 2px; }
.intel-bull::marker { color: var(--green); }
.intel-bear::marker { color: var(--red); }

.intel-kv-list { display: flex; flex-direction: column; gap: 4px; }
.intel-kv {
  display: flex; align-items: center; gap: 6px;
  font-size: 10px; font-family: var(--mono);
}
.intel-kv > span:first-child { color: var(--muted); flex: 1; }
.intel-kv > span:not(:first-child) { color: var(--text); }

.intel-chart-wrap { position: relative; width: 100%; }

.intel-risk-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.intel-risk-item {
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: 5px; padding: 7px 9px;
}
.intel-risk-top { display: flex; align-items: center; gap: 7px; margin-bottom: 3px; }
.intel-risk-sev { font-size: 9px; font-weight: 700; letter-spacing: 0.07em; }
.intel-risk-cat { font-size: 10px; color: var(--muted); }
.intel-risk-desc { font-size: 10px; color: var(--text); line-height: 1.5; }

.intel-pills { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 8px; }
.intel-pill-red {
  background: rgba(229,62,62,0.15); border: 1px solid rgba(229,62,62,0.4);
  color: var(--red); font-size: 9px; font-weight: 600; border-radius: 3px;
  padding: 2px 6px; letter-spacing: 0.04em;
}

.intel-details { margin-top: 8px; }
.intel-details-sum {
  font-size: 10px; color: var(--blue); cursor: pointer;
  list-style: none; user-select: none; padding: 4px 0;
}
.intel-details-sum::-webkit-details-marker { display: none; }

.intel-opts-wrap { display: flex; flex-direction: column; gap: 4px; }
.intel-opt-row {
  display: grid; grid-template-columns: 42px 60px 1fr 70px;
  align-items: center; gap: 6px; font-size: 10px;
  font-family: var(--mono); padding: 3px 0;
  border-bottom: 1px solid rgba(48,54,61,0.5);
}
.intel-opt-type { font-weight: 700; font-size: 9px; }
.intel-opt-strike, .intel-opt-exp { color: var(--text); }
.intel-opt-prem { text-align: right; color: var(--muted); }
.intel-bull { color: var(--green); }
.intel-bear { color: var(--red); }

/* ── POSITION EDIT BUTTON (scanner rows) ── */
.wl-edit-btn {
  position: absolute; bottom: 2px; right: 2px;
  background: rgba(99,179,237,0.08); border: 1px solid rgba(99,179,237,0.25);
  color: var(--blue); font-size: 10px; border-radius: 3px;
  padding: 1px 4px; cursor: pointer; line-height: 1.4;
  opacity: 0; transition: opacity 0.15s;
}
.scanner-row:hover .wl-edit-btn { opacity: 1; }
.wl-edit-btn:hover { background: rgba(99,179,237,0.2); }
.sr-pos-val { font-size: 9px; color: var(--green); font-family: var(--mono); margin-top: 1px; }

/* Portfolio mode scanner row layout */
.sr-shares { font-size: 9px; color: var(--muted); font-family: var(--mono); margin-top: 2px; }
.sr-pos-right { display: flex; flex-direction: column; align-items: flex-end; justify-content: center; gap: 2px; flex-shrink: 0; }
.sr-pos-total { font-family: var(--mono); font-size: 11px; font-weight: 700; }
.sr-chg-pct { font-family: var(--mono); font-size: 10px; font-weight: 600; }

/* ── PORTFOLIO ANALYTICS ROW ── */
.pf-badge {
  font-size: 10px; color: var(--green); font-family: var(--mono); white-space: nowrap;
  background: rgba(34,211,165,0.1); border: 1px solid rgba(34,211,165,0.25);
  border-radius: 3px; padding: 1px 6px; margin-left: 6px;
}
.pf-opt-badge {
  color: var(--text); background: rgba(99,179,237,0.08); border-color: rgba(99,179,237,0.2);
}
.pf-bench-wrap {
  display: flex; align-items: center; gap: 5px;
  margin-left: 8px; margin-right: 8px;
}
.pf-bench-btn {
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.1);
  color: var(--muted); font-size: 9px; font-family: var(--mono); white-space: nowrap;
  padding: 2px 7px; border-radius: 3px; cursor: pointer;
  transition: background 0.12s, color 0.12s;
}
.pf-bench-btn.active {
  background: rgba(99,179,237,0.15); border-color: rgba(99,179,237,0.4);
  color: var(--blue);
}
.pf-bench-btn:hover:not(.active) { background: rgba(255,255,255,0.08); color: var(--text); }

/* Portfolio KPI grid */
.pf-kpi-grid {
  display: grid; grid-template-columns: 1fr 1fr 1fr;
  gap: 8px; padding: 4px 0 8px;
}
.pf-kpi {
  background: rgba(255,255,255,0.02); border: 1px solid var(--border);
  border-radius: 5px; padding: 8px 10px;
}
.pf-kpi-lbl {
  font-size: 9px; color: var(--muted); text-transform: uppercase;
  letter-spacing: 0.04em; margin-bottom: 3px;
  font-family: var(--display);
}
.pf-kpi-val { font-size: 13px; font-family: var(--mono); font-weight: 600; color: var(--text); }

/* Portfolio P&L table */
.pf-table-wrap { max-height: 420px; overflow-y: auto; }
.pf-table { width: 100%; border-collapse: collapse; font-size: 11px; font-family: var(--font); }
.pf-table thead { position: sticky; top: 0; z-index: 2; }
.pf-table th {
  color: var(--muted); font-weight: 600; text-align: right;
  padding: 5px 6px; border-bottom: 1px solid var(--border); font-size: 10px;
  font-family: var(--display);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--bg2);
}
.pf-table th:first-child { text-align: left; }
.pf-table td {
  color: var(--text); text-align: right;
  padding: 6px 6px; border-bottom: 1px solid rgba(48,54,61,0.3);
}
.pf-table td:first-child { text-align: left; }

/* Keep key numeric columns mono for scanability */
.pf-table td:nth-child(2),
.pf-table td:nth-child(3),
.pf-table td:nth-child(4),
.pf-table td:nth-child(5),
.pf-table td:nth-child(6),
.pf-table td:nth-child(7) {
  font-family: var(--mono);
}

/* Position weight bars */
.pf-bar-row {
  display: grid; grid-template-columns: 42px 1fr 36px 48px;
  align-items: center; gap: 6px; margin-bottom: 5px;
}
.pf-bar-lbl { font-size: 9px; color: var(--blue); font-family: var(--mono); }
.pf-bar-track { height: 5px; background: rgba(255,255,255,0.06); border-radius: 3px; overflow: hidden; }
.pf-bar-fill { height: 100%; background: var(--blue); border-radius: 3px; transition: width 0.3s; }
.pf-bar-val { font-size: 9px; color: var(--text); font-family: var(--mono); text-align: right; }
.pf-bar-amt { font-size: 9px; color: var(--muted); font-family: var(--mono); text-align: right; }

/* ── Market-mover AI recommendation overlay ─────────────────────────────── */
.mm-rec-hint {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10px; font-family: var(--display); font-weight: 600;
  color: var(--amber); background: rgba(246,173,85,0.12);
  border: 1px solid rgba(246,173,85,0.3);
  border-radius: 4px; padding: 2px 7px; cursor: pointer;
  letter-spacing: 0.04em; white-space: nowrap;
  transition: background 0.15s;
}
.mm-rec-hint:hover { background: rgba(246,173,85,0.22); }

.mm-rec-overlay {
  position: fixed; z-index: 9999;
  width: 480px; max-width: calc(100vw - 24px);
  max-height: calc(100vh - 60px); overflow-y: auto;
  background: #0f1520;
  border: 1px solid var(--border2);
  border-radius: 10px;
  box-shadow: 0 16px 48px rgba(0,0,0,0.7), 0 0 0 1px rgba(99,179,237,0.08);
  opacity: 0; transform: translateY(-6px) scale(0.97);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}
.mm-rec-overlay.mm-rec-visible {
  opacity: 1; transform: translateY(0) scale(1);
  pointer-events: auto;
}

.mm-rec-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 14px 8px;
  border-bottom: 1px solid var(--border);
}
.mm-rec-title {
  font-size: 11px; font-family: var(--display); font-weight: 700;
  color: var(--text); letter-spacing: 0.04em; text-transform: uppercase;
}
.mm-rec-close {
  background: none; border: none; cursor: pointer;
  color: var(--muted); font-size: 18px; line-height: 1;
  padding: 0 2px; transition: color 0.1s;
}
.mm-rec-close:hover { color: var(--text); }

.mm-rec-disclaimer {
  font-size: 9px; color: var(--muted); font-family: var(--display);
  padding: 5px 14px 0; letter-spacing: 0.02em;
}

.mm-rec-body { padding: 10px 14px 14px; }

.mm-rec-loading {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 0; color: var(--muted);
  font-size: 12px; font-family: var(--display);
}
.mm-rec-spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--border2);
  border-top-color: var(--blue);
  animation: mm-spin 0.7s linear infinite;
  flex-shrink: 0;
}
@keyframes mm-spin { to { transform: rotate(360deg); } }

.mm-rec-row {
  display: flex; align-items: flex-start; gap: 8px;
  margin-bottom: 8px;
}
.mm-rec-chip {
  display: inline-block; padding: 3px 9px;
  border-radius: 4px; font-size: 11px; font-family: var(--mono);
  font-weight: 700; letter-spacing: 0.06em;
  line-height: 1.4; flex-shrink: 0;
}
.mm-rec-chip.bull { background: rgba(34,211,165,0.15); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.mm-rec-chip.bear { background: rgba(245,101,101,0.13); color: var(--red); border: 1px solid rgba(245,101,101,0.28); }
.mm-rec-chip.neut { background: rgba(246,173,85,0.12); color: var(--amber); border: 1px solid rgba(246,173,85,0.28); }

.mm-rec-instrument {
  font-size: 12px; font-family: var(--mono); font-weight: 700;
  color: var(--blue); letter-spacing: 0.04em;
}
.mm-rec-conf {
  font-size: 10px; color: var(--muted); font-family: var(--display);
  margin-left: auto; white-space: nowrap; padding-top: 3px;
}

.mm-rec-rationale {
  font-size: 12px; color: var(--text); font-family: var(--font);
  line-height: 1.55; margin-bottom: 8px;
}

.mm-rec-meta {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 6px; margin-top: 4px;
}
.mm-rec-meta-item {
  background: rgba(255,255,255,0.03); border: 1px solid var(--border);
  border-radius: 5px; padding: 6px 8px;
}
.mm-rec-meta-lbl {
  font-size: 9px; color: var(--muted); font-family: var(--display);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 3px;
}
.mm-rec-meta-val {
  font-size: 11px; color: var(--text); font-family: var(--font); line-height: 1.35;
}

/* ── Market-mover stock & ETF picks section ─────────────────────────────── */
.mm-stocks-divider { height: 1px; background: var(--border); margin: 0; }

.mm-stocks-section { padding: 10px 14px 14px; }

.mm-stocks-head {
  display: flex; align-items: baseline; gap: 7px; margin-bottom: 8px;
}
.mm-stocks-label {
  font-size: 10px; font-family: var(--display); font-weight: 700;
  color: var(--blue); letter-spacing: 0.08em; text-transform: uppercase;
}
.mm-stocks-sublabel {
  font-size: 10px; color: var(--muted); font-family: var(--display);
}

.mm-stocks-theme {
  font-size: 11px; color: var(--muted); font-family: var(--font);
  font-style: italic; margin: 0 0 10px; line-height: 1.45;
  padding: 6px 8px; background: rgba(255,255,255,0.02);
  border-left: 2px solid var(--border2); border-radius: 0 3px 3px 0;
}

.mm-stocks-group { margin-bottom: 12px; }
.mm-stocks-group:last-child { margin-bottom: 0; }

.mm-stocks-group-hd {
  font-size: 9px; font-family: var(--display); font-weight: 700;
  letter-spacing: 0.08em; text-transform: uppercase;
  margin-bottom: 7px; padding-bottom: 4px;
  border-bottom: 1px solid var(--border);
}

.mm-stocks-item {
  margin-bottom: 8px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.mm-stocks-item:last-child { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }

.mm-stocks-item-top {
  display: flex; align-items: center; gap: 6px; margin-bottom: 3px;
  flex-wrap: wrap;
}
.mm-stocks-ticker {
  font-size: 10px; font-family: var(--mono); font-weight: 700;
  padding: 2px 6px; border: 1px solid; border-radius: 3px;
  letter-spacing: 0.05em; flex-shrink: 0;
}
.mm-stocks-ticker-link {
  cursor: pointer; transition: opacity 0.12s, transform 0.12s;
}
.mm-stocks-ticker-link:hover { opacity: 0.75; transform: scale(1.06); }
.mm-stocks-name {
  font-size: 11px; color: var(--text); font-family: var(--font); font-weight: 600;
}
.mm-stocks-sector {
  font-size: 9px; color: var(--muted); font-family: var(--display);
  margin-left: auto; text-align: right; white-space: nowrap;
}
.mm-stocks-rationale {
  font-size: 11px; color: var(--muted); font-family: var(--font);
  line-height: 1.45; margin: 0;
}

/* ── Bulk Import CSV Drop Zone ─────────────────────────────────────── */
.bulk-csv-drop {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  border: 1.5px dashed var(--border); border-radius: 7px;
  padding: 10px 14px; cursor: pointer; transition: all 0.15s;
  font-size: 11px; color: var(--muted); font-family: var(--display);
  letter-spacing: 0.04em;
}
.bulk-csv-drop.drag-over {
  border-color: var(--blue); background: rgba(99,179,237,0.06);
  color: var(--blue);
}
.bulk-csv-drop-icon { font-size: 16px; }
.left-panel.drag-over-csv {
  outline: 2px dashed var(--blue);
  outline-offset: -3px;
  background: rgba(99,179,237,0.03);
}

/* ── Portfolio Data Page ───────────────────────────────────────────── */
.pf-data-page-wrap {
  max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px;
}
.pf-data-page-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.pf-data-page-title {
  font-size: 16px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--text); font-family: var(--display); text-transform: uppercase;
}
.pf-data-page-sel-wrap { position: relative; }
.pf-data-page-select {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 6px;
  color: var(--text); font-family: var(--display); font-size: 11px;
  font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer; outline: none; min-width: 180px;
}
.pf-data-page-select:focus { border-color: var(--blue); }
.pf-data-page-close {
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); font-size: 14px; cursor: pointer; padding: 5px 10px;
  transition: all 0.12s;
}
.pf-data-page-close:hover { color: var(--text); border-color: var(--text); }
.pf-data-page-content { }

/* Portfolio group (one per portfolio in View All) */
.pf-dp-group { margin-bottom: 30px; }
.pf-dp-group-name {
  font-size: 10px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--blue); text-transform: uppercase; font-family: var(--display);
  margin-bottom: 10px; padding: 6px 0 6px 2px;
  border-bottom: 1px solid rgba(99,179,237,0.2);
  display: flex; align-items: center; gap: 10px;
}
.pf-dp-group-val {
  font-size: 12px; font-weight: 600; color: var(--text); font-family: var(--mono);
}

/* Sortable full portfolio table */
.pf-dp-table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
.pf-dp-table {
  width: 100%; border-collapse: collapse; font-size: 11px;
}
.pf-dp-table thead { position: sticky; top: 0; z-index: 2; }
.pf-dp-table th {
  background: var(--bg3); color: #ffffff; font-size: 10px;
  font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  padding: 8px 10px; text-align: right; white-space: nowrap;
  border-bottom: 1px solid var(--border); cursor: pointer; user-select: none;
  transition: color 0.12s;
}
.pf-dp-table th:first-child { text-align: left; padding-left: 12px; }
.pf-dp-table th:hover { color: var(--blue); }
.pf-dp-table th.sort-asc::after { content: ' ▲'; color: var(--blue); }
.pf-dp-table th.sort-desc::after { content: ' ▼'; color: var(--blue); }
.pf-dp-table td {
  padding: 7px 10px; text-align: right; font-family: var(--mono);
  font-size: 11px; border-bottom: 1px solid rgba(48,54,61,0.5);
  vertical-align: middle; white-space: nowrap;
}
.pf-dp-table td:first-child {
  text-align: left; font-family: var(--display); padding-left: 12px;
  font-weight: 600; color: var(--blue); white-space: nowrap;
}
.pf-dp-table tbody tr:hover td { background: rgba(255,255,255,0.04); }
.pf-dp-table tbody tr:last-child td { border-bottom: none; }

/* Totals row */
.pf-dp-total-row td {
  background: var(--bg3) !important; font-weight: 700;
  color: var(--text) !important; border-top: 1px solid var(--border) !important;
  border-bottom: none !important;
}
.pf-dp-total-row td:first-child { color: var(--muted) !important; }

/* Grand total row */
.pf-dp-grand-row td {
  background: rgba(99,179,237,0.06) !important; font-weight: 800;
  color: var(--blue) !important; border-top: 2px solid rgba(99,179,237,0.3) !important;
  font-size: 12px !important; border-bottom: none !important;
}
.pf-dp-grand-row td:first-child { color: var(--blue) !important; }

/* No positions state */
.pf-dp-empty {
  padding: 32px; text-align: center; color: var(--muted);
  font-size: 12px; font-family: var(--font);
}

/* KPI summary chips above the table */
.pf-dp-kpis {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
}
.pf-dp-kpi {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 7px;
  padding: 8px 14px; min-width: 110px;
}
.pf-dp-kpi-lbl {
  font-size: 9px; color: var(--muted); letter-spacing: 0.08em;
  text-transform: uppercase; font-family: var(--display); margin-bottom: 3px;
}
.pf-dp-kpi-val {
  font-size: 13px; font-weight: 700; font-family: var(--mono); color: var(--text);
}
@media (max-width: 600px) {
  .pf-data-page-wrap { padding: 14px 12px 32px; }
  .pf-dp-kpi { min-width: 90px; padding: 6px 10px; }
  .pf-dp-kpi-val { font-size: 12px; }
}

/* ── MONITOR PAGE ─────────────────────────────────────────────────────────── */
.monitor-wrap { max-width: 1320px; margin: 0 auto; padding: 20px 24px 40px; }
.monitor-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 20px; padding-bottom: 14px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
/* Refresh: 50% scale of default .pf-data-page-close; blue glyph */
.pf-data-page-close.monitor-refresh {
  color: #63b3ed;
  font-size: 7px;
  padding: 2px 5px;
  line-height: 1;
  border-radius: 3px;
  min-width: 0;
}
.pf-data-page-close.monitor-refresh:hover { color: #90cdf4; }
.monitor-header-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.monitor-title {
  font-size: 16px; font-weight: 800; letter-spacing: 0.06em;
  color: var(--text); font-family: var(--display); text-transform: uppercase;
}
.monitor-content { max-width: 100%; }

/* Monitor open — loading progress */
.monitor-load {
  max-width: 420px;
  margin: 48px auto 0;
  padding: 0 16px;
  text-align: center;
}
.monitor-load-title {
  font-size: 12px;
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 14px;
}
.monitor-load-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(48, 54, 61, 0.9);
  border: 1px solid var(--border);
  overflow: hidden;
}
.monitor-load-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--green), #34d399);
  box-shadow: 0 0 12px rgba(34, 211, 165, 0.35);
  /* width animated by JS lerp (no CSS transition — avoids stutter with creep) */
}
.monitor-load-pct {
  margin-top: 10px;
  font-size: 11px;
  font-family: var(--mono);
  color: var(--muted);
}
.monitor-load-pct b {
  color: var(--green);
  font-weight: 700;
}
/* Sticky table headers: parent #monitorOverlay must be the only scrollport.
   The global .pf-dp-table-wrap { overflow-x:auto } traps position:sticky — override here. */
#monitorContent .pf-dp-table-wrap {
  overflow: visible;
  max-width: 100%;
}
#monitorContent .pf-dp-table {
  min-width: 100%;
}
#monitorContent .pf-dp-table thead {
  position: sticky;
  top: 0;
  z-index: 6;
}
/* Options first in DOM: stocks table comes below — when scrolling into stocks, its thead should stack above. */
#monitorContent .monitor-section--stocks .pf-dp-table thead {
  z-index: 7;
}
#monitorContent .pf-dp-table th {
  background: var(--bg3) !important;
  box-shadow: 0 1px 0 var(--border);
}
.monitor-section { margin-bottom: 32px; }
.monitor-section-head {
  font-size: 10px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; font-family: var(--display);
  margin-bottom: 10px; padding: 6px 0 6px 2px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.monitor-section-head--options {
  color: #a78bfa; border-bottom: 1px solid rgba(167,139,250,0.25);
}
.monitor-section-head--stocks {
  color: var(--green); border-bottom: 1px solid rgba(34,211,165,0.25);
}
.monitor-section-count {
  font-size: 11px; font-weight: 600; font-family: var(--mono);
  background: var(--bg3); border-radius: 4px; padding: 1px 7px;
  color: var(--muted);
}
.monitor-opt-refresh-btn {
  margin-left: auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 24px; height: 24px;
  background: none; border: 1px solid rgba(167,139,250,0.3);
  border-radius: 6px; cursor: pointer; color: #a78bfa;
  font-size: 14px; line-height: 1; padding: 0;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
  flex-shrink: 0;
}
.monitor-opt-refresh-btn:hover { background: rgba(167,139,250,0.1); border-color: #a78bfa; }
.monitor-opt-refresh-btn.monitor-opt-refresh-spin {
  animation: monitor-opt-refresh-spin 0.7s linear infinite;
  pointer-events: none; opacity: 0.75;
}
@keyframes monitor-opt-refresh-spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.monitor-section-total {
  font-size: 12px; font-weight: 600; color: var(--text); font-family: var(--mono);
}
.pf-dp-table th.monitor-th-dragging { opacity: 0.4; cursor: grabbing; }
.pf-dp-table th.monitor-th-drop {
  background: rgba(99,179,237,0.18) !important;
  border-left: 2px solid var(--blue);
}
@media (max-width: 600px) {
  /* Mobile Monitor: header + KPI bar frozen, sections scroll, column labels frozen */
  #monitorOverlay {
    display: flex;
    flex-direction: column;
    overflow: hidden;
  }
  #monitorOverlay .monitor-wrap {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    padding: 0;           /* padding moved to header + content below */
  }
  #monitorOverlay .monitor-header {
    flex-shrink: 0;
    padding: 12px 14px;
    background: var(--bg);
    margin-bottom: 0;     /* border-bottom provides visual separation */
  }
  #monitorOverlay #monitorContent {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
    padding: 14px 12px 48px;
    -webkit-overflow-scrolling: touch;
  }
  /* Sticky top KPI summary — stays visible while sections scroll */
  #monitorOverlay #monitorContent .monitor-top-kpis {
    position: sticky;
    top: 0;
    z-index: 20;
    background: var(--bg);
    margin-left: -12px;
    margin-right: -12px;
    padding: 0 12px 10px;
    margin-bottom: 14px !important;
    border-bottom: 1px solid var(--border);
  }
  /* Each table wrapper becomes its own scroll container (horiz + vert)
     so that position:sticky on thead works correctly */
  #monitorOverlay #monitorContent .pf-dp-table-wrap {
    overflow: auto !important;
    max-height: 60vh;
    -webkit-overflow-scrolling: touch;
    border-radius: 0 0 6px 6px;
  }
  /* Thead frozen at the top of each table's scroll area */
  #monitorOverlay #monitorContent .pf-dp-table thead {
    position: sticky;
    top: 0;
    z-index: 6;
  }
}

/* Per-section chip strip (above each table, smaller than top-level KPIs) */
.pf-dp-section-kpis { margin: 6px 0 10px; gap: 8px; }
.pf-dp-kpi-sm { min-width: 0 !important; padding: 5px 10px !important; }
.pf-dp-kpi-sm .pf-dp-kpi-lbl { font-size: 8px !important; }

/* Options chip row — summary + expiry chips on one line */
.monitor-opt-chips { flex-wrap: wrap; overflow-x: auto; }
.monitor-opt-chips-divider {
  width: 1px; background: var(--border); align-self: stretch; margin: 0 4px; flex-shrink: 0;
}
.monitor-dte-chip { border-color: rgba(167,139,250,0.25) !important; }
.monitor-dte-chip-sub {
  font-size: 8px; color: var(--muted); margin-top: 3px;
  font-family: var(--display); letter-spacing: 0.04em;
}

/* Section labels inside groups (Stocks / Options) */
.pf-dp-section-label {
  font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--muted); font-family: var(--display);
  margin: 14px 0 6px; display: flex; align-items: center; gap: 10px;
}
.pf-dp-section-note {
  font-size: 9px; font-weight: 400; letter-spacing: 0; text-transform: none;
  color: var(--muted); font-family: var(--font); opacity: 0.7;
}

/* Draggable column header */
.pf-dp-th-drag { cursor: grab; }
.pf-dp-th-drag:active { cursor: grabbing; }
.pf-dp-th-drag.drag-over { background: rgba(99,179,237,0.15) !important; color: var(--blue) !important; }

/* Tooltip info badge in options header */
.pf-dp-th-info {
  display: inline-flex; align-items: center; justify-content: center;
  width: 11px; height: 11px; border-radius: 50%; background: rgba(107,114,128,0.5);
  color: var(--text); font-size: 8px; font-weight: 700; cursor: help;
  vertical-align: middle; margin-left: 2px;
}

/* Symbol cell */
.pf-dp-sym { text-align: left !important; font-family: var(--display) !important;
  font-weight: 600 !important; color: var(--blue) !important; padding-left: 12px !important; }

/* Action cell (edit + delete buttons) */
.pf-dp-actions {
  text-align: right !important; white-space: nowrap; padding-right: 8px !important;
}
.pf-dp-edit-btn, .pf-dp-del-btn {
  background: none; border: none; cursor: pointer; padding: 2px 4px;
  font-size: 11px; border-radius: 4px; line-height: 1; transition: background 0.12s, color 0.12s;
}
.pf-dp-edit-btn { color: var(--blue); }
.pf-dp-edit-btn:hover { background: rgba(99,179,237,0.15); }
.pf-dp-del-btn { color: var(--muted); }
.pf-dp-del-btn:hover { color: var(--red); background: rgba(229,62,62,0.12); }

/* Suppress hover on total rows in new design */
.pf-dp-table tbody tr.pf-dp-total-row:hover td { background: var(--bg3) !important; }
/* ── TAX PLANNING ─────────────────────────────────────────────────────────── */
.tp-intro { padding: 10px 12px; }
.tp-summary-line { font-size: 11px; margin-bottom: 10px; display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.tp-run-btn {
  display: inline-block; padding: 7px 16px; background: var(--blue); color: #fff;
  border: none; border-radius: 6px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font); transition: opacity 0.15s;
}
.tp-run-btn:hover { opacity: 0.85; }
.tp-run-btn-sm { padding: 4px 12px; font-size: 11px; }
.tp-loading { display: flex; align-items: center; gap: 10px; padding: 18px 14px; color: var(--muted); font-size: 12px; }
.tp-spinner {
  width: 16px; height: 16px; border: 2px solid var(--border); border-top-color: var(--blue);
  border-radius: 50%; animation: tp-spin 0.7s linear infinite; flex-shrink: 0;
}
@keyframes tp-spin { to { transform: rotate(360deg); } }
.tp-header-bar { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; border-bottom: 1px solid var(--border); }
.tp-wash-note { font-size: 10px; color: var(--muted); padding: 6px 12px; border-bottom: 1px solid var(--border); font-style: italic; }
.tp-table td { vertical-align: top; padding: 7px 8px; line-height: 1.4; }
.tp-table th { text-align: left !important; }
.tp-row { transition: background 0.2s; }
.tp-row-done { background: rgba(34,211,165,0.08) !important; }
.tp-row-done td { color: var(--green) !important; opacity: 0.85; }
.tp-cb { width: 15px; height: 15px; cursor: pointer; accent-color: var(--green); }

/* ── OPTIONS SCANNER ──────────────────────────────────────────────────────── */
.os-modal-body { background: var(--bg); border-radius: 12px; }

/* AI Feed */
.os-aifeed { background: var(--bg2); border-bottom: 1px solid var(--border); padding: 18px 22px 16px; }
.os-aifeed-kicker { font-size: 9px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; color: var(--blue); margin-bottom: 8px; }
.os-aifeed-headline { font-size: 17px; font-weight: 700; color: var(--text); line-height: 1.35; margin-bottom: 10px; }
.os-aifeed-narrative { font-size: 12px; color: var(--muted); line-height: 1.6; margin-bottom: 14px; max-width: 1100px; }
.os-ticker-chips { display: flex; gap: 8px; flex-wrap: nowrap; overflow-x: auto; margin-bottom: 14px; scrollbar-width: none; }
.os-ticker-chips::-webkit-scrollbar { display: none; }
.os-chip { display: flex; flex-direction: column; gap: 3px; background: var(--bg); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; min-width: 64px; }
.os-chip-ticker { font-family: var(--mono); font-size: 12px; font-weight: 700; color: var(--text); }
.os-chip-premium { font-family: var(--mono); font-size: 10px; color: var(--muted); }
.os-chip-bias { font-size: 9px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.os-chip-bias--bull { color: var(--green); }
.os-chip-bias--bear { color: var(--red); }
.os-trade-ideas { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.os-trade-idea { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.os-trade-idea-left { flex: 1; min-width: 0; }
.os-trade-idea-label { font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.os-trade-idea-corr { font-size: 10px; color: var(--muted); margin-bottom: 5px; }
.os-trade-idea-rationale { font-size: 11px; color: var(--muted); line-height: 1.5; display: none; }
.os-trade-idea-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.os-conviction { font-size: 10px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 3px 9px; border-radius: 4px; }
.os-conviction--High   { background: rgba(34,211,165,0.15); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.os-conviction--Medium { background: rgba(246,173,85,0.12); color: var(--amber); border: 1px solid rgba(246,173,85,0.3); }
.os-conviction--Low    { background: rgba(113,128,150,0.12); color: var(--muted); border: 1px solid var(--border); }
.os-trade-idea-toggle { font-size: 10px; color: var(--blue); background: none; border: none; cursor: pointer; padding: 3px 8px; text-decoration: underline; }
.os-aifeed-footer { font-size: 10px; color: var(--muted); }

/* Options scanner search autocomplete dropdown */
.os-search-wrap { position: relative; }
.os-search-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0;
  background: var(--bg2); border: 1px solid var(--border2); border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5); z-index: 9999; overflow: hidden;
  min-width: 260px;
}
.os-drop-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 12px; cursor: pointer;
  transition: background 0.12s;
}
.os-drop-row:hover, .os-drop-row.active { background: var(--bg3); }
.os-drop-sym { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--text); min-width: 52px; }
.os-drop-name { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Put/Call ratio meter */
.os-pc-meter { display: flex; align-items: center; gap: 6px; min-width: 130px; }
.os-pc-track  { flex: 1; height: 6px; background: var(--bg3); border-radius: 3px; overflow: hidden; }
.os-pc-fill   { height: 100%; border-radius: 3px; transition: width 0.3s ease; }
.os-pc-val    { font-family: var(--mono); font-size: 11px; font-weight: 700; min-width: 32px; text-align: right; }
.os-pc-lbl    { font-size: 9px; font-weight: 800; letter-spacing: 0.08em; min-width: 34px; }

/* Table header area */
.os-table-kicker { font-size: 10px; font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.os-search-input { background: var(--bg2); border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 12px; padding: 5px 10px; width: 140px; outline: none; }
.os-search-input::placeholder { color: var(--muted); }
.os-search-input:focus { border-color: var(--blue); }

/* Flagged orders table */
.os-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.os-th { padding: 8px 12px; text-align: left; font-size: 9px; font-weight: 700; letter-spacing: 0.09em; text-transform: uppercase; color: var(--muted); border-bottom: 1px solid var(--border); white-space: nowrap; position: sticky; top: 0; background: var(--bg); z-index: 1; }
.os-th--sortable { cursor: pointer; user-select: none; transition: color 0.12s; }
.os-th--sortable:hover { color: var(--text); }
.os-th--sort-desc::after { content: ' ▼'; color: var(--blue); }
.os-th--sort-asc::after  { content: ' ▲'; color: var(--blue); }
.os-th--num { text-align: right; }
.os-td { padding: 9px 12px; border-bottom: 1px solid rgba(255,255,255,0.04); vertical-align: middle; white-space: nowrap; }
.os-td--num { text-align: right; font-family: var(--mono); }
.os-td--name { font-size: 11px; color: var(--text); max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.os-td--ticker { font-family: var(--mono); font-size: 14px; font-weight: 800; color: var(--text); cursor: pointer; }
.os-td--ticker:hover { color: var(--blue); }
.os-td--premium { font-family: var(--mono); font-size: 12px; color: var(--green); font-weight: 700; }
.os-td--strike { font-family: var(--mono); font-size: 12px; color: var(--text); }
.os-td--expiry { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.os-td--dte { font-family: var(--mono); font-size: 11px; color: var(--muted); }
.os-td--ratio--call { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--green); }
.os-td--ratio--put  { font-family: var(--mono); font-size: 13px; font-weight: 700; color: var(--red); }
.os-td--volpct { font-family: var(--mono); font-size: 12px; color: var(--text); }

.os-type-badge { display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.08em; border-radius: 4px; padding: 2px 8px; }
.os-type-badge--call { background: rgba(34,211,165,0.15); color: var(--green); border: 1px solid rgba(34,211,165,0.3); }
.os-type-badge--put  { background: rgba(245,101,101,0.12); color: var(--red);   border: 1px solid rgba(245,101,101,0.3); }

.os-meter { display: flex; align-items: center; gap: 7px; }
.os-meter-track { width: 72px; height: 7px; background: rgba(255,255,255,0.07); border-radius: 4px; overflow: hidden; flex-shrink: 0; }
.os-meter-fill { height: 100%; border-radius: 4px; transition: width 0.3s ease; }
.os-meter-label { font-family: var(--mono); font-size: 10px; font-weight: 700; letter-spacing: 0.06em; min-width: 28px; }
.os-empty { text-align: center; padding: 32px; color: var(--muted); font-size: 13px; }
.os-retry-btn { margin-left: 10px; background: none; border: 1px solid var(--border); border-radius: 6px; color: var(--text); font-size: 11px; padding: 4px 10px; cursor: pointer; }
.os-retry-btn:hover { background: rgba(255,255,255,0.06); }
tr.os-hidden { display: none; }
tr.os-row:hover td { background: rgba(255,255,255,0.025); }

/* ── Options Scanner: animated sweep indicator ── */
.os-scan-wrap { padding: 36px 24px 28px; display: flex; flex-direction: column; align-items: center; gap: 18px; }
.os-scan-screen {
  width: 320px; height: 54px;
  background: rgba(0,0,0,0.45);
  border: 1px solid rgba(34,211,165,0.2);
  border-radius: 8px;
  position: relative; overflow: hidden;
}
/* trailing green glow that grows from left */
.os-scan-trail {
  position: absolute; top: 0; bottom: 0; left: 0;
  background: linear-gradient(to right, transparent 0%, rgba(34,211,165,0.06) 70%, rgba(34,211,165,0.18) 100%);
  animation: osTrail 2.4s ease-in-out infinite;
}
/* bright scan line */
.os-scan-line {
  position: absolute; top: 0; bottom: 0; width: 3px;
  background: #22d3a5;
  box-shadow: 0 0 14px 5px rgba(34,211,165,0.55), 0 0 3px 1px #22d3a5;
  animation: osSweep 2.4s ease-in-out infinite;
}
/* subtle grid lines for "radar screen" feel */
.os-scan-screen::before {
  content: '';
  position: absolute; inset: 0;
  background:
    repeating-linear-gradient(90deg, rgba(34,211,165,0.04) 0 1px, transparent 1px 80px),
    repeating-linear-gradient(0deg,  rgba(34,211,165,0.04) 0 1px, transparent 1px 18px);
}
@keyframes osSweep {
  0%   { left: -3px;  opacity: 1; }
  90%  { left: 100%;  opacity: 1; }
  100% { left: 100%;  opacity: 0; }
}
@keyframes osTrail {
  0%   { width: 0%; }
  90%  { width: 100%; }
  100% { width: 0%; }
}
.os-scan-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase;
  color: #22d3a5;
}
.os-scan-sub {
  font-size: 11px; color: var(--muted); margin-top: 2px; text-align: center;
}
.os-scan-dots::after {
  content: '';
  animation: osDots 1.5s steps(4, end) infinite;
}
@keyframes osDots {
  0%  { content: '';    }
  25% { content: '.';   }
  50% { content: '..';  }
  75% { content: '...'; }
}

/* ── Sell ITM Puts Tool ─────────────────────────────────────────────────── */
.os-itm-section {
  border-top: 2px solid var(--border);
  padding: 8px 18px 10px;
}
.os-itm-section.os-itm-section--expanded {
  padding: 16px 18px 24px;
}
.os-itm-top--bar {
  display: flex;
  align-items: center;
  margin-bottom: 0;
}
.os-itm-section--expanded .os-itm-top--bar {
  margin-bottom: 8px;
}
.os-itm-top--inner {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.os-itm-top-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}
.os-itm-top-left .os-table-kicker {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.os-itm-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  flex-wrap: wrap;
}
.os-itm-expand-hint {
  margin-left: auto;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
}
.os-itm-section--expanded .os-itm-expand-hint {
  display: none;
}
.os-itm-toggle {
  flex-shrink: 0;
  width: 28px; height: 28px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--border); border-radius: 6px;
  color: var(--muted); cursor: pointer; padding: 0;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.os-itm-toggle:hover { color: var(--text); border-color: var(--blue); background: var(--bg3); }
.os-itm-chevron { display: inline-block; font-size: 11px; line-height: 1; transition: transform 0.15s ease; }
.os-itm-section--expanded .os-itm-chevron { transform: rotate(90deg); }
.os-itm-collapsible[hidden] { display: none !important; }
.os-itm-placeholder { color: var(--muted); font-size: 11px; padding: 6px 0; }
.os-itm-result { min-height: 36px; }

/* criteria slider grid */
.os-itm-criteria { margin-bottom: 16px; }
.os-itm-sliders { display: grid; grid-template-columns: 1fr 1fr; gap: 7px 28px; }
.os-itm-srow { display: flex; align-items: center; gap: 7px; min-width: 0; }
.os-itm-slabel { font-size: 10px; font-weight: 600; color: var(--muted); font-family: var(--mono); width: 86px; flex-shrink: 0; white-space: nowrap; }
.os-itm-sval { font-size: 10px; font-weight: 700; color: var(--text); font-family: var(--mono); width: 42px; text-align: right; flex-shrink: 0; }
.os-itm-sto { font-size: 9px; color: var(--muted); flex-shrink: 0; }

/* range input styling */
.os-itm-range { -webkit-appearance: none; appearance: none; flex: 1; min-width: 40px; height: 3px; border-radius: 2px; outline: none; cursor: pointer; background: var(--border); }
.os-itm-range::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 12px; height: 12px; background: var(--green); border-radius: 50%; cursor: pointer; transition: transform .1s; }
.os-itm-range::-webkit-slider-thumb:hover { transform: scale(1.2); }
.os-itm-range::-moz-range-thumb { width: 12px; height: 12px; background: var(--green); border-radius: 50%; border: none; cursor: pointer; }
.os-itm-range::-moz-range-track { background: var(--border); height: 3px; border-radius: 2px; }
.itm-card { background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; padding: 20px 22px 18px; max-width: 960px; }
.itm-card-kicker { font-size: 9px; font-weight: 800; letter-spacing: 0.14em; text-transform: uppercase; color: var(--blue); margin-bottom: 5px; }
.itm-contract-sym { font-size: 14px; font-weight: 700; color: var(--text); font-family: var(--mono); margin-bottom: 18px; }
.itm-highlights { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 18px; }
.itm-hl { display: flex; flex-direction: column; gap: 3px; }
.itm-hl-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.itm-hl-val-lg { font-size: 22px; font-weight: 800; color: var(--green); font-family: var(--mono); line-height: 1; }
.itm-hl-val { font-size: 14px; font-weight: 700; color: var(--text); font-family: var(--mono); }
.itm-greeks { display: flex; gap: 20px; flex-wrap: wrap; padding-top: 14px; border-top: 1px solid var(--border); }
.itm-greek { display: flex; flex-direction: column; gap: 3px; min-width: 72px; }
.itm-greek-label { font-size: 9px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.itm-greek-val { font-size: 12px; font-weight: 600; color: var(--text); font-family: var(--mono); }
.itm-no-match { color: var(--muted); font-size: 12px; padding: 8px 0; line-height: 1.6; }
.itm-footer-note { font-size: 10px; color: var(--muted); margin-top: 10px; }

/* ═══════════════════════════════════════════════════════════════════════════
   SECTOR FLOW INTELLIGENCE
   ═══════════════════════════════════════════════════════════════════════════ */

/* Modal header */
.sf-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  padding: 16px 56px 12px 20px;  /* right pad clears the abs-positioned ✕ */
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}
.sf-title {
  font-family: var(--display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--text);
}
.sf-subtitle {
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.04em;
}

/* AI narrative band */
.sf-ai-band {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: rgba(99,179,237,0.06);
  border: 1px solid rgba(99,179,237,0.14);
  border-radius: 8px;
  padding: 12px 14px;
  margin-top: 16px;
  line-height: 1.55;
}
.sf-ai-kicker {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  color: #63b3ed;
  font-family: var(--mono);
  padding: 2px 7px;
  background: rgba(99,179,237,0.12);
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: flex-start;
  margin-top: 2px;
}
.sf-ai-text {
  font-size: 12px;
  color: rgba(255,255,255,0.8);
}

/* Flow summary row */
.sf-flow-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 14px;
}
.sf-flow-card {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 8px;
  padding: 10px 12px;
}
.sf-flow-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 700;
}
.sf-flow-icon { font-size: 13px; }
.sf-flow-card-sub {
  font-size: 9px;
  color: var(--muted);
  margin: 2px 0 6px;
  letter-spacing: 0.03em;
}
.sf-flow-card-tickers {
  font-size: 10px;
  color: rgba(255,255,255,0.65);
  font-family: var(--mono);
  line-height: 1.5;
}

/* Main single-column stack: RRG on top, heatmap below */
.sf-main-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin-top: 16px;
}
@media (max-width: 640px) {
  .sf-flow-row  { grid-template-columns: repeat(2, 1fr); }
}

/* Panel */
.sf-panel { display: flex; flex-direction: column; gap: 10px; }
.sf-panel-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: var(--mono);
}
.sf-rrg-wrap { width: 100%; }
.sf-rrg-hint {
  font-size: 9.5px;
  color: var(--muted);
  line-height: 1.5;
  opacity: 0.7;
}

/* Legend */
.sf-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
}
.sf-leg-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  color: rgba(255,255,255,0.6);
  font-family: var(--mono);
}

/* Heatmap table */
.sf-heat-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 11.5px;
}
.sf-th {
  padding: 7px 10px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  text-align: left;
  font-family: var(--mono);
}
.sf-th-r { text-align: right; }
.sf-th-c { text-align: center; }
.sf-td {
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  display: table-cell;
  align-items: center;
  gap: 7px;
  vertical-align: middle;
}
.sf-td-r { text-align: right; font-family: var(--mono); }
.sf-td-c { text-align: center; font-family: var(--mono); }
.sf-row:hover { background: rgba(255,255,255,0.025); }
.sf-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
  flex-shrink: 0;
}
.sf-quad-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  font-family: var(--mono);
  white-space: nowrap;
}

