:root {
  --bg: #0b1220;
  --bg-2: #121b2e;
  --panel: #17233a;
  --line: rgba(255,255,255,.08);
  --text: #e8eef8;
  --muted: #93a0b8;
  --gold: #d4a017;
  --gold-2: #f0c14b;
  --ok: #3dd68c;
  --warn: #f5c26b;
  --bad: #f07178;
  --opt: #3dd68c;
  --base: #6ea8fe;
  --pes: #f07178;
}

* { box-sizing: border-box; }
html, body { background: var(--bg); color: var(--text); }
body {
  font-family: "Segoe UI", Calibri, Arial, sans-serif;
  min-height: 100vh;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { color: #fff; }

.alfa-nav {
  background: var(--bg-2);
  border-bottom: 1px solid var(--line);
}
.alfa-brand {
  font-weight: 700;
  letter-spacing: .08em;
  color: #fff !important;
}
.alfa-brand span { color: var(--gold-2); }
.navbar-dark .navbar-nav .nav-link { color: var(--muted); }
.navbar-dark .navbar-nav .nav-link:hover,
.navbar-dark .navbar-nav .nav-link.active { color: #fff; }

.page-wrap { padding: 1.5rem 0 3rem; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1.1rem 1.2rem;
}
.kpi {
  background: linear-gradient(180deg, #1b2944, #152036);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 1rem 1.1rem;
}
.kpi .label { color: var(--muted); font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; }
.kpi .value { font-size: 1.55rem; font-weight: 700; }
.kpi .hint { color: var(--muted); font-size: .85rem; }

.badge-ok { background: #1a4a34; color: var(--ok); }
.badge-warn { background: #4a3b16; color: var(--warn); }
.badge-muted { background: #2a3348; color: var(--muted); }

.table-darkish {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  color: var(--text);
}
.table-darkish thead th {
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-color: var(--line);
  white-space: nowrap;
}
.table-darkish td { border-color: var(--line); vertical-align: middle; }
.table-darkish tbody tr:hover { background: rgba(255,255,255,.03); }
.pos { color: var(--ok); }
.neg { color: var(--bad); }
.ticker-link { font-weight: 700; color: #fff; }
.sector-chip {
  display: inline-block;
  background: #22314d;
  color: var(--muted);
  border-radius: 999px;
  padding: .15rem .6rem;
  font-size: .75rem;
}
.res-cell { white-space: nowrap; }
.res-chip {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  padding: .12rem .4rem;
  margin: 0 .15rem .15rem 0;
  border-radius: 4px;
  background: rgba(240, 193, 75, .12);
  color: var(--gold-2);
  border: 1px solid rgba(240, 193, 75, .28);
}

.co-hero { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.co-hero h1 { margin: 0; font-size: 2rem; }
.co-hero .ticker { color: var(--gold-2); letter-spacing: .08em; }
.nav-co a { color: var(--muted); font-size: .9rem; }

.quarter-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
  margin: 0 0 1rem;
}
.quarter-bar label {
  color: var(--muted);
  font-size: .85rem;
  margin: 0;
}
.quarter-bar .form-select {
  width: auto;
  min-width: 220px;
  background: #0f1728;
  border-color: var(--line);
  color: var(--text);
}
.archive-banner {
  background: rgba(245, 194, 107, .12);
  border: 1px solid rgba(245, 194, 107, .35);
  color: var(--warn);
  border-radius: 10px;
  padding: .7rem 1rem;
  font-size: .9rem;
}

.nav-pills .nav-link {
  color: var(--muted);
  border-radius: 999px;
}
.nav-pills .nav-link.active {
  background: var(--gold);
  color: #111;
  font-weight: 600;
}

.pdf-frame, .img-frame {
  width: 100%;
  min-height: 75vh;
  border: 0;
  background: #0a0a0a;
  border-radius: 10px;
}
audio { width: 100%; }

.kv-table td:first-child { color: var(--muted); width: 42%; }
.filter-bar .form-control, .filter-bar .form-select {
  background: #0f1728;
  border-color: var(--line);
  color: var(--text);
}
.footer-note { color: var(--muted); font-size: .8rem; margin-top: 2rem; }
.model-table { font-size: .82rem; }
.model-table th, .model-table td { white-space: nowrap; }
.chart-box {
  position: relative;
  height: 260px;
  width: 100%;
}
.chart-box-wide { height: 260px; }
.chart-box canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.quote-chart {
  height: 400px;
  width: 100%;
}
.quote-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem 1.25rem;
  align-items: baseline;
  margin-bottom: .85rem;
}
.quote-meta .qx {
  font-size: 1.45rem;
  font-weight: 700;
}
.quote-meta .qx.pos { color: var(--ok); }
.quote-meta .qx.neg { color: var(--bad); }
.quote-meta .qk {
  color: var(--muted);
  font-size: .82rem;
}
.var-block {
  border-top: 1px solid var(--line);
  padding-top: 1.1rem;
}
.var-controls .form-control,
.var-controls .form-select {
  width: auto;
  min-width: 5.5rem;
  background: #0f1728;
  border-color: var(--line);
  color: var(--text);
}
.corr-legend {
  display: flex;
  align-items: center;
  gap: .45rem;
  font-size: .75rem;
  color: var(--muted);
}
.corr-legend-bar {
  width: 140px;
  height: 10px;
  border-radius: 99px;
  background: linear-gradient(90deg, #6ea8fe, #17233a 50%, #f07178);
  border: 1px solid var(--line);
}
.corr-scroll {
  overflow: auto;
  max-height: min(70vh, 820px);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.corr-table {
  border-collapse: separate;
  border-spacing: 0;
  font-size: .72rem;
  margin: 0;
}
.corr-table th,
.corr-table td {
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: center;
  padding: 0;
  white-space: nowrap;
}
.corr-table .lab {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--panel);
  text-align: left;
  padding: .25rem .45rem;
  font-weight: 600;
  color: var(--text);
  max-width: 11rem;
  overflow: hidden;
  text-overflow: ellipsis;
}
.corr-table thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--panel);
  color: var(--muted);
  font-weight: 600;
}
.corr-table thead th.lab {
  z-index: 4;
  left: 0;
}
.corr-table.tickers thead th.rot {
  height: 5.2rem;
  vertical-align: bottom;
  padding: .2rem 0;
  min-width: 1.35rem;
}
.corr-table.tickers thead th.rot span {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  font-size: .68rem;
  letter-spacing: .02em;
  display: inline-block;
  max-height: 5rem;
  overflow: hidden;
}
.corr-cell {
  width: 2.35rem;
  min-width: 2.35rem;
  height: 1.85rem;
  cursor: pointer;
  font-variant-numeric: tabular-nums;
  font-size: .68rem;
  color: #e8eef8;
}
.corr-table.tickers .corr-cell {
  width: 1.35rem;
  min-width: 1.35rem;
  height: 1.35rem;
  font-size: 0;
}
.corr-cell.is-diag { font-weight: 700; }
.corr-cell.is-hl { box-shadow: inset 0 0 0 2px var(--gold-2); }
.corr-table .lab.is-hl { color: var(--gold-2); }
.corr-sep { border-left: 2px solid rgba(240, 193, 75, .45) !important; }
.corr-row-sep td,
.corr-row-sep th { border-top: 2px solid rgba(240, 193, 75, .45) !important; }
.corr-table .lab.is-btn { cursor: pointer; }
.corr-table .lab.is-btn:hover { color: var(--gold-2); }
.fin-chart-card { overflow: hidden; }
.fin-chart-title { color: var(--gold-2); font-size: .95rem; margin-bottom: .75rem; }
.fin-table-wrap { max-height: 420px; }
.fin-table th:first-child, .fin-table td:first-child {
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 1;
  min-width: 220px;
}
.fin-table thead th { white-space: nowrap; }

.video-embed iframe { border: 0; border-radius: 10px; }
.video-card {
  display: block;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: hidden;
  color: var(--text);
  height: 100%;
}
.video-card:hover { border-color: var(--gold); color: #fff; }
.video-card.is-active { outline: 2px solid var(--gold); }
.video-thumb { position: relative; background: #000; aspect-ratio: 16 / 9; }
.video-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-duration {
  position: absolute;
  right: .45rem;
  bottom: .45rem;
  background: rgba(0,0,0,.8);
  color: #fff;
  font-size: .75rem;
  padding: .1rem .35rem;
  border-radius: 4px;
}
.video-card-body { padding: .75rem .85rem 1rem; }
.video-card-title { font-weight: 600; font-size: .95rem; line-height: 1.3; min-height: 2.5em; }
.video-card-meta { color: var(--muted); font-size: .8rem; margin-top: .35rem; }
.video-section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: .75rem;
  margin: 0 0 .85rem;
}
.video-section-head h2 {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--gold-2);
}

.etf-search { max-width: 320px; }
.etf-groups { display: flex; flex-wrap: wrap; gap: .4rem; }
.etf-chip {
  background: #22314d;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .2rem .7rem;
  font-size: .75rem;
}
.etf-chip:hover { color: #fff; border-color: var(--gold); }
.etf-chip.is-on { background: rgba(212, 160, 23, .18); color: var(--gold-2); border-color: var(--gold); }
.etf-table-panel { padding-bottom: .4rem; }
.etf-scroll { max-height: 62vh; }
.etf-table { font-size: .82rem; margin-bottom: 0; }
.etf-table thead th {
  position: sticky;
  top: 0;
  background: #1a2740;
  z-index: 3;
  cursor: default;
}
.etf-table th.etf-sort { cursor: pointer; }
.etf-table th.etf-sort:hover { color: var(--gold-2); }
.etf-table td.etf-sticky,
.etf-table th.etf-sticky {
  position: sticky;
  left: 0;
  background: var(--panel);
  z-index: 2;
  min-width: 190px;
}
.etf-table thead th.etf-sticky { z-index: 4; background: #1a2740; }
.etf-row { cursor: pointer; }
.etf-row.is-selected td { background: rgba(212, 160, 23, .12); }
.etf-row.is-missing { opacity: .62; }
.etf-group-row td {
  color: var(--gold-2);
  font-size: .72rem;
  letter-spacing: .06em;
  text-transform: uppercase;
  background: #1a2740;
  padding-top: .55rem;
}
.etf-sub { color: var(--muted); font-size: .7rem; font-weight: 400; max-width: 240px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.etf-flag { margin-right: .15rem; }
.etf-spark { width: 88px; height: 26px; display: block; }
.etf-spark-td { width: 96px; }
