:root {
  --navy: #0e2a4d;
  --navy2: #16406e;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #1a2433;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #0f9d58;
  --red: #d93025;
  --gold: #c9a227;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 42, 77, .08), 0 4px 14px rgba(16, 42, 77, .05);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15.5px;
  line-height: 1.55;
}
a { color: var(--navy2); }

/* ---------- preview banner ---------- */
.preview-banner {
  background: #fff7df;
  border-bottom: 1px solid #eadb9e;
  color: #6b5900;
  text-align: center;
  font-size: 13px;
  padding: 5px 12px;
}

/* ---------- header / nav ---------- */
.site-header {
  background: linear-gradient(120deg, var(--navy) 0%, var(--navy2) 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(14, 42, 77, .35);
}
.header-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  gap: 26px;
  min-height: 60px;
  flex-wrap: wrap;
}
.brand { display: flex; align-items: baseline; gap: 7px; text-decoration: none; }
.brand .b1 { font-size: 21px; font-weight: 700; letter-spacing: 2.5px; color: #fff; }
.brand .b2 { font-size: 21px; font-weight: 700; color: var(--gold); letter-spacing: 1px; }
.brand .b3 { font-size: 11px; color: #b9c8dd; letter-spacing: 3px; margin-left: 4px; }
nav.main-nav { display: flex; gap: 4px; flex: 1; }
nav.main-nav a {
  color: #d7e2f0;
  text-decoration: none;
  padding: 19px 13px;
  font-size: 14.5px;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}
nav.main-nav a:hover { color: #fff; }
nav.main-nav a.active { color: #fff; border-bottom-color: var(--gold); }
.header-quote { text-align: right; font-variant-numeric: tabular-nums; line-height: 1.25; }
.live-dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: #2ecc71;
  margin-right: 6px;
  vertical-align: 2px;
  animation: livepulse 2s infinite;
}
@keyframes livepulse { 0%,100% { opacity: 1; } 50% { opacity: .35; } }
.header-quote .hq-level { font-size: 17px; font-weight: 700; }
.header-quote .hq-chg { font-size: 12.5px; font-weight: 600; }

/* ---------- layout ---------- */
.wrap { max-width: 1180px; margin: 0 auto; padding: 26px 20px 40px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 24px;
  margin-bottom: 22px;
}
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 14px; }
.subtitle { color: var(--muted); margin: 0 0 20px; max-width: 760px; }
.up { color: var(--green); }
.down { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------- hero quote ---------- */
.hero { display: flex; gap: 24px; align-items: flex-end; flex-wrap: wrap; }
.hero-level { font-size: 44px; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-chg { font-size: 19px; font-weight: 700; padding-bottom: 4px; }
.asof { color: var(--muted); font-size: 12.5px; padding-bottom: 7px; }
.stat-row { display: flex; gap: 8px; flex-wrap: nowrap; margin-top: 14px; }
.stat {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
  flex: 1 1 0;
  min-width: 0;
}
.stat .lbl {
  font-size: 10px; color: var(--muted); text-transform: uppercase;
  letter-spacing: .3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.stat .val { font-size: 15.5px; font-weight: 700; font-variant-numeric: tabular-nums; }
@media (max-width: 820px) {
  .stat-row { flex-wrap: wrap; }
  .stat { flex-basis: 30%; }
}

/* ---------- tables ---------- */
table.data { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; }
table.data th {
  text-align: right;
  font-size: 12.5px;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--muted);
  border-bottom: 2px solid var(--line);
  padding: 8px 10px;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
table.data th:first-child, table.data td:first-child { text-align: left; }
table.data td { padding: 7px 10px; border-bottom: 1px solid #eef2f6; text-align: right; }
table.data tbody tr:hover { background: #f2f6fb; }
table.data td.tick { font-weight: 700; color: var(--navy2); }
th.sorted-asc::after { content: " \25B4"; }
th.sorted-desc::after { content: " \25BE"; }

/* copy protection on the constituents table */
.nocopy, .nocopy * {
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

.table-tools { display: flex; gap: 12px; align-items: center; margin-bottom: 12px; flex-wrap: wrap; }
.table-tools input[type="search"] {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 14px;
  width: 210px;
}

/* ---------- extended hours ---------- */
.ext-line {
  display: flex; align-items: baseline; gap: 9px; flex-wrap: wrap;
  margin: 10px 0 2px; font-variant-numeric: tabular-nums;
}
.ext-tag {
  font-size: 11px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase;
  color: #6b5900; background: #fff3cf; border: 1px solid #eadb9e;
  border-radius: 5px; padding: 2px 8px;
}
.ext-lvl { font-size: 21px; font-weight: 700; }
.ext-pct { font-size: 15px; font-weight: 700; }
.ext-movers { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.ext-mover {
  display: flex; align-items: baseline; gap: 8px;
  border: 1px solid var(--line); border-radius: 7px; padding: 7px 11px;
  font-variant-numeric: tabular-nums;
}
.ext-mover .em-tick { font-weight: 700; color: var(--navy2); min-width: 46px; }
.ext-mover .em-pct { font-weight: 700; margin-left: auto; }
.ext-mover.sharp { border-color: var(--gold); border-left: 3px solid var(--gold); background: #fffdf3; }

/* ---------- home split: table left, intraday chart right ---------- */
.home-split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 30px;
  align-items: stretch;
}
.split-right { display: flex; flex-direction: column; }
.split-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.split-head .chip-row .chip { padding: 3px 10px; font-size: 12px; }
.cons-scroll {
  max-height: 430px;
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  scrollbar-gutter: stable;
}
.cons-scroll table.data th,
.cons-scroll table.data td { padding-left: 8px; padding-right: 8px; }
.cons-scroll table.data thead th {
  position: sticky;
  top: 0;
  background: #fff;
  box-shadow: inset 0 -2px 0 var(--line);
  z-index: 1;
}
.split-right .chart-box.split-chart { flex: 1; min-height: 220px; }
.split-left h1 { font-size: 23px; margin-bottom: 4px; }
.split-left .subtitle { font-size: 13.5px; margin: 0 0 12px; }
@media (max-width: 820px) {
  .home-split { grid-template-columns: 1fr; }
  .split-right .chart-box.split-chart { height: 240px; flex: none; }
}

/* ---------- chart controls ---------- */
.chip-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  color: var(--muted);
}
.chip.on { color: #fff; border-color: transparent; }
.chip.range.on { background: var(--navy2); }
.chart-box { position: relative; height: 430px; }
.chart-box.short { height: 300px; }

/* ---------- racing ---------- */
.race-row { display: grid; grid-template-columns: 44px 74px 1fr 86px; gap: 10px; align-items: center; padding: 7px 0; }
.race-pos { font-weight: 700; color: var(--muted); font-size: 15px; text-align: center; }
.race-pos.p1 { color: var(--gold); font-size: 19px; }
.race-pos.p2 { color: #8c9bb0; font-size: 17px; }
.race-pos.p3 { color: #b0782f; font-size: 16px; }
.race-tick { font-weight: 700; color: var(--navy2); }
.race-track { background: #eef2f7; border-radius: 6px; height: 22px; overflow: hidden; }
.race-bar { height: 100%; border-radius: 6px; width: 0; transition: width 1.1s cubic-bezier(.2,.7,.3,1); }
.race-bar.gain { background: linear-gradient(90deg, #17b866, #0f9d58); }
.race-bar.loss { background: linear-gradient(90deg, #f26b5e, #d93025); }
.race-val { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- daily closes month blocks ---------- */
.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 18px;
  align-items: start;
}
.month-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fdfefe;
}
.month-title {
  background: var(--navy2);
  color: #fff;
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-align: center;
  padding: 6px 4px;
}
.month-block table.data { font-size: 13px; }
.month-block table.data th { cursor: default; padding: 5px 8px; }
.month-block table.data td { padding: 3.5px 8px; }

.expand-row td { background: #fff8e6; border-top: 2px solid var(--gold); }

/* ---------- ticker chips (index changes) ---------- */
.tchip {
  display: inline-block;
  font-size: 12.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 2px 8px;
  border-radius: 5px;
  margin: 1px 0;
  background: #eef2f7;
  color: var(--navy2);
}
.tchip.in { background: #e3f5ec; color: #0b7a44; }
.tchip.out { background: #fdeae8; color: #b3271e; text-decoration: line-through; }

/* ---------- heatmap ---------- */
table.heat td { text-align: center; font-size: 13px; padding: 6px 4px; border-radius: 4px; min-width: 52px; }
table.heat th { font-size: 12px; color: var(--muted); padding: 6px 4px; }

/* ---------- footer ---------- */
.site-footer {
  background: var(--navy);
  color: #b9c8dd;
  margin-top: 30px;
  font-size: 13.5px;
}
.footer-inner { max-width: 1180px; margin: 0 auto; padding: 26px 20px; display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.site-footer a { color: #e3ecf7; }

@media (max-width: 760px) {
  .hero-level { font-size: 40px; }
  .header-quote { display: none; }
  nav.main-nav a { padding: 14px 9px; }
}
