/* ============================================================
   NSE Insights — Dashboard Theme
   Matches landing page: pure black + electric green
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --bg-base:        #050505;
  --bg-surface:     #0d0d0d;
  --bg-card:        #111111;
  --bg-card-hover:  #161616;
  --border:         rgba(0, 230, 118, 0.10);
  --border-light:   rgba(0, 230, 118, 0.22);
  --border-dim:     rgba(255,255,255,0.06);
  --text-primary:   #f0f0f0;
  --text-secondary: #909090;
  --text-muted:     #555555;
  --accent-primary: #00e676;    /* Electric green — landing page green */
  --accent-secondary: #00c853; /* Slightly dimmer green */
  --accent-blue:    #00e676;   /* Use green instead of blue for consistency */
  --accent-teal:    #00bfa5;
  --up:   #00e676;
  --down: #ff4444;
  --chart-latest: #00e676;
  --chart-hist:   rgba(0, 230, 118, 0.45);
  --green-glow:   rgba(0, 230, 118, 0.15);
  --green-faint:  rgba(0, 230, 118, 0.06);
  --mono: 'JetBrains Mono', monospace;
}

/* ── Light Mode Variables ───────────────────────────────── */
body.light {
  --bg-base:        #f5f5f5;
  --bg-surface:     #ffffff;
  --bg-card:        #ffffff;
  --bg-card-hover:  #f9fff9;
  --border:         rgba(0, 180, 90, 0.18);
  --border-light:   rgba(0, 180, 90, 0.35);
  --border-dim:     rgba(0,0,0,0.08);
  --text-primary:   #0d0d0d;
  --text-secondary: #444444;
  --text-muted:     #888888;
  --accent-primary: #00b248;
  --accent-secondary: #008c3a;
  --accent-blue:    #00b248;
  --up:   #00b248;
  --down: #e53935;
  --chart-latest: #00b248;
  --chart-hist:   rgba(0, 178, 72, 0.4);
  --green-glow:   rgba(0, 178, 72, 0.12);
  --green-faint:  rgba(0, 178, 72, 0.05);
}

body.light .topnav {
  background: rgba(255,255,255,0.92);
  box-shadow: 0 1px 0 rgba(0,0,0,0.08);
}

body.light .search-bar-wrap {
  background: radial-gradient(ellipse at top, rgba(0,178,72,0.05) 0%, transparent 60%);
}

body.light .search-bar {
  box-shadow: 0 4px 16px rgba(0,0,0,0.08), 0 0 0 1px rgba(0,178,72,0.1);
}

body.light select { color: var(--text-primary); }
body.light select option { background: #fff; color: #0d0d0d; }
body.light select optgroup { background: #fff; color: #000; }

body.light .index-pill {
  background: rgba(255,255,255,0.9);
  border-color: var(--border);
}

body.light .price-range-btns { background: #eeeeee; }
body.light .range-btn:hover { background: rgba(0,0,0,0.06); }

body.light .period-toggle { background: #eeeeee; border-color: var(--border); }

body.light .growth-pill { background: #eeeeee; border-color: var(--border); }

body.light .data-updated { border-color: var(--border); }

body.light .val-card-badge.undervalued { background: rgba(0,178,72,0.12); }
body.light .val-card-badge.overvalued  { background: rgba(229,57,53,0.12); }
body.light .val-card-badge.fair        { background: rgba(255,160,0,0.12); }

/* ── Theme Toggle Button ────────────────────────────────── */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  color: var(--text-secondary);
  padding: 0.35rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
  line-height: 1;
}
.theme-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-base);
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* ── Navigation ────────────────────────────────────────────── */
.topnav {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 2rem;
  height: 52px;
  background: rgba(5,5,5,0.85);
  border-bottom: 1px solid var(--border-dim);
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(20px);
}

/* Logo */
.topnav-left { display: flex; align-items: center; }
.logo-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none;
  font-weight: 800;
  font-size: 1rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.logo-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 8px var(--accent-primary);
  flex-shrink: 0;
  animation: logo-pulse 2s ease-in-out infinite;
}
@keyframes logo-pulse {
  0%,100% { opacity: 1; box-shadow: 0 0 8px var(--accent-primary); }
  50%      { opacity: 0.6; box-shadow: 0 0 16px var(--accent-primary); }
}
.logo-text { color: var(--text-primary); }

/* Center nav links */
.topnav-center {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}
.nav-link {
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0.35rem 0.85rem;
  border-radius: 8px;
  transition: color 0.15s, background 0.15s;
}
.nav-link:hover { color: var(--text-primary); background: rgba(255,255,255,0.04); }
.nav-link.active { color: var(--accent-primary); font-weight: 600; }

/* Right CTA */
.topnav-right { display: flex; gap: 0.6rem; align-items: center; justify-content: flex-end; }

.btn-login {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  padding: 0.4rem 0.85rem;
  border-radius: 8px;
  border: 1px solid var(--border-dim);
  transition: color 0.15s, border-color 0.15s;
}
.btn-login:hover { color: var(--text-primary); border-color: var(--accent-primary); }

.btn-getstarted {
  font-size: 0.82rem;
  font-weight: 700;
  color: #000;
  text-decoration: none;
  background: var(--accent-primary);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s, transform 0.1s;
  letter-spacing: 0.01em;
  box-shadow: 0 0 16px var(--green-glow);
}
.btn-getstarted:hover {
  background: #00ff88;
  box-shadow: 0 0 28px rgba(0,230,118,0.4);
  transform: translateY(-1px);
}

.theme-toggle {
  background: none;
  border: 1px solid var(--border-dim);
  border-radius: 8px;
  padding: 0.3rem 0.55rem;
  font-size: 0.85rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: border-color 0.2s, color 0.2s;
  line-height: 1;
}
.theme-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Keep for any legacy references */
.positive { color: var(--up); }
.negative { color: var(--down); }

/* ── Search Bar ────────────────────────────────────────────── */
.search-bar-wrap {
  padding: 1.75rem 1rem 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  background: radial-gradient(ellipse at top, rgba(0, 230, 118, 0.05) 0%, transparent 60%);
}
.search-bar {
  display: flex;
  align-items: center;
  background: var(--bg-surface);
  padding: 0.5rem;
  border-radius: 14px;
  border: 1px solid var(--border-dim);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px var(--green-faint);
  width: 100%;
  max-width: 640px;
  transition: border-color 0.2s, box-shadow 0.2s;
  position: relative;
}

/* ── Company Search Autocomplete ──────────────────────────── */
.company-search-container {
  flex: 1;
  position: relative;
  min-width: 0;
}

.company-search-input {
  width: 100%;
  padding: 0.6rem 2.2rem 0.6rem 0.8rem;
  border: none;
  background: transparent;
  color: var(--text-primary);
  font-size: 0.95rem;
  outline: none;
  font-family: inherit;
  box-sizing: border-box;
}

.company-search-input::placeholder {
  color: var(--text-secondary);
}

/* Dropdown arrow button — sits at right edge of input */
.search-dropdown-btn {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  padding: 4px 5px;
  cursor: pointer;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 5px;
  transition: color 0.15s, background 0.15s;
  z-index: 2;
}
.search-dropdown-btn:hover {
  color: var(--accent-primary);
  background: rgba(0, 230, 118, 0.1);
}

.company-suggestions-dropdown {
  position: absolute;
  top: calc(100% + 8px);
  left: -12px;
  right: -12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  max-height: 320px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0,230,118,0.08);
  padding: 4px;
}

.company-suggestions-dropdown.active {
  display: block;
}

/* Sector group header inside dropdown */
.suggestion-group-header {
  padding: 0.35rem 0.75rem 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  opacity: 0.7;
  margin-top: 4px;
}

.company-suggestion-item {
  padding: 0.55rem 0.75rem;
  cursor: pointer;
  border-radius: 8px;
  transition: background-color 0.12s;
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.company-suggestion-item:hover {
  background-color: rgba(0, 230, 118, 0.1);
}

.company-suggestion-item.selected {
  background-color: rgba(0, 230, 118, 0.15);
}

.company-suggestion-ticker {
  font-weight: 700;
  color: var(--accent-primary);
  font-size: 0.82rem;
  min-width: 48px;
  font-family: var(--mono);
}

.company-suggestion-name {
  flex: 1;
  color: var(--text-primary);
  font-size: 0.88rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.company-suggestion-price {
  color: var(--text-secondary);
  font-size: 0.78rem;
  white-space: nowrap;
}

.company-suggestion-change {
  font-size: 0.72rem;
  font-weight: 600;
  min-width: 50px;
  text-align: right;
}
.company-suggestion-change.up { color: var(--green-accent); }
.company-suggestion-change.down { color: #ff4444; }

/* Light mode */
body.light .company-suggestion-item:hover {
  background-color: rgba(0, 178, 72, 0.08);
}
body.light .company-suggestions-dropdown {
  background: #fff;
  border-color: #d0d8e4;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
.search-bar:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(0,230,118,0.2);
}

select {
  background: transparent;
  border: none;
  color: var(--text-primary);
  padding: 0.5rem 1rem;
  font-size: 0.95rem;
  flex: 1;
  outline: none;
  font-family: inherit;
}
select option { background: var(--bg-surface); color: var(--text-primary); }
select optgroup { background: var(--bg-surface); color: #000; font-weight: 700; }

.exchange-tag {
  background: var(--bg-surface);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 800;
  margin: 0 0.5rem;
  color: var(--accent-primary);
  letter-spacing: 0.05em;
  border: 1px solid var(--border);
  font-family: var(--mono);
}

#search-btn {
  background: var(--accent-primary);
  color: #000;
  border: none;
  width: 38px;
  height: 38px;
  padding: 0;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 20px var(--green-glow);
}
#search-btn:hover {
  background: #00ff88;
  box-shadow: 0 0 30px rgba(0,230,118,0.4);
  transform: translateY(-1px);
}

/* ── View Toggle ─────────────────────────────────────────────── */
.view-toggle {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 3px;
  gap: 2px;
}
.view-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 0.35rem 1.1rem;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.15s;
  font-family: inherit;
}
.view-btn.active {
  background: var(--bg-surface);
  color: var(--text-primary);
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}
.view-btn:not(.active):hover { color: var(--text-secondary); }

/* ── Market Summary ──────────────────────────────────────────── */
.market-summary {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 0.75rem;
}
.market-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 0.9rem 1rem;
  text-align: center;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.market-card:hover {
  border-color: var(--border);
  box-shadow: 0 0 12px var(--green-faint);
}
.market-card-label {
  font-size: 0.6rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.4rem;
}
.market-card-value {
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  font-family: var(--mono);
}
.market-card-value.up { color: var(--up); }
.market-card-value.down { color: var(--down); }
.market-card-chg {
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 0.2rem;
  font-family: var(--mono);
}

/* ── Footer ──────────────────────────────────────────────────── */
.site-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  border-top: 1px solid var(--border);
  margin-top: 3rem;
  font-size: 0.75rem;
  color: var(--text-muted);
  flex-wrap: wrap;
  gap: 0.75rem;
}
.footer-left { display: flex; align-items: center; gap: 0.75rem; }
.footer-brand { font-weight: 700; color: var(--text-secondary); }
.footer-tagline { color: var(--text-muted); }
.footer-center { display: flex; gap: 1.25rem; }
.footer-center a {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}
.footer-center a:hover { color: var(--text-primary); }
.footer-right { color: var(--text-muted); }

/* ── Sector Heatmap ──────────────────────────────────────────── */
.sector-heatmap-wrap {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 1.5rem;
}
.sector-heatmap-title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.6rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sector-heatmap-sub {
  font-weight: 400;
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: none;
  letter-spacing: 0;
}
.sector-heatmap-row {
  display: flex;
  gap: 1rem;
  align-items: stretch;
}
#sector-heatmap {
  flex: 0 0 50%;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}
.heatmap-row {
  display: flex;
  flex: 1;
}
#sector-market-summary {
  flex: 1;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-y: auto;
  max-height: 180px;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.summary-sector-item {
  padding: 0.55rem 0.9rem;
  border-bottom: 1px solid var(--border-dim);
  transition: background 0.15s;
}
.summary-sector-item:last-child { border-bottom: none; }
.summary-sector-item:hover { background: var(--bg-hover); }
.summary-sector-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.2rem;
  flex-wrap: wrap;
}
.summary-sector-name {
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--text-primary);
  flex: 1;
}
.summary-sector-mcap {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent-primary);
}
.summary-sector-share {
  font-size: 0.68rem;
  color: var(--text-muted);
}
.summary-sector-chg {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
}
.summary-sector-chg.pos { color: #10b981; background: rgba(16,185,129,0.12); }
.summary-sector-chg.neg { color: #ef4444; background: rgba(239,68,68,0.12); }
.summary-sector-insight {
  font-size: 0.71rem;
  color: var(--text-secondary);
  line-height: 1.5;
}
.summary-sector-insight b { color: var(--text-primary); }

.heatmap-row {
  display: flex;
  height: 90px;
}
.heatmap-row + .heatmap-row {
  border-top: 2px solid rgba(0,0,0,0.15);
}
.heatmap-tile {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  transition: filter 0.15s, transform 0.15s;
  border-right: 2px solid rgba(0,0,0,0.15);
  min-width: 60px;
}
.heatmap-tile:last-child { border-right: none; }
.heatmap-tile:hover { filter: brightness(1.15); z-index: 2; }
.heatmap-tile-inner {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.4rem;
  gap: 0.15rem;
}
.heatmap-sector-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255,255,255,0.95);
  text-align: center;
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
  line-height: 1.2;
}
.heatmap-mcap {
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}
.heatmap-change {
  font-size: 0.68rem;
  color: rgba(255,255,255,0.8);
  text-shadow: 0 1px 3px rgba(0,0,0,0.5);
}

/* ── Sector Overview ─────────────────────────────────────────── */
.sector-grid {
  max-width: 1200px;
  margin: 1.5rem auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
}
.sector-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.sector-card:hover {
  border-color: var(--accent-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 16px rgba(16, 185, 129, 0.12);
}
.sector-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.25rem;
}
.sector-card-emoji { font-size: 1.6rem; }
.sector-card-trend {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 6px;
}
.sector-card-trend.pos { color: #10b981; background: rgba(16, 185, 129, 0.12); }
.sector-card-trend.neg { color: #ef4444; background: rgba(239, 68, 68, 0.12); }
.sector-card-trend.neu { color: var(--text-muted); background: var(--bg-hover); }
.sector-card-name { font-weight: 700; font-size: 1rem; color: var(--text-primary); }
.sector-card-count { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.sector-card-metrics {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.35rem;
}
.sector-metric-item {
  font-size: 0.72rem;
  color: var(--text-secondary);
  background: var(--bg-hover);
  border-radius: 6px;
  padding: 0.3rem 0.5rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Legacy Sector Card Stats */
.sector-card-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-top: 0.6rem;
}
.stat-badge {
  display: inline-flex;
  align-items: center;
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  padding: 0.25rem 0.6rem;
  border-radius: 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-secondary);
  font-family: var(--mono);
}
.stat-badge.strength-up {
  border-color: rgba(0, 230, 118, 0.3);
  color: var(--up);
}
.stat-badge.strength-down {
  border-color: rgba(255, 68, 68, 0.3);
  color: var(--down);
}
.stat-badge.strength-mixed {
  border-color: rgba(255, 160, 0, 0.3);
  color: #ffa000;
}

.sector-table-header {
  max-width: 1200px;
  margin: 1.5rem auto 0.75rem;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
}
.sector-back-btn {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  padding: 0.4rem 0.8rem;
  border-radius: 8px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.2s;
}
.sector-back-btn:hover { color: var(--text-primary); border-color: var(--border-light); }
.sector-table-title { font-weight: 800; font-size: 1.1rem; color: var(--text-primary); flex: 1; }
.sector-compare-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 8px;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}
.sector-compare-toggle:hover { border-color: var(--accent-primary); color: var(--accent-primary); }

/* Sector Snapshot */
.sector-snapshot {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 1.5rem;
}
.snapshot-label,
.comparison-label {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.75rem;
}
.snapshot-grid,
.comparison-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.75rem;
}
.snapshot-card,
.comparison-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 10px;
  padding: 0.8rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.snapshot-card:hover,
.comparison-card:hover {
  border-color: var(--border);
}
.snapshot-label-text,
.comparison-label-text {
  font-size: 0.65rem;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.snapshot-value,
.comparison-value {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--mono);
}
.comparison-value.worse { color: var(--down); }
.comparison-value.better { color: var(--up); }

/* Sector Comparison */
.sector-comparison {
  max-width: 1200px;
  margin: 1rem auto;
  padding: 0 1.5rem;
}

.sector-table-scroll {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  overflow-x: auto;
}
.sector-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border);
}
.sector-table th {
  text-align: left;
  padding: 0.7rem 0.9rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
.sector-table th:hover { color: var(--text-secondary); }
.sector-table th.sort-asc::after { content: ' ▲'; }
.sector-table th.sort-desc::after { content: ' ▼'; }
.sector-table td {
  padding: 0.6rem 0.9rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-secondary);
  white-space: nowrap;
}
.sector-table tbody tr { cursor: pointer; }
.sector-table tr:hover td { background: var(--bg-card-hover); }
.sector-table td:first-child { font-weight: 700; color: var(--text-primary); }
.sector-table .num-col { text-align: right; font-variant-numeric: tabular-nums; }

/* ── Company Header ────────────────────────────────────────── */
.company-header {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
}
.company-info { display: flex; align-items: center; gap: 1rem; }
.company-logo {
  font-size: 2.2rem;
  background: var(--bg-card);
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  border: 1px solid var(--border-light);
}
.company-name {
  font-size: 1.6rem;
  font-weight: 900;
  letter-spacing: -0.03em;
  color: var(--text-primary);
}
.company-meta { color: var(--text-muted); font-size: 0.85rem; margin-top: 0.15rem; }

.company-price-block { text-align: right; }
.company-price {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-family: var(--mono);
}
.company-price-change {
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 0.2rem;
  font-family: var(--mono);
}
.company-eps-pill {
  background: var(--green-faint);
  border: 1px solid var(--border);
  color: var(--accent-primary);
  padding: 0.25rem 0.7rem;
  border-radius: 8px;
  font-size: 0.72rem;
  font-weight: 700;
  display: inline-block;
  margin-top: 0.5rem;
  letter-spacing: 0.01em;
  font-family: var(--mono);
}
.company-latest-year { color: var(--text-muted); font-size: 0.72rem; margin-top: 0.4rem; }

/* ── Stats Grid ────────────────────────────────────────────── */
/* ── Stats Carousel ──────────────────────────────────────── */
.stats-grid {
  max-width: 1200px;
  margin: 1.5rem auto 0;
  padding: 0 1rem;
}
.stats-carousel-wrap {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.stats-carousel {
  flex: 1;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  display: flex;
  gap: 0.75rem;
  padding-bottom: 2px; /* prevent clip */
}
.stats-carousel::-webkit-scrollbar { display: none; }
.stats-slide {
  flex: 0 0 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  scroll-snap-align: start;
}
.stats-nav {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-secondary);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
  padding: 0;
  user-select: none;
}
.stats-nav:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(0,230,118,0.06);
}
.stats-dots {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin: 0.6rem 0 1rem;
}
.stats-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border);
  cursor: pointer;
  transition: background 0.2s, transform 0.2s;
}
.stats-dot.active {
  background: var(--accent-primary);
  transform: scale(1.3);
}
.stat-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1rem;
  transition: border-color 0.2s;
  min-width: 0;
}
.stat-section:hover {
  border-color: var(--border-light);
}
.stat-section-title {
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.5rem;
  font-size: 0.82rem;
}
.stat-label { color: var(--text-secondary); }
.stat-val { font-weight: 600; color: var(--text-primary); font-family: var(--mono); }
.stat-val.up { color: var(--up); }
.stat-val.down { color: var(--down); }

/* ── Valuation Coming Soon ───────────────────────────────── */
.valuation-coming-soon {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem 1rem;
  gap: 0.5rem;
}
.valuation-cs-icon { font-size: 2rem; opacity: 0.6; }
.valuation-cs-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}
.valuation-cs-sub {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ── Chart Controls ────────────────────────────────────────── */
.chart-controls {
  max-width: 1200px;
  margin: 2rem auto 1rem;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart-section-label {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.period-toggle {
  display: flex;
  background: var(--bg-card);
  padding: 0.2rem;
  border-radius: 10px;
  border: 1px solid var(--border);
}
.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.4rem 1rem;
  border-radius: 8px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.toggle-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.25);
}

/* ── Charts Grid ───────────────────────────────────────────── */
.charts-grid {
  max-width: 1200px;
  margin: 0 auto 3rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1rem;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.25rem;
  min-height: 240px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}
.chart-card:hover {
  border-color: var(--border-light);
  transform: translateY(-2px);
}
.chart-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.chart-title { font-size: 0.82rem; font-weight: 700; color: var(--text-secondary); }
.chart-expand { color: var(--text-muted); cursor: pointer; font-size: 0.85rem; opacity: 0; transition: opacity 0.2s; }
.chart-card:hover .chart-expand { opacity: 1; }
.chart-wrap { flex: 1; position: relative; width: 100%; height: 180px; }

/* ── Chart Modal ───────────────────────────────────────────── */
.chart-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.chart-modal.hidden { display: none; }
.chart-modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  z-index: -1;
}
.chart-modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4);
  width: 90%;
  max-width: 900px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.chart-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1.2rem;
  border-bottom: 1px solid var(--border-dim);
}
.chart-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 0;
}
.chart-modal-controls {
  display: flex;
  gap: 0.75rem;
}
.chart-modal-fullscreen,
.chart-modal-close {
  background: transparent;
  border: 1px solid var(--border-dim);
  color: var(--text-secondary);
  width: 40px;
  height: 40px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}
.chart-modal-fullscreen:hover,
.chart-modal-close:hover {
  background: var(--bg-surface);
  border-color: var(--border);
  color: var(--accent-primary);
}
.chart-modal-body {
  flex: 1;
  padding: 1.5rem;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#chart-modal-canvas {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
}
.chart-modal-footer {
  padding: 0.75rem 1.2rem;
  border-top: 1px solid var(--border-dim);
  font-size: 0.85rem;
  color: var(--text-muted);
  background: var(--bg-surface);
}
.chart-modal-meta {
  display: block;
}

/* ── Growth Labels ─────────────────────────────────────────── */
.growth-pills {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  justify-content: center;
}
.growth-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.2rem 0.6rem;
  border-radius: 6px;
  font-size: 0.62rem;
  font-weight: 700;
}
.growth-pill span { color: var(--text-muted); margin-right: 0.25rem; }

/* ── Empty state ───────────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 5rem 1rem 6rem;
  color: var(--text-muted);
}
.empty-icon { margin-bottom: 1.25rem; display: flex; justify-content: center; }
.empty-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.02em;
}
.empty-sub { font-size: 0.9rem; }

/* ── Footer / Data Updated ─────────────────────────────────── */
.data-updated {
  text-align: center;
  padding: 1rem;
  color: var(--text-muted);
  font-size: 0.7rem;
  border-top: 1px solid var(--border);
  margin-top: 2rem;
}

/* ── Valuation Panel ───────────────────────────────────────── */
.valuation-disclaimer {
  font-size: 0.7rem; color: var(--text-muted); font-style: italic;
  margin-left: auto;
}
.valuation-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.val-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.4rem;
  position: relative;
  overflow: hidden;
}
.val-card-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 0.6rem;
}
.val-card-title {
  font-size: 0.75rem; font-weight: 600; color: var(--text-secondary);
  text-transform: uppercase; letter-spacing: 0.05em;
}
.val-card-badge {
  font-size: 0.6rem; font-weight: 700; padding: 2px 8px;
  border-radius: 10px; text-transform: uppercase;
}
.val-card-badge.undervalued { background: rgba(0,230,118,0.12); color: var(--up); }
.val-card-badge.overvalued { background: rgba(255,68,68,0.12); color: var(--down); }
.val-card-badge.fair { background: rgba(255,160,0,0.12); color: #ffa000; }
.val-card-badge.na { background: rgba(90,90,90,0.15); color: var(--text-muted); }
.val-card-value {
  font-size: 1.5rem; font-weight: 700; color: var(--text-primary);
  margin-bottom: 0.25rem;
  font-family: var(--mono);
}
.val-card-upside {
  font-size: 0.8rem; font-weight: 600;
}
.val-card-upside.positive { color: #10b981; }
.val-card-upside.negative { color: #ef4444; }
.val-card-desc {
  font-size: 0.65rem; color: var(--text-muted); margin-top: 0.5rem;
  line-height: 1.4;
}
.valuation-summary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.2rem 1.6rem;
  margin-bottom: 0.8rem;
}
.val-summary-header {
  display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.5rem;
}
.val-summary-verdict {
  font-size: 1.1rem; font-weight: 800; color: var(--text-primary);
}
.val-summary-bar {
  height: 8px; border-radius: 4px; background: var(--bg-surface);
  position: relative; overflow: hidden; margin: 0.6rem 0;
}
.val-summary-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 0.5s ease;
}
.val-summary-bar-labels {
  display: flex; justify-content: space-between;
  font-size: 0.65rem; color: var(--text-muted);
}
.val-summary-detail {
  font-size: 0.75rem; color: var(--text-secondary); line-height: 1.6;
}
.valuation-assumptions {
  font-size: 0.65rem; color: var(--text-muted); line-height: 1.5;
  padding: 0.8rem 0; border-top: 1px solid var(--border);
}
.valuation-assumptions strong { color: var(--text-secondary); }

/* ── Price Chart ───────────────────────────────────────────── */
.price-chart-section {
  max-width: 1200px;
  margin: 0 auto 1.25rem;
  padding: 0 1.5rem;
}
.price-chart-inner {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1rem 1.25rem;
}
.price-chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.price-summary-row {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}
.price-current {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
}
.price-label {
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.price-value {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  font-family: var(--mono);
}
.price-change {
  font-size: 0.8rem;
  font-weight: 600;
  font-family: var(--mono);
}
.price-range-info {
  display: flex;
  gap: 1.25rem;
}
.price-stat {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.price-stat span:first-child {
  font-size: 0.58rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.price-stat span:last-child {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-secondary);
}
.price-range-btns {
  display: flex;
  gap: 0.2rem;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 2px;
}
.range-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 0.28rem 0.55rem;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.range-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}
.range-btn.active {
  background: var(--accent-blue);
  color: #fff;
}
.price-chart-controls {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.chart-type-toggle {
  display: flex;
  gap: 0.15rem;
  background: var(--bg-surface);
  border-radius: 8px;
  padding: 2px;
}
.chart-type-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 26px;
  background: transparent;
  border: none;
  color: var(--text-muted);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chart-type-btn:hover {
  color: var(--text-secondary);
  background: rgba(255,255,255,0.04);
}
.chart-type-btn.active {
  background: var(--accent-blue);
  color: #fff;
}
body.light .chart-type-btn:hover { background: rgba(0,0,0,0.06); }
.price-chart-wrap {
  height: 200px;
  position: relative;
}

/* ── Company + Chart side-by-side layout (desktop) ─────────── */
.company-chart-row {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 1rem;
  align-items: start;
  margin-bottom: 1.25rem;
}
.company-chart-row .company-header {
  max-width: none;
  margin: 0;
  padding: 1.25rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  flex-direction: column;
  align-items: flex-start;
  gap: 1rem;
}
.company-chart-row .price-chart-section {
  max-width: none;
  margin: 0;
  padding: 0;
}

/* ── Stats Grid ── desktop tweaks ──────────────────────────── */
.stats-grid {
  max-width: 1200px;
  margin: 0 auto 0;
  padding: 0 1.5rem;
}
.stat-section {
  padding: 0.85rem 1rem;
  border-radius: 12px;
}
.stat-section-title {
  font-size: 0.6rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
}
.stat-row { margin-bottom: 0.38rem; font-size: 0.78rem; }

/* ── Charts Grid ── 3-up on desktop ────────────────────────── */
.chart-controls {
  max-width: 1200px;
  margin: 1.25rem auto 0.75rem;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.chart-section-label {
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}
.period-toggle {
  display: flex;
  background: var(--bg-card);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--border);
}
.toggle-btn {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 0.3rem 0.85rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  font-family: inherit;
}
.toggle-btn.active {
  background: var(--accent-primary);
  color: white;
  box-shadow: 0 2px 6px rgba(16, 185, 129, 0.2);
}
.charts-grid {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
}
.chart-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1rem 1.1rem;
  min-height: 200px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.2s, transform 0.2s;
}
.chart-card:hover {
  border-color: var(--border-light);
  transform: translateY(-1px);
}
.chart-card-header {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.75rem;
}
.chart-title { font-size: 0.75rem; font-weight: 700; color: var(--text-secondary); }
.chart-expand { color: var(--text-muted); cursor: pointer; font-size: 0.8rem; opacity: 0; transition: opacity 0.2s; }
.chart-card:hover .chart-expand { opacity: 1; }
.chart-wrap { flex: 1; position: relative; width: 100%; height: 160px; }

/* Growth pills */
.growth-pills {
  display: flex;
  gap: 0.4rem;
  margin-top: 0.6rem;
  justify-content: center;
  flex-wrap: wrap;
}
.growth-pill {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 5px;
  font-size: 0.58rem;
  font-weight: 700;
}
.growth-pill span { color: var(--text-muted); margin-right: 0.2rem; }

/* ── Responsive ────────────────────────────────────────────── */
@media (max-width: 900px) {
  .charts-grid { grid-template-columns: repeat(2, 1fr); }
  .company-chart-row { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  /* Nav — collapse to logo + hamburger-style */
  .topnav { padding: 0 1rem; height: 48px; }
  .topnav-center { display: none; }
  .btn-login { display: none; }
  .btn-getstarted { padding: 0.35rem 0.75rem; font-size: 0.78rem; }

  /* Search */
  .search-bar-wrap { padding: 1rem 0.75rem 0.75rem; }
  .search-bar { max-width: 100%; }
  .view-toggle { width: 100%; max-width: 100%; }
  .view-btn { flex: 1; }

  /* Market summary — 3 col */
  .market-summary { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; padding: 0 0.75rem; }
  .market-card { padding: 0.65rem 0.5rem; }
  .market-card-value { font-size: 0.85rem; }
  .market-card-label { font-size: 0.55rem; }

  /* Company header */
  .company-header { flex-direction: row; flex-wrap: wrap; gap: 0.75rem; padding: 1rem; }
  .company-name { font-size: 1.2rem; }
  .company-price { font-size: 1.5rem; }
  .company-price-block { text-align: right; }

  /* Price chart */
  .price-chart-section { padding: 0 0.75rem; }
  .price-chart-wrap { height: 160px; }
  .price-range-info { gap: 0.75rem; }
  .price-stat span:last-child { font-size: 0.72rem; }

  /* Stats */
  .stats-grid { padding: 0 0.75rem; }

  /* Charts — single col on mobile */
  .charts-grid { grid-template-columns: 1fr; gap: 0.6rem; padding: 0 0.75rem; }
  .chart-card { min-height: 180px; }
  .chart-wrap { height: 140px; }
  .chart-controls { padding: 0 0.75rem; }

  /* Chart Modal — responsive on tablet */
  .chart-modal-content { width: 95%; max-height: 80vh; }
  .chart-modal-header { padding: 0.9rem; }
  .chart-modal-title { font-size: 1rem; }
  .chart-modal-body { padding: 1rem; }
  .chart-modal-controls { gap: 0.5rem; }
  .chart-modal-fullscreen,
  .chart-modal-close { width: 36px; height: 36px; font-size: 1rem; }

  /* Sector grid — keep 3 cols down to 900px */
  .sector-grid { grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }

  /* Valuation */
  .valuation-grid { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .val-card-value { font-size: 1.2rem; }

  /* Footer */
  .site-footer { padding: 0.75rem 1rem; flex-direction: column; align-items: flex-start; gap: 0.5rem; }
  .footer-center { gap: 1rem; }
}

@media (max-width: 480px) {
  /* Market summary — 2 col */
  .market-summary { grid-template-columns: repeat(2, 1fr); }

  /* Stats — 1 col */
  .stats-grid { grid-template-columns: 1fr; }

  /* Sector grid */
  .sector-grid { grid-template-columns: repeat(3, 1fr); }

  /* Valuation */
  .valuation-grid { grid-template-columns: 1fr; }

  /* Topnav right — only Get started */
  .theme-toggle { display: none; }

  /* Chart Modal — full width on mobile */
  .chart-modal-content { width: 100%; max-height: 90vh; border-radius: 8px 8px 0 0; bottom: 0; position: absolute; }
  .chart-modal { align-items: flex-end; }
  .chart-modal-header { padding: 0.8rem; }
  .chart-modal-title { font-size: 0.95rem; }
  .chart-modal-body { padding: 0.75rem; max-height: calc(90vh - 120px); }
  .chart-modal-fullscreen,
  .chart-modal-close { width: 40px; height: 40px; }
}

/* ── Info Row: description (2/3) + news (1/3) ──────────── */
.info-row {
  max-width: 1200px;
  margin: 0 auto 1rem;
  padding: 0 1.5rem;
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1rem;
  align-items: stretch;
}
.company-desc-card {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 1rem 1.25rem;
  display: flex;
  align-items: center;
}
.company-desc-text {
  margin: 0;
  font-size: 0.875rem;
  color: var(--text-secondary);
  line-height: 1.7;
}
.news-section {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}
.news-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.6rem;
  flex-shrink: 0;
}
.news-title {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.news-source-tag {
  font-size: 0.58rem;
  color: var(--text-muted);
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  padding: 0.1rem 0.4rem;
  border-radius: 99px;
}
.news-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  flex: 1;
  overflow-y: auto;
}
.news-card {
  display: block;
  padding: 0.5rem 0.65rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-dim);
  border-radius: 7px;
  text-decoration: none;
  transition: border-color 0.15s, background 0.15s;
  flex-shrink: 0;
}
.news-card:hover { border-color: var(--accent-primary); background: var(--green-faint); }
.news-card-source {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.58rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}
.news-favicon { width: 11px; height: 11px; border-radius: 2px; }
.news-card-title { font-size: 0.75rem; font-weight: 600; color: var(--text-primary); line-height: 1.35; }
.news-loading { font-size: 0.75rem; color: var(--text-muted); padding: 0.5rem 0; text-align: center; }
.news-empty { font-size: 0.73rem; color: var(--text-muted); padding: 0.4rem 0; line-height: 1.5; }
.news-empty a { color: var(--accent-primary); text-decoration: none; }
.news-empty a:hover { text-decoration: underline; }

/* ── Valuation panel — full-width, after charts ─────────── */
.valuation-panel {
  max-width: 1200px;
  margin: 0 auto 1.5rem;
  padding: 0 1.5rem;
}
.valuation-panel-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-dim);
  border-radius: 12px;
  padding: 1rem 1.25rem;
}
.valuation-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border-dim);
}
.valuation-title {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 900px) {
  .info-row { grid-template-columns: 1fr; }
  .valuation-panel { padding: 0 0.75rem; }
}
@media (max-width: 768px) {
  .info-row { padding: 0 0.75rem; }
}
/* ── Admin padlock button ───────────────────────────────── */
.admin-padlock {
  font-size: 1rem;
  text-decoration: none;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
  padding: 0.2rem;
  display: inline-flex;
  align-items: center;
}
.admin-padlock:hover {
  opacity: 1;
  transform: scale(1.15);
}

/* ═══════════════════════════════════════════════════════════ */
/* MOBILE OPTIMIZATION — Hamburger Menu + Touch UX            */
/* ═══════════════════════════════════════════════════════════ */

/* ── Hamburger Menu Button ──────────────────────────────── */
.hamburger {
  display: flex;
  flex-direction: column;
  gap: 5px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  align-items: center;
  justify-content: center;
}
.hamburger span {
  width: 24px;
  height: 2px;
  background: var(--accent-primary);
  display: block;
  border-radius: 2px;
  transition: all 0.3s ease;
}
.hamburger.active span:nth-child(1) {
  transform: rotate(45deg) translate(10px, 10px);
}
.hamburger.active span:nth-child(2) {
  opacity: 0;
}
.hamburger.active span:nth-child(3) {
  transform: rotate(-45deg) translate(7px, -7px);
}

/* ── Mobile Menu Panel ─────────────────────────────────── */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 999;
  opacity: 1;
  transition: opacity 0.3s;
}
.mobile-menu.hidden {
  display: none;
  opacity: 0;
  pointer-events: none;
}
.mobile-menu-content {
  position: fixed;
  top: 0;
  left: 0;
  width: 70vw;
  max-width: 300px;
  height: 100vh;
  background: var(--bg-base);
  z-index: 1000;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 2px 0 20px rgba(0, 0, 0, 0.5);
  animation: slideInMenu 0.3s ease-out;
}
@keyframes slideInMenu {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(0);
  }
}
.mobile-menu-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border-dim);
  font-weight: 600;
  color: var(--text-primary);
}
.close-mobile-menu {
  background: none;
  border: none;
  color: var(--text-primary);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.875rem 1.25rem;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 0.95rem;
  border: none;
  background: none;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
  width: 100%;
  text-align: left;
  font-family: inherit;
}
.mobile-nav-link:hover,
.mobile-nav-link:active {
  background-color: var(--bg-card);
  color: var(--accent-primary);
}
.mobile-menu-divider {
  border: none;
  border-top: 1px solid var(--border-dim);
  margin: 0.5rem 0;
}

/* ── Nav Desktop (hidden on mobile) ───────────────────── */
.nav-desktop {
  display: flex;
}

/* ── Responsive: Hide nav on desktop, show on mobile ──── */
@media (max-width: 768px) {
  /* Hide desktop nav elements */
  .nav-desktop {
    display: none !important;
  }
  /* Show hamburger menu */
  .hamburger {
    display: flex;
  }
  /* Adjust topnav for mobile */
  .topnav {
    justify-content: space-between;
  }
  .topnav-left {
    flex: 1;
  }
  .topnav-right {
    display: none;
  }
  .topnav-center {
    display: none;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* MOBILE LAYOUTS — Responsive Grid & Stacking               */
/* ═══════════════════════════════════════════════════════════ */

/* ── Tablet (768px - 1024px) ──────────────────────────── */
@media (max-width: 1024px) {
  .company-chart-row {
    grid-template-columns: 1fr;
  }
  .info-row {
    grid-template-columns: 1fr;
  }
  .sector-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* ── Mobile (<768px) ───────────────────────────────────── */
@media (max-width: 768px) {
  /* ── Search Bar ──────────────────────────────────── */
  .search-bar {
    flex-direction: row;
    gap: 0;
  }
  .search-bar select {
    width: 100%;
  }
  #search-btn {
    width: 38px;
    flex-shrink: 0;
  }
  .view-toggle {
    width: 100%;
  }
  .view-btn {
    flex: 1;
  }

  /* ── Company Header ──────────────────────────────── */
  .company-header {
    padding: 1rem 1rem;
  }
  .company-price-block {
    gap: 0.25rem;
  }
  .company-price {
    font-size: 1.5rem;
  }
  .company-eps-pill {
    font-size: 0.7rem;
    padding: 0.25rem 0.5rem;
  }

  /* ── Price Chart ─────────────────────────────────── */
  .price-chart-section {
    margin-top: 1rem;
  }
  .price-range-btns {
    flex-wrap: wrap;
    gap: 0.4rem;
  }
  .range-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.75rem;
  }
  .price-chart-wrap {
    height: 200px;
  }

  /* ── Info Row (Description + News) ────────────── */
  .company-desc-card {
    padding: 1rem;
  }
  .company-desc-text {
    font-size: 0.85rem;
    line-height: 1.4;
  }
  .news-section {
    margin-top: 1rem;
  }
  .news-grid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* ── Stats Grid (Financial Data) ─────────────── */
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .stat-box {
    padding: 0.75rem;
  }
  .stat-label {
    font-size: 0.7rem;
  }
  .stat-value {
    font-size: 0.95rem;
  }

  /* ── Financial Charts ────────────────────────── */
  .charts-row {
    grid-template-columns: 1fr;
  }
  .chart-card {
    min-height: 180px;
  }
  .chart-card-wrap {
    height: 120px;
  }

  /* ── Valuation Panel ─────────────────────────── */
  .valuation-grid {
    grid-template-columns: 1fr;
  }

  /* ── Period Toggle ───────────────────────────── */
  .period-toggle {
    gap: 0.5rem;
  }
  .toggle-btn {
    padding: 0.5rem 1rem;
    font-size: 0.8rem;
  }

  /* ── Sector Heatmap ─────────────────────────── */
  .sector-heatmap-row { flex-direction: column; }
  #sector-heatmap { flex: none; }
  #sector-market-summary { max-height: 220px; }

  /* ── Sector Grid ─────────────────────────────── */
  .sector-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.6rem;
    padding: 0 0.75rem;
  }
  .sector-card {
    padding: 1rem;
  }
  .sector-card-metrics { grid-template-columns: 1fr; }

  /* ── Footer ──────────────────────────────────── */
  .site-footer {
    flex-direction: column;
    gap: 0.5rem;
    padding: 1rem;
    text-align: center;
  }
  .footer-left,
  .footer-center,
  .footer-right {
    width: 100%;
  }

  /* ── Market Summary ──────────────────────────── */
  .market-summary {
    grid-template-columns: repeat(2, 1fr);
    gap: 0.5rem;
    padding: 0.75rem;
  }
  .market-card {
    padding: 0.75rem;
  }
  .market-card-label {
    font-size: 0.65rem;
  }
  .market-card-value {
    font-size: 0.95rem;
  }
}

/* ── Small Mobile (<480px) ────────────────────────────── */
@media (max-width: 480px) {
  .topnav {
    padding: 0.5rem 0.75rem;
  }
  .logo-text {
    display: none;
  }
  .logo-dot {
    display: inline-block;
  }

  .search-bar-wrap {
    padding: 0.75rem;
  }
  .search-bar {
    gap: 0.4rem;
  }
  .exchange-tag {
    display: none;
  }

  .company-header {
    padding: 0.75rem;
    flex-direction: column;
    gap: 0.75rem;
  }
  .company-info {
    gap: 0.5rem;
  }
  .company-logo {
    font-size: 2rem;
  }
  .company-name {
    font-size: 1.1rem;
  }
  .company-meta {
    font-size: 0.75rem;
  }

  .price-range-btns {
    grid-template-columns: repeat(3, 1fr);
  }

  .market-summary {
    grid-template-columns: 1fr;
  }
  .market-card-value {
    font-size: 0.85rem;
  }

  .chart-card {
    min-height: 160px;
  }
  .chart-card-wrap {
    height: 100px;
  }

  .stats-box {
    padding: 0.5rem;
  }
  .stat-label {
    font-size: 0.65rem;
  }
  .stat-value {
    font-size: 0.85rem;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* TOUCH INTERACTIONS — Tap Targets & States                  */
/* ═══════════════════════════════════════════════════════════ */

/* Increase tap target size on mobile */
@media (hover: none) and (pointer: coarse) {
  button,
  a,
  [role="button"] {
    min-height: 44px;
    min-width: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  /* Remove hover states on touch devices, use active instead */
  button:hover {
    background-color: transparent;
  }

  button:active,
  a:active {
    opacity: 0.7;
    transform: scale(0.95);
  }

  /* Chart tooltips on touch */
  canvas {
    touch-action: manipulation;
  }
}

/* ═══════════════════════════════════════════════════════════ */
/* ACCESSIBILITY — Responsive Type Scaling                    */
/* ═══════════════════════════════════════════════════════════ */

@media (max-width: 768px) {
  html {
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  html {
    font-size: 13px;
  }
}

/* ═══════════════════════════════════════════════════════════
   SECTOR DETAIL DASHBOARD (Banking-first)
   ═══════════════════════════════════════════════════════════ */

/* Hero banner */
.sd-hero {
  background: linear-gradient(135deg, #0d3b66 0%, #0d5c63 100%);
  border-radius: 10px;
  padding: 1.5rem 2rem;
  margin-bottom: 1.2rem;
}
.sd-hero h2 {
  color: #f0f0f0;
  font-size: 1.5rem;
  margin: 0 0 0.3rem 0;
  font-weight: 700;
}
.sd-hero p {
  color: #7ec8c8;
  margin: 0 0 0.8rem 0;
  font-size: 0.85rem;
}
.sd-year-toggle {
  display: flex;
  gap: 1.2rem;
}
.sd-year-toggle label {
  color: #b0b0b0;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.sd-year-toggle input[type="radio"] {
  accent-color: var(--accent-primary, #00e676);
}

/* Tab navigation */
.sd-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  margin-bottom: 1.2rem;
  overflow-x: auto;
}
.sd-tab {
  padding: 0.6rem 1.2rem;
  background: none;
  border: none;
  color: #808080;
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.2s, border-color 0.2s;
}
.sd-tab:hover {
  color: #c0c0c0;
}
.sd-tab.active {
  color: #f0f0f0;
  border-bottom-color: var(--accent-primary, #00e676);
}

/* Panels */
.sd-panel {
  animation: sdFadeIn 0.25s ease;
}
@keyframes sdFadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* KPI row */
.sd-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}
.sd-kpi-card {
  background: var(--bg-card, #111111);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 1rem;
  text-align: center;
}
.sd-kpi-label {
  color: #707070;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.4rem;
}
.sd-kpi-value {
  color: #f0f0f0;
  font-size: 1.3rem;
  font-weight: 700;
  font-family: 'JetBrains Mono', monospace;
}
.sd-kpi-yoy {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  margin-top: 0.25rem;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
}
.sd-kpi-yoy.pos {
  color: #00e676;
  background: rgba(0,230,118,0.1);
}
.sd-kpi-yoy.neg {
  color: #ff5252;
  background: rgba(255,82,82,0.1);
}
.sd-kpi-sub {
  color: #606060;
  font-size: 0.68rem;
  margin-top: 0.25rem;
}

/* Chart wrappers */
.sd-section {
  background: var(--bg-card, #111111);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
  padding: 1rem;
  margin-bottom: 1rem;
}
.sd-section h3 {
  color: #7ec8c8;
  font-size: 0.9rem;
  margin: 0 0 0.8rem 0;
}
.sd-section h4 {
  color: #7ec8c8;
  font-size: 0.85rem;
  margin: 0 0 0.6rem 0;
}
.sd-section p {
  color: #b0b0b0;
  font-size: 0.82rem;
  margin: 0.2rem 0;
}
.sd-chart-wrap {
  position: relative;
  width: 100%;
}
.sd-chart-tall {
  height: 360px;
}
.sd-chart-sq {
  height: 320px;
}

/* Two-column grid */
.sd-two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

/* Metric radios (profitability tab) */
.sd-metric-radios {
  display: flex;
  gap: 1.2rem;
  margin-bottom: 1rem;
  padding: 0.6rem 1rem;
  background: var(--bg-card, #111111);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px;
}
.sd-metric-radios label {
  color: #b0b0b0;
  font-size: 0.82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.3rem;
}
.sd-metric-radios input[type="radio"] {
  accent-color: var(--accent-primary, #00e676);
}

/* Asset treemap */
.sd-asset-treemap {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  min-height: 120px;
}
.sd-treemap-tile {
  background: #0d5c63;
  border-radius: 4px;
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-width: 60px;
  min-height: 60px;
  cursor: default;
  transition: transform 0.15s;
}
.sd-treemap-tile:hover {
  transform: scale(1.04);
}
.sd-treemap-name {
  color: #f0f0f0;
  font-size: 0.7rem;
  font-weight: 600;
  text-align: center;
}
.sd-treemap-val {
  color: #7ec8c8;
  font-size: 0.65rem;
  font-family: 'JetBrains Mono', monospace;
}
.sd-treemap-roe {
  color: rgba(255,255,255,0.5);
  font-size: 0.58rem;
}

/* Deep Dive header */
.sd-dd-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}
.sd-dd-header h3 {
  color: #f0f0f0;
  font-size: 1.1rem;
  margin: 0;
}
.sd-dd-header p {
  color: #7ec8c8;
  font-size: 0.78rem;
  margin: 0.2rem 0 0;
}
.sd-select {
  background: var(--bg-card, #111111);
  color: #f0f0f0;
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 6px;
  padding: 0.5rem 0.8rem;
  font-size: 0.82rem;
  cursor: pointer;
  min-width: 180px;
}
.sd-select:focus {
  outline: 1px solid var(--accent-primary, #00e676);
}

/* Radar section */
.sd-radar-wrap {
  max-width: 480px;
  margin: 0 auto 1rem;
}

/* No-data placeholder */
.sd-no-data {
  color: #606060;
  text-align: center;
  padding: 2rem 1rem;
  font-size: 0.82rem;
  line-height: 1.6;
}

/* Responsive */
@media (max-width: 768px) {
  .sd-two-col {
    grid-template-columns: 1fr;
  }
  .sd-kpi-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .sd-hero {
    padding: 1rem;
  }
  .sd-hero h2 {
    font-size: 1.15rem;
  }
  .sd-tabs {
    gap: 0;
  }
  .sd-tab {
    padding: 0.5rem 0.8rem;
    font-size: 0.75rem;
  }
  .sd-dd-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
  .sd-select {
    width: 100%;
  }
  .sd-chart-tall {
    height: 300px;
  }
  .sd-chart-sq {
    height: 260px;
  }
}

@media (max-width: 480px) {
  .sd-kpi-row {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
  }
  .sd-kpi-value {
    font-size: 1rem;
  }
  .sd-metric-radios {
    flex-wrap: wrap;
    gap: 0.6rem;
  }
}