:root {
  color-scheme: light;

  --bg: #eef1f5;
  --panel: #ffffff;
  --panel-2: #f5f7fa;
  --panel-3: #eceff4;
  --line: #dde2ea;
  --line-soft: #e8ecf2;
  --ink: #101720;
  --ink-2: #41505f;
  --muted: #6c7a8a;

  --accent: #5b3fd6;
  --accent-2: #5b3fd6;
  --accent-soft: rgba(91, 63, 214, 0.1);
  --accent-line: rgba(91, 63, 214, 0.3);

  /* Chart and status hues: the dataviz light steps, validated against #ffffff.
     `-ink` is the readable step for text; the plain step is for fills only. */
  --blue: #2a78d6;    --blue-soft: rgba(42, 120, 214, 0.12);   --blue-ink: #1f5fa8;
  --orange: #eb6834;  --orange-soft: rgba(235, 104, 52, 0.13); --orange-ink: #b2461f;
  --aqua: #1baf7a;    --aqua-soft: rgba(27, 175, 122, 0.14);   --aqua-ink: #15795a;
  --yellow: #eda100;  --yellow-soft: rgba(237, 161, 0, 0.16);  --yellow-ink: #8a6a00;
  --magenta: #e87ba4; --magenta-soft: rgba(232, 123, 164, 0.16); --magenta-ink: #a83c69;
  --violet: #4a3aa7;  --violet-soft: rgba(74, 58, 167, 0.12);  --violet-ink: #4a3aa7;
  --red: #e34948;     --red-soft: rgba(227, 73, 72, 0.12);     --red-ink: #c23b3b;
  --slate: #64748b;   --slate-soft: rgba(100, 116, 139, 0.12); --slate-ink: #4a5666;

  /* Sequential ramp for attainment; validated ordinal against #ffffff. */
  --heat-1: #8ab6e2;
  --heat-2: #649fda;
  --heat-3: #4586cd;
  --heat-4: #2a6cb5;
  --heat-5: #155293;

  --ok: var(--aqua-ink);
  --risk: var(--red-ink);
  --risk-soft: var(--red-soft);

  --radius: 16px;
  --radius-sm: 10px;
  --gap: 18px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 14px/1.55 var(--sans);
  font-feature-settings: "tnum" 1;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; font-weight: 600; letter-spacing: -0.015em; }
p { margin: 0; }
button, input, select { font: inherit; color: inherit; }
a { color: var(--accent-2); }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Shell ---------- */

.app { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; }

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 20px 14px;
  background: var(--panel);
  border-right: 1px solid var(--line);
}

.side-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 0; }

.brand-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: linear-gradient(140deg, var(--accent), var(--accent-2));
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.brand-text { display: grid; line-height: 1.2; }
.brand-text strong { font-size: 14px; }
.brand-text span { font-size: 11px; color: var(--muted); }

.viewnav { display: grid; gap: 3px; }

.viewnav-tab {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease;
}

.viewnav-tab svg { flex: none; opacity: 0.75; }
.viewnav-tab:hover { background: var(--panel-2); color: var(--ink); }
.viewnav-tab.is-active { background: var(--accent-soft); color: var(--ink); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent-line); }
.viewnav-tab.is-active svg { color: var(--accent-2); opacity: 1; }
.viewnav-tab:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.side-foot { margin-top: auto; display: grid; gap: 12px; }

.side-link {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}

.side-link:hover { background: var(--panel-2); color: var(--ink); }
.side-link svg { opacity: 0.7; }

.side-card {
  padding: 13px;
  border-radius: 13px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  font-size: 11px;
  line-height: 1.55;
  color: var(--muted);
}

.side-card-title { color: var(--ink-2); font-weight: 600; margin-bottom: 4px; }

/* ---------- Topbar ---------- */

.content { min-width: 0; display: flex; flex-direction: column; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 26px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.search {
  display: flex;
  align-items: center;
  gap: 9px;
  flex: 0 1 380px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.search svg { color: var(--muted); flex: none; }
.search input { flex: 1; min-width: 0; border: 0; background: none; outline: none; font-size: 13px; }
.search input::placeholder { color: var(--muted); }
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.search.is-off { opacity: 0.45; }

.topbar-actions { display: flex; align-items: center; gap: 16px; }

.freshness {
  display: grid;
  grid-template-columns: auto auto;
  gap: 1px 10px;
  margin: 0;
  font-size: 10.5px;
  text-align: right;
}

.freshness dt { color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.freshness dd { margin: 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* ---------- Layout ---------- */

main { padding: 26px; display: block; }

.view { display: none; }
.view.is-active { display: grid; gap: var(--gap); }

.view-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 22px; flex-wrap: wrap; }

.kicker {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.11em;
  text-transform: uppercase;
  color: var(--accent-2);
  margin-bottom: 8px;
}

.view-head h1 { font-size: 30px; letter-spacing: -0.03em; }
.lede { margin-top: 9px; max-width: 76ch; color: var(--ink-2); font-size: 13.5px; }
.view-actions { display: flex; gap: 8px; align-items: center; }
.split { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: var(--gap); }

/* ---------- Panel ---------- */

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }

.panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line-soft);
}

.panel-head h2 { display: flex; align-items: center; font-size: 15px; }
.panel-note { margin-top: 5px; max-width: 80ch; color: var(--muted); font-size: 12px; line-height: 1.55; }
.panel-body { padding: 18px 20px; display: grid; gap: 16px; }

.provenance { color: var(--muted); font-size: 12px; line-height: 1.6; }
.footnote { font-size: 11.5px; line-height: 1.6; }
.muted { color: var(--muted); }

.alert {
  color: var(--red-ink);
  background: var(--red-soft);
  border: 1px solid var(--red);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 12px;
}

/* ---------- Controls ---------- */

.ghost {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--ink-2);
  border-radius: 999px;
  padding: 8px 15px;
  font-size: 12.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: border-color 130ms ease, color 130ms ease, background 130ms ease;
}

.ghost:hover:not(:disabled) { border-color: var(--accent-line); color: var(--ink); background: var(--accent-soft); }
.ghost:disabled { opacity: 0.4; cursor: default; }
.ghost:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }

.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.field { display: grid; gap: 5px; min-width: 0; }

.field > span {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}

.field select,
.field input {
  appearance: none;
  border: 1px solid var(--line);
  background: var(--panel-2);
  border-radius: var(--radius-sm);
  padding: 8px 11px;
  font-size: 12.5px;
  width: 100%;
  min-width: 0;
  max-width: 230px;
}

.field select {
  padding-right: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 15px, calc(100% - 11px) 15px;
  background-size: 5px 5px;
  background-repeat: no-repeat;
}

.field input[type="search"] { min-width: 190px; }
.field select:focus, .field input:focus { outline: none; border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field select[aria-invalid="true"], .field input[aria-invalid="true"] { border-color: var(--red); }

.why {
  display: inline-grid;
  place-items: center;
  width: 15px;
  height: 15px;
  margin-left: 6px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel-2);
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 700;
  line-height: 1;
  cursor: help;
  vertical-align: 1px;
}

.why:hover, .why[aria-expanded="true"] { color: var(--accent-2); border-color: var(--accent-line); background: var(--accent-soft); }
.why:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 1px; }

.popover {
  position: fixed;
  z-index: 60;
  max-width: 400px;
  padding: 13px 15px;
  border-radius: 12px;
  background: #161c24;
  color: #e6ebf1;
  font-size: 12px;
  line-height: 1.6;
  box-shadow: 0 18px 40px rgba(16, 23, 32, 0.28);
}

/* ---------- Figures ---------- */

.figures { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; }

.figure {
  position: relative;
  padding: 18px 20px;
  display: grid;
  gap: 5px;
  align-content: start;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
}

.figure::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 3px; background: var(--figure, var(--accent)); }
.figure h3 { display: flex; align-items: center; font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.figure strong { font-size: 28px; font-weight: 600; letter-spacing: -0.035em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.figure p { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.figures .figure:nth-child(1) { --figure: var(--violet); }
.figures .figure:nth-child(2) { --figure: var(--magenta); }
.figures .figure:nth-child(3) { --figure: var(--orange); }
.figures .figure:nth-child(4) { --figure: var(--aqua); }
.figures .figure:nth-child(5) { --figure: var(--red); }
.figures .figure:nth-child(6) { --figure: var(--blue); }
.figures .figure:nth-child(1) strong { color: var(--accent-2); }
.figures .figure:nth-child(2) strong { color: var(--magenta-ink); }
.figures .figure:nth-child(3) strong { color: var(--orange-ink); }
.figures .figure:nth-child(4) strong { color: var(--aqua-ink); }
.figures .figure:nth-child(5) strong { color: var(--red-ink); }
.figures .figure:nth-child(6) strong { color: var(--blue-ink); }

/* ---------- Summary strip ---------- */

.summary-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }

.summary-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 15px;
  display: grid;
  gap: 3px;
}

.summary-item span { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.summary-item strong { font-size: 21px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

/* ---------- Exposure ---------- */

.exposure { grid-template-columns: minmax(300px, 400px) minmax(0, 1fr); align-items: start; gap: 26px; }
.exposure-headline { display: grid; gap: 8px; }
.exposure-label { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.exposure-headline > strong { font-size: 42px; font-weight: 600; letter-spacing: -0.04em; color: var(--red-ink); font-variant-numeric: tabular-nums; line-height: 1; }

.leaderboard { display: grid; gap: 8px; }

.leader-row {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  font-size: 12.5px;
}

.leader-row .rank {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 7px;
  background: var(--accent-soft);
  color: var(--accent-2);
  font-size: 11px;
  font-weight: 600;
}

.leader-row .amount { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--red-ink); }
.leader-row .muted { font-size: 11px; }

/* ---------- Status grid ---------- */

.status-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 10px; }

.status-card {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 13px 15px 13px 18px;
  display: grid;
  gap: 4px;
  overflow: hidden;
}

.status-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--tone, var(--slate)); }
.status-card span { font-size: 11px; color: var(--muted); line-height: 1.35; }
.status-card strong { font-size: 23px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; color: var(--tone-ink, var(--ink)); }

/* ---------- Tables ---------- */

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; }
.grid { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.grid thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.grid tbody td { border-bottom: 1px solid var(--line-soft); padding: 11px 14px; vertical-align: top; }
.grid tbody tr:last-child td { border-bottom: 0; }
.grid tbody tr:hover td { background: var(--panel-2); }
.grid .num, .grid th.num { text-align: right; font-variant-numeric: tabular-nums; }
.grid small { display: block; color: var(--muted); font-size: 11px; line-height: 1.4; }
.grid .empty { text-align: center; color: var(--muted); padding: 34px 14px; }
.payout-table { min-width: 1000px; }

.person { display: grid; gap: 2px; }
.person strong { font-weight: 600; word-break: break-word; }
.person span { color: var(--muted); font-size: 11px; line-height: 1.4; }

.pill {
  display: inline-block;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--panel-3);
  color: var(--ink-2);
  font-size: 10.5px;
  font-weight: 600;
  white-space: nowrap;
}

.pill[data-status], .pill.is-ok, .pill.is-warn {
  border-color: var(--tone);
  background: var(--tone-soft);
  color: var(--tone-ink, var(--tone));
}

.pill.is-ok { --tone: var(--aqua); --tone-soft: var(--aqua-soft); --tone-ink: var(--aqua-ink); }
.pill.is-warn { --tone: var(--red); --tone-soft: var(--red-soft); --tone-ink: var(--red-ink); }
.negative { color: var(--red-ink); }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; font-size: 12px; color: var(--muted); }

/* ---------- Cards, plan, donut ---------- */

.team-grid, .bench-stack { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 12px; }

.team-card, .bench-card {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 16px;
  display: grid;
  gap: 9px;
  overflow: hidden;
}

.team-card::before, .bench-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.team-card h3, .bench-card h3 { font-size: 13px; }
.team-line, .bench-metric { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; color: var(--ink-2); }
.team-line strong, .bench-metric strong { font-variant-numeric: tabular-nums; color: var(--ink); }
.hero-number { font-size: 25px; font-weight: 600; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }

.bar-track { height: 6px; border-radius: 3px; background: var(--panel-3); overflow: hidden; }
.bar-fill { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }


.donut-panel { display: grid; gap: 18px; justify-items: center; }
.donut { width: 176px; height: 176px; border-radius: 50%; display: grid; place-items: center; position: relative; }
.donut::after { content: ""; position: absolute; inset: 26px; border-radius: 50%; background: var(--panel); }
.donut-label { position: relative; z-index: 1; text-align: center; display: grid; gap: 1px; }
.donut-label strong { font-size: 23px; font-weight: 600; font-variant-numeric: tabular-nums; }
.donut-label span { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.chart-legend { display: grid; gap: 7px; width: 100%; font-size: 12px; color: var(--ink-2); }
.chart-legend div { display: flex; align-items: center; gap: 9px; }
.chart-legend .legend-dot { width: 9px; height: 9px; border-radius: 3px; flex: none; }
.chart-legend b { margin-left: auto; font-variant-numeric: tabular-nums; color: var(--ink); }

.empty { color: var(--muted); font-size: 12.5px; padding: 18px 0; text-align: center; }

/* ---------- Meaning tones ---------- */

[data-status] { --tone: var(--slate); --tone-soft: var(--slate-soft); --tone-ink: var(--slate-ink); }
[data-status="Accepted"] { --tone: var(--aqua); --tone-soft: var(--aqua-soft); --tone-ink: var(--aqua-ink); }
[data-status="Done"] { --tone: var(--blue); --tone-soft: var(--blue-soft); --tone-ink: var(--blue-ink); }
[data-status="Waiting For Trainer Edit"] { --tone: var(--yellow); --tone-soft: var(--yellow-soft); --tone-ink: var(--yellow-ink); }
[data-status="Infrastructure Error"] { --tone: var(--orange); --tone-soft: var(--orange-soft); --tone-ink: var(--orange-ink); }
[data-status="Rejected"] { --tone: var(--red); --tone-soft: var(--red-soft); --tone-ink: var(--red-ink); }
[data-status="Conflicting verdict"] { --tone: var(--magenta); --tone-soft: var(--magenta-soft); --tone-ink: var(--magenta-ink); }
[data-status="Running"] { --tone: var(--violet); --tone-soft: var(--violet-soft); --tone-ink: var(--violet-ink); }
[data-status="Queued"] { --tone: var(--magenta); --tone-soft: var(--magenta-soft); --tone-ink: var(--magenta-ink); }

[data-domain] { --tone: var(--slate); --tone-soft: var(--slate-soft); }
[data-domain="Code"] { --tone: var(--blue); }
[data-domain="General"] { --tone: var(--aqua); }
[data-domain="Health"] { --tone: var(--violet); }
[data-domain="Law"] { --tone: var(--magenta); }
[data-domain="Finance"] { --tone: var(--yellow); }
[data-domain="Business"] { --tone: var(--orange); }

[data-outcome="accepted"] { --tone: var(--aqua); }
[data-outcome="rejected"] { --tone: var(--red); }
[data-outcome="unsubmitted"] { --tone: var(--yellow); }

.tag { display: inline-flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--ink-2); white-space: nowrap; }
.tag::before { content: ""; width: 7px; height: 7px; border-radius: 2px; background: var(--tone); flex: none; }

/* ---------- Exposure chart ----------
   Two series, so the legend is always present and both segments are directly
   labelled: the aqua/red pair sits in the 6-8 CVD band and needs that
   secondary encoding. */

.exposure-chart { margin: 6px 0 0; display: grid; gap: 15px; }
.exposure-chart figcaption { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.bench-bar { display: grid; gap: 6px; }
.bench-bar-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; font-size: 12px; }
.bench-bar-head span { color: var(--ink-2); font-weight: 500; }
.bench-bar-head b { font-variant-numeric: tabular-nums; font-weight: 600; }
.bench-bar-foot { font-size: 11px; color: var(--muted); }
.stack { display: flex; gap: 2px; height: 28px; min-width: 2%; }

.seg {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  min-width: 3px;
  padding: 0 8px;
  overflow: hidden;
  cursor: default;
}

.seg:first-child { border-radius: 6px 0 0 6px; }
.seg:last-child { border-radius: 0 6px 6px 0; }
.seg:only-child { border-radius: 6px; }
.seg.is-paid { background: var(--aqua-ink); }
.seg.is-pending { background: var(--red-ink); }
.seg i { font-style: normal; font-size: 10.5px; font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
.seg:hover { filter: brightness(1.12); }

.chart-key { display: flex; flex-wrap: wrap; gap: 15px; font-size: 11.5px; color: var(--ink-2); }
.key-item { display: inline-flex; align-items: center; gap: 7px; }
.key-item::before { content: ""; width: 9px; height: 9px; border-radius: 3px; flex: none; }
.key-item.is-paid::before { background: var(--aqua-ink); }
.key-item.is-pending::before { background: var(--red-ink); }

/* ---------- Responsive ---------- */

@media (max-width: 1400px) {
  .figures { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (max-width: 1180px) {
  .split { grid-template-columns: 1fr; }
  .figures { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .exposure { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; align-items: center; gap: 14px; overflow-x: auto; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .viewnav { grid-auto-flow: column; gap: 4px; }
  .viewnav-tab { padding: 8px 12px; }
  .viewnav-tab span { display: none; }
  .side-foot { margin: 0; grid-auto-flow: column; align-items: center; }
  .side-card { display: none; }
  .side-link span { display: none; }
}

@media (max-width: 720px) {
  main { padding: 18px 14px 48px; }
  .topbar { padding: 12px 14px; flex-wrap: wrap; }
  .search { flex: 1 1 100%; }
  .view-head h1 { font-size: 25px; }
  .figures { grid-template-columns: 1fr; }
  .field, .field select, .field input, .field input[type="search"] { max-width: none; flex: 1 1 100%; }
  .panel-head, .panel-body { padding: 15px 14px; }
  .summary-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .popover { max-width: calc(100vw - 28px); }
}


/* ---------- Attainment heatmap ---------- */

.plan-grid { display: grid; gap: 16px; }
.heatmap-wrap { overflow-x: auto; }

.heatmap { border-collapse: separate; border-spacing: 3px; width: 100%; }

.heatmap thead th {
  padding: 0 0 4px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.heatmap thead th:first-child, .heatmap tbody th { text-align: left; }

.heatmap tbody th {
  padding-right: 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  white-space: nowrap;
}

.heat-cell {
  min-width: 56px;
  height: 52px;
  padding: 6px 4px;
  border-radius: 8px;
  text-align: center;
  background: var(--heat, var(--panel-3));
  color: #fff;
  cursor: default;
  transition: transform 110ms ease;
}

.heat-cell span { display: block; font-size: 12.5px; font-weight: 600; font-variant-numeric: tabular-nums; }
.heat-cell[data-step="1"], .heat-cell[data-step="2"] { color: #0f2c4d; }
.heat-cell small { display: block; margin-top: 2px; font-size: 10px; opacity: 0.82; font-variant-numeric: tabular-nums; }
.heat-cell:hover { transform: scale(1.04); }

[data-step="1"] { --heat: var(--heat-1); }
[data-step="2"] { --heat: var(--heat-2); }
[data-step="3"] { --heat: var(--heat-3); }
[data-step="4"] { --heat: var(--heat-4); }
[data-step="5"] { --heat: var(--heat-5); }

.heat-cell[data-step="none"] {
  background: repeating-linear-gradient(135deg, var(--panel-2) 0 5px, var(--panel-3) 5px 10px);
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--line);
}

.heat-key { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 11.5px; color: var(--muted); }
.heat-key-label { color: var(--ink-2); }
.heat-scale { display: inline-flex; gap: 2px; }
.heat-scale i { width: 26px; height: 10px; border-radius: 2px; background: var(--heat); }
.heat-key-ends { display: inline-flex; gap: 8px; }
.heat-key-ends b { font-weight: 500; font-variant-numeric: tabular-nums; }
.heat-key-none { display: inline-flex; align-items: center; gap: 6px; }
.heat-key-none i { width: 14px; height: 10px; border-radius: 2px; background: repeating-linear-gradient(135deg, var(--panel-2) 0 4px, var(--panel-3) 4px 8px); box-shadow: inset 0 0 0 1px var(--line); }


/* ---------- Pipeline timeline ---------- */

.timeline { margin: 0; display: grid; gap: 12px; }
.timeline figcaption { font-size: 10px; font-weight: 600; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }

.timeline-plot {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(34px, 1fr);
  align-items: end;
  gap: 8px;
  height: 190px;
  padding-top: 18px;
}

.timeline-day { display: grid; align-content: end; gap: 6px; height: 100%; grid-template-rows: auto 1fr auto; }
.timeline-total { font-size: 10.5px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }
.timeline-column { display: flex; flex-direction: column-reverse; gap: 2px; align-self: end; width: 100%; border-radius: 6px; overflow: hidden; }
.timeline-seg { display: block; width: 100%; min-height: 2px; background: var(--tone, var(--slate)); cursor: default; }
.timeline-seg:hover { filter: brightness(1.2); }
.timeline-date { font-size: 10px; color: var(--muted); text-align: center; font-variant-numeric: tabular-nums; }

.chart-key .key-item[data-status] i { width: 9px; height: 9px; border-radius: 3px; background: var(--tone); flex: none; }
.chart-key .key-item[data-status] { display: inline-flex; align-items: center; gap: 7px; }
.chart-key .key-item[data-status]::before { content: none; }
