:root {
  --bg: #090f19;
  --panel: #111b29;
  --panel-2: #172333;
  --line: #2b394a;
  --text: #f4f1e9;
  --dim: #a7b7cc;
  --faint: #8e9fb6;
  --accent: #e9c782;
  --up: #53dbaa;
  --down: #ff8293;
  --warn: #f3c46d;
  --band80: rgba(102, 174, 255, 0.16);
  --band50: rgba(102, 174, 255, 0.35);
  --radius: 14px;
  --header-height: 64px;
  --font: Inter, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--header-height) + 12px); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }
.wrap { max-width: 1520px; margin-inline: auto; padding-inline: clamp(24px, 3vw, 48px); }
.num, td, .glance .v, .tile .v { font-variant-numeric: tabular-nums; }
.skip-link {
  position: fixed; top: 12px; left: 16px; z-index: 30;
  padding: 10px 14px; background: var(--panel-2); border-radius: 8px;
  transform: translateY(calc(-100% - 16px));
}
.skip-link:focus { transform: none; }

/* Header and section navigation */
.site-header {
  position: sticky; top: 0; z-index: 10;
  background: #0c1420;
  border-bottom: 1px solid var(--line);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; height: var(--header-height); }
.wordmark { display: inline-flex; align-items: center; color: var(--text); font-weight: 750; font-size: 19px; letter-spacing: -0.035em; }
.wordmark img { margin-right: 9px; flex: none; }
.wordmark span { color: var(--accent); margin-left: 3px; }
.wordmark:hover { text-decoration: none; }
.nav-toggle { display: none; }
.layout { display: grid; grid-template-columns: 208px minmax(0, 1fr); gap: clamp(24px, 3vw, 46px); }
#section-nav {
  position: sticky; top: calc(var(--header-height) + 24px); align-self: start;
  max-height: calc(100dvh - var(--header-height) - 36px); overflow: auto;
  padding: 4px 16px 8px 4px;
  border-right: 1px solid var(--line);
  scrollbar-width: thin;
}
.nav-group { list-style: none; padding: 0; margin: 0; }
.nav-label {
  margin: 18px 0 5px; padding-inline: 11px;
  color: var(--faint); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em;
}
#section-nav a {
  display: block; padding: 7px 10px; border: 1px solid transparent; border-radius: 7px;
  color: var(--dim); font-size: 13px; font-weight: 600;
}
#section-nav a:hover { color: var(--text); background: var(--panel); text-decoration: none; }
#section-nav a[aria-current] { color: var(--accent); background: #2a2925; border-color: #665b42; }

/* Panels */
main { min-width: 0; padding-block: 24px 42px; }
main > *, .panel > * { min-width: 0; }
.overview { margin-bottom: 24px; }
.overview-head { display: flex; gap: 8px 20px; justify-content: space-between; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.overview-head .sub { margin: 0; }
.updated {
  color: var(--dim); font-size: 12px; font-variant-numeric: tabular-nums;
  background: var(--panel); border: 1px solid var(--line); padding: 5px 10px; border-radius: 6px;
}
.board-status { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 14px; }
#source-status { color: var(--accent); font-size: 13px; text-decoration: underline; }
#data-sources { scroll-margin-top: calc(var(--header-height) + 16px); }
#retry-load { margin-left: 8px; padding: 6px 12px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); color: var(--text); cursor: pointer; font: inherit; }
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(20px, 2vw, 28px);
  margin-bottom: 22px;
}
h1, h2, h3 { margin: 0 0 6px; line-height: 1.2; }
h1 { font-size: clamp(30px, 3vw, 44px); font-weight: 740; letter-spacing: -0.05em; }
h2 { font-size: 23px; font-weight: 700; letter-spacing: -0.03em; }
h3 { font-size: 16px; margin-top: 24px; letter-spacing: -0.015em; }
.sub { color: var(--dim); margin: 0 0 16px; font-size: 14px; max-width: 78ch; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 12px 18px; flex-wrap: wrap; }
.panel-head .sub { margin-bottom: 0; }
.notice { background: rgba(255, 130, 147, 0.1); border: 1px solid var(--down); color: var(--text); padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; }

/* Tables */
.table-wrap {
  overflow-x: auto; border: 1px solid var(--line); border-radius: 8px;
  /* Scroll cue: a right-edge shadow, covered by a panel-colored patch that travels with the last column. */
  background: linear-gradient(to left, var(--panel) 40%, transparent) right / 36px 100% no-repeat local,
    linear-gradient(to left, #0009, transparent) right / 14px 100% no-repeat scroll;
}
.table-wrap:has(table:empty) { display: none; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { background: var(--panel-2); text-align: left; color: var(--dim); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody tr:hover { background: #162334; }
tr:last-child td { border-bottom: 0; }
tfoot td { background: var(--panel-2); color: var(--dim); }
tfoot tr:first-child td { border-top: 2px solid var(--line); }
tfoot td:first-child { font-weight: 500; }
td.r, th.r { text-align: right; }
.good { color: var(--up); }
.bad { color: var(--down); }
.muted { color: var(--faint); }

/* Macro */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 12px; }
.tile { background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.tile .k { color: var(--dim); font-size: 12px; }
.tile .v { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.tile .d { font-size: 12px; color: var(--faint); }
.tile .r { font-size: 13px; }
.tile progress { display: block; width: 100%; height: 6px; margin: 6px 0; accent-color: var(--accent); }
.tile .spark { display: block; width: 100%; max-width: 160px; height: 34px; margin: 2px 0; }
.tile .spark polyline { fill: none; stroke: var(--accent); stroke-width: 1.5; vector-effect: non-scaling-stroke; }

/* Method */
.method p { color: var(--dim); max-width: 880px; font-size: 14px; }
.method strong { color: var(--text); }
.disclaimer { border-top: 1px solid var(--line); padding-top: 12px; }
.sources { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.sources li { font-size: 12px; padding: 3px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--dim); }
.sources li.fail { border-color: var(--down); color: var(--down); }

.site-footer { color: var(--faint); font-size: 12px; padding: 20px 0 40px; border-top: 1px solid var(--line); }
.empty { color: var(--faint); font-size: 14px; padding: 12px 0; }
.glance { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 152px), 1fr)); gap: 9px; }
.glance .g {
  min-width: 0; padding: 11px 13px;
  color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
}
.glance .g:hover { background: var(--panel-2); border-color: #426181; text-decoration: none; }
.glance .k { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; color: var(--dim); font-size: 12px; font-weight: 600; }
.glance .k span { flex: none; color: var(--accent); }
.glance .v { font-size: clamp(16px, 1.3vw, 19px); font-weight: 700; line-height: 1.3; letter-spacing: -0.025em; margin: 5px 0 4px; overflow-wrap: anywhere; }
.glance .d { color: var(--faint); font-size: 12px; line-height: 1.4; }

@media all {
  .layout { grid-template-columns: minmax(0, 1fr); }
  .nav-toggle {
    display: inline-flex; align-items: center; gap: 9px; min-height: 44px;
    padding: 0 12px; border: 1px solid var(--line); border-radius: 8px;
    background: var(--panel); color: var(--text); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer;
  }
  .nav-toggle:hover, .nav-toggle[aria-expanded="true"] { background: var(--panel-2); color: var(--accent); }
  .menu-icon { width: 14px; height: 10px; border-block: 1.5px solid currentColor; position: relative; }
  .menu-icon::after { content: ""; position: absolute; inset: 50% 0 auto; border-top: 1.5px solid currentColor; }
  #section-nav {
    display: none; position: fixed; inset: calc(var(--header-height) + 7px) clamp(16px, 3vw, 30px) auto auto;
    z-index: 9; width: min(290px, calc(100vw - 32px));
    padding: 10px; border: 1px solid var(--line); border-radius: 12px;
    background: var(--panel); box-shadow: 0 14px 45px #03070eb3;
  }
  body:has(.nav-toggle[aria-expanded="true"]) #section-nav { display: block; }
  #section-nav a { padding-block: 10px; }
}
@media (max-width: 640px) {
  :root { --header-height: 56px; }
  .wrap { padding-inline: 14px; }
  main { padding-top: 18px; }
  .panel { padding: 16px 12px; margin-bottom: 16px; }
  .overview { margin-bottom: 16px; }
  .overview-head { margin-bottom: 12px; }
  .glance { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .glance .g { padding: 9px; }
  td:first-child { position: sticky; left: 0; background: var(--panel); }
  th:first-child { position: sticky; left: 0; }
}
/* Research masthead */
.wrap { max-width: 1440px; }
.header-inner { gap: 24px; }
.mast-links { display: flex; align-items: center; gap: clamp(16px, calc(16px + (100vw - 1320px) * .1), 28px); margin-left: auto; }
.mast-links a { color: var(--dim); font-size: .9rem; font-weight: 600; white-space: nowrap; }
.wordmark { font: bold 1.45rem Georgia, serif; }
.wordmark span { font-style: italic; }
.masthead {
  border-bottom: 1px solid var(--line);
  background: radial-gradient(ellipse at 13% 20%, #3b34252e, transparent 50%), linear-gradient(108deg, #111822, #101a29);
}
.mast-grid { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: clamp(30px, 6vw, 96px); align-items: center; padding-block: clamp(32px, 4vw, 56px); }
.mast-grid h1 { font: 500 clamp(3.2rem, 5.3vw, 5rem)/.99 Georgia, serif; letter-spacing: -.055em; }
.mast-grid h1 span { display: block; color: var(--accent); font-style: italic; margin-top: .08em; }
.mast-copy p { color: #b9c4d3; max-width: 45ch; font-size: 1.05rem; margin: 0 0 18px; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.actions a { border: 1px solid #495565; border-radius: 6px; padding: 10px 18px; color: var(--text); font-weight: 650; }
.actions .primary { background: var(--accent); border-color: var(--accent); color: #1b1914; }
.actions a:hover { filter: brightness(1.1); text-decoration: underline; }
h2 { font: 500 clamp(1.6rem, 2.4vw, 2.15rem)/1.18 Georgia, serif; letter-spacing: -.035em; }
/* Measured: wordmark + 8 nowrap links at a 16px gap + Menu need ~1211px inside the 3vw gutters. */
.nav-current { display: none; }
@media (max-width: 1320px) {
  .mast-links { display: none; }
  /* Section name next to Menu, filled by app.js; auto margin keeps it and Menu on the right. */
  .nav-current { display: block; margin-left: auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: 13px; font-weight: 600; }
  .nav-current:empty { display: none; }
}
@media (max-width: 680px) {
  .mast-grid { grid-template-columns: minmax(0,1fr); gap: 12px; padding-block: 20px; }
  .mast-grid h1 { font-size: clamp(2.1rem, 9vw, 2.8rem); }
  .mast-copy p { font-size: .95rem; margin-bottom: 12px; }
  .actions { gap: 8px; flex-wrap: nowrap; }
  .actions a { padding: 7px 12px; font-size: 14px; white-space: nowrap; }
  .header-inner { gap: 8px; }
  .wordmark { font-size: 1.2rem; }
  .wordmark img { width: 48px; height: auto; margin-right: 6px; }
  .nav-current { font-size: 12px; }
}
.wk { margin: 0 0 16px; min-width: 0; overflow: hidden; background: #0d1622; border: 1px solid var(--line); border-radius: 12px; }
.wk:empty { display: none; }
.wk svg { display: block; width: 100%; height: auto; }
.wk .grid { stroke: #243141; stroke-width: .8; }
.wk .lvl { stroke: var(--faint); stroke-dasharray: 4 4; }
.wk .axis { fill: var(--dim); font-size: 12px; font-family: var(--font); }
.wk .price { fill: none; stroke: var(--text); stroke-width: 1.5; }
.wk .pct { fill: none; stroke: #87baff; stroke-width: 1.7; }
.wk .avg { fill: none; stroke: #6fd3d0; stroke-width: 1.8; stroke-dasharray: 5 3; }
.wk .dot { fill: var(--down); }
.wk .bot { fill: none; stroke: var(--up); stroke-width: 2; }
.wk .top { fill: none; stroke: var(--down); stroke-width: 2; }
.turns { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 12px; margin-bottom: 16px; }
.turn .v small { font-size: 14px; color: var(--faint); font-weight: 500; }
.turn .v span { font-size: 15px; font-weight: 600; }
.turn .d { font-size: 13px; margin: 4px 0 8px; }
.turn .live { font-size: 15px; margin: 8px 0 4px; padding: 6px 10px; border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 6px; }
.warn { color: var(--warn); }
.factors { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.factors li { display: grid; grid-template-columns: minmax(0, 1fr) 4ch 9ch; gap: 8px; padding: 3px 0; border-top: 1px solid var(--line); }
.factors b { text-align: right; }
.factors small { color: var(--faint); text-align: right; }
.legend-bot { color: var(--up); }
.legend-top { color: var(--down); }
.wk .diamond { fill: var(--accent); }
.wk .dot.open, .wk .diamond.open { fill: none; stroke-width: 1.5; }  /* run still open: the marker can move */
.wk .dot.open { stroke: var(--down); }
.wk .diamond.open { stroke: var(--accent); }
.wk .up { fill: var(--up); }
.wk .down { fill: var(--down); }
.wk rect { opacity: .6; }
.wk .pane-label { fill: var(--text); font: 600 13px var(--font); }
.plot-legend { display: flex; flex-wrap: wrap; gap: 5px 20px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); background: var(--panel); color: var(--dim); font-size: 12px; }
.plot-legend span { display: inline-flex; gap: 7px; align-items: center; }
.plot-legend i { width: 17px; border-top: 2px solid; }
.plot-legend .pct { color: #87baff; }
.plot-legend .avg { color: #6fd3d0; border-top-style: dashed; }
.plot-legend .bot { color: var(--up); }
.plot-legend .top { color: var(--down); }
.plot-legend .lvl { color: var(--faint); border-top-style: dashed; }
.plot-legend .dot, .plot-legend .diamond { width: 7px; height: 7px; border: 0; }
.plot-legend .dot { background: var(--down); border-radius: 50%; }
.plot-legend .diamond { background: var(--accent); transform: rotate(45deg); }
.plot-legend .bars { height: 9px; width: 12px; border: 0; border-left: 5px solid var(--up); border-right: 5px solid var(--down); }
.plot-note { margin: 0; padding: 0 14px 10px; font-size: 12px; color: var(--dim); background: var(--panel); }
.panel-head { margin-bottom: 6px; }
.panel-head h2, .panel-head h3 { margin: 0; }
.sub-head { margin-top: 24px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { min-height: 40px; min-width: 56px; padding: 0 14px; border: 0; background: var(--panel-2); color: var(--dim); font: inherit; font-size: 13px; font-weight: 650; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button:hover { color: var(--text); }
.seg button[aria-pressed="true"] { background: #2a2925; color: var(--accent); }
.seg button:focus-visible { outline-offset: -3px; }
.wk .cross { stroke: var(--dim); stroke-width: 1; stroke-dasharray: 2 3; pointer-events: none; }
.plot-readout { margin: 0; padding: 8px 14px; min-height: 2.6em; border-top: 1px solid var(--line); background: var(--panel); color: var(--text); font-size: 12px; font-variant-numeric: tabular-nums; }

/* Signal board: the two scores lead, the rest support them. */
.glance .primary { background: var(--panel-2); border-color: #665b42; }
.glance .primary .k { color: var(--text); font-size: 13px; }
.glance .primary .v { font-size: clamp(24px, 2.2vw, 32px); }
.glance .g:not(.primary) .v { font-size: clamp(15px, 1.1vw, 17px); }
@media (min-width: 641px) and (max-width: 899px) {
  .glance .primary { grid-column: span 2; }
}
/* Scores stacked in a wide left column; with dense packing nine cards fill a 3x3 block beside them. */
@media (min-width: 900px) {
  .glance { grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); grid-auto-flow: dense; }
  .glance .primary { grid-column: 1; grid-row: span 3; }
  .glance .g:not(.primary) { grid-row: span 2; }
}
.cred { margin: 12px 0 0; color: var(--faint); font-size: 12px; }
td.few { color: var(--faint); font-style: italic; }

/* Collapsed derivations */
details.more { margin: -8px 0 16px; }
details.more summary { display: inline-flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; list-style: none; color: var(--accent); font-size: 13px; font-weight: 600; }
details.more summary::-webkit-details-marker { display: none; }
details.more summary::before { content: ""; width: 6px; height: 6px; border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; transform: rotate(-45deg); }
details.more[open] summary::before { transform: rotate(45deg); }
details.more[open] summary { margin-bottom: 6px; }
details.more summary:hover { text-decoration: underline; }
