:root {
  --bg: #f0f2f5;
  --surface: #ffffff;
  --primary: #1a3a5c;
  --primary-light: #264d7a;
  --accent: #c8a84b;
  --pass: #28a745;
  --warn: #ffc107;
  --fail: #dc3545;
  --text: #212529;
  --text-muted: #6c757d;
  --border: #dee2e6;
  --radius: 10px;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 20px rgba(0,0,0,0.12);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ---- NAV ---- */
nav {
  background: var(--primary);
  color: white;
  padding: 0 2rem;
  display: flex;
  align-items: center;
  height: 56px;
  gap: 2rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
nav .brand {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-decoration: none;
}
nav a {
  color: rgba(255,255,255,0.8);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.15s;
}
nav a:hover { color: white; }

/* ---- LAYOUT ---- */
.container { max-width: 1100px; margin: 0 auto; padding: 2rem 1.5rem; }

/* ---- HERO SEARCH ---- */
.hero {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-light) 100%);
  color: white;
  padding: 3rem 1.5rem;
  text-align: center;
}
.hero h1 { font-size: 2rem; margin-bottom: 0.5rem; }
.hero p { color: rgba(255,255,255,0.75); margin-bottom: 1.5rem; font-size: 0.95rem; }
.search-bar {
  display: flex;
  gap: 0.5rem;
  max-width: 500px;
  margin: 0 auto;
}
.search-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  border-radius: var(--radius);
  font-size: 1rem;
  outline: none;
}
.search-bar input::placeholder { color: #999; }
.btn {
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: var(--radius);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s;
}
.btn-primary {
  background: var(--accent);
  color: var(--primary);
}
.btn-primary:hover { background: #d4b05a; transform: translateY(-1px); }
.btn-outline {
  background: transparent;
  border: 2px solid var(--border);
  color: var(--text);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-sm { padding: 0.4rem 0.9rem; font-size: 0.85rem; }
.btn-danger { background: var(--fail); color: white; }
.btn-danger:hover { background: #c0392b; }

/* ---- CARDS ---- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}
.card-title { font-size: 1rem; font-weight: 700; color: var(--primary); }

/* ---- SCORE BADGE ---- */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 52px; height: 52px;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 800;
  color: white;
}
.grade-A { background: var(--pass); }
.grade-B { background: #20c997; }
.grade-C { background: var(--warn); color: #555; }
.grade-D { background: #fd7e14; }
.grade-F { background: var(--fail); }
/* Not Rated — too little data to score. Deliberately neutral grey rather than
   the fail colour: "we don't know" must not look like "this is bad". */
.grade-NR { background: #6b7280; }

/* ---- SCORE COLOR ---- */
.score-none { color: var(--text-muted); font-weight: 600; }
.score-high { color: var(--pass); font-weight: 700; }
.score-mid { color: #e67e22; font-weight: 700; }
.score-low { color: var(--fail); font-weight: 700; }

/* ---- RECOMMENDATION PILLS ---- */
.pill {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}
.pill-A, .pill-buy { background: #d4edda; color: #155724; }
.pill-B { background: #cce8e0; color: #0a4d38; }
.pill-C, .pill-hold { background: #fff3cd; color: #856404; }
.pill-D, .pill-avoid { background: #fde8d8; color: #7c3a00; }
.pill-F { background: #f8d7da; color: #721c24; }
.pill-NR { background: #e5e7eb; color: #374151; }

/* ---- TABLE ---- */
.table-wrap { overflow-x: auto; }
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  background: var(--bg);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8f9fa; }
.ticker-cell { font-weight: 700; color: var(--primary); }
.ticker-cell a { color: inherit; text-decoration: none; }
.ticker-cell a:hover { text-decoration: underline; }

/* ---- SCORE BAR ---- */
.score-bar-wrap { display: flex; align-items: center; gap: 0.5rem; }
.score-bar {
  flex: 1;
  height: 8px;
  background: var(--border);
  border-radius: 4px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}
.score-num { font-size: 0.85rem; font-weight: 700; min-width: 32px; text-align: right; }

/* ---- FILTERS ---- */
.filters {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}
.filters label { font-size: 0.85rem; color: var(--text-muted); }
.filters select {
  padding: 0.4rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

/* ---- REPORT PAGE ---- */
.report-hero {
  background: var(--primary);
  color: white;
  padding: 2rem;
  border-radius: var(--radius) var(--radius) 0 0;
}
.report-hero .ticker { font-size: 2rem; font-weight: 800; }
.report-hero .name { color: rgba(255,255,255,0.75); font-size: 1rem; }
.report-hero .sector-tag {
  display: inline-block;
  background: rgba(255,255,255,0.15);
  padding: 0.2rem 0.6rem;
  border-radius: 12px;
  font-size: 0.8rem;
  margin-top: 0.5rem;
}

.score-card {
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr;
  gap: 1.5rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--surface);
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
}
.score-card .big-score {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1;
}
.score-card .meta-label { font-size: 0.75rem; color: var(--text-muted); text-transform: uppercase; margin-bottom: 0.2rem; }
.score-card .meta-value { font-size: 1.1rem; font-weight: 700; }

/* ---- RADAR CHART ---- */
.radar-container {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 700px) {
  .radar-container { grid-template-columns: 1fr; }
  .score-card { grid-template-columns: auto 1fr; }
}

.metric-list { display: flex; flex-direction: column; gap: 0.5rem; }
.metric-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.metric-name {
  font-size: 0.85rem;
  width: 130px;
  flex-shrink: 0;
  color: var(--text-muted);
}
.metric-passed {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  flex-shrink: 0;
}
.metric-passed.yes { background: var(--pass); }
.metric-passed.no { background: var(--fail); }

/* ---- FINANCIALS TABLE ---- */
.fin-table { font-size: 0.85rem; }
.fin-table th { font-size: 0.75rem; }

/* ---- DCF SECTION ---- */
.dcf-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.dcf-stat { background: var(--bg); border-radius: 8px; padding: 1rem; }
.dcf-stat .label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 0.25rem; text-transform: uppercase; }
.dcf-stat .value { font-size: 1.3rem; font-weight: 700; }

/* ---- COMPARE PAGE ---- */
.compare-input {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 1.5rem;
}
.compare-input input {
  width: 120px;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  text-transform: uppercase;
}
.compare-table th:first-child { width: 200px; }
.compare-table td:first-child { color: var(--text-muted); font-size: 0.85rem; font-weight: 600; }
.best-value { background: #d4edda; font-weight: 700; }

/* ---- LOADING / EMPTY ---- */
.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.5rem;
}
@keyframes spin { to { transform: rotate(360deg); } }

.empty-state {
  text-align: center;
  padding: 3rem;
  color: var(--text-muted);
}
.empty-state .icon { font-size: 2.5rem; margin-bottom: 0.5rem; }

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert-error { background: #f8d7da; color: #721c24; border: 1px solid #f5c6cb; }
.alert-info { background: #d1ecf1; color: #0c5460; border: 1px solid #bee5eb; }
.alert-success { background: #d4edda; color: #155724; border: 1px solid #c3e6cb; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.back-link:hover { color: var(--primary); }

/* ---- PASSED INDICATOR ---- */
.check { color: var(--pass); }
.cross { color: var(--fail); }

/* ---- MARKET TABS ---- */
.market-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 1.25rem;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.market-tab {
  flex: 1;
  padding: 0.75rem 1rem;
  border: none;
  background: transparent;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  color: var(--text-muted);
  border-bottom: 3px solid transparent;
  transition: all 0.15s;
  text-align: center;
}
.market-tab:hover { color: var(--primary); background: var(--bg); }
.market-tab.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
  background: var(--bg);
}

/* ---- INDUSTRY PAGE ---- */
.sector-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1.25rem;
}
.sector-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: box-shadow 0.15s;
}
.sector-card:hover { box-shadow: var(--shadow-md); }
.sector-card-header {
  padding: 1rem 1.25rem 0.75rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}
.sector-name { font-size: 1rem; font-weight: 700; color: var(--primary); }
.sector-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.15rem; }
.sector-score-badge {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
  min-width: 48px;
  text-align: right;
}
.sector-card-body { padding: 0.9rem 1.25rem; }
.sector-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
  font-size: 0.82rem;
}
.sector-stat-label { color: var(--text-muted); }
.sector-stat-value { font-weight: 600; }
.grade-bar {
  display: flex;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin: 0.6rem 0 0.5rem;
  gap: 2px;
}
.grade-bar-seg { height: 100%; border-radius: 2px; transition: width 0.4s; }
.grade-legend {
  display: flex;
  gap: 0.75rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  margin-bottom: 0.6rem;
}
.grade-legend span { display: flex; align-items: center; gap: 0.25rem; }
.grade-dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.sector-top-list { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.3rem; }
.sector-top-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8rem;
  padding: 0.25rem 0.35rem;
  text-decoration: none;
  color: inherit;
  border-radius: 4px;
  transition: background 0.1s;
}
.sector-top-item:hover { background: var(--bg); }
.sector-top-ticker { font-weight: 700; color: var(--primary); min-width: 52px; }
.sector-top-name {
  flex: 1; color: var(--text-muted);
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.sector-industries-toggle {
  display: block; width: 100%; text-align: left;
  background: var(--bg); border: none; border-top: 1px solid var(--border);
  padding: 0.6rem 1.25rem; font-size: 0.8rem; color: var(--text-muted);
  cursor: pointer; transition: background 0.12s;
}
.sector-industries-toggle:hover { background: #e9ecef; color: var(--primary); }
.sector-industries { padding: 0.75rem 1.25rem; border-top: 1px solid var(--border); display: none; }
.sector-industries.open { display: block; }
.industry-row {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0; font-size: 0.8rem;
  border-bottom: 1px solid var(--border);
}
.industry-row:last-child { border-bottom: none; }
.industry-name { flex: 1; color: var(--text); }
.industry-count { color: var(--text-muted); min-width: 50px; text-align: right; font-size: 0.75rem; }
.industry-score { font-weight: 700; min-width: 36px; text-align: right; }
.industry-summary {
  display: flex; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.5rem;
}
.industry-summary-stat {
  flex: 1; min-width: 130px;
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; text-align: center;
}
.industry-summary-stat .val { font-size: 1.8rem; font-weight: 800; color: var(--primary); line-height: 1; }
.industry-summary-stat .lbl { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; }
@media (max-width: 700px) {
  .sector-grid { grid-template-columns: 1fr; }
}

/* ---- INFO TOOLTIP ---- */
.info-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #adb5bd;
  color: white;
  font-size: 9px;
  font-weight: 800;
  font-style: normal;
  cursor: help;
  position: relative;
  margin-left: 3px;
  vertical-align: middle;
  flex-shrink: 0;
  line-height: 1;
  user-select: none;
}
/* Tooltip bubble is rendered by /static/js/tooltip.js (fixed position, escapes overflow) */

/* ---- WATCHLIST ---- */
.watchlist-empty {
  text-align: center; padding: 3rem; color: var(--text-muted);
}
.wl-pct-pos { color: var(--pass); font-weight: 700; }
.wl-pct-neg { color: var(--fail); font-weight: 700; }
.wl-note-input {
  width: 100%; padding: 0.3rem 0.5rem; border: 1px solid var(--border);
  border-radius: 5px; font-size: 0.8rem; resize: none;
}

/* ---- PREDICTIONS ---- */
.pred-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.pred-stat {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1rem 1.25rem; text-align: center;
}
.pred-stat .val { font-size: 1.8rem; font-weight: 800; color: var(--primary); line-height: 1; }
.pred-stat .lbl { font-size: 0.75rem; color: var(--text-muted); margin-top: 0.25rem; text-transform: uppercase; }

.pred-card {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 1.1rem 1.25rem; display: flex; flex-direction: column; gap: 0;
  transition: box-shadow 0.15s;
}
.pred-card:hover { box-shadow: var(--shadow-md); }
.pred-rank {
  font-size: 1.4rem; font-weight: 800; color: var(--border); min-width: 36px; text-align: center;
}
.pred-info { flex: 1; min-width: 140px; }
.pred-ticker { font-size: 1rem; font-weight: 700; color: var(--primary); }
.pred-name { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.1rem; }
.pred-sector { font-size: 0.72rem; color: var(--text-muted); }
.pred-returns { display: flex; gap: 1rem; flex-wrap: wrap; align-items: center; }
.pred-return-cell { text-align: center; min-width: 70px; }
.pred-return-val { font-size: 1.05rem; font-weight: 700; }
.pred-return-lbl { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; }
.pred-confidence {
  font-size: 0.72rem; font-weight: 700; padding: 0.2rem 0.6rem;
  border-radius: 20px; white-space: nowrap;
}
.pred-confidence.High   { background: #d4edda; color: #155724; }
.pred-confidence.Medium { background: #fff3cd; color: #856404; }
.pred-confidence.Low    { background: #f8d7da; color: #721c24; }

.outcome-badge {
  display: inline-block; padding: 0.2rem 0.6rem; border-radius: 20px;
  font-size: 0.75rem; font-weight: 700;
}
.outcome-Beat    { background: #d4edda; color: #155724; }
.outcome-Hit     { background: #cce8e0; color: #0a4d38; }
.outcome-Partial { background: #fff3cd; color: #856404; }
.outcome-Miss    { background: #f8d7da; color: #721c24; }
.outcome-Pending { background: #e2e3e5; color: #383d41; }

/* accuracy doughnut placeholder */
.accuracy-ring {
  width: 90px; height: 90px; border-radius: 50%;
  background: conic-gradient(var(--pass) var(--pct, 0%), var(--border) 0%);
  display: flex; align-items: center; justify-content: center;
  font-size: 1rem; font-weight: 800; color: var(--primary);
}/* ---- TECHNICAL ANALYSIS PAGE ---- */
.signal-badge {
  display: inline-block; padding: 0.25rem 0.7rem; border-radius: 20px;
  font-size: 0.78rem; font-weight: 700; white-space: nowrap;
}
.signal-StrongBuy  { background: #d4edda; color: #155724; }
.signal-Buy        { background: #cce8e0; color: #0a4d38; }
.signal-Neutral    { background: #e2e3e5; color: #383d41; }
.signal-Sell       { background: #fde8d8; color: #7c3a00; }
.signal-StrongSell { background: #f8d7da; color: #721c24; }

.tech-score-bar-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 110px; }
.tech-score-bar {
  flex: 1; height: 8px; background: var(--border);
  border-radius: 4px; overflow: hidden;
}
.tech-score-bar-fill { height: 100%; border-radius: 4px; transition: width 0.4s; }

.tech-stat-strip {
  display: flex; gap: 1rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}
.tech-stat {
  background: var(--surface); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 0.75rem 1.25rem; text-align: center; flex: 1; min-width: 120px;
}
.tech-stat .val { font-size: 1.6rem; font-weight: 800; color: var(--primary); line-height: 1; }
.tech-stat .lbl { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.2rem; text-transform: uppercase; }

/* ---- COMBINED SCORE ---- */
.combined-score-bar-wrap { display: flex; align-items: center; gap: 0.5rem; min-width: 130px; }
.combined-score-bar {
  flex: 1; height: 10px; background: var(--border);
  border-radius: 5px; overflow: hidden;
}
.combined-score-bar-fill { height: 100%; border-radius: 5px; transition: width 0.4s; }
.combined-score-num { font-size: 0.9rem; font-weight: 800; min-width: 36px; text-align: right; }

.dual-score {
  display: flex; flex-direction: column; gap: 2px;
}
.dual-score-row {
  display: flex; align-items: center; gap: 0.35rem; font-size: 0.78rem;
}
.dual-score-label { color: var(--text-muted); min-width: 16px; font-weight: 600; }

.weight-slider-wrap {
  display: flex; align-items: center; gap: 0.6rem; font-size: 0.85rem;
}
.weight-slider-wrap input[type=range] { width: 130px; cursor: pointer; }
.weight-labels { display: flex; justify-content: space-between; font-size: 0.72rem; color: var(--text-muted); }

/* ---- DAY TRADING PAGE ---- */
.dt-signal-badge {
  display: inline-block; padding: 0.28rem 0.75rem; border-radius: 20px;
  font-size: 0.8rem; font-weight: 700; white-space: nowrap;
}
.dt-Bullish       { background: #d4edda; color: #155724; }
.dt-WeakBullish   { background: #cce8e0; color: #0a4d38; }
.dt-WeakBearish   { background: #fde8d8; color: #7c3a00; }
.dt-Bearish       { background: #f8d7da; color: #721c24; }

.dt-tabs {
  display: flex; gap: 0; border-bottom: 2px solid var(--border);
  margin-bottom: 1.25rem;
}
.dt-tab {
  padding: 0.6rem 1.25rem; font-size: 0.9rem; font-weight: 600;
  cursor: pointer; border: none; background: none; color: var(--text-muted);
  border-bottom: 2px solid transparent; margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}
.dt-tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.dt-tab:hover  { color: var(--primary); }

.dt-controls {
  display: flex; gap: 0.75rem; flex-wrap: wrap; align-items: flex-end;
  margin-bottom: 1.25rem;
}
.dt-controls label  { font-size: 0.8rem; color: var(--text-muted); display: block; margin-bottom: 0.2rem; }
.dt-controls input[type=text], .dt-controls select {
  padding: 0.45rem 0.75rem; border: 1px solid var(--border);
  border-radius: 6px; font-size: 0.9rem; background: white;
}
.dt-controls input[type=text] { width: 160px; }

.dt-summary-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 0.75rem; margin-bottom: 1.25rem;
}
.dt-stat {
  background: var(--surface); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 0.75rem 1rem; text-align: center;
}
.dt-stat .val  { font-size: 1.35rem; font-weight: 800; line-height: 1.1; color: var(--primary); }
.dt-stat .lbl  { font-size: 0.7rem;  color: var(--text-muted); margin-top: 0.2rem; text-transform: uppercase; letter-spacing: 0.04em; }
.dt-stat .sub  { font-size: 0.72rem; color: var(--text-muted); margin-top: 0.1rem; }

.dt-chart-wrap {
  position: relative; width: 100%; height: 400px;
}
.dt-chart-wrap canvas { width: 100% !important; height: 100% !important; }

.dt-vwap-above  { color: var(--pass); font-weight: 700; }
.dt-vwap-below  { color: var(--fail); font-weight: 700; }
.dt-ema-bull    { color: var(--pass); font-weight: 700; }
.dt-ema-bear    { color: var(--fail); font-weight: 700; }

/* ════════════════════════════════════════════════════════════════
   SCORE STRIP — report page hero score card (5 stats in a row)
   ════════════════════════════════════════════════════════════════ */
.score-strip {
  background: white;
  padding: 1.5rem;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 1.5rem;
  display: grid;
  grid-template-columns: auto 1fr 1fr 1fr 1fr;
  gap: 1.5rem;
  align-items: center;
}
@media (max-width: 768px) {
  .score-strip {
    grid-template-columns: auto 1fr 1fr;
    gap: 1rem;
    padding: 1rem;
  }
}
@media (max-width: 480px) {
  .score-strip {
    grid-template-columns: auto 1fr;
    gap: 0.75rem;
    padding: 0.85rem;
  }
}

/* ════════════════════════════════════════════════════════════════
   GROUPED NAV — desktop dropdowns + mobile accordion (tooltip.js)
   ════════════════════════════════════════════════════════════════ */

/* Desktop: 4 group buttons flush to the right */
.nav-desktop {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  margin-left: auto;
}

.nav-grp { position: relative; }

.nav-grp-btn {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.82);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0.45rem 0.8rem;
  border-radius: 6px;
  white-space: nowrap;
  line-height: 1;
  transition: background 0.15s, color 0.15s;
}
.nav-grp-btn:hover,
.nav-grp-btn.open  { background: rgba(255,255,255,0.1); color: white; }
.nav-grp-btn.active { color: var(--accent); }
.nav-caret { font-size: 0.6rem; vertical-align: middle; margin-left: 3px; opacity: 0.7; }

/* Dropdown panel */
.nav-grp-dd {
  display: none;
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  min-width: 148px;
  background: var(--primary);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.38);
  padding: 0.3rem 0;
  z-index: 1000;
}
.nav-grp-dd.open { display: block; }
.nav-grp-dd a {
  display: block;
  padding: 0.55rem 1rem;
  color: rgba(255,255,255,0.82);
  text-decoration: none;
  font-size: 0.875rem;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.nav-grp-dd a:hover    { background: rgba(255,255,255,0.1); color: white; }
.nav-grp-dd a.nav-current { color: var(--accent); font-weight: 700; background: rgba(200,168,75,0.08); }

/* Mobile nav — hidden on desktop */
.nav-mobile { display: none; }

/* Hamburger — hidden on desktop */
.nav-hamburger {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 26px;
  height: 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  margin-left: auto;
  flex-shrink: 0;
}
.nav-hamburger span {
  display: block;
  width: 100%;
  height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
  transition: transform 0.25s ease, opacity 0.2s ease;
  transform-origin: center;
}
.nav-hamburger.open span:nth-child(1) { transform: translateY(9px) rotate(45deg); }
.nav-hamburger.open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-hamburger.open span:nth-child(3) { transform: translateY(-9px) rotate(-45deg); }

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — 768 px (tablets & phones)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {

  /* Nav */
  nav {
    flex-wrap: wrap;
    height: auto;
    min-height: 56px;
    padding: 0 1rem;
    gap: 0;
    align-items: center;
  }
  nav .brand { padding: 1rem 0; flex: 1; }
  .nav-desktop  { display: none; }
  .nav-hamburger { display: flex; padding: 1rem 0; }

  /* Mobile accordion */
  .nav-mobile {
    display: none;
    flex-direction: column;
    width: 100%;
    padding: 0.35rem 0 0.85rem;
    border-top: 1px solid rgba(255,255,255,0.15);
  }
  .nav-mobile.open { display: flex; }

  /* Group label headers inside mobile menu */
  .nav-mob-hdr {
    font-size: 0.67rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent);
    padding: 0.75rem 0.5rem 0.2rem;
    margin-top: 0.2rem;
  }
  .nav-mob-hdr:first-child { padding-top: 0.35rem; margin-top: 0; }

  /* Links inside mobile menu */
  .nav-mobile a {
    padding: 0.6rem 1rem;
    width: 100%;
    font-size: 0.9rem;
    color: rgba(255,255,255,0.82);
    text-decoration: none;
    border-bottom: 1px solid rgba(255,255,255,0.06);
  }
  .nav-mobile a:last-child { border-bottom: none; }
  .nav-mobile a:hover     { color: white; background: rgba(255,255,255,0.06); }
  .nav-mobile a.nav-current { color: var(--accent); font-weight: 600; }

  /* Layout */
  .container { padding: 1rem; }

  /* Hero */
  .hero { padding: 1.5rem 1rem; }
  .hero h1 { font-size: 1.5rem; }
  .hero p  { font-size: 0.88rem; }
  .search-bar { flex-direction: column; }
  .search-bar .btn { width: 100%; padding: 0.7rem 1rem; }

  /* Buttons */
  .btn { padding: 0.65rem 1.1rem; font-size: 0.88rem; }
  .btn-sm { padding: 0.38rem 0.75rem; font-size: 0.8rem; }

  /* Cards */
  .card { padding: 1rem; }
  .card-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Tables — universal horizontal scroll via .table-scroll-wrap (injected by JS) */
  .table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .table-scroll-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    width: 100%;
    /* visual fade hint on right edge when content overflows */
    background: linear-gradient(to right, transparent 85%, rgba(0,0,0,0.04)) no-repeat right center / 60px 100%,
                var(--surface);
  }
  th, td { padding: 0.55rem 0.7rem; font-size: 0.82rem; }

  /* Score card (report page) */
  .score-card {
    grid-template-columns: auto 1fr;
    gap: 1rem;
    padding: 1rem;
  }
  .score-card .big-score { font-size: 2.2rem; }

  /* Radar (report page) */
  .radar-container { grid-template-columns: 1fr; }

  /* DCF grid */
  .dcf-grid { grid-template-columns: repeat(2, 1fr); }

  /* Industry / sector grid */
  .sector-grid { grid-template-columns: 1fr; }

  /* Filters */
  .filters { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .filters select, .filters input[type=text] { width: 100%; max-width: 100%; }

  /* Market tabs */
  .market-tab { padding: 0.6rem 0.5rem; font-size: 0.8rem; }

  /* Summary stats strips */
  .tech-stat-strip { gap: 0.5rem; }
  .tech-stat { min-width: calc(50% - 0.25rem); padding: 0.65rem 0.85rem; }
  .tech-stat .val { font-size: 1.3rem; }

  .dt-summary-strip { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .dt-stat .val { font-size: 1.2rem; }
  .dt-chart-wrap { height: 260px; }

  /* Day trading controls */
  .dt-controls { flex-direction: column; align-items: stretch; gap: 0.5rem; }
  .dt-controls input[type=text], .dt-controls select { width: 100%; }
  .dt-tabs { overflow-x: auto; white-space: nowrap; }

  /* Predictions */
  .pred-summary { grid-template-columns: repeat(2, 1fr); gap: 0.75rem; }
  .pred-stat .val { font-size: 1.4rem; }
  .pred-returns { gap: 0.5rem; }/* Compare */
  .compare-input { flex-direction: column; align-items: stretch; }
  .compare-input input { width: 100%; }

  /* Weight slider */
  .weight-slider-wrap { flex-wrap: wrap; }
  .weight-slider-wrap input[type=range] { width: 100%; }

  /* Industry summary */
  .industry-summary-stat { min-width: calc(50% - 0.5rem); }

  /* Toast — keep it above mobile nav */
  .toast { bottom: 1rem; right: 0.75rem; left: 0.75rem; max-width: unset; }

  /* Portfolio settings grid (2-col → 1-col) */
  .settings-grid-2 { grid-template-columns: 1fr !important; }

  /* Scan status bar label: allow it to wrap to avoid horizontal scroll */
  #scanLabel { white-space: normal; word-break: break-word; }

  /* Prediction grid: force single column on phones */
  #predCards { grid-template-columns: 1fr !important; }

  /* Correlation panel controls: allow wrap */
  .corr-controls { flex-wrap: wrap !important; }

  /* Range-row labels: shrink min-width so sliders don't overflow */
  .range-row label { min-width: 100px; }

  /* Watchlist: hero input row stacks naturally */
  .wl-input-row { flex-direction: column; align-items: stretch; }
  .wl-input-row input { min-width: 0 !important; width: 100%; }
  .wl-input-row .btn { align-self: flex-start; }
}

/* ════════════════════════════════════════════════════════════════
   RESPONSIVE — 480 px (small phones)
   ════════════════════════════════════════════════════════════════ */
@media (max-width: 480px) {
  .hero h1 { font-size: 1.25rem; }
  .score-card { grid-template-columns: 1fr; text-align: center; }
  .dcf-grid { grid-template-columns: 1fr; }
  .pred-summary { grid-template-columns: repeat(2, 1fr); }.tech-stat { flex: 1 1 calc(50% - 0.25rem); }
  .industry-summary-stat { min-width: 100%; }
  .score-badge { width: 44px; height: 44px; font-size: 1rem; }
  table { min-width: 420px; }
  td, th { padding: 0.45rem 0.55rem; font-size: 0.78rem; }
  .card { padding: 0.85rem; }
  .container { padding: 0.75rem; }
}
