:root {
  --bg: #0e1116;
  --panel: #161b22;
  --panel-2: #1c232d;
  --line: #2a323d;
  --text: #dfe5ec;
  --muted: #8b96a5;
  --faint: #5d6877;
  --accent: #6aa6ff;
  /* Meaning colors: effect on risk assets (never raw up/down) */
  --supportive: #3fbf8f;
  --neutral: #9aa5b4;
  --restrictive: #ef6b6b;
  --context: #c7a86b;
  --q-goldilocks: rgba(63, 191, 143, 0.10);
  --q-overheating: rgba(230, 170, 70, 0.10);
  --q-stagflation: rgba(239, 107, 107, 0.11);
  --q-slowdown: rgba(106, 166, 255, 0.10);
  --radius: 10px;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); }
body { font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif; -webkit-font-smoothing: antialiased; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 var(--gutter); }

header.top { border-bottom: 1px solid var(--line); background: #0b0e12; position: sticky; top: 0; z-index: 10; }
@media (max-width: 640px) { header.top { position: static; } }
header.top .wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
.brand { font-weight: 700; letter-spacing: .2px; color: var(--text); }
nav.main { display: flex; gap: 4px; flex-wrap: wrap; }
nav.main a { color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 14px; }
nav.main a.on, nav.main a:hover { color: var(--text); background: var(--panel-2); text-decoration: none; }
nav.main { align-items: center; }
details.menu { position: relative; }
details.menu summary { list-style: none; cursor: pointer; color: var(--muted); padding: 4px 10px; border-radius: 6px; font-size: 14px; }
details.menu summary::-webkit-details-marker { display: none; }
details.menu summary::after { content: " ▾"; font-size: 11px; }
details.menu.on summary, details.menu summary:hover { color: var(--text); background: var(--panel-2); }
details.menu .drop { position: absolute; top: 30px; left: 0; z-index: 40; background: #11161d; border: 1px solid var(--line); border-radius: 8px;
  padding: 6px; display: flex; flex-direction: column; min-width: 160px; box-shadow: 0 10px 30px rgba(0,0,0,.5); }
details.menu .drop a { padding: 6px 10px; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }
.kpi .k { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; }
.kpi .k .v { font-size: 22px; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi .k .l { font-size: 12px; color: var(--muted); }
.bar { height: 8px; border-radius: 4px; background: #26303b; position: relative; overflow: hidden; }
.bar > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; }
input[type=range] { width: 100%; accent-color: var(--accent); }
label.ctl { display: block; font-size: 13px; color: var(--muted); margin: 8px 0 2px; }
label.ctl b { color: var(--text); }
.spacer { flex: 1; }
.badge { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap; }
.badge.ok { color: var(--supportive); border-color: rgba(63,191,143,.4); }
.badge.warn { color: #e6aa46; border-color: rgba(230,170,70,.45); }
.badge.bad { color: var(--restrictive); border-color: rgba(239,107,107,.45); }

main { padding: 22px 0 40px; }
h1 { font-size: 24px; margin: 0 0 4px; }
h2 { font-size: 18px; margin: 0 0 10px; }
h3 { font-size: 15px; margin: 0 0 6px; }
.sub { color: var(--muted); margin: 0 0 16px; }
.small { font-size: 12.5px; color: var(--muted); }
.tiny { font-size: 11.5px; color: var(--faint); }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: minmax(0, 1fr); } }

.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px;
        background: var(--panel-2); border: 1px solid var(--line); white-space: nowrap; }
.chip.Supportive, .chip.Improving { color: var(--supportive); border-color: rgba(63,191,143,.35); }
.chip.Restrictive, .chip.Deteriorating { color: var(--restrictive); border-color: rgba(239,107,107,.35); }
.chip.Neutral, .chip.Stable { color: var(--neutral); }
.chip.Rising, .chip.Falling { color: var(--context); border-color: rgba(199,168,107,.35); }
.label-fact, .label-inf { font-size: 10.5px; font-weight: 700; letter-spacing: .6px; padding: 1px 6px; border-radius: 4px; vertical-align: 1px; }
.label-fact { color: #8fb8ff; background: rgba(106,166,255,.12); }
.label-inf { color: #e6aa46; background: rgba(230,170,70,.12); }

/* layer rows on the overview */
.layers { display: flex; flex-direction: column; gap: 8px; }
.lrow { display: grid; grid-template-columns: 150px 120px minmax(0, 1fr); gap: 12px; align-items: start; padding: 12px; background: var(--panel-2);
        border: 1px solid var(--line); border-radius: 8px; }
.lrow .t { font-weight: 650; }
.lrow .q { font-size: 12.5px; color: var(--muted); }
.lrow .chips { display: flex; flex-direction: column; gap: 4px; align-items: flex-start; }
.lrow.off { opacity: .55; }
@media (max-width: 640px) { .lrow { grid-template-columns: minmax(0, 1fr); } .lrow .chips { flex-direction: row; } }

/* tables */
.tbl-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
th, td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.hl td { background: rgba(106,166,255,.07); }

/* charts */
.chart { width: 100%; height: 360px; }
.chart.tall { height: 420px; }
.chart.mini { height: 120px; }
.rangebar { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 6px; }
.rangebar button { background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 6px; padding: 3px 10px;
                   font-size: 12.5px; cursor: pointer; }
.rangebar button.on, .rangebar button:hover { color: var(--text); border-color: var(--accent); }
@media (max-width: 640px) { .chart { height: 300px; } .chart.tall { height: 340px; } }

/* gauge cards */
.gcard { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.gcard .head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.gcard .name { font-weight: 600; font-size: 13.5px; }
.gcard .val { font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; }
.gcard .row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.gcard button.show { align-self: flex-start; background: none; border: 0; color: var(--accent); padding: 0; font-size: 12.5px; cursor: pointer; }
.gcard.stale { border-color: rgba(230,170,70,.5); }

/* percentile strip: one shared 0-100 scale everywhere */
.pstrip { position: relative; height: 8px; border-radius: 4px; background: linear-gradient(90deg, #26303b, #3a4552); margin: 4px 0 2px; }
.pstrip .tick { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--text); border-radius: 1px; }
.pstrip .mid { position: absolute; left: 50%; top: 0; width: 1px; height: 8px; background: rgba(255,255,255,.18); }

.warn-box { border: 1px solid rgba(230,170,70,.45); background: rgba(230,170,70,.07); color: #e9c48a; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
.err-box { border: 1px solid rgba(239,107,107,.45); background: rgba(239,107,107,.07); color: #f1a3a3; padding: 10px 12px; border-radius: 8px; font-size: 13px; }
button.info { width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--faint); background: transparent; color: var(--muted);
  font: italic 600 11px/15px Georgia, serif; padding: 0; margin-left: 5px; cursor: pointer; vertical-align: 1px; flex: none; }
button.info:hover { color: var(--text); border-color: var(--accent); }
#infopop { display: none; position: absolute; z-index: 50; background: #11161d; border: 1px solid var(--line); border-radius: 10px;
  padding: 12px 14px; box-shadow: 0 10px 30px rgba(0,0,0,.5); font-size: 13.5px; }
#infopop .close { position: absolute; right: 8px; top: 4px; background: none; border: 0; color: var(--muted); font-size: 20px; cursor: pointer; }
.gl h3 { margin: 0 24px 6px 0; }
.gl p { margin: 0 0 7px; }
.tier { display: inline-block; font-size: 10.5px; font-weight: 700; letter-spacing: .4px; text-transform: uppercase; color: var(--accent);
  margin-right: 4px; }
.speed { font-size: 10.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; padding: 1px 6px; border-radius: 4px; }
.speed.fast { color: #4fd1d9; background: rgba(79,209,217,.1); }
.speed.slow { color: var(--muted); background: rgba(255,255,255,.05); }
.concept { border-left: 3px solid var(--accent); }
.verdict { font-weight: 700; }
.verdict.Diverge { color: #e6aa46; }
.verdict.Agree { color: var(--neutral); }
footer { border-top: 1px solid var(--line); padding: 18px 0 30px; color: var(--muted); font-size: 12.5px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
.legend span::before { content: ""; display: inline-block; width: 9px; height: 9px; border-radius: 2px; margin-right: 5px; background: var(--c); vertical-align: -1px; }
