/* ============================================================================
   GROUNDTRUTH — TRON-inspired executive design system
   Dark navy and black, cyan accents, precise hairlines, restrained glow.
   No gaming look: no neon overload, no bouncing animation, no colour noise.
   ========================================================================== */

:root {
  /* surfaces */
  --bg: #05070d;
  --bg-2: #080b14;
  --panel: #0b1020;
  --panel-2: #0e1426;
  --panel-3: #121a30;
  --line: #1b2540;
  --line-soft: #141c31;
  --line-bright: #24365e;

  /* text */
  --fg: #e8eefc;
  --fg-2: #b9c6e4;
  --muted: #7d8bab;
  --faint: #55617c;

  /* accents */
  --cyan: #3fd8ff;
  --cyan-dim: #1d9dc4;
  --cyan-deep: #0d5c78;
  --amber: #ffb347;
  --amber-dim: #c98428;
  --red: #ff6b6b;
  --green: #46e0a8;
  --violet: #8b8bff;

  /* series */
  --s-lost: #3fd8ff;
  --s-icow: #3a7fc2;
  --s-recovery: #d9a441;
  --s-physical: #d9705f;
  --s-longtail: #8a8ee6;
  --s-ransom: #b965a0;
  --s-contra: #46e0a8;

  --glow: 0 0 0 1px rgba(63, 216, 255, .18), 0 0 24px -8px rgba(63, 216, 255, .45);
  --radius: 3px;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "Roboto Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  overflow-wrap: break-word;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

/* faint grid + vignette, the only ambient effect */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(1200px 600px at 20% -10%, rgba(63, 216, 255, .07), transparent 60%),
    linear-gradient(rgba(63, 216, 255, .022) 1px, transparent 1px) 0 0 / 100% 44px,
    linear-gradient(90deg, rgba(63, 216, 255, .022) 1px, transparent 1px) 0 0 / 44px 100%;
}

.wrap { position: relative; z-index: 1; max-width: 1320px; margin: 0 auto; padding: 0 22px 90px; }

/* ---------------------------------------------------------------- top bar */
.topbar {
  position: sticky; top: 0; z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 13, .88);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  max-width: 1320px; margin: 0 auto; padding: 12px 22px;
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
}
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; letter-spacing: .16em; font-size: 12.5px; }
.brand .mark {
  width: 22px; height: 22px; flex: none;
  border: 1px solid var(--cyan); border-radius: 2px;
  box-shadow: inset 0 0 12px -2px rgba(63, 216, 255, .55);
  position: relative;
}
.brand .mark::after {
  content: ""; position: absolute; inset: 5px; background: var(--cyan);
  clip-path: polygon(0 0, 100% 0, 100% 55%, 55% 55%, 55% 100%, 0 100%);
}
.brand small { display: block; letter-spacing: .05em; color: var(--muted); font-weight: 500; font-size: 10.5px; }
.topbar .spacer { flex: 1; }
.topbar .meta { color: var(--muted); font-size: 11.5px; font-family: var(--mono); }
.topbar .meta b { color: var(--fg-2); font-weight: 600; }
.topbar .meta-item + .meta-item::before { content: "\00b7"; margin: 0 8px; color: var(--faint); }

/* ------------------------------------------------------------- primitives */
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.small { font-size: 12px; }
.tiny { font-size: 11px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.strong { color: var(--fg); font-weight: 600; }
.nowrap { white-space: nowrap; }
.center { text-align: center; }
a { color: var(--cyan); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 25px; }
h2 { font-size: 15px; }
h3 { font-size: 12.5px; }

.panel {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin: 14px 0;
}
.panel.flush { padding: 0; overflow: hidden; }
.panel-head {
  display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0;
  padding: 14px 20px 12px; border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 { flex: 1; }
.panel-head .hint { color: var(--muted); font-size: 11.5px; }
.panel-body { padding: 18px 20px; }

/* section marker: numbered rail like a control panel */
.section { margin: 30px 0 0; }
.section > header { display: flex; align-items: center; gap: 13px; margin-bottom: 12px; flex-wrap: wrap; min-width: 0; }
.section .idx {
  font-family: var(--mono); font-size: 11px; color: var(--cyan);
  border: 1px solid var(--cyan-deep); border-radius: 2px;
  padding: 2px 7px; letter-spacing: .1em; background: rgba(63, 216, 255, .06);
}
.section h2 { font-size: 16px; letter-spacing: .01em; text-transform: uppercase; }
.section h2 span { color: var(--muted); font-weight: 500; text-transform: none; letter-spacing: 0; font-size: 12.5px; margin-left: 9px; }
.section .rule { flex: 1; height: 1px; background: linear-gradient(90deg, var(--line-bright), transparent); }

/* notices */
.notice {
  border-left: 2px solid var(--amber);
  background: rgba(255, 179, 71, .05);
  padding: 10px 14px; border-radius: 0 var(--radius) var(--radius) 0;
  font-size: 12.5px; color: var(--fg-2);
}
.notice.info { border-color: var(--cyan-dim); background: rgba(63, 216, 255, .05); }
.notice.danger { border-color: var(--red); background: rgba(255, 107, 107, .05); }

/* tags */
.tag {
  display: inline-block; font-family: var(--mono); font-size: 10.5px; letter-spacing: .06em;
  padding: 2px 7px; border-radius: 2px; border: 1px solid var(--line-bright);
  color: var(--fg-2); background: rgba(255, 255, 255, .02); white-space: nowrap;
}
.tag.verified { border-color: rgba(70, 224, 168, .5); color: var(--green); background: rgba(70, 224, 168, .07); }
.tag.assumed { border-color: rgba(255, 179, 71, .5); color: var(--amber); background: rgba(255, 179, 71, .07); }
.tag.unknown { border-color: var(--line-bright); color: var(--muted); }
.tag.contradicted { border-color: rgba(255, 107, 107, .5); color: var(--red); background: rgba(255, 107, 107, .07); }
.tag.cyan { border-color: var(--cyan-deep); color: var(--cyan); background: rgba(63, 216, 255, .06); }

/* --------------------------------------------------------------- report head */
.report-head {
  display: flex; align-items: flex-end; gap: 18px; flex-wrap: wrap; min-width: 0;
  margin: 26px 0 0; padding-bottom: 18px; border-bottom: 1px solid var(--line);
}
.rh-main { flex: 1; min-width: 260px; }
.rh-kicker { font-family: var(--mono); font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--cyan); margin-bottom: 6px; }
.report-head h1 { font-size: 28px; letter-spacing: -.02em; }
.rh-meta { display: flex; flex-wrap: wrap; gap: 4px 0; margin-top: 7px; font-size: 12px; color: var(--muted); }
.rh-meta > span + span::before { content: ""; display: inline-block; width: 3px; height: 3px; border-radius: 50%; background: var(--faint); margin: 0 10px; vertical-align: 3px; }
.rh-meta .mono { font-size: 11px; }
.rh-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.rh-actions .btn { padding: 8px 14px; font-size: 12px; }

/* --------------------------------------------------------------- exec brief */
.brief {
  display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1.6fr); gap: 18px;
  align-items: center; margin-bottom: 14px; padding: 14px 18px;
  border: 1px solid var(--line); border-radius: var(--radius);
  background: linear-gradient(90deg, rgba(63, 216, 255, .045), transparent 70%);
}
.brief-lead { margin: 0; font-size: 13px; line-height: 1.6; color: var(--fg-2); }
.brief-lead strong { color: var(--fg); }
.brief-status { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; margin: 0; }
.bs-item { padding: 2px 14px; border-left: 1px solid var(--line); min-width: 0; }
.bs-item dt { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.bs-item dd { margin: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.bs-note { font-size: 11px; color: var(--muted); }

/* --------------------------------------------------------------- exec KPIs */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi {
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 16px 13px; position: relative; overflow: hidden; cursor: pointer;
  display: flex; flex-direction: column;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.kpi::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; height: 2px;
  background: linear-gradient(90deg, var(--cyan), transparent); opacity: .45;
}
.kpi:hover { border-color: var(--line-bright); }
.kpi:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
.kpi.is-active { border-color: var(--cyan-dim); box-shadow: var(--glow); }
.kpi.is-active::before { opacity: 1; }
.kpi .kpi-id { display: flex; align-items: center; gap: 8px; }
.kpi .kpi-code { font-family: var(--mono); font-size: 11px; letter-spacing: .1em; color: var(--cyan); font-weight: 600; }
.kpi .kpi-name {
  font-size: 12px; color: var(--fg-2); line-height: 1.4; margin-top: 4px; min-height: 34px;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kpi .kpi-value { font-size: 27px; font-weight: 650; letter-spacing: -.02em; margin: 5px 0 1px; color: #fff; }
/* SPEC 12 section 3: the range is the headline figure, the reference is secondary */
.kpi .kpi-range { font-size: 25px; font-weight: 650; letter-spacing: -.02em; margin: 12px 0 0; color: #fff; line-height: 1.15; }
.kpi .kpi-range .kpi-range-label { display: block; font-size: 9.5px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--cyan); margin-bottom: 5px; }
.kpi .kpi-range .kpi-range-value { display: block; font-size: 27px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.kpi-scale { position: relative; height: 6px; margin: 10px 0 9px; background: var(--line-soft); border-radius: 3px; }
.kpi-scale .ks-fill { position: absolute; top: 0; bottom: 0; border-radius: 3px; background: linear-gradient(90deg, rgba(63, 216, 255, .5), rgba(63, 216, 255, .85)); box-shadow: 0 0 10px -2px rgba(63, 216, 255, .6); }
.kpi-scale .ks-ref { position: absolute; top: -3px; width: 2px; height: 12px; margin-left: -1px; background: #fff; border-radius: 1px; }
.kpi .kpi-reference { font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kpi .kpi-reference b { color: var(--fg); font-weight: 600; margin-left: 4px; }
.kpi .kpi-driver { font-size: 11.5px; color: var(--muted); margin-top: 6px; line-height: 1.45; flex: 1; }
.kpi .kpi-value .unit { font-size: 13px; font-weight: 500; color: var(--fg-2); margin-left: 3px; }
.kpi .kpi-label { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.kpi .kpi-meta { margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-soft); font-size: 11.5px; display: grid; gap: 4px; }
.kpi .kpi-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--muted); }
.kpi .kpi-row .v { font-family: var(--mono); color: var(--fg); }
.kpi .badge { margin-top: 8px; }

.readme { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.readme .rm-item { font-size: 11.5px; color: var(--muted); line-height: 1.5; padding: 10px 14px; border-left: 1px solid var(--line-bright); min-width: 0; }
.readme .rm-k { display: flex; align-items: center; gap: 7px; color: var(--fg-2); font-weight: 600; font-size: 11.5px; margin-bottom: 3px; }
.rm-swatch { display: inline-block; flex: none; }
.rm-swatch.band { width: 16px; height: 6px; border-radius: 3px; background: rgba(63, 216, 255, .7); }
.rm-swatch.diamond { width: 7px; height: 7px; background: #fff; transform: rotate(45deg); }

/* panel title row */
.panel-title { display: flex; align-items: baseline; gap: 6px 14px; flex-wrap: wrap; margin-bottom: 14px; min-width: 0; }
.panel-title h3 { font-size: 13px; color: var(--fg); letter-spacing: .01em; }
.panel-title .hint { color: var(--muted); font-size: 11.5px; }

/* ------------------------------------------------------------- range chart */
.rc { --rc-name: 190px; --rc-val: 168px; }
.rc-row { display: grid; grid-template-columns: var(--rc-name) minmax(0, 1fr) var(--rc-val); gap: 18px; align-items: center; }
.rc-head { padding-bottom: 8px; border-bottom: 1px solid var(--line-bright); margin-bottom: 4px; }
.rc-head .rc-name, .rc-head .rc-val { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.rc-head .rc-val { text-align: right; }
.rc-axis { position: relative; height: 14px; }
.rc-tick { position: absolute; top: 0; transform: translateX(-50%); font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; }
.rc-tick.first { transform: none; }
.rc-tick.last { transform: translateX(-100%); }
.range-list { display: flex; flex-direction: column; }
.range-row { padding: 9px 0; border-bottom: 1px solid var(--line-soft); cursor: pointer; transition: background .15s ease; }
.range-row:last-child { border-bottom: none; }
.range-row:hover { background: rgba(63, 216, 255, .03); }
.range-row.is-selected { background: linear-gradient(90deg, rgba(63, 216, 255, .07), transparent 80%); }
.range-row.is-selected .rn-id { color: var(--cyan); }
.range-row.is-alt { padding-top: 3px; }
.range-row.is-alt .rn-id { font-weight: 500; color: var(--fg-2); padding-left: 12px; }
.range-row.is-alt .rn-sub { padding-left: 26px; }
.rn-id { font-family: var(--mono); font-size: 12px; font-weight: 600; color: var(--fg); letter-spacing: .03em; }
.rn-sub { font-size: 11px; color: var(--muted); line-height: 1.35; margin-top: 2px; }
.range-track { position: relative; height: 34px; }
.rc-grid { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line-soft); }
.range-bar { position: absolute; left: 0; right: 0; top: 8px; height: 14px; }
.range-fill {
  position: absolute; top: 0; height: 14px; border-radius: 2px;
  background: linear-gradient(90deg, rgba(63, 216, 255, .42), rgba(63, 216, 255, .2));
  border: 1px solid rgba(63, 216, 255, .75);
  box-shadow: 0 0 16px -6px rgba(63, 216, 255, .9);
}
.range-fill.hypo {
  background: repeating-linear-gradient(45deg, rgba(255, 179, 71, .22) 0 6px, rgba(255, 179, 71, .07) 6px 12px);
  border-color: var(--amber-dim); box-shadow: none;
}
.range-fill.same { background: rgba(63, 216, 255, .1); border-style: dashed; box-shadow: none; }
.range-cap { position: absolute; top: -3px; width: 2px; height: 20px; margin-left: -1px; background: var(--cyan); }
.range-cap.hypo { background: var(--amber); }
.range-mid { position: absolute; top: 3px; width: 8px; height: 8px; margin-left: -4px; background: #fff; transform: rotate(45deg); box-shadow: 0 0 0 2px var(--bg); }
.range-mid.outside { background: var(--amber); }
.range-end { position: absolute; top: 16px; font-family: var(--mono); font-size: 10px; color: var(--muted); white-space: nowrap; padding: 0 5px; }
.range-label.not-assessed { position: absolute; top: 9px; font-size: 11.5px; color: var(--muted); font-style: italic; }
.range-value { text-align: right; min-width: 0; }
.rv-range { font-family: var(--mono); font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; }
.rv-sub { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 3px; font-size: 11px; color: var(--muted); white-space: nowrap; }
.rv-ref { font-family: var(--mono); color: var(--fg-2); }
.is-alt .rv-range { color: var(--fg-2); font-weight: 500; }

/* ------------------------------------------------------------------ charts */
.chart { width: 100%; max-width: 100%; height: auto; display: block; overflow: visible; }
.chart .gridline { stroke: var(--line-soft); stroke-width: 1; }
.chart .axisline { stroke: var(--line-bright); stroke-width: 1; }
.chart .tick { stroke: var(--line-bright); stroke-width: 1; }
.chart .axis-text { fill: var(--muted); font-size: 10px; font-family: var(--mono); }
.chart .axis-title { fill: var(--muted); font-size: 10px; letter-spacing: .1em; text-transform: uppercase; }
.chart .band { fill: rgba(63, 216, 255, .1); stroke: none; }
.chart .stack { fill-opacity: .16; stroke: none; }
.chart .central { fill: none; stroke: var(--cyan); stroke-width: 2.2; filter: drop-shadow(0 0 4px rgba(63, 216, 255, .55)); }
.chart .central-dot { fill: var(--bg); stroke: var(--cyan); stroke-width: 1.6; }
.chart .uline { fill: none; stroke: rgba(232, 238, 252, .5); stroke-width: 1; stroke-dasharray: 5 4; }
.chart .uline.bound { stroke: rgba(63, 216, 255, .45); stroke-dasharray: 3 3; }
.chart .uline.total { stroke: rgba(232, 238, 252, .6); }
.chart .uline-label { fill: var(--fg-2); font-size: 10.5px; font-family: var(--mono); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; }
.chart .hit { fill: transparent; cursor: crosshair; }
.chart .cursor { stroke: var(--cyan); stroke-width: 1; opacity: .55; }
.chart .bar { stroke: none; fill-opacity: .7; }
.chart .bar.contra { fill-opacity: 1; stroke: rgba(70, 224, 168, .7); stroke-width: 1; }
.chart .hatch-bg { fill: rgba(5, 7, 13, .55); }
.chart .hatch-line { stroke: var(--s-contra); stroke-width: 1.4; }
.chart .total-mark { stroke: #fff; stroke-width: 1.5; }
.chart .bar-label { fill: var(--fg); font-size: 11px; font-family: var(--mono); }
.chart .row-label { fill: var(--fg-2); font-size: 11px; font-family: var(--mono); letter-spacing: .03em; }
.chart .row-hit { fill: transparent; cursor: pointer; }
.chart .comp-row:hover .row-hit { fill: rgba(63, 216, 255, .03); }
.chart .comp-row.on .row-hit { fill: rgba(63, 216, 255, .06); }
.chart .comp-row.on .row-label { fill: var(--cyan); font-weight: 600; }
.chart .comp-row:not(.on) .bar { fill-opacity: .42; }

/* composition breakdown of the selected scenario */
.comp-list { margin-top: 16px; border-top: 1px solid var(--line-soft); padding-top: 12px; max-width: 760px; }
.comp-head { font-size: 11.5px; margin-bottom: 8px; }
.comp-head .mono { color: var(--cyan); font-weight: 600; }
.comp-line { display: grid; grid-template-columns: 12px minmax(0, 1.4fr) minmax(60px, 1fr) 84px 58px; gap: 10px; align-items: center; padding: 4px 0; font-size: 12px; }
.comp-line .swatch { width: 10px; height: 10px; border-radius: 2px; opacity: .8; }
.comp-line .cl-k { color: var(--fg-2); min-width: 0; }
.comp-line .cl-meter { height: 4px; background: var(--line-soft); border-radius: 2px; position: relative; overflow: hidden; }
.comp-line .cl-fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 2px; opacity: .75; }
.comp-line .cl-v { font-family: var(--mono); text-align: right; color: var(--fg); white-space: nowrap; }
.comp-line .cl-p { font-family: var(--mono); text-align: right; color: var(--muted); font-size: 11px; white-space: nowrap; }
.comp-line.contra .cl-k, .comp-line.contra .cl-v { color: var(--s-contra); }
.comp-line.total { border-top: 1px solid var(--line-bright); margin-top: 4px; padding-top: 7px; }
.comp-line.total .cl-k, .comp-line.total .cl-v { color: #fff; font-weight: 600; }

/* development miniatures */
.minis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-bottom: 12px; }
.mini {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 10px 12px 8px; cursor: pointer; min-width: 0; transition: border-color .15s ease, box-shadow .15s ease;
}
.mini:hover { border-color: var(--line-bright); }
.mini:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
.mini.on { border-color: var(--cyan-dim); box-shadow: var(--glow); }
.mini-head { display: flex; justify-content: space-between; align-items: baseline; gap: 2px 8px; flex-wrap: wrap; }
.mini-id { font-family: var(--mono); font-size: 11px; font-weight: 600; color: var(--fg-2); letter-spacing: .04em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini.on .mini-id { color: var(--cyan); }
.mini-range { font-family: var(--mono); font-size: 11.5px; color: #fff; white-space: nowrap; }
.spark { display: block; width: 100%; height: 58px; margin: 6px 0 4px; }
.spark-band { fill: rgba(63, 216, 255, .14); }
.spark-line { fill: none; stroke: var(--cyan); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
.spark-total { stroke: rgba(232, 238, 252, .45); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.mini-foot { display: flex; justify-content: space-between; font-family: var(--mono); font-size: 9.5px; color: var(--faint); gap: 6px; }
.mini-foot span:nth-child(2) { color: var(--muted); }

.chart-tooltip {
  position: fixed; z-index: 90; pointer-events: none; min-width: 230px; max-width: 340px;
  background: rgba(8, 11, 20, .97); border: 1px solid var(--line-bright);
  border-radius: var(--radius); padding: 10px 12px; font-size: 11.5px;
  box-shadow: 0 12px 34px -12px #000, 0 0 0 1px rgba(63, 216, 255, .12);
  opacity: 0; transition: opacity .1s ease;
}
.chart-tooltip.on { opacity: 1; }
.chart-tooltip .tt-head { font-family: var(--mono); color: var(--cyan); font-size: 11px; letter-spacing: .06em; margin-bottom: 6px; }
.chart-tooltip .tt-row { display: flex; justify-content: space-between; gap: 14px; }
.chart-tooltip .tt-row + .tt-row { margin-top: 2px; }
.chart-tooltip .tt-row .k { color: var(--muted); }
.chart-tooltip .tt-row .v { font-family: var(--mono); color: var(--fg); text-align: right; white-space: nowrap; }
.chart-tooltip .tt-sep { height: 1px; background: var(--line-soft); margin: 6px 0; }

.legend { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 12px; }
.legend .item { display: flex; align-items: center; gap: 7px; font-size: 11.5px; color: var(--fg-2); }
.legend .item.faint-item { color: var(--muted); }
.legend .swatch, .swatch { display: inline-block; width: 11px; height: 11px; border-radius: 2px; flex: none; }
.legend .item.faint-item .swatch { opacity: .45; }
.swatch.lg-band { width: 16px; height: 8px; background: rgba(63, 216, 255, .35); border: 1px solid rgba(63, 216, 255, .75); }
.swatch.lg-diamond { width: 8px; height: 8px; background: #fff; transform: rotate(45deg); border-radius: 0; }
.swatch.lg-hypo { width: 16px; height: 8px; background: repeating-linear-gradient(45deg, rgba(255, 179, 71, .5) 0 3px, transparent 3px 6px); border: 1px solid var(--amber-dim); }
.swatch.lg-line { width: 16px; height: 0; border-top: 2px solid var(--cyan); border-radius: 0; }
.swatch.lg-dash, .legend .swatch.dash { width: 16px; height: 0; border-top: 2px dashed rgba(232, 238, 252, .6); border-radius: 0; }
.swatch.lg-hatch { background: repeating-linear-gradient(45deg, var(--s-contra) 0 1.5px, transparent 1.5px 4px); border: 1px solid rgba(70, 224, 168, .6); }

/* ------------------------------------------------------------------- table */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); font-weight: 600; padding: 9px 10px;
  border-bottom: 1px solid var(--line-bright); white-space: nowrap;
}
tbody td { padding: 9px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
tbody tr:hover { background: rgba(63, 216, 255, .035); }
tbody tr.is-selected { background: rgba(63, 216, 255, .07); }
tbody tr:last-child td { border-bottom: none; }
tfoot td { padding: 10px; border-top: 1px solid var(--line-bright); font-weight: 600; }
.scroll-x { overflow-x: auto; -webkit-overflow-scrolling: touch; max-width: 100%; min-width: 0; }
.scroll-x table { min-width: 720px; }

/* -------------------------------------------------------------- scenario UI */
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.chip {
  border: 1px solid var(--line-bright); background: rgba(255, 255, 255, .02);
  color: var(--fg-2); border-radius: 2px; padding: 7px 12px; cursor: pointer;
  font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  transition: all .16s ease;
}
.chip:hover { border-color: var(--cyan-dim); color: var(--fg); }
.chip.on { border-color: var(--cyan); color: #fff; background: rgba(63, 216, 255, .1); box-shadow: var(--glow); }
.chip .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; margin-right: 7px; vertical-align: 1px; }
.dot.verified { background: var(--green); }
.dot.assumed { background: var(--amber); }
.dot.unknown { background: var(--faint); }
.dot.contradicted { background: var(--red); }

/* ------------------------------------------------------- causal path glyph */
.scn-table td { vertical-align: top; }
.cpath { display: flex; align-items: center; gap: 0; flex-wrap: nowrap; white-space: nowrap; }
.cnode {
  display: inline-block; font-family: var(--mono); font-size: 10px; letter-spacing: .06em;
  padding: 3px 7px; border: 1px solid var(--line-bright); border-radius: 2px; color: var(--fg-2);
  background: rgba(255, 255, 255, .02);
}
.cnode.it { border-color: rgba(63, 216, 255, .55); color: var(--cyan); background: rgba(63, 216, 255, .06); }
.cnode.ot { border-color: rgba(217, 164, 65, .6); color: var(--s-recovery); background: rgba(217, 164, 65, .06); }
.cnode.logistics_it { border-color: rgba(63, 216, 255, .4); color: var(--fg-2); }
.cnode.bi { border-color: var(--line-bright); color: var(--muted); }
.cedge { display: inline-flex; align-items: center; width: 26px; height: 10px; position: relative; flex: none; }
.cedge i { display: block; width: 100%; border-top: 1.5px solid var(--line-bright); }
.cedge::after { content: ""; position: absolute; right: 0; top: 2px; border-left: 5px solid var(--line-bright); border-top: 3px solid transparent; border-bottom: 3px solid transparent; }
.cedge.verified i { border-top: 1.5px solid var(--green); }
.cedge.verified::after { border-left-color: var(--green); }
.cedge.assumed i { border-top: 1.5px dashed var(--amber); }
.cedge.assumed::after { border-left-color: var(--amber); }
.cedge.unknown i { border-top: 1.5px dotted var(--muted); }
.cedge.unknown::after { border-left-color: var(--muted); }
.cedge.contradicted i { border-top: 1.5px solid var(--red); }
.cedge.contradicted::after { border-left-color: var(--red); }
.pp { font-family: var(--mono); font-size: 10px; letter-spacing: .04em; }
.pp.on { color: var(--amber); }
.pp.off { color: var(--faint); }
.cpath-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 12px; font-size: 11px; color: var(--muted); }
.cpath-legend > span { display: inline-flex; align-items: center; gap: 7px; }
.clamp-3 { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }

/* ------------------------------------------------------- reduction stages */
.stage-rail { list-style: none; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; counter-reset: none; }
.stage {
  display: flex; gap: 11px; align-items: flex-start; min-width: 0;
  border: 1px solid var(--line); padding: 11px 13px; background: rgba(255, 255, 255, .012);
  opacity: .6; position: relative;
}
.stage + .stage { border-left: none; }
.stage:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.stage:last-child { border-radius: 0 var(--radius) var(--radius) 0; }
.stage.on { opacity: 1; background: rgba(63, 216, 255, .055); box-shadow: inset 0 2px 0 var(--cyan); }
.stage .stage-n {
  flex: none; width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-bright);
  display: grid; place-items: center; font-family: var(--mono); font-size: 11px; color: var(--muted);
}
.stage.on .stage-n { border-color: var(--cyan); color: var(--cyan); box-shadow: 0 0 10px -2px rgba(63, 216, 255, .6); }
.stage .stage-t { font-size: 12.5px; font-weight: 600; color: var(--fg-2); }
.stage.on .stage-t { color: #fff; }
.stage .stage-now { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--cyan); border: 1px solid var(--cyan-deep); border-radius: 2px; padding: 0 5px; margin-left: 6px; vertical-align: 1px; }
.stage .stage-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .06em; color: var(--faint); margin-top: 1px; }
.stage .stage-m { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }

/* --------------------------------------------------- validation priorities */
.prio-list { display: flex; flex-direction: column; gap: 10px; }
.rec.prio {
  display: grid; grid-template-columns: 34px minmax(0, 1fr) minmax(250px, 330px); gap: 16px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 14px 16px; position: relative;
}
.rec.prio::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: var(--cyan-deep); }
.prio-n { font-family: var(--mono); font-size: 20px; font-weight: 600; color: var(--cyan); line-height: 1; padding-top: 2px; }
.rec .rec-id { font-family: var(--mono); font-size: 10px; color: var(--muted); letter-spacing: .08em; }
.rec h3 { margin: 4px 0 5px; font-size: 14px; line-height: 1.4; color: #fff; }
.prio-q { margin: 0; font-size: 12.5px; color: var(--fg-2); line-height: 1.5; }
.prio-ctx { display: flex; flex-wrap: wrap; gap: 3px 14px; margin-top: 8px; }
.prio-facts { margin: 0; display: grid; gap: 6px; font-size: 11.5px; align-content: start; border-left: 1px solid var(--line-soft); padding-left: 14px; }
.prio-facts > div { display: grid; grid-template-columns: 130px minmax(0, 1fr); gap: 8px; align-items: baseline; }
.prio-facts dt { color: var(--muted); }
.prio-facts dd { margin: 0; color: var(--fg-2); min-width: 0; }
.prio-facts dd .mono.faint { display: block; word-break: break-all; font-size: 10px; }

/* -------------------------------------------------------------- coverage */
.ins-banner {
  display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px;
  border: 1px solid var(--line-bright); border-radius: var(--radius); background: rgba(255, 255, 255, .02);
  font-size: 12.5px; color: var(--fg-2); line-height: 1.55;
}
.ins-banner strong { color: #fff; }
.ins-banner .ib-icon {
  flex: none; width: 16px; height: 16px; margin-top: 2px; border: 1.5px solid var(--muted); border-radius: 3px; position: relative;
}
.ins-banner .ib-icon::before { content: ""; position: absolute; left: 3px; top: -7px; width: 7px; height: 7px; border: 1.5px solid var(--muted); border-bottom: none; border-radius: 5px 5px 0 0; }
.ins-banner.has-policy { border-color: rgba(255, 179, 71, .5); }
.ins-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.ins-head h3 { font-size: 13px; color: var(--cyan); }
.cov-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.cov-grid.tiers { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cov {
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel);
  padding: 13px 15px; border-top: 2px solid var(--line-bright); min-width: 0;
}
.cov.potentially_insurable { border-top-color: var(--green); }
.cov.economic_loss_only { border-top-color: var(--faint); }
.cov.confirmed_covered { border-top-color: var(--cyan-deep); }
.cov.coverage_dependent { border-top-color: var(--amber); }
.cov.typically_outside_cover { border-top-color: var(--red); }
.cov.not_assessed { border-top-color: var(--faint); }
.cov .cov-t { font-size: 12.5px; font-weight: 600; color: var(--fg); }
.cov .cov-k { font-family: var(--mono); font-size: 9.5px; letter-spacing: .08em; color: var(--faint); margin-top: 1px; }
.cov .cov-v { font-size: 21px; font-weight: 650; margin: 8px 0 3px; color: #fff; font-family: var(--mono); letter-spacing: -.01em; }
.cov .cov-v.locked { font-family: var(--sans); font-size: 15px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin: 12px 0 5px; }
.cov .cov-v .unit { font-size: 12px; color: var(--fg-2); font-weight: 500; }
.cov .cov-m { font-size: 11.5px; color: var(--muted); line-height: 1.45; }
.ins-split { display: flex; height: 8px; margin: 14px 0 0; border-radius: 4px; overflow: hidden; background: var(--line-soft); gap: 2px; }
.ins-split .seg { display: block; height: 100%; }
.seg.potentially_insurable, .seg-dot.potentially_insurable { background: rgba(70, 224, 168, .75); }
.seg.coverage_dependent, .seg-dot.coverage_dependent { background: rgba(255, 179, 71, .8); }
.seg.typically_outside_cover, .seg-dot.typically_outside_cover { background: rgba(255, 107, 107, .75); }
.seg.not_assessed, .seg-dot.not_assessed { background: var(--faint); }
.seg-dot { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 8px; vertical-align: 0; }
.cls-table .tag { margin-left: 8px; }
.tag.potentially_insurable { border-color: rgba(70, 224, 168, .45); color: var(--green); }
.tag.coverage_dependent { border-color: rgba(255, 179, 71, .45); color: var(--amber); }
.tag.typically_outside_cover { border-color: rgba(255, 107, 107, .45); color: var(--red); }
.tag.economic_loss_only, .tag.not_assessed, .tag.confirmed_covered { color: var(--muted); }
.tag.tiny { font-size: 9.5px; padding: 1px 6px; }
.comp-table td:nth-child(3) { max-width: 420px; }
.comp-table td:nth-child(4) { max-width: 380px; }

/* --------------------------------------------------------------- details */
details.fold { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); margin: 12px 0; }
details.fold > summary {
  cursor: pointer; padding: 14px 18px; list-style: none;
  display: flex; align-items: center; gap: 12px; font-size: 12.5px; font-weight: 600;
  color: var(--fg-2); letter-spacing: .04em; text-transform: uppercase;
  /* a flex item does not shrink below its content width unless told to */
  min-width: 0; flex-wrap: wrap; overflow-wrap: anywhere;
}
details.fold > summary > * { min-width: 0; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before {
  content: ""; width: 7px; height: 7px; border-right: 1.5px solid var(--cyan);
  border-bottom: 1.5px solid var(--cyan); transform: rotate(-45deg); transition: transform .18s ease;
  flex: none; margin-left: 2px;
}
details.fold[open] > summary::before { transform: rotate(45deg); }
details.fold > summary:hover { color: var(--fg); }
details.fold .fold-meta { margin-left: auto; min-width: 0; overflow-wrap: anywhere; color: var(--muted); font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; font-family: var(--mono); }
details.fold .fold-body { padding: 4px 18px 20px; border-top: 1px solid var(--line-soft); }
details.fold .fold-body > *:first-child { margin-top: 16px; }

/* ---------------------------------------------------------------- upload */
.drop {
  border: 1px dashed var(--line-bright); border-radius: var(--radius);
  padding: 34px 20px; text-align: center; background: rgba(63, 216, 255, .02);
  transition: all .18s ease;
}
.drop.over { border-color: var(--cyan); background: rgba(63, 216, 255, .07); box-shadow: var(--glow); }
.drop .file { font-family: var(--mono); font-size: 12px; color: var(--cyan); margin-top: 8px; }

.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 6px; }
select, input[type=text] {
  width: 100%; background: var(--bg-2); color: var(--fg);
  border: 1px solid var(--line-bright); border-radius: var(--radius);
  padding: 10px 12px; font-size: 13px; font-family: var(--sans);
}
select:focus, input:focus { outline: none; border-color: var(--cyan); box-shadow: var(--glow); }

button, .btn {
  background: rgba(63, 216, 255, .1); color: var(--cyan);
  border: 1px solid var(--cyan-dim); border-radius: var(--radius);
  padding: 10px 18px; font-size: 12.5px; font-weight: 600; font-family: var(--sans);
  letter-spacing: .04em; cursor: pointer; transition: all .16s ease;
  text-decoration: none; display: inline-block;
}
button:hover, .btn:hover { background: rgba(63, 216, 255, .19); color: #fff; text-decoration: none; }
button:disabled { opacity: .45; cursor: not-allowed; }
button.ghost, .btn.ghost { background: transparent; border-color: var(--line-bright); color: var(--fg-2); }
button.ghost:hover, .btn.ghost:hover { border-color: var(--cyan-dim); color: var(--fg); }

/* --------------------------------------------------------------- progress */
.progress { height: 3px; background: var(--line); border-radius: 2px; overflow: hidden; margin: 12px 0; }
.progress .bar { height: 100%; width: 30%; background: linear-gradient(90deg, var(--cyan-deep), var(--cyan)); animation: slide 1.4s ease-in-out infinite; }
@keyframes slide { 0% { margin-left: -30%; } 100% { margin-left: 100%; } }
@media (prefers-reduced-motion: reduce) { .progress .bar { animation: none; width: 100%; } }

.log { font-family: var(--mono); font-size: 11.5px; color: var(--muted); max-height: 210px; overflow-y: auto; }
.log div { padding: 2px 0; }

/* ------------------------------------------------------------- responsive */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
/* a grid item defaults to min-width:auto and would otherwise grow with its content */
.grid-2 > *, .grid-3 > *, .kpis > *, .cov-grid > *, .rec-grid > * { min-width: 0; }

@media (max-width: 1080px) {
  .brief { grid-template-columns: 1fr; }
  .brief-status { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 0; }
  .minis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec.prio { grid-template-columns: 30px minmax(0, 1fr); }
  .rec.prio .prio-facts { grid-column: 2; border-left: none; padding-left: 0; border-top: 1px solid var(--line-soft); padding-top: 10px; }
  .rc { --rc-name: 150px; --rc-val: 150px; }
  /* the scenario table becomes one card per scenario: nothing is clipped or scrolled */
  .scroll-x table.scn-table { min-width: 0; }
  .scn-table thead { display: none; }
  .scn-table, .scn-table tbody { display: block; width: 100%; }
  .scn-table tr { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 4px 18px; padding: 14px 4px; border-bottom: 1px solid var(--line-soft); }
  .scn-table td { display: block; border: none; padding: 4px 0; text-align: left; min-width: 0; }
  .scn-table td.num { white-space: normal; }
  .scn-table td[data-label]::before { content: attr(data-label); display: block; font-family: var(--sans); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 600; margin-bottom: 2px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cov-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .rec-grid { grid-template-columns: 1fr; }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  .wrap { padding: 0 14px 70px; }
  h1 { font-size: 20px; }
  .kpis, .cov-grid, .grid-2 { grid-template-columns: 1fr; }
  .rc-row { grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; }
  .rc-row .rc-track { grid-column: 1 / -1; grid-row: 2; }
  .rc-head .rc-name, .rc-head .rc-val { display: none; }
  .rc-head .rc-track { grid-row: 1; }
  .range-row.is-alt .rn-id, .range-row.is-alt .rn-sub { padding-left: 0; }
  .brief-status { grid-template-columns: 1fr 1fr; }
  .bs-item { padding: 2px 10px; }
  .readme { grid-template-columns: 1fr; }
  .stage-rail { grid-template-columns: 1fr; }
  .stage + .stage { border-left: 1px solid var(--line); border-top: none; }
  .stage:first-child { border-radius: var(--radius) var(--radius) 0 0; }
  .stage:last-child { border-radius: 0 0 var(--radius) var(--radius); }
  .cov-grid.tiers { grid-template-columns: 1fr; }
  .scn-table tr { grid-template-columns: 1fr; }
  .prio-facts > div { grid-template-columns: 120px minmax(0, 1fr); }
  .comp-line { grid-template-columns: 12px minmax(0, 1fr) 76px 50px; }
  .comp-line .cl-meter { display: none; }
  .report-head h1 { font-size: 22px; }
  .kpi .kpi-range .kpi-range-value { font-size: 25px; }
  .panel { padding: 15px 14px; }
  .panel-head, .panel-body { padding-left: 14px; padding-right: 14px; }
  .section h2 { font-size: 13.5px; }
  .section h2 span { display: block; margin: 3px 0 0; }
  .topbar-inner { padding: 10px 14px; }
  .kpi .kpi-value { font-size: 23px; }
}

/* ------------------------------------------------------------------ print */
@media print {
  body { background: #fff; color: #000; }
  body::before, .topbar, .no-print { display: none !important; }
  .panel, .kpi, .rec, .cov, details.fold { border-color: #bbb; background: #fff; }
  details.fold > .fold-body { display: block !important; }
}

/* ------------------------------------------- extraction contract (SPEC 14) */
.basis-panel { border-left: 2px solid var(--cyan-deep); }
.basis-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; }
.basis-cell { padding: 2px 16px; border-left: 1px solid var(--line); min-width: 0; }
.basis-cell:first-child { padding-left: 0; border-left: none; }
.basis-cell .bc-k { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.basis-cell .bc-v { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--fg); }
.basis-cell .bc-m { font-size: 11.5px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
@media (max-width: 1080px) {
  .basis-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 0; }
  .basis-cell:nth-child(odd) { padding-left: 0; border-left: none; }
}
@media (max-width: 760px) {
  .basis-grid { grid-template-columns: 1fr; }
  .basis-cell { padding: 0 0 10px; border-left: none; border-bottom: 1px solid var(--line-soft); margin-bottom: 10px; }
  .basis-cell:last-child { border-bottom: none; }
}

/* SPEC 15: an unresolved business interruption is visible on the card, not only in the fold */
.kpi .kpi-open { margin-top: 8px; color: var(--amber); line-height: 1.4; }
.kpi .kpi-open .tag { margin-right: 6px; }

/* ==========================================================================
   Desktop UX SPEC V1.0 — persistent navigation, explanations, scenario views
   Same visual language: hairlines, mono labels, cyan accent, compact type.
   ========================================================================== */

/* ------------------------------------------------ view navigation (UX-02) */
.viewnav {
  display: flex; align-items: center; gap: 4px; padding: 3px;
  border: 1px solid var(--line-bright); border-radius: var(--radius);
  background: rgba(255, 255, 255, .02);
}
.navbtn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; font-size: 11.5px; font-weight: 600; letter-spacing: .05em;
  border: 1px solid transparent; border-radius: 2px;
  background: transparent; color: var(--fg-2);
  font-family: var(--sans); text-decoration: none; cursor: pointer;
  transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.navbtn:hover { background: rgba(63, 216, 255, .1); border-color: var(--line-bright); color: #fff; text-decoration: none; }
.navbtn:disabled { opacity: .4; cursor: not-allowed; background: transparent; border-color: transparent; color: var(--muted); }
.navbtn:focus-visible { outline: 1px solid var(--cyan); outline-offset: 2px; }
.navbtn[aria-current="page"] { color: var(--cyan); border-color: var(--cyan-deep); background: rgba(63, 216, 255, .08); }
.navbtn-i { font-size: 12px; line-height: 1; color: var(--muted); }
.navbtn:hover .navbtn-i, .navbtn[aria-current="page"] .navbtn-i { color: var(--cyan); }

/* -------------------------------------------------- explanation control UX-03 */
.explain-wrap { display: inline-flex; align-items: center; margin-left: 7px; vertical-align: middle; }
.explain {
  display: inline-grid; place-items: center; flex: none;
  width: 16px; height: 16px; min-width: 16px; padding: 0; margin: 0;
  border: 1px solid var(--line-bright); border-radius: 50%;
  background: transparent; color: var(--muted);
  font-size: 10px; font-weight: 700; line-height: 1; letter-spacing: 0;
  cursor: pointer; transition: all .15s ease;
}
.explain:hover { border-color: var(--cyan-dim); color: var(--cyan); background: rgba(63, 216, 255, .08); }
.explain:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }
.explain[aria-expanded="true"] {
  border-color: var(--cyan); color: var(--cyan); background: rgba(63, 216, 255, .16);
  box-shadow: 0 0 10px -3px rgba(63, 216, 255, .7);
}
.explain-panel {
  position: fixed; z-index: 95; display: block; box-sizing: border-box;
  min-width: 210px; padding: 11px 13px;
  background: rgba(8, 11, 20, .985);
  border: 1px solid var(--line-bright); border-radius: var(--radius);
  box-shadow: 0 14px 36px -14px #000, 0 0 0 1px rgba(63, 216, 255, .12);
  font-size: 11.5px; line-height: 1.5; color: var(--fg-2);
  max-height: calc(100vh - 24px); overflow-y: auto;
}
.explain-panel[hidden] { display: none; }
.ep-title {
  display: block; font-family: var(--mono); font-size: 11px; letter-spacing: .06em;
  color: var(--cyan); margin-bottom: 8px;
}
.ep-block { display: block; margin-top: 9px; }
.ep-k {
  display: block; font-size: 9.5px; letter-spacing: .12em; text-transform: uppercase;
  color: var(--muted); font-weight: 700; margin-bottom: 3px;
}
.ep-i { display: block; color: var(--fg-2); margin-top: 4px; }
.ep-tag {
  display: inline-block; font-family: var(--mono); font-size: 9px; letter-spacing: .06em;
  text-transform: uppercase; padding: 1px 5px; margin-right: 6px; border-radius: 2px;
  border: 1px solid var(--line-bright); color: var(--muted); white-space: nowrap; vertical-align: 1px;
}
.ep-tag.input { border-color: rgba(70, 224, 168, .45); color: var(--green); }
.ep-tag.assumption { border-color: rgba(255, 179, 71, .45); color: var(--amber); }
.ep-tag.derived { border-color: var(--cyan-deep); color: var(--cyan); }
.ep-tag.unknown { border-color: var(--line-bright); color: var(--muted); }

/* --------------------------------------------- card action into a detail view */
.kpi .kpi-detail {
  display: inline-flex; align-items: center; gap: 6px;
  margin-top: 11px; padding-top: 10px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; font-weight: 600; letter-spacing: .05em; color: var(--cyan);
}
.kpi .kpi-detail:hover { color: #fff; text-decoration: none; }
.kpi .kpi-detail:focus-visible { outline: 1px solid var(--cyan); outline-offset: 3px; }

/* ------------------------------------------------- scenario detail view UX-01 */
.sd-lead { margin: 14px 0 0; font-size: 14px; line-height: 1.6; color: var(--fg); }
.sd-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 26px; margin-top: 16px; }
.sd-grid > * { min-width: 0; }
.sd-terms {
  display: flex; flex-wrap: wrap; gap: 5px 20px; margin: 13px 0 0;
  padding-top: 11px; border-top: 1px solid var(--line-soft);
  font-size: 11.5px; color: var(--muted);
}
.sd-terms .sd-term b { color: var(--fg); font-family: var(--mono); font-size: 11px; }

.sd-facts { margin: 0; }
.sd-facts > div + div { margin-top: 12px; }
.sd-facts dt {
  font-size: 10px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); margin-bottom: 4px;
}
.sd-facts dd { margin: 0; font-size: 12.5px; color: var(--fg); }
.sd-jump { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.sd-jumplink {
  font-family: var(--mono); font-size: 11px; letter-spacing: .05em;
  padding: 3px 9px; border: 1px solid var(--line-bright); border-radius: 2px;
  color: var(--fg-2); background: rgba(255, 255, 255, .02);
}
.sd-jumplink:hover { border-color: var(--cyan-dim); color: var(--cyan); text-decoration: none; }
.sd-scope {
  display: flex; gap: 10px; align-items: flex-start; margin-top: 16px;
  padding: 11px 14px; border: 1px solid var(--line-bright);
  border-left: 2px solid var(--amber); border-radius: 0 var(--radius) var(--radius) 0;
  background: rgba(255, 179, 71, .05);
  font-size: 12.5px; line-height: 1.55; color: var(--fg-2);
}
.sd-scope strong { color: #fff; }
.sd-figs { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 26px; }
/* the headline figure keeps the weight of the executive card, without the card */
.sd-figs .kpi-range { margin: 0; }
.sd-figs .kpi-range .kpi-range-label {
  display: block; font-size: 10.5px; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; color: var(--cyan); margin-bottom: 6px;
}
.sd-figs .kpi-range .kpi-range-value {
  display: block; font-size: 38px; font-weight: 650; letter-spacing: -.02em;
  line-height: 1.08; color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap;
}
.sd-figs .kpi-scale { height: 8px; margin: 15px 0 9px; }
.sd-figs .kpi-reference { font-size: 13px; color: var(--muted); }
.sd-figs .kpi-reference b { color: #fff; font-weight: 650; margin-left: 5px; font-size: 17px; }
@media (max-width: 760px) {
  .sd-figs .kpi-range .kpi-range-value { font-size: 30px; }
}
.sd-figs > * { min-width: 0; }
.sd-rows { margin: 14px 0 0; border-top: 1px solid var(--line-soft); padding-top: 10px; }
.sd-rows > div {
  display: flex; justify-content: space-between; align-items: baseline; gap: 14px;
  padding: 5px 0; font-size: 12px; border-bottom: 1px solid var(--line-soft);
}
.sd-rows > div:last-child { border-bottom: none; }
.sd-rows dt { color: var(--muted); }
.sd-rows dd { margin: 0; color: var(--fg); white-space: nowrap; }
.sd-measures { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sd-measure {
  border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--panel); padding: 13px 15px; min-width: 0;
}
.sd-measure .sm-k { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.sd-measure .sm-v { font-size: 22px; font-weight: 650; letter-spacing: -.02em; color: #fff; margin-top: 6px; }
.sd-measure .sm-m { font-size: 11.5px; color: var(--muted); margin-top: 4px; line-height: 1.45; }
.sd-grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.sd-grid-3 > * { min-width: 0; }
.sd-field { border-left: 1px solid var(--line); padding: 2px 0 2px 14px; }
.sd-field-v { font-size: 15px; color: var(--fg); margin-top: 3px; }

/* --------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .topbar .meta { order: 3; width: 100%; }
  .viewnav { order: 2; }
  .sd-grid { grid-template-columns: 1fr; }
  .sd-figs { grid-template-columns: 1fr; gap: 18px; }
  .sd-measures, .sd-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .viewnav { width: 100%; justify-content: space-between; }
  .navbtn { padding: 7px 9px; font-size: 11.5px; }
  .sd-measures, .sd-grid-3 { grid-template-columns: 1fr; }
  .sd-figs { gap: 14px; }
  .explain-panel { min-width: 180px; }
}

/* Client scenario families A/B/C (metadata presentation only). */
.family-kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); margin-top: 14px; }
.family-kpis .family-card { cursor: default; border-color: var(--line-bright); }
.family-kpis .family-card[data-family="C"] { border-style: dashed; }
.family-kpis .family-card[data-family="C"] .kpi-range-value { color: var(--amber); }
@media (max-width: 900px) { .family-kpis { grid-template-columns: 1fr; } }
.family-kpis .kpi-range .kpi-range-value { font-size: 18px; line-height: 1.25; white-space: normal; overflow-wrap: anywhere; }
.family-kpis [data-family="C"] .kpi-range .kpi-range-value { font-size: 16px; color: var(--amber); }
