/* ═══════════════════════════════════════════════
   B3 TERMINAL — Dark Bloomberg-style theme
   ═══════════════════════════════════════════════ */

:root {
  --bg: #0a0a0a;
  --surface: #111111;
  --surface-2: #181818;
  --surface-3: #1e1e1e;
  --border: #2a2a2a;
  --border-light: #333;
  --text: #e0e0e0;
  --text-muted: #888;
  --text-faint: #555;
  --accent: #00e676;
  --accent-dim: #00c853;
  --accent-bg: rgba(0,230,118,0.08);
  --red: #ff5252;
  --red-bg: rgba(255,82,82,0.08);
  --yellow: #ffd740;
  --blue: #448aff;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
  --font-body: 'Inter', -apple-system, sans-serif;
  --radius: 6px;
  --radius-lg: 10px;
  --transition: 180ms cubic-bezier(0.16, 1, 0.3, 1);
}

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

html {
  scroll-behavior: smooth;
  scroll-padding-top: 100px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--text);
  background: var(--bg);
  line-height: 1.5;
  min-height: 100vh;
}

/* ── TOPBAR ── */
#topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  height: 52px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 16px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.logo-text {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
  letter-spacing: 1px;
}

.logo-badge {
  font-size: 9px;
  font-weight: 700;
  background: var(--accent);
  color: var(--bg);
  padding: 1px 5px;
  border-radius: 3px;
  letter-spacing: 1px;
}

.topbar-center { flex: 1; max-width: 500px; margin: 0 auto; }

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

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
}

#tickerSearch {
  width: 100%;
  height: 36px;
  padding: 0 12px 0 36px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
  transition: border-color var(--transition);
}
#tickerSearch:focus { border-color: var(--accent); }
#tickerSearch::placeholder { color: var(--text-faint); }

.search-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 320px;
  overflow-y: auto;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 var(--radius) var(--radius);
  display: none;
  z-index: 200;
}

.search-dropdown.active { display: block; }

.search-item {
  display: flex;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  gap: 10px;
  transition: background var(--transition);
  border-bottom: 1px solid var(--border);
}
.search-item:last-child { border-bottom: none; }
.search-item:hover, .search-item.selected { background: var(--accent-bg); }
.search-item-ticker {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--accent);
  min-width: 70px;
}
.search-item-name { color: var(--text-muted); font-size: 12px; }

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.api-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-family: var(--font-mono);
  color: var(--text-muted);
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}
.status-dot.connected { background: var(--accent); }
.status-text { letter-spacing: 1px; }

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

/* ── MODAL ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.modal-close {
  font-size: 20px;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }
.modal-body { display: flex; flex-direction: column; gap: 10px; }
.input-label { font-size: 12px; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.input-field {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  outline: none;
}
.input-field:focus { border-color: var(--accent); }
.input-hint { font-size: 11px; color: var(--text-faint); }

.btn-primary {
  height: 40px;
  padding: 0 20px;
  background: var(--accent);
  color: var(--bg);
  border: none;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
}
.btn-primary:hover { background: var(--accent-dim); }

.btn-sm {
  height: 30px;
  padding: 0 12px;
  background: var(--surface-3);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
  cursor: pointer;
  transition: all var(--transition);
  white-space: nowrap;
}
.btn-sm:hover { border-color: var(--accent); color: var(--accent); }

/* ── SECTION NAV (sticky) ── */
#sectionNav {
  position: fixed;
  top: 52px;
  left: 0;
  right: 0;
  z-index: 90;
  height: 40px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.nav-scroll {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  padding: 0 16px;
  gap: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}
.nav-scroll::-webkit-scrollbar { display: none; }

.nav-link {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  color: #00e676;
  text-decoration: none;
  padding: 8px 18px;
  border-radius: var(--radius);
  white-space: nowrap;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  transition: all var(--transition);
}
.nav-link:hover { color: #69f0ae; background: var(--surface-2); }
.nav-link.active {
  color: #0d1117;
  background: #00e676;
  font-weight: 700;
}

/* ── MAIN CONTENT ── */
main {
  margin-top: 92px;
  padding: 24px 24px 60px;
  max-width: 1400px;
  margin-left: auto;
  margin-right: auto;
}

.section {
  margin-bottom: 48px;
  padding-top: 16px;
}

/* #12 — Wider section headers */
.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
.section-accent {
  width: 3px;
  height: 22px;
  background: var(--accent);
  border-radius: 2px;
}
.section-header h2 {
  color: #00e676;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text);
}
.section-controls {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

.select-sm {
  height: 30px;
  padding: 0 28px 0 10px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-family: var(--font-mono);
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23888' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}
.select-sm:focus { border-color: var(--accent); }

/* ── EMPTY/LOADING STATES ── */
.empty-state, .loading-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 50vh;
  gap: 16px;
  color: var(--text-muted);
}
.empty-state h2 { font-size: 18px; font-weight: 500; color: var(--text); }
.empty-state p { font-size: 13px; }
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top: 3px solid var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── SUMMARY ── */
.summary-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 16px;
}
.ticker-big {
  font-family: var(--font-mono);
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
}
.company-name {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}
.tag-row { display: flex; gap: 8px; margin-top: 8px; }
.tag {
  font-size: 11px;
  padding: 3px 10px;
  background: var(--accent-bg);
  color: var(--accent);
  border-radius: 999px;
  font-weight: 500;
}
.tag-outline {
  background: none;
  border: 1px solid var(--border-light);
  color: var(--text-muted);
}
.summary-price { text-align: right; }
.price-big {
  font-family: var(--font-mono);
  font-size: 36px;
  font-weight: 700;
  color: var(--text);
  display: block;
}
.price-change {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius);
  display: inline-block;
  margin-top: 4px;
}
.price-change.up { color: var(--accent); background: var(--accent-bg); }
.price-change.down { color: var(--red); background: var(--red-bg); }

/* 52-week variation */
.price-52w-var {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: #64b5f6;
  display: inline-block;
  margin-left: 8px;
}

/* KPI Grid */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.kpi-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-label {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.kpi-value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
}

/* Range */
.range-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}
.range-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.range-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.range-bar-wrap { display: flex; align-items: center; gap: 8px; }
.range-val { font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); white-space: nowrap; min-width: 55px; }
.range-val:last-child { text-align: right; }
.range-bar { flex: 1; height: 4px; background: var(--border); border-radius: 2px; position: relative; }
.range-fill { height: 100%; background: var(--accent); border-radius: 2px; position: relative; }
.range-fill::after {
  content: '';
  position: absolute;
  right: -4px;
  top: -3px;
  width: 10px;
  height: 10px;
  background: var(--accent);
  border-radius: 50%;
}

/* Card */
.card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.card h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}
.overview-text { font-size: 13px; color: var(--text-muted); line-height: 1.7; }

/* ── FINANCIALS TABLE ── */
.fin-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
}
.fin-tab {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.fin-tab:hover { color: var(--text); }
.fin-tab.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 12px;
  font-variant-numeric: tabular-nums lining-nums;
}
.data-table th {
  background: var(--surface-2);
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 10px 14px;
  text-align: right;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 1;
}
.data-table th:first-child { text-align: left; }
.data-table td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--border);
  text-align: right;
  color: var(--text);
  white-space: nowrap;
}
.data-table td:first-child { text-align: left; color: var(--text-muted); font-weight: 500; }
.data-table tr:hover td { background: rgba(255,255,255,0.02); }
.data-table .row-header { font-weight: 600; color: var(--accent); }
.data-table .negative { color: var(--red); }
.data-table .positive { color: var(--accent); }

/* ── MARGINS GRID ── */
.margins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}
.margin-group {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.margin-group-title {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.margin-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid rgba(42,42,42,0.5);
}
.margin-item:last-child { border-bottom: none; }
.margin-item-label { font-size: 12px; color: var(--text-muted); }
.margin-item-value {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  font-variant-numeric: tabular-nums lining-nums;
}

/* ── DCF ── */
.dcf-layout {
  display: grid;
  grid-template-columns: 380px 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .dcf-layout { grid-template-columns: 1fr; }
}
.dcf-inputs {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.dcf-inputs h3 {
  font-size: 13px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}
.dcf-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.dcf-row label {
  font-size: 12px;
  color: var(--text-muted);
  min-width: 160px;
}
.input-sm {
  height: 32px;
  padding: 0 8px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 13px;
  width: 100px;
  outline: none;
}
.input-sm:focus { border-color: var(--accent); }
.checkbox-label {
  font-size: 11px;
  color: var(--text-faint);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.wacc-panel {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 10px 0;
}
.wacc-panel h4 {
  font-size: 12px;
  color: var(--accent);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.wacc-result {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
  font-size: 13px;
}
.accent-value { color: var(--accent); font-weight: 700; font-family: var(--font-mono); }

.dcf-result-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.dcf-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.dcf-card.best { border-color: var(--accent); }
.dcf-card.base { border-color: var(--blue); }
.dcf-card.worst { border-color: var(--red); }
.dcf-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 6px; }
.dcf-val { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--text); display: block; }
.dcf-card.best .dcf-val { color: var(--accent); }
.dcf-card.base .dcf-val { color: var(--blue); }
.dcf-card.worst .dcf-val { color: var(--red); }

.dcf-fair-value {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
  font-size: 14px;
  color: var(--text-muted);
}

/* Sensitivity table highlight */
.sensitivity-table td.base-cell {
  background: var(--accent-bg);
  color: var(--accent);
  font-weight: 700;
}
.sensitivity-table th.base-col {
  color: var(--accent);
}
.sensitivity-table td.base-row-header {
  color: var(--accent);
  font-weight: 700;
}

/* ── COMPS ── */
/* Already uses .data-table styles */

/* ── REPORTS ── */
.reports-grid { display: grid; gap: 16px; }

/* ── LLM CONTENT ── */
.llm-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-bg);
  color: var(--accent);
  border: 1px solid rgba(0,230,118,0.3);
}
/* Push button to far right, arrow sits immediately after */
.section-header .llm-btn { margin-left: auto; }
.llm-btn:hover { background: rgba(0,230,118,0.15); }

.llm-content { min-height: 100px; }
.llm-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 150px;
  color: var(--text-faint);
  font-size: 13px;
  background: var(--surface-2);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
}
.llm-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 150px;
  color: var(--accent);
  font-size: 13px;
}

/* Risk Cards */
.risk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.risk-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.risk-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.risk-card-title { font-size: 13px; font-weight: 600; color: var(--text); }
.risk-severity {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.risk-severity.high { background: var(--red-bg); color: var(--red); }
.risk-severity.medium { background: rgba(255,215,64,0.1); color: var(--yellow); }
.risk-severity.low { background: var(--accent-bg); color: var(--accent); }
.risk-card-cat { font-size: 11px; color: var(--accent); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.risk-card-desc { font-size: 12px; color: var(--text-muted); line-height: 1.6; }

/* Guidance */
.guidance-grid { display: grid; gap: 16px; }
.guidance-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.guidance-metric { font-family: var(--font-mono); font-size: 13px; font-weight: 600; color: var(--accent); margin-bottom: 4px; }
.guidance-value { font-size: 13px; color: var(--text); margin-bottom: 2px; }
.guidance-period { font-size: 11px; color: var(--text-faint); }
.guidance-summary {
  background: var(--surface-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.7;
}

/* Consensus */
.consensus-targets {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.target-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.target-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 6px; }
.target-value { font-family: var(--font-mono); font-size: 22px; font-weight: 700; color: var(--text); display: block; }
.target-card.high .target-value { color: var(--accent); }
.target-card.mean .target-value { color: var(--blue); }
.target-card.low .target-value { color: var(--red); }

/* News */
.news-grid { display: grid; gap: 12px; }
.news-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.news-card-header { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 8px; gap: 10px; }
.news-title { font-size: 13px; font-weight: 600; color: var(--text); line-height: 1.4; }
.news-sentiment {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}
.news-sentiment.positive { background: var(--accent-bg); color: var(--accent); }
.news-sentiment.negative { background: var(--red-bg); color: var(--red); }
.news-sentiment.neutral { background: rgba(68,138,255,0.1); color: var(--blue); }
.news-meta { font-size: 11px; color: var(--text-faint); margin-bottom: 8px; }
.news-summary { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 8px; }
.news-impact { font-size: 12px; color: var(--text-muted); padding: 8px; background: var(--surface-3); border-radius: var(--radius); }
.news-impact strong { color: var(--text); }
.news-precedent { font-size: 11px; color: var(--text-faint); margin-top: 6px; font-style: italic; }

/* Thesis */
.thesis-header {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.thesis-metric {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
}
.thesis-metric-label { font-size: 11px; color: var(--text-muted); text-transform: uppercase; display: block; margin-bottom: 6px; }
.thesis-metric-value { font-family: var(--font-mono); font-size: 20px; font-weight: 700; display: block; }
.verdict-overvalued { color: var(--red); }
.verdict-undervalued { color: var(--accent); }
.verdict-fairly { color: var(--yellow); }
.thesis-body {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
}
.thesis-body h4 {
  font-size: 13px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 8px;
}
.thesis-body h4:first-child { margin-top: 0; }
.thesis-body p { font-size: 13px; color: var(--text-muted); line-height: 1.7; margin-bottom: 8px; }
.thesis-body ul { margin: 0 0 8px 20px; }
.thesis-body li { font-size: 12px; color: var(--text-muted); line-height: 1.6; margin-bottom: 4px; }

/* ── TOOLTIP ── */
.tooltip-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text-faint);
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  font-family: serif;
  cursor: help;
  position: relative;
  margin-left: 4px;
  vertical-align: middle;
}
.tooltip-icon:hover { color: var(--accent); border-color: var(--accent); cursor: pointer; }
/* Tooltip popup is now rendered via JS (#tooltipPopup) to escape overflow:hidden containers */
#tooltipPopup {
  position: fixed;
  background: var(--surface-3);
  border: 1px solid var(--border-light);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 11px;
  font-style: normal;
  font-weight: 400;
  padding: 8px 12px;
  border-radius: var(--radius);
  width: 260px;
  max-width: 90vw;
  white-space: normal;
  line-height: 1.5;
  z-index: 9999;
  pointer-events: none;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  display: none;
}

/* ── ORANGE HIGHLIGHT METRICS ── */
.metric-highlight .margins-value, .metric-highlight .margin-item-value { color: #ff9800 !important; font-weight: 600; }
.metric-highlight .margins-label, .metric-highlight .margin-item-label { color: #ff9800 !important; }

/* ── MARGIN INTERPRETATION TAGS ── */
.margin-interp {
  display: inline-block;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  margin-left: 6px;
  font-weight: 500;
  vertical-align: middle;
}
.margin-interp.good { background: rgba(0,230,118,0.15); color: #00e676; }
.margin-interp.neutral { background: rgba(255,171,64,0.15); color: #ffab40; }
.margin-interp.bad { background: rgba(255,82,82,0.15); color: #ff5252; }

/* IFRS tag */
.ifrs-tag {
  font-size: 9px; font-weight: 600; letter-spacing: 0.5px;
  background: rgba(0,230,118,0.12); color: #00e676;
  padding: 2px 6px; border-radius: 3px; vertical-align: middle;
  margin-left: 4px;
}

/* ── SECTION COLLAPSIBLE (click header to toggle) ── */
.section-header.collapsible { cursor: pointer; user-select: none; }
.section-header.collapsible:hover h2 { opacity: 0.8; }
.section-header.collapsible::after {
  content: '\25BC'; font-size: 10px; color: var(--text-dim);
  transition: transform 0.2s; margin-left: 8px; flex-shrink: 0;
}
.section-header.collapsible.collapsed::after { transform: rotate(-90deg); }
.section-body.collapsed { display: none; }

/* ── BLURRED/LOCKED SECTIONS ── */
.section-locked { position: relative; }
.section-locked > *:not(.lock-overlay) { filter: blur(4px); pointer-events: none; user-select: none; }
.lock-overlay {
  position: absolute; top: 0; left: 0; right: 0; bottom: 0;
  display: flex; align-items: center; justify-content: center;
  background: rgba(13,17,23,0.6); z-index: 10; border-radius: var(--radius);
}
.lock-overlay-content {
  text-align: center; padding: 32px;
}
.lock-overlay-content h3 { color: #00e676; margin-bottom: 8px; }
.lock-overlay-content p { color: var(--text-dim); font-size: 13px; margin-bottom: 16px; }
.lock-overlay-content .btn-unlock {
  background: #00e676; color: #0d1117; border: none; padding: 8px 24px;
  border-radius: 6px; font-weight: 600; cursor: pointer; font-size: 13px;
}

/* ── TOUR OVERLAY ── */
.tour-backdrop {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.7); z-index: 9998;
}
.tour-popup {
  position: fixed; z-index: 9999; background: var(--surface-2);
  border: 1px solid #00e676; border-radius: 8px; padding: 20px;
  max-width: 360px; box-shadow: 0 8px 32px rgba(0,0,0,0.5);
}
.tour-popup h4 { color: #00e676; margin-bottom: 8px; font-size: 15px; }
.tour-popup p { color: var(--text); font-size: 13px; line-height: 1.5; margin-bottom: 16px; }
.tour-btns { display: flex; gap: 8px; justify-content: flex-end; }
.tour-btn { padding: 6px 16px; border-radius: 4px; font-size: 12px; cursor: pointer; border: none; }
.tour-btn-skip { background: var(--surface-3); color: var(--text-dim); }
.tour-btn-next { background: #00e676; color: #0d1117; font-weight: 600; }
.tour-btn-next:hover { background: #69f0ae; }
.tour-highlight { outline: 2px solid #00e676 !important; outline-offset: 4px; box-shadow: 0 0 20px rgba(0,230,118,0.3); z-index: 10000; position: relative; }

/* ── RANKING FILTER DESC ARROW ── */
.rank-filter-desc {
  font-size: 11px; color: var(--text-dim); line-height: 1.5;
  padding: 8px 0; white-space: pre-line;
}
.rank-ideal-tag {
  display: inline-block; margin-top: 4px;
  font-size: 11px; color: #00e676; font-weight: 500;
}

/* ── DIVIDEND YEAR ROWS ── */
.div-year-row:hover { background: var(--surface-3) !important; }
.div-year-row.open .div-year-arrow { transform: rotate(90deg); }

/* ── REPORTS TABS ── */
.reports-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 16px;
}
.reports-tab {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 8px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.reports-tab:hover { color: var(--text); }
.reports-tab.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.reports-panel { display: none; }
.reports-panel.active { display: block; }

/* ── COLLAPSIBLE ── */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  transition: all var(--transition);
  margin-bottom: 8px;
}
.collapsible-header:hover { border-color: var(--accent); color: var(--text); }
.collapsible-header.open .collapse-arrow { transform: rotate(90deg); }
.collapse-arrow { transition: transform var(--transition); color: var(--accent); flex-shrink: 0; }

/* ── LLM TIMER ── */
.llm-timer {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  margin-left: 6px;
  min-width: 35px;
}

/* ── NEWS FILTERS ── */
.news-filters {
  display: flex;
  gap: 6px;
  margin-bottom: 16px;
}
.news-filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.news-filter-btn:hover { color: var(--text); border-color: var(--text-muted); }
.news-filter-btn.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }

/* #24 — News filter colored text */
.news-filter-btn[data-sentiment="positive"] { color: #00e676; }
.news-filter-btn[data-sentiment="neutral"] { color: #64b5f6; }
.news-filter-btn[data-sentiment="negative"] { color: #ff5252; }
.news-filter-btn[data-sentiment="positive"].active { color: #00e676; border-color: #00e676; background: rgba(0,230,118,0.08); }
.news-filter-btn[data-sentiment="neutral"].active { color: #64b5f6; border-color: #64b5f6; background: rgba(100,181,246,0.08); }
.news-filter-btn[data-sentiment="negative"].active { color: #ff5252; border-color: #ff5252; background: rgba(255,82,82,0.08); }

/* ── FINANCIAL TABLE ROW HIGHLIGHTS ── */
.data-table tr.highlight-green td:first-child { color: var(--accent); font-weight: 700; }
.data-table tr.highlight-green { background: rgba(0,230,118,0.04); }
.data-table tr.highlight-blue td:first-child { color: var(--blue); font-weight: 700; }
.data-table tr.highlight-blue { background: rgba(68,138,255,0.04); }

/* Income statement: light blue for key lines (Revenue, EBIT, EBT, Net Income) */
.data-table tr.highlight-lightblue td:first-child { color: #64b5f6; font-weight: 700; }
.data-table tr.highlight-lightblue { background: rgba(100,181,246,0.05); }

/* Cash flow: green for operations/investing/financing/net change */
.data-table tr.highlight-cf-green td:first-child { color: var(--accent); font-weight: 700; }
.data-table tr.highlight-cf-green { background: rgba(0,230,118,0.04); }

/* Operating Expenses: red collapsible parent */
.data-table tr.highlight-opex-red td:first-child { color: #ff5252; font-weight: 700; }
.data-table tr.highlight-opex-red { background: rgba(255,82,82,0.05); }
.data-table tr.highlight-opex-red:hover { background: rgba(255,82,82,0.10); }

/* Child rows: indented, subtle */
.data-table tr.fin-child td:first-child { padding-left: 8px; }
.data-table tr.fin-child { background: rgba(255,255,255,0.01); }

/* Non-recurring items: dashed border + muted orange */
.data-table tr.highlight-nr-orange td:first-child { color: #ffab40; font-style: italic; }
.data-table tr.highlight-nr-orange { background: rgba(255,171,64,0.03); border-left: 2px dashed #ffab40; }

/* Cash flow: orange for dividends paid */
.data-table tr.highlight-cf-orange td:first-child { color: #ffab40; font-weight: 700; }
.data-table tr.highlight-cf-orange { background: rgba(255,171,64,0.05); }
.data-table tr.highlight-orange td:first-child { color: #ff9800; font-weight: 700; }
.data-table tr.highlight-orange { background: rgba(255,152,0,0.05); }

/* ── DCF RECOMMENDATION ── */
.dcf-recommendation {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin: 12px 0;
}
.dcf-recommendation h4 {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}
.dcf-rec-item {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
}
.dcf-rec-item span:first-child { color: var(--text-muted); }
.dcf-rec-item span:last-child { font-family: var(--font-mono); color: var(--text); font-weight: 600; }

/* ── COMPS METHODOLOGY ── */
.comp-brazilian { color: var(--accent); }
.comp-international { color: var(--blue); }

/* ── ANALYST COLORS ── */
.analyst-brazilian { color: var(--accent); font-weight: 600; }
.analyst-international { color: var(--blue); }

/* Report cards in announcements */
.report-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 8px;
}
.report-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 6px;
  gap: 10px;
}
.report-type {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  flex-shrink: 0;
  background: var(--accent-bg);
  color: var(--accent);
}
.report-date { font-size: 11px; color: var(--text-faint); }
.report-title { font-size: 13px; font-weight: 600; color: var(--text); }
.report-summary { font-size: 12px; color: var(--text-muted); line-height: 1.5; margin-top: 4px; }

/* ── FOOTER ── */
footer {
  text-align: center;
  padding: 20px;
  border-top: 1px solid var(--border);
}
footer a {
  font-size: 11px;
  color: var(--text-faint);
  text-decoration: none;
}
footer a:hover { color: var(--text-muted); }

/* ── RESPONSIVE ── */
@media (max-width: 768px) {
  main { padding: 16px; }
  .summary-hero { flex-direction: column; }
  .summary-price { text-align: left; }
  .price-big { font-size: 28px; }
  .ticker-big { font-size: 24px; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .range-row { grid-template-columns: 1fr; }
  .consensus-targets { grid-template-columns: 1fr; }
  .dcf-result-cards { grid-template-columns: 1fr; }
}

/* ═══════════════════════════════════════════════
   CVM PIPELINE INTEGRATION STYLES
   ═══════════════════════════════════════════════ */

/* Pipeline status indicator in topbar */
#pipelineStatus .status-dot {
  background: var(--red);
}
#pipelineStatus .status-dot.connected {
  background: var(--blue);
}
#pipelineStatus .status-text {
  color: var(--text-muted);
}
#pipelineStatus .status-dot.connected + .status-text {
  color: var(--blue);
}

/* Data source badges (CVM / BRAPI tags in table headers) */
.data-source-tag {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  font-family: var(--font-mono);
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 3px;
  vertical-align: middle;
  margin-left: 6px;
  background: rgba(68, 138, 255, 0.15);
  color: var(--blue);
  border: 1px solid rgba(68, 138, 255, 0.3);
}
.data-source-tag.brapi {
  background: rgba(255, 215, 64, 0.12);
  color: var(--yellow);
  border-color: rgba(255, 215, 64, 0.3);
}

/* Pipeline badge on summary section (shows CNPJ) */
.tag-pipeline {
  background: rgba(68, 138, 255, 0.12);
  color: var(--blue);
  border: 1px solid rgba(68, 138, 255, 0.25);
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: help;
}

/* CVM filing report cards */
.report-link {
  margin-top: 8px;
}
.report-link a {
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.5px;
}
.report-link a:hover {
  text-decoration: underline;
  color: var(--accent);
}

/* ═══════════════════════════════════════════════
   NEW FEATURE STYLES
   ═══════════════════════════════════════════════ */

/* #2 — Chart Section */
.chart-section {
  margin-bottom: 16px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px 10px;
}
.chart-timeframe-btns {
  display: flex;
  gap: 4px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}
.chart-timeframe-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.chart-timeframe-btn:hover { color: var(--text); border-color: var(--text-muted); }
.chart-timeframe-btn.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.chart-canvas-wrap {
  position: relative;
  width: 100%;
  height: 220px;
  margin-bottom: 8px;
  cursor: crosshair;
}
.chart-canvas-wrap canvas {
  width: 100% !important;
  height: 100% !important;
}

/* Investment Calculator */
.invest-calc {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-size: 13px;
  color: var(--text-muted);
}
.invest-calc input[type="number"] {
  width: 120px;
  height: 32px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--accent);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  outline: none;
}
.invest-calc input[type="number"]:focus { border-color: var(--accent); }
.invest-calc input[type="date"] {
  height: 32px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.invest-calc select {
  height: 32px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 12px;
  outline: none;
}
.invest-calc .invest-result {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 700;
  color: var(--accent);
}
.chart-variation-overlay {
  position: absolute;
  top: 6px;
  left: 10px;
  background: rgba(18,18,18,0.92);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 8px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text);
  pointer-events: none;
  z-index: 10;
  min-width: 160px;
  backdrop-filter: blur(6px);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}
.chart-overlay-dates {
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  margin-bottom: 4px;
}
.chart-overlay-prices {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.chart-overlay-pct {
  font-size: 18px;
  font-weight: 700;
  line-height: 1.2;
}
.chart-overlay-abs {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.chart-drag-highlight {
  position: absolute;
  top: 0;
  height: 100%;
  background: rgba(0,230,118,0.06);
  border-left: 1px dashed rgba(0,230,118,0.3);
  border-right: 1px dashed rgba(0,230,118,0.3);
  pointer-events: none;
  z-index: 5;
}

/* #4 — Capital Structure Visual */
.capital-structure-bar {
  display: flex;
  height: 24px;
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 8px;
  margin-bottom: 12px;
}
.capital-bar-equity {
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--bg);
  min-width: 30px;
}
.capital-bar-debt {
  background: var(--red);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
  min-width: 30px;
}

/* #9 — Language dropdown */
.lang-dropdown-wrap {
  position: relative;
  display: inline-block;
}
.lang-toggle {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1px;
  min-width: 40px;
  text-align: center;
  cursor: pointer;
}
.lang-toggle.active { color: var(--accent); border-color: var(--accent); }
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 4px);
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 6px;
  min-width: 130px;
  padding: 4px 0;
  z-index: 999;
  box-shadow: 0 4px 12px rgba(0,0,0,.35);
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  font-size: 12px;
  color: var(--text-dim);
  cursor: pointer;
  transition: background .15s, color .15s;
}
.lang-option:hover {
  background: var(--border);
  color: var(--text);
}
.lang-option.selected {
  color: var(--accent);
  font-weight: 600;
}
.lang-check {
  display: inline-block;
  width: 14px;
  font-size: 13px;
  text-align: center;
  color: var(--accent);
}

/* #21 — Reports pagination */
.reports-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 16px;
  padding: 12px;
}
.reports-pagination button {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 6px 12px;
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition);
}
.reports-pagination button:hover { color: var(--text); border-color: var(--text-muted); }
.reports-pagination button.active { background: var(--accent-bg); color: var(--accent); border-color: var(--accent); }
.reports-pagination button:disabled { opacity: 0.3; cursor: not-allowed; }
.reports-pagination .page-info {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-muted);
}

/* #27 — Supply Chain */
.supply-chain-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 768px) {
  .supply-chain-grid { grid-template-columns: 1fr; }
}
.supply-chain-list {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.supply-chain-list h4 {
  font-size: 12px;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border);
}
.supply-chain-item {
  padding: 8px 0;
  border-bottom: 1px solid rgba(42,42,42,0.5);
}
.supply-chain-item:last-child { border-bottom: none; }
.supply-chain-name { font-size: 13px; font-weight: 600; color: var(--text); }
.supply-chain-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; }
.supply-chain-col {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.supply-chain-card {
  padding: 10px 0;
  border-bottom: 1px solid rgba(42,42,42,0.5);
}
.supply-chain-card:last-child { border-bottom: none; }
.sc-name { font-size: 13px; font-weight: 600; color: var(--text); }
.sc-ticker { color: var(--accent); cursor: pointer; font-weight: 400; margin-left: 4px; }
.sc-ticker:hover { text-decoration: underline; }
.sc-desc { font-size: 12px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.sc-rel { font-size: 11px; color: var(--text-faint); margin-top: 2px; font-style: italic; }

/* #28 — Composite Ranking Section */
.ranking-section {
  margin-bottom: 32px;
  padding: 20px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}
.rank-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}
.rank-filters {
  display: flex;
  gap: 4px;
}
.rank-filter-btn {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: transparent;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}
.rank-filter-btn:hover {
  border-color: var(--accent);
  color: var(--text-main);
}
.rank-filter-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: #000;
  font-weight: 700;
}
.rank-filter-desc {
  font-size: 11px;
  color: var(--text-faint);
  margin-bottom: 12px;
  font-style: italic;
}
.ranking-card {
  background: var(--surface-3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0;
}
.ranking-card .table-wrap {
  overflow-x: hidden;
}
.rank-table {
  font-size: 12px;
  width: 100%;
}
.rank-table th {
  position: sticky;
  top: 0;
  background: var(--surface-3);
  z-index: 2;
  padding: 6px 6px;
  white-space: nowrap;
}
.rank-table td {
  font-family: var(--font-mono);
  white-space: nowrap;
  padding: 6px 6px;
}
.rank-table tr:hover {
  background: rgba(255,255,255,0.03);
}
.rank-col-num { width: 3%; }
.rank-col-ticker { width: 7%; min-width: 0; text-align: center; }
.rank-table td:nth-child(1) { width: 3%; text-align: center; }
.rank-table td:nth-child(2) { text-align: center; }
.rank-col-sector {
  width: 10%;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-sector {
  font-family: var(--font-main);
  font-size: 11px;
  color: var(--text-dim);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.rank-col-num { text-align: right; }
.rank-col-score { text-align: center; width: 5%; }
@media (max-width: 768px) {
  .rank-controls { flex-direction: column; align-items: flex-start; }
  .rank-table { font-size: 10px; }
  .rank-table td { padding: 4px 4px; }
}

/* ── AI PROFESSOR CHAT ── */
.ai-chat-fab {
  position: fixed; bottom: 24px; right: 24px; z-index: 9999;
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--accent); color: #111; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 16px rgba(0,230,118,0.3);
  transition: transform 0.2s, box-shadow 0.2s;
}
.ai-chat-fab:hover { transform: scale(1.08); box-shadow: 0 6px 24px rgba(0,230,118,0.4); }

.ai-chat-panel {
  position: fixed; bottom: 88px; right: 24px; z-index: 9999;
  width: 380px; max-height: 520px;
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 12px; display: flex; flex-direction: column;
  box-shadow: 0 8px 32px rgba(0,0,0,0.5);
  overflow: hidden;
}
.ai-chat-header {
  display: flex; align-items: center; padding: 12px 16px;
  background: var(--surface-3); border-bottom: 1px solid var(--border);
  gap: 8px;
}
.ai-chat-title { font-weight: 700; font-size: 14px; color: var(--accent); }
.ai-chat-quota { font-size: 10px; color: var(--text-dim); margin-left: auto; }
.ai-chat-close {
  background: none; border: none; color: var(--text-dim); font-size: 20px;
  cursor: pointer; padding: 0 4px; line-height: 1;
}
.ai-chat-close:hover { color: var(--text); }

.ai-chat-messages {
  flex: 1; overflow-y: auto; padding: 12px 16px;
  display: flex; flex-direction: column; gap: 10px;
  max-height: 380px; min-height: 200px;
}
.ai-msg {
  max-width: 90%; padding: 10px 14px; border-radius: 12px;
  font-size: 13px; line-height: 1.5; word-wrap: break-word;
}
.ai-msg-bot {
  align-self: flex-start;
  background: var(--surface-3); color: var(--text);
  border-bottom-left-radius: 4px;
}
.ai-msg-user {
  align-self: flex-end;
  background: var(--accent); color: #111; font-weight: 500;
  border-bottom-right-radius: 4px;
}
.ai-msg-loading {
  align-self: flex-start; color: var(--text-dim); font-style: italic;
}

.ai-chat-input {
  display: flex; padding: 10px 12px; gap: 8px;
  border-top: 1px solid var(--border); background: var(--surface-3);
}
.ai-chat-input input {
  flex: 1; background: var(--surface); border: 1px solid var(--border);
  border-radius: 8px; padding: 8px 12px; color: var(--text);
  font-size: 13px; font-family: var(--font-main); outline: none;
}
.ai-chat-input input:focus { border-color: var(--accent); }
.ai-chat-input button {
  background: var(--accent); color: #111; border: none; border-radius: 8px;
  padding: 8px 14px; cursor: pointer; font-size: 14px; font-weight: 700;
}
.ai-chat-input button:hover { opacity: 0.9; }

@media (max-width: 480px) {
  .ai-chat-panel { width: calc(100vw - 32px); right: 16px; bottom: 80px; }
}
