/* Cook & Cardenas — interactive overheating report.
   Palette + type follow the C&C report template: warm paper grey, rust plate,
   vermilion mark, ochre table headers, condensed uppercase headings. */

:root {
  --paper: #efede8;
  --paper-2: #e6e2da;
  --card: #fbfaf7;
  --ink: #1e1a17;
  --ink-2: #4f4842;
  --ink-3: #8a827a;
  --line: #d9d3c9;
  --line-2: #e8e4dc;
  --rust: #5c2615;
  --rust-2: #7a3520;
  --verm: #e8553a;
  --ochre: #b09a52;
  --ochre-soft: #f3edda;
  --pass: #3f8a64;
  --pass-soft: #e3f0e7;
  --fail: #d6452e;
  --fail-soft: #fbe5df;
  --risk: #c98a14;
  --risk-soft: #fbefd6;
  --muted: #a39c93;
  --f-head: "Barlow Condensed", "Arial Narrow", system-ui, sans-serif;
  --f-body: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-serif: "Fraunces", Georgia, serif;
  --story-w: 470px;
  --top-h: 62px;
  --shadow: 0 10px 30px -12px rgba(40, 28, 18, 0.28), 0 2px 6px rgba(40, 28, 18, 0.08);
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 400 14.5px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button { font: inherit; color: inherit; }
kbd {
  display: inline-block; min-width: 1.5em; padding: 0 0.35em; margin: 0 1px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px;
  background: var(--card); font: 600 11px/1.5 var(--f-body); text-align: center; color: var(--ink-2);
}
code { font-size: 12px; background: var(--paper-2); padding: 1px 5px; border-radius: 3px; }

.wordmark { font: 400 17px/1 var(--f-head); letter-spacing: 0.06em; color: var(--ink); white-space: nowrap; }
.wordmark i { font-family: var(--f-serif); font-style: normal; font-weight: 300; }
.wordmark.big { font-size: 64px; line-height: 0.9; letter-spacing: 0.01em; font-weight: 300; }
.wordmark.big small { display: block; font: 600 11px/1 var(--f-body); letter-spacing: 0.14em; margin-top: 14px; color: var(--ink-2); }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: var(--top-h) auto 1fr; height: 100vh; opacity: 0; transition: opacity 0.6s var(--ease); }
body.ready .app { opacity: 1; }
.topbar { grid-row: 1; }
.banner { grid-row: 2; }
.main { grid-row: 3; display: flex; min-height: 0; position: relative; }

.topbar {
  position: relative; z-index: 30; display: flex; align-items: center; gap: 18px;
  padding: 0 18px; background: rgba(239, 237, 232, 0.92); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); transition: transform 0.5s var(--ease), opacity 0.5s;
}
.app[data-chapter="cover"] .topbar { transform: translateY(-100%); opacity: 0; pointer-events: none; }
.app[data-chapter="cover"] { grid-template-rows: 0 auto 1fr; }
.brand { display: flex; flex-direction: column; gap: 3px; background: none; border: 0; cursor: pointer; text-align: left; padding: 0; min-width: 150px; }
.brand .proj { font: 600 12px/1 var(--f-body); color: var(--ink-3); letter-spacing: 0.02em; }
.chapters { display: flex; gap: 2px; flex: 1; justify-content: center; overflow-x: auto; scrollbar-width: none; }
.chapters button {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px; border: 0; border-radius: 999px;
  background: none; cursor: pointer; color: var(--ink-3); white-space: nowrap; position: relative;
  transition: background 0.2s, color 0.2s;
}
.chapters button .n {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid currentColor; font: 600 11px/1 var(--f-body);
}
.chapters button .t { font: 500 15px/1 var(--f-head); letter-spacing: 0.03em; text-transform: uppercase; }
.chapters button:hover { background: var(--paper-2); color: var(--ink); }
.chapters button.done { color: var(--ink-2); }
.chapters button.done .n { background: var(--ink-2); color: var(--paper); border-color: var(--ink-2); }
.chapters button.on { color: var(--rust); background: #f7ece6; }
.chapters button.on .n { background: var(--rust); color: #fff; border-color: var(--rust); }
.chapters .badge { position: absolute; top: 1px; right: 2px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--verm); color: #fff; font: 700 10px/17px var(--f-body); text-align: center; }
@media (max-width: 1800px) { .chapters button:not(.on) .t { display: none; } }
.actions { display: flex; gap: 8px; align-items: center; }
.progress { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; }
.progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--rust), var(--verm)); transition: width 0.8s var(--ease); }

.app[data-chapter="cover"] .banner,
.app[data-chapter="cover"] .levels,
.app[data-chapter="cover"] .hint,
.app[data-chapter="cover"] .toolbar,
.app[data-chapter="cover"] .legend { display: none; }
.banner { background: #fff4d6; border-bottom: 1px solid #ecd9a0; padding: 7px 18px; font-size: 13px; color: #6b5210; }
.banner a { color: inherit; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 500; font-size: 13.5px;
  transition: transform 0.15s, background 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.btn:hover { border-color: var(--ink-3); box-shadow: 0 2px 8px -3px rgba(0,0,0,0.2); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--rust); border-color: var(--rust); color: #fff; }
.btn.primary:hover { background: var(--rust-2); }
.btn.ghost { background: transparent; }
.btn.big { padding: 13px 22px; font-size: 15px; border-radius: 10px; }
.btn.small { padding: 5px 10px; font-size: 12.5px; }
.btn.final { background: var(--pass); border-color: var(--pass); color: #fff; font-weight: 600; padding: 12px 22px; border-radius: 10px; }
.btn.final:hover { background: #357656; border-color: #357656; box-shadow: 0 4px 14px -4px rgba(63,138,100,0.55); }
.btn[disabled] { opacity: 0.45; pointer-events: none; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.icon-btn { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--card); cursor: pointer; font-weight: 700; }
.link, .rl { background: none; border: 0; padding: 0; cursor: pointer; color: var(--rust); font: inherit; text-decoration: underline; text-decoration-color: rgba(92,38,21,0.35); text-underline-offset: 3px; }
.rl:hover, .link:hover { text-decoration-color: var(--rust); color: var(--verm); }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); width: 290px; background: var(--card); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 6px; z-index: 40; }
.menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 10px; border-radius: 7px; cursor: pointer; }
.menu button:hover { background: var(--paper); }
.menu small { display: block; color: var(--ink-3); font-size: 12px; }

/* ---------- story column ---------- */
.story {
  width: var(--story-w); flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--paper); border-right: 1px solid var(--line); position: relative; z-index: 5;
  transition: width 0.6s var(--ease);
}
.app.is-wide .story { width: min(60vw, 1040px); }
.app[data-chapter="cover"] .story { width: 0; border: 0; overflow: hidden; }
.story-body { flex: 1; overflow-y: auto; padding: 30px 36px 40px; scrollbar-width: thin; }
.story-body.enter > * { animation: rise 0.55s var(--ease) both; }
.story-body.enter > *:nth-child(2) { animation-delay: 0.04s; }
.story-body.enter > *:nth-child(3) { animation-delay: 0.08s; }
.story-body.enter > *:nth-child(4) { animation-delay: 0.12s; }
.story-body.enter > *:nth-child(n+5) { animation-delay: 0.16s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.story-nav { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 20px; border-top: 1px solid var(--line); background: var(--paper); }
.story-nav span { font-size: 12px; color: var(--ink-3); }

.story h1 {
  font: 600 30px/1.05 var(--f-head); text-transform: uppercase; letter-spacing: 0.02em; margin: 0 0 18px;
  padding-bottom: 12px; border-bottom: 1.5px solid var(--ink);
}
.story h3 { font: 600 18px/1.2 var(--f-head); text-transform: uppercase; letter-spacing: 0.03em; margin: 26px 0 8px; }
.story p { margin: 0 0 12px; color: var(--ink-2); }
.story p b { color: var(--ink); }
.story ul, .story ol { color: var(--ink-2); padding-left: 20px; }
.kicker { display: block; font: 600 11px/1 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--verm); margin-bottom: 10px; }
.caption { font-size: 12.5px; color: var(--ink-3); margin-top: 12px; }
.small { font-size: 13px; }
.muted { color: var(--ink-3); }
.pending { border: 1.5px dashed var(--risk); background: var(--risk-soft); color: #6b5210; padding: 10px 12px; border-radius: 8px; font-size: 13px; margin: 0 0 14px; }
.loading { color: var(--ink-3); font-size: 13px; padding: 20px 0; }

.facts-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin: 18px 0 6px; }
.facts-grid div { background: var(--card); padding: 10px 12px; }
.facts-grid dt { font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); }
.facts-grid dd { margin: 2px 0 0; font-weight: 500; }

.gl { border-bottom: 1px dotted var(--ink-3); cursor: help; position: relative; }
.gl:hover::after, .gl:focus::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px); translate: -50% 0;
  width: 240px; padding: 8px 10px; border-radius: 8px; background: var(--ink); color: #f3efe8;
  font: 400 12.5px/1.45 var(--f-body); z-index: 20; box-shadow: var(--shadow); pointer-events: none;
}

.crit-cards { display: grid; gap: 10px; margin: 16px 0; }
.crit-card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.crit-card header { display: flex; gap: 8px; align-items: baseline; }
.crit-card header b { font: 600 16px/1 var(--f-head); text-transform: uppercase; letter-spacing: 0.03em; color: var(--rust); }
.crit-card header span { font-weight: 600; font-size: 13.5px; }
.crit-card p { margin: 6px 0; font-size: 13.5px; }
.crit-card footer { font-size: 12px; color: var(--ink-3); }
.ticks { list-style: none; padding: 0; }
.ticks li { padding-left: 22px; position: relative; margin-bottom: 6px; font-size: 13.5px; }
.ticks li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 10px; height: 6px; border-left: 2px solid var(--pass); border-bottom: 2px solid var(--pass); rotate: -45deg; }

/* ---------- KPIs + tables ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin: 0 0 18px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; border-top: 3px solid var(--ink-3); }
.kpi b { display: block; font: 600 34px/1 var(--f-head); }
.kpi b small { font-size: 18px; color: var(--ink-3); font-weight: 500; }
.kpi span { font-size: 12.5px; color: var(--ink-2); }
.kpi-fail { border-top-color: var(--fail); } .kpi-fail b { color: var(--fail); }
.kpi-pass { border-top-color: var(--pass); } .kpi-pass b { color: var(--pass); }
.kpi-risk { border-top-color: var(--risk); }

.rtable { width: 100%; border-collapse: collapse; margin: 18px 0 8px; font-size: 13.5px; background: var(--card); border-radius: 10px; overflow: hidden; }
.rtable caption { caption-side: top; text-align: left; font-size: 12px; color: var(--ink-3); padding-bottom: 6px; }
.rtable thead th { background: var(--ochre); color: #1c1710; font-weight: 700; text-align: left; padding: 8px 10px; font-size: 12.5px; vertical-align: bottom; }
.rtable thead th small { display: block; font-weight: 500; font-size: 11px; opacity: 0.8; }
.rtable tbody th { text-align: left; font-weight: 500; padding: 7px 10px; white-space: nowrap; }
.rtable td { padding: 7px 10px; }
.rtable tbody tr:nth-child(even) { background: #f5f2ea; }
.rtable tbody tr[data-room], .rtable tbody tr[data-window] { cursor: pointer; transition: background 0.15s; }
.rtable tbody tr[data-room]:hover, .rtable tbody tr[data-window]:hover { background: #f7e9df; }
.rtable .num { text-align: right; font-variant-numeric: tabular-nums; }
.rtable .bad { color: var(--fail); font-weight: 600; }
.rtable-narrow { max-width: 460px; }
.rtable.dense { font-size: 12.5px; }
.rtable.dense td, .rtable.dense th { padding: 5px 8px; }
.na { color: var(--ink-3); }
.table-scroll { overflow: auto; max-height: 56vh; border-radius: 10px; }
.cellbar { display: grid; grid-template-columns: 52px 1fr; align-items: center; gap: 8px; min-width: 150px; }
.cellbar .v { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.cellbar i { height: 7px; background: var(--line-2); border-radius: 4px; position: relative; }
.cellbar i em { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--pass); }
.cellbar.bad i em { background: var(--fail); }
.cellbar.bad .v { color: var(--fail); }
.cellbar i b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
/* --- progress: strategy results (what the tested strategies achieved) -------- */
.ptiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); gap: 8px; margin: 4px 0 10px; }
.ptile { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; border-top: 3px solid var(--ink-3); display: flex; flex-direction: column; gap: 4px; }
.ptile.good { border-top-color: var(--pass); background: linear-gradient(180deg, var(--pass-soft), var(--card) 70%); }
.ptile .lab { font: 600 11px/1.3 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.ptile b { font: 600 28px/1 var(--f-head); color: var(--ink); white-space: nowrap; }
.ptile.good b { color: var(--pass); }
.ptile b em { font-style: normal; color: var(--ink-3); font-size: 18px; }
.ptile b small { font-size: 16px; color: var(--ink-3); font-weight: 500; }
.ptile .sub { font-size: 12px; line-height: 1.35; color: var(--ink-2); }
.still { font-size: 13.5px; color: var(--ink-2); border-left: 3px solid var(--ochre); padding: 4px 0 4px 10px; margin: 0 0 16px; }
.sub-h { font: 600 20px/1.2 var(--f-head); letter-spacing: 0.02em; text-transform: uppercase; margin: 22px 0 6px; }
.step-eff { margin: 4px 0 0; font-size: 12.5px; color: var(--pass); font-weight: 600; }
.step-eff::before { content: "▲ "; font-size: 10px; }
.wins { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: 14px 0 4px; }
.wins .lab { grid-column: 1 / -1; font: 600 11px/1.3 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); }
.win { background: var(--pass-soft); border-radius: 10px; padding: 9px 12px; display: grid; gap: 2px; }
.win b { font-size: 13.5px; }
.win span { font-size: 12.5px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.win em { font-style: normal; font: 600 18px/1.1 var(--f-head); color: var(--pass); }
.dbar { display: grid; grid-template-columns: 1fr auto; grid-template-areas: "v chips" "bar bar"; align-items: center; gap: 3px 8px; min-width: 190px; }
.dbar .v { grid-area: v; font-variant-numeric: tabular-nums; font-size: 13px; }
.dbar .v s { color: var(--ink-3); text-decoration-thickness: 1px; }
.dbar .v b { font-weight: 700; }
.dbar.bad .v b { color: var(--fail); }
.dbar.ok .v b { color: var(--pass); }
.dbar .chips { grid-area: chips; display: flex; gap: 4px; justify-content: flex-end; }
.dbar i { grid-area: bar; height: 8px; background: #efebe3; border-radius: 4px; position: relative; }
.dbar i u { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: repeating-linear-gradient(135deg, #b9ad97 0 3px, #d8cfbf 3px 6px); }
.dbar i em { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--pass); transition: width 0.5s var(--ease); }
.dbar.bad i em { background: var(--fail); }
.dbar i b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink); border-radius: 1px; }
.chg { font: 600 11px/1.5 var(--f-body); padding: 0 7px; border-radius: 999px; white-space: nowrap; }
.chg.up { background: var(--pass-soft); color: var(--pass); }
.chg.down { background: var(--fail-soft); color: var(--fail); }
.chg.pass { background: var(--pass); color: #fff; }
.ptable-prog td { vertical-align: middle; padding-top: 6px; padding-bottom: 6px; }
.ptable-prog td.res { white-space: nowrap; }
.ptable-prog tr.is-up th::after { content: " ✓"; color: var(--pass); font-weight: 700; }
.alltab { margin: 18px 0 6px; }
.alltab summary { cursor: pointer; font-weight: 600; font-size: 13.5px; color: var(--rust); }
.ftable.tan thead th { background: var(--ochre); color: #1c1710; border-color: #9c8747; }
.ftable.tan tbody tr:nth-child(even) th, .ftable.tan tbody tr:nth-child(even) td { background: #f5f2ea; }
.card-body .changed .crow { margin: 8px 0 12px; }
.card-body .changed .crow > span { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 3px; }
.card-body .changed .crow > span em { font-style: normal; font-weight: 400; color: var(--ink-3); }
.card-body ul.applied { margin: 4px 0; padding-left: 18px; font-size: 13.5px; }
.card-body ul.applied li::marker { content: "✓  "; color: var(--pass); }
.kv { border-collapse: collapse; width: 100%; font-size: 13.5px; margin-bottom: 16px; }
.kv th { text-align: left; background: var(--verm); color: #fff; padding: 7px 10px; width: 36%; font-weight: 600; border-bottom: 1px solid #f08b73; }
.kv td { background: #fbe9e3; padding: 7px 10px; border-bottom: 1px solid #f6d3c8; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font: 600 11.5px/1.6 var(--f-body); letter-spacing: 0.02em; white-space: nowrap; }
.pill-pass { background: var(--pass-soft); color: var(--pass); }
.pill-fail { background: var(--fail-soft); color: var(--fail); }
.pill-risk { background: var(--risk-soft); color: var(--risk); }
.pill-muted { background: var(--paper-2); color: var(--ink-3); }
.t-pass { color: var(--pass); } .t-fail { color: var(--fail); } .t-risk { color: var(--risk); } .t-muted { color: var(--ink-3); }
.tag { display: inline-block; font: 600 10.5px/1.6 var(--f-body); padding: 0 6px; border-radius: 4px; background: var(--paper-2); color: var(--ink-2); letter-spacing: 0.02em; text-transform: uppercase; }
.tag.ok { background: var(--pass-soft); color: var(--pass); }
.tag.warn { background: var(--risk-soft); color: var(--risk); }
.star { color: var(--verm); font-size: 11.5px; font-weight: 600; }

/* ---------- when + charts ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.chip { border: 1px solid var(--line); background: var(--card); border-radius: 999px; padding: 5px 12px; cursor: pointer; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.chip.on { background: var(--ink); color: #fff; border-color: var(--ink); }
.chip.ghost { cursor: default; background: var(--paper-2); border-color: transparent; font-size: 12px; padding: 3px 9px; }
.chips.small { margin: 6px 0 0; }
.dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; }
.dot-fail { background: var(--fail); }
.carpet-wrap, .mini-carpet { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 10px 8px; margin: 12px 0; }
.carpet-wrap canvas { width: 100%; height: 190px; display: block; }
.mini-carpet canvas { width: 100%; height: 130px; display: block; }
.carpet-tip { font-size: 12px; color: var(--ink-2); min-height: 18px; margin-top: 4px; }
.ramp { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--ink-3); margin-top: 6px; }
.ramp i { flex: 1; height: 8px; border-radius: 4px; }
.hourmatrix { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 12px 0; }
.hm-title { font-size: 12px; color: var(--ink-3); margin-bottom: 6px; }
.hm-row { display: grid; grid-template-columns: 34px repeat(24, 1fr); gap: 2px; margin-bottom: 2px; }
.hm-row b { font: 500 11px/14px var(--f-body); color: var(--ink-3); }
.hm-row i { height: 14px; border-radius: 2px; background: #f1eee7; }
.hm-axis span { font-size: 10px; color: var(--ink-3); }

/* ---------- threats ---------- */
.callouts { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 10px; }
.callout { display: grid; grid-template-columns: 30px 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; transition: border-color 0.2s, transform 0.2s; }
.callout:hover { border-color: var(--verm); transform: translateX(3px); }
.callout .num { width: 26px; height: 26px; border-radius: 50%; background: var(--verm); color: #fff; display: grid; place-items: center; font: 700 13px/1 var(--f-body); }
.callout small { color: var(--ink-3); font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; }
.callout p { margin: 3px 0 0; font-size: 13.5px; color: var(--ink); }
.callout .note { color: var(--ink-3); font-style: italic; font-size: 12.5px; }

/* ---------- strategies ladder ---------- */
.ladder { list-style: none; padding: 0; margin: 16px 0; position: relative; }
.ladder::before { content: ""; position: absolute; left: 13px; top: 8px; bottom: 8px; width: 2px; background: linear-gradient(var(--pass), var(--risk), var(--fail)); border-radius: 2px; opacity: 0.5; }
.ladder > li { padding-left: 40px; margin-bottom: 14px; position: relative; }
.rung { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.rung span { position: absolute; left: 0; width: 28px; height: 28px; border-radius: 50%; background: var(--card); border: 2px solid var(--ink-2); display: grid; place-items: center; font: 700 12px/1 var(--f-body); }
.rung b { font: 600 15px/1.2 var(--f-head); text-transform: uppercase; letter-spacing: 0.03em; }
.strat-card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; margin-top: 8px; transition: border-color 0.2s, box-shadow 0.2s; cursor: default; }
.strat-card:hover { border-color: var(--rust); box-shadow: var(--shadow); }
.strat-card header { display: flex; align-items: center; gap: 8px; }
.strat-card header b { flex: 1; font-size: 14px; }
.strat-card p { font-size: 13px; margin: 6px 0; }
.strat-card footer { font-size: 12px; color: var(--ink-3); }

/* strategy icons (pure CSS glyphs) */
.strat-ico { width: 22px; height: 22px; border-radius: 6px; flex: none; display: inline-block; position: relative; background: var(--paper-2); }
.ico-glass { background: linear-gradient(135deg, #3f5664 50%, #7b95a4 50%); }
.ico-overhang { background: linear-gradient(#5b4b3e 0 28%, #cfdbe2 28%); }
.ico-xblind { background: linear-gradient(#8c8f93 0 22%, #5e6166 22%); }
.ico-shutters { background: repeating-linear-gradient(#6f7f6a 0 3px, #4e5c4a 3px 5px); box-shadow: inset 11px 0 0 -10px #fff; }
.ico-blind { background: repeating-linear-gradient(#efe7d6 0 3px, #bfb39e 3px 5px); }
.ico-opening { background: linear-gradient(115deg, #cfdbe2 55%, #8fd0a8 55%); }
.ico-fan { background: radial-gradient(circle, #3a3430 18%, transparent 20%), conic-gradient(#3a3430 0 30deg, #e9e4da 30deg 120deg, #3a3430 120deg 150deg, #e9e4da 150deg 240deg, #3a3430 240deg 270deg, #e9e4da 270deg); border-radius: 50%; }
.ico-mvhr { background: linear-gradient(90deg, #7fa9c7 50%, #e59c7e 50%); }
.ico-cooling { background: #6fa8dc; }

/* ---------- picker ---------- */
.seg { display: inline-flex; background: var(--paper-2); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-weight: 500; font-size: 13px; color: var(--ink-2); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,0.12); }
.seg.small button { padding: 4px 10px; font-size: 12px; }
.app-tabs { position: sticky; top: 0; z-index: 2; display: flex; gap: 4px; background: var(--card); border-bottom: 2px solid var(--line); margin: 4px 0 12px; }
.app-tabs button { border: 0; background: none; padding: 8px 12px; margin-bottom: -2px; border-bottom: 2px solid transparent; cursor: pointer; font: inherit; font-weight: 600; font-size: 13px; color: var(--ink-2); }
.app-tabs button.on { color: var(--ink); border-bottom-color: var(--verm); }
.app-tabs button:hover { color: var(--ink); }
.app-panel .seg { margin-bottom: 8px; }
.pk-legend { display: flex; flex-wrap: wrap; gap: 14px; font-size: 12px; color: var(--ink-3); margin: 12px 0 8px; }
.pk-legend span { display: inline-flex; align-items: center; gap: 5px; }
.pk-legend .pcell { width: 20px; height: 20px; font-size: 11px; pointer-events: none; }
.ptable { border-collapse: separate; border-spacing: 0; width: 100%; font-size: 13px; }
.ptable thead th { position: sticky; top: 0; background: var(--paper); z-index: 2; font-weight: 600; font-size: 11.5px; vertical-align: bottom; padding: 6px 4px; }
.ptable thead tr.grp th { top: 0; font: 600 11px/1.3 var(--f-body); text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-3); border-bottom: 1px solid var(--line); text-align: center; }
.ptable thead tr:not(.grp) th { top: 22px; }
.ptable th.sh { width: 76px; text-align: center; }
.ptable th.sh span:last-child { display: block; margin-top: 4px; line-height: 1.2; }
.ptable tbody th { text-align: left; font-weight: 500; padding: 8px 10px 8px 0; position: sticky; left: 0; background: var(--paper); z-index: 1; min-width: 170px; }
.ptable tbody th small { display: block; color: var(--ink-3); font-weight: 400; font-size: 11.5px; }
.ptable tbody th small.pk-inplace { color: var(--ink-2); font-style: italic; }
.pk-scope { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 4px 0 8px; }
.ptable tbody tr { border-bottom: 1px solid var(--line-2); }
.ptable tbody tr:hover th, .ptable tbody tr:hover td { background: #f6ede6; }
.ptable td.pc { text-align: center; padding: 4px; border-bottom: 1px solid var(--line-2); }
.ptable td.na { font-size: 11px; color: var(--line); }
.ptable td.pnote { padding: 4px 0 4px 8px; border-bottom: 1px solid var(--line-2); }
.ptable td.pnote input { width: 170px; border: 1px solid transparent; background: transparent; padding: 5px 7px; border-radius: 6px; font-size: 12.5px; }
.ptable td.pnote input:hover, .ptable td.pnote input:focus { border-color: var(--line); background: var(--card); outline: none; }
.row-house th b { font-size: 14px; }
.pcell {
  width: 34px; height: 34px; border-radius: 9px; border: 1.5px solid var(--line); background: var(--card);
  cursor: pointer; font-weight: 700; font-size: 15px; display: inline-grid; place-items: center;
  transition: transform 0.12s, background 0.15s, border-color 0.15s;
}
.pcell:hover { transform: scale(1.08); border-color: var(--ink-3); }
.pcell.is-rec { border-color: var(--verm); color: var(--verm); border-style: dashed; }
.pcell.is-explore { background: var(--pass); border: 1.5px solid var(--pass); color: #fff; }
.pcell.is-not_viable { background: #8c847b; border: 1.5px solid #8c847b; color: #fff; }
.pcell.is-discuss { background: var(--risk); border: 1.5px solid var(--risk); color: #fff; }
.pcell.is-inherited { opacity: 0.45; border-style: dashed; }
.pk-foot { margin-top: 16px; padding: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.pk-count { font-size: 13px; color: var(--ink-2); margin-bottom: 10px; }
.pk-form { display: grid; grid-template-columns: 200px 1fr; gap: 8px; }
.pk-form input, .pk-form textarea { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px; background: #fff; resize: vertical; }

.pcell { position: relative; }
.tm { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1.5px solid #fff; }
.pcell .tm { position: absolute; top: -4px; right: -4px; }
.tm-agreed { background: var(--pass); }
.tm-discuss { background: var(--risk); }
.tm-conflict { background: var(--fail); box-shadow: 0 0 0 2px rgba(214,69,46,0.25); }
.team { margin-top: 18px; padding: 14px 16px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; }
.team h3 { margin-top: 0 !important; }
.team h4 { font: 600 13px/1.2 var(--f-head); text-transform: uppercase; letter-spacing: 0.05em; margin: 14px 0 6px; color: var(--ink-2); }
.team-sum { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--ink-2); margin: 8px 0; }
.team-sum span { display: inline-flex; align-items: center; gap: 6px; }
.team-sum .tm { border: 0; }
.team-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; font-size: 13px; }
.team-list li { padding: 8px 10px; background: var(--paper); border-radius: 8px; }
.team-list li div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.vote { font-size: 12px; padding: 1px 8px; border-radius: 999px; background: var(--paper-2); }
.vote.v-explore { background: var(--pass-soft); color: var(--pass); }
.vote.v-not_viable { background: #ebe7e2; color: #6e665e; }
.vote.v-discuss { background: var(--risk-soft); color: var(--risk); }

/* ---------- strategy results + final report ---------- */
:root { --navy: #16283a; }
.stack { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 10px; }
.stack-item { display: grid; grid-template-columns: 30px 1fr; gap: 10px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.stack-item .num { width: 26px; height: 26px; border-radius: 50%; background: var(--rust); color: #fff; display: grid; place-items: center; font: 700 12px/1 var(--f-body); }
.stack-item ul { margin: 6px 0; padding-left: 18px; font-size: 13.5px; }
.stack-item small { color: var(--ink-3); }
.vswitch { margin: 6px 0 12px; flex-wrap: wrap; }
.vcomm { font-size: 13.5px; color: var(--ink-2); padding-left: 18px; }
.ctable td.cf { white-space: nowrap; }
.ftable { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 16px 0 10px; background: #fff; }
.ftable caption { caption-side: top; text-align: left; font-size: 11.5px; font-style: italic; color: var(--ink-2); padding-bottom: 5px; }
.ftable thead th { background: var(--navy); color: #fff; font-weight: 600; text-align: left; padding: 5px 8px; vertical-align: bottom; border: 1px solid #2b3f55; }
.ftable thead th small { display: block; font-weight: 400; font-size: 10.5px; opacity: 0.8; }
.ftable thead th.band, .ftable thead th.grp { text-align: center; font-weight: 600; }
.ftable tbody th { text-align: left; font-weight: 500; padding: 4px 8px; border-bottom: 1px solid var(--line-2); white-space: nowrap; }
.ftable tbody th small { color: var(--ink-3); font-weight: 400; }
.ftable td { padding: 4px 8px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.ftable td.num { text-align: right; font-variant-numeric: tabular-nums; }
.ftable td.bad { color: var(--fail); font-weight: 600; }
.ftable td.rt { text-align: center; }
.ftable.narrow { max-width: 520px; }
.ftable.dense { font-size: 11.5px; }
.ftable.inc tbody tr:hover th, .ftable.inc tbody tr:hover td { background: #f6ede6; }
.ftable.appr td { font-size: 12px; }
.rt-fail { color: #d0021b; font-weight: 600; }
.rt-pass { color: #1f9d3a; font-weight: 600; }
.rt-na { color: var(--ink-3); }
.doc h1.doc-h { font: 600 24px/1.15 var(--f-head); text-transform: none; letter-spacing: 0; border-bottom: 1px solid var(--ink); padding-bottom: 8px; margin: 26px 0 14px; color: var(--navy); }
.doc h1.doc-h:first-child { margin-top: 0; }
.doc h2.doc-h2 { font: 600 17px/1.2 var(--f-body); margin: 22px 0 8px; color: var(--navy); }
.doc h3.doc-h3 { font: 600 14px/1.3 var(--f-body); margin: 16px 0 6px; color: var(--ink); }
.doc .doc-h span, .doc .doc-h2 span, .doc .doc-h3 span { display: inline-block; min-width: 2.4em; color: var(--ink-3); font-weight: 500; }
.doc p, .doc li { font-size: 13.5px; line-height: 1.6; }
.doc blockquote.std { margin: 8px 0 12px 20px; padding-left: 12px; border-left: 3px solid var(--line); }
.doc blockquote.std p { font-style: italic; color: var(--ink-2); }
.doc ul.cols { columns: 2; column-gap: 24px; }
.doc ul.refs li { margin-bottom: 6px; }
.doc ol.cons li { margin-bottom: 8px; }
.snap { display: none; }

/* review-mode editing */
#btn-edit.on { background: #ffe7a8; border-color: #e2b84a; }
body.editing .ed { outline: 1.5px dashed rgba(92,38,21,0.35); outline-offset: 4px; border-radius: 4px; cursor: text; position: relative; transition: outline-color 0.15s, background 0.15s; }
body.editing .ed:hover { outline-color: var(--rust); background: rgba(255,231,168,0.25); }
body.editing .ed::after { content: "✎"; position: absolute; right: -6px; top: -12px; font-size: 11px; background: var(--rust); color: #fff; border-radius: 999px; padding: 1px 6px; opacity: 0; transition: opacity 0.15s; pointer-events: none; }
body.editing .ed:hover::after { opacity: 1; }
body.editing .ed.is-edited { outline-color: #c98a14; outline-style: solid; }
body.editing .ed.is-edited::before { content: "edited"; position: absolute; left: -2px; top: -13px; font: 600 9.5px/1 var(--f-body); letter-spacing: 0.06em; text-transform: uppercase; background: #c98a14; color: #fff; padding: 2px 5px; border-radius: 3px; }
body.editing .ed:empty { min-height: 1.4em; }
body.editing .ed:empty::before { content: "(empty — click to add)"; color: var(--ink-3); font-style: italic; font-size: 12px; }
.ed.is-open { display: none; }
.ed-box { margin: 6px 0 14px; background: #fffdf6; border: 1.5px solid var(--rust); border-radius: 10px; padding: 8px; box-shadow: var(--shadow); }
.ed-box textarea { width: 100%; min-height: 90px; border: 0; outline: none; background: transparent; font: 400 14px/1.6 var(--f-body); color: var(--ink); resize: vertical; }
.ed-bar { display: flex; align-items: center; gap: 6px; justify-content: flex-end; flex-wrap: wrap; border-top: 1px solid var(--line-2); padding-top: 6px; }
.ed-hint { flex: 1; font-size: 11.5px; color: var(--ink-3); }
.steps { padding-left: 20px; }
.steps li { margin-bottom: 10px; }

/* ---------- stage ---------- */
.stage {
  flex: 1; position: relative; min-width: 0; overflow: hidden;
  background: radial-gradient(ellipse 90% 70% at 55% 38%, #faf8f4 0%, #ece8e0 55%, #dfdad1 100%);
}
#view { width: 100%; height: 100%; display: block; cursor: grab; outline: none; }
#view:active { cursor: grabbing; }
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.lbl { position: absolute; left: 0; top: 0; translate: -50% -50%; will-change: transform; white-space: nowrap; }
.lbl-compass { font: 700 13px/1 var(--f-head); color: var(--rust); }
.lbl-sp { font: 700 12px/1 var(--f-head); color: #b98612; }
.lbl-callout span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--verm); color: #fff; font: 700 13px/1 var(--f-body); box-shadow: 0 0 0 4px rgba(232,85,58,0.25), var(--shadow); animation: pop 0.5s var(--ease) both; }
.lbl-callout.is-behind span { opacity: 0.38; box-shadow: none; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }
.lbl-plan { pointer-events: auto; cursor: pointer; background: rgba(251,250,247,0.92); border: 1px solid var(--line); border-radius: 8px; padding: 4px 8px; font-size: 11.5px; line-height: 1.3; text-align: center; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
.lbl-plan b { display: block; font-weight: 600; }
.lbl-plan:has(.plan-muted) { background: none; border: 0; box-shadow: none; padding: 0; }
.plan-muted { font-style: normal; font-size: 10.5px; color: var(--ink-3); text-shadow: 0 0 3px #fff, 0 0 3px #fff; }
.lbl-plan span { font-weight: 700; }
.lbl-badge { background: var(--ink); color: #fff; font: 700 10.5px/1 var(--f-body); letter-spacing: 0.06em; padding: 5px 8px; border-radius: 999px; text-transform: uppercase; }
.lbl-badge.is-preview { background: var(--verm); }

.toolbar { position: absolute; top: 14px; left: 14px; display: flex; gap: 8px; align-items: center; z-index: 6; }
.toolbar .seg { background: rgba(251,250,247,0.9); backdrop-filter: blur(6px); box-shadow: var(--shadow); }
.tool { border: 0; background: rgba(251,250,247,0.9); backdrop-filter: blur(6px); box-shadow: var(--shadow); border-radius: 10px; padding: 8px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.tool.on { background: #ffe7a8; }
.levels { position: absolute; right: 14px; top: 50%; translate: 0 -50%; display: flex; flex-direction: column; gap: 4px; z-index: 6; background: rgba(251,250,247,0.9); backdrop-filter: blur(6px); padding: 5px; border-radius: 12px; box-shadow: var(--shadow); }
.levels button { width: 40px; height: 32px; border: 0; background: none; border-radius: 8px; cursor: pointer; font: 600 12px/1 var(--f-body); color: var(--ink-2); }
.levels button:hover { background: var(--paper-2); }
.levels button.on { background: var(--ink); color: #fff; }
.card:not([hidden]) ~ .levels, .app.has-card .levels { right: 404px; }
.legend { position: absolute; left: 14px; bottom: 44px; z-index: 6; background: rgba(251,250,247,0.92); backdrop-filter: blur(6px); border-radius: 12px; padding: 10px 12px; box-shadow: var(--shadow); font-size: 12px; max-width: 280px; }
.legend b { display: block; font: 600 12px/1.2 var(--f-body); margin-bottom: 6px; }
.legend .li { display: inline-flex; align-items: center; gap: 6px; margin: 2px 10px 2px 0; color: var(--ink-2); }
.legend .li i { width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(0,0,0,0.12); }
.legend .ramp i { min-width: 120px; }
.tooltip { position: absolute; left: 0; top: 0; z-index: 8; pointer-events: none; background: var(--ink); color: #f3efe8; padding: 7px 10px; border-radius: 8px; font-size: 12.5px; box-shadow: var(--shadow); }
.tooltip b { display: block; font-weight: 600; }
.tooltip .t-pass { color: #8fd3ad; } .tooltip .t-fail { color: #ff9c86; } .tooltip .t-risk { color: #ffd07a; } .tooltip .t-muted { color: #bdb5ab; }
.hint { position: absolute; right: 14px; bottom: 12px; font-size: 11.5px; color: var(--ink-3); z-index: 4; text-align: right; }
.hint kbd { font-size: 10px; }
.sunbar { position: absolute; left: 50%; translate: -50% 0; bottom: 44px; z-index: 7; display: flex; align-items: center; gap: 12px; background: rgba(30,26,23,0.88); color: #f3efe8; padding: 8px 12px; border-radius: 12px; box-shadow: var(--shadow); font-size: 12px; backdrop-filter: blur(6px); }
.sunbar label { display: flex; align-items: center; gap: 6px; }
.sunbar input[type="range"] { width: 130px; accent-color: #ffc23a; }
.sunbar button { border: 0; background: rgba(255,255,255,0.12); color: #fff; width: 28px; height: 28px; border-radius: 50%; cursor: pointer; }
.sun-read { min-width: 190px; }
.sun-read span { color: #ffd98a; }

/* ---------- detail card ---------- */
.card {
  position: absolute; right: 12px; top: 12px; bottom: 12px; width: 380px; z-index: 9; display: flex; flex-direction: column;
  background: rgba(251,250,247,0.97); backdrop-filter: blur(10px); border-radius: 16px; box-shadow: 0 24px 60px -20px rgba(40,28,18,0.45), 0 2px 8px rgba(0,0,0,0.08);
  animation: slidein 0.35s var(--ease) both; overflow: hidden;
}
@keyframes slidein { from { transform: translateX(30px); opacity: 0; } to { transform: none; opacity: 1; } }
.card-head { display: flex; justify-content: space-between; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.card-head h3 { margin: 2px 0; font: 600 26px/1 var(--f-head); text-transform: uppercase; letter-spacing: 0.02em; }
.card-head .sub { font-size: 12.5px; color: var(--ink-3); }
.card-head-r { display: flex; align-items: flex-start; gap: 8px; }
.eyebrow { font: 600 10.5px/1 var(--f-body); letter-spacing: 0.14em; text-transform: uppercase; color: var(--verm); }
.x { border: 0; background: var(--paper-2); width: 28px; height: 28px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
.card-body { overflow-y: auto; padding: 4px 16px 18px; }
.card-body section { padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.card-body section:last-child { border-bottom: 0; }
.card-body h4 { display: flex; justify-content: space-between; align-items: baseline; margin: 0 0 8px; font: 600 14px/1.2 var(--f-head); text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-2); }
.card-body h4 small { color: var(--ink-3); }
.card-body h4 .link { font: 500 12px var(--f-body); text-transform: none; letter-spacing: 0; }
.card-body p { margin: 0 0 6px; font-size: 13.5px; color: var(--ink-2); }
.advice { background: var(--ochre-soft); border-radius: 10px; padding: 10px 12px !important; margin: 10px 0; border: 0 !important; }
.advice.threat { background: #fbeae4; }
.advice h4 { color: var(--rust) !important; }
.advice p { color: var(--ink) !important; }
.advice em { color: var(--ink-2); }
.crit { margin-bottom: 12px; }
.crit-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.crit-name { font-weight: 600; font-size: 13px; }
.crit-name em { font-style: normal; font-weight: 400; color: var(--ink-3); margin-left: 4px; }
.crit-val { font: 600 20px/1 var(--f-head); font-variant-numeric: tabular-nums; }
.crit-fail .crit-val { color: var(--fail); } .crit-pass .crit-val { color: var(--pass); } .crit-risk .crit-val { color: var(--risk); }
.crit-bar { height: 8px; background: var(--line-2); border-radius: 4px; position: relative; margin: 6px 0 4px; }
.crit-bar span { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--ink-3); animation: grow 0.7s var(--ease) both; transform-origin: left; }
@keyframes grow { from { transform: scaleX(0); } }
.crit-fail .crit-bar span { background: var(--fail); } .crit-pass .crit-bar span { background: var(--pass); } .crit-risk .crit-bar span { background: var(--risk); }
.crit-bar b { position: absolute; top: -4px; bottom: -4px; width: 2px; background: var(--ink); }
.crit-foot { font-size: 11.5px; color: var(--ink-3); }
.win-list { display: grid; gap: 3px; }
.win-row { display: grid; grid-template-columns: 70px 1fr 70px 30px; align-items: center; gap: 8px; border: 0; background: none; padding: 6px 6px; border-radius: 7px; cursor: pointer; text-align: left; font-size: 12.5px; }
.win-row:hover { background: var(--paper-2); }
.win-row span { color: var(--ink-3); }
.win-row .gain { height: 6px; background: var(--line-2); border-radius: 3px; position: relative; }
.win-row .gain em { position: absolute; inset: 0 auto 0 0; border-radius: 3px; background: linear-gradient(90deg, #f2e39a, #ec8633, #d2362a); }
.win-row .num { text-align: right; font-weight: 600; color: var(--ink); }
.win-foot { font-size: 11px; color: var(--ink-3); text-align: right; }
.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.facts div span { display: block; font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.06em; }
.facts div b { font-weight: 600; font-size: 13.5px; }
.gain-big b { font: 600 44px/1 var(--f-head); }
.gain-big span { margin-left: 8px; font-size: 12.5px; color: var(--ink-3); }
.gain-scale { height: 10px; border-radius: 5px; margin: 10px 0 4px; position: relative; background: linear-gradient(90deg, #3f63ae, #6e9dd4, #afd0ea, #f2e39a, #f5ba56, #ec8633, #d2362a); }
.gain-scale i { position: absolute; top: -5px; width: 4px; height: 20px; border-radius: 2px; background: var(--ink); translate: -50% 0; box-shadow: 0 0 0 2px #fff; }
.gain-foot { display: flex; justify-content: space-between; font-size: 11px; color: var(--ink-3); }
.flags { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--ink-2); }
.strat-list { display: grid; gap: 6px; }
.strat-row { display: grid; grid-template-columns: 22px 1fr auto; gap: 10px; align-items: center; padding: 8px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; transition: border-color 0.2s; }
.strat-row:hover { border-color: var(--rust); }
.strat-row .strat-txt { font-size: 13px; }
.strat-row .strat-txt small { display: block; color: var(--ink-3); font-size: 11.5px; margin-top: 2px; }
.resp { border: 1.5px solid var(--line); background: var(--card); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.resp-none:hover { border-color: var(--rust); color: var(--rust); }
.resp-explore { background: var(--pass); border-color: var(--pass); color: #fff; }
.resp-not_viable { background: #8c847b; border-color: #8c847b; color: #fff; }
.resp-discuss { background: var(--risk); border-color: var(--risk); color: #fff; }

/* ---------- cover ---------- */
.cover { position: fixed; inset: 0; z-index: 20; pointer-events: none; display: grid; grid-template-columns: minmax(420px, 36%) 1fr; }
.cover[hidden] { display: none; }
.cover-left {
  pointer-events: auto; background: linear-gradient(90deg, rgba(228,226,221,0.98) 70%, rgba(228,226,221,0.85));
  padding: 48px 52px; display: flex; flex-direction: column; gap: 22px; animation: fadein 0.9s var(--ease) both;
  background-image: linear-gradient(rgba(0,0,0,0.035) 1px, transparent 1px), linear-gradient(90deg, rgba(0,0,0,0.035) 1px, transparent 1px);
  background-size: 64px 64px; background-color: #e4e2dd;
}
@keyframes fadein { from { opacity: 0; transform: translateX(-20px); } to { opacity: 1; transform: none; } }
.cover-title { margin-top: auto; }
.cover-title h1 { font: 300 64px/1 var(--f-serif); margin: 0; letter-spacing: -0.01em; }
.cover-title p { margin: 10px 0 0; color: var(--ink-2); }
.cover-verdict b { display: block; font: 600 22px/1.2 var(--f-head); text-transform: uppercase; letter-spacing: 0.02em; color: var(--rust); }
.cover-verdict span { color: var(--ink-3); font-size: 13px; }
.cover-hint { font-size: 13px; color: var(--ink-3); margin: 0; }
.cover-plate {
  pointer-events: auto; align-self: end; justify-self: end; width: min(460px, 40vw); background: var(--rust); color: #f4e9e2;
  padding: 34px 40px 30px; display: grid; gap: 6px; position: relative; animation: plate 1s 0.3s var(--ease) both;
}
@keyframes plate { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: none; } }
.cover-plate::before { content: "&"; position: absolute; left: -26px; top: -30px; width: 58px; height: 58px; border-radius: 50%; border: 3px solid var(--verm); color: var(--verm); display: grid; place-items: center; font: 400 34px/1 var(--f-serif); background: rgba(92,38,21,0.0); }
.cover-plate span { font: 600 22px/1.2 var(--f-head); }
.cover-plate b { font: 600 22px/1.2 var(--f-head); }
.cover-plate small { color: #d9bfb2; }
.cover-fatal { pointer-events: auto; grid-column: 1 / -1; display: grid; place-items: center; align-content: center; gap: 20px; background: var(--paper); }

/* ---------- help / toast ---------- */
.help { position: fixed; inset: 0; z-index: 50; background: rgba(30,26,23,0.45); display: grid; place-items: center; backdrop-filter: blur(3px); }
.help[hidden] { display: none; }
.help-card { position: relative; background: var(--card); border-radius: 18px; padding: 28px 30px; width: min(760px, 92vw); box-shadow: var(--shadow); }
.help-card .x { position: absolute; right: 16px; top: 16px; }
.help-card h2 { font: 600 26px/1 var(--f-head); text-transform: uppercase; margin: 0 0 12px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-top: 16px; }
.help-grid div { background: var(--paper); border-radius: 10px; padding: 12px; font-size: 13px; }
.help-grid b { display: block; margin-bottom: 4px; }
.toast { position: fixed; left: 50%; bottom: 26px; translate: -50% 20px; z-index: 60; max-width: min(620px, 90vw); background: var(--ink); color: #f3efe8; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow); font-size: 13.5px; opacity: 0; pointer-events: none; transition: opacity 0.3s, translate 0.3s var(--ease); }
.toast.show { opacity: 1; translate: -50% 0; }
.toast.error { background: #7d1d12; }
.toast.warn { background: #6b5210; }
.toast.success { background: #1f5a3d; }

@media (max-width: 900px) {
  .main { flex-direction: column-reverse; }
  .story, .app.is-wide .story { width: 100%; height: 52%; border-right: 0; border-top: 1px solid var(--line); }
  .stage { min-height: 48%; }
  .card { width: auto; left: 12px; }
  .hint { display: none; }
  .cover { grid-template-columns: 1fr; }
  .wordmark.big { font-size: 44px; }
}

/* =================== PRINT (PDF export) =================== */
.print-root { display: none; }
/* The 16:9 pages (interim + strategy results). Outside @media print so print.js can lay them
   out off-screen and move what does not fit onto "(continued)" pages before printing. */
.print-root.measuring { display: block; position: absolute; left: -20000px; top: 0; width: 338.67mm; visibility: hidden; }
/* Word export (D-75): pictures of heat maps, legends, marks and the cover are taken from these pages */
.print-root.measuring.capturing { left: 0; visibility: visible; z-index: -1; }
.print-root .page {
  width: 338.67mm; height: 190.5mm; padding: 11mm 14mm 9mm; position: relative; overflow: hidden;
  page-break-after: always; break-after: page; background: #fff; font-size: 9.6pt; color: var(--ink);
  -webkit-print-color-adjust: exact; print-color-adjust: exact;
}
.print-root .p-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 1.2pt solid var(--ink); padding-bottom: 3mm; margin-bottom: 6mm; }
.print-root .p-head h2 { margin: 0; font: 500 19pt/1 var(--f-head); letter-spacing: 0.02em; }
.print-root .p-head .wordmark { font-size: 15pt; }
.print-root .p-foot { position: absolute; left: 14mm; right: 14mm; bottom: 6mm; display: flex; justify-content: space-between; font: 500 13pt/1 var(--f-head); }
.print-root .p-body { height: calc(190.5mm - 11mm - 9mm - 16mm - 12mm); }
.print-root .p-cols { display: grid; grid-template-columns: 1fr 1.15fr; gap: 10mm; height: 100%; }
.print-root .p-cols-wide { grid-template-columns: 1fr 1fr; height: auto; }
.print-root .p-text p { margin: 0 0 2.6mm; line-height: 1.5; color: var(--ink-2); }
.print-root .p-text.small p, .print-root .p-text.small li { font-size: 8.4pt; }
.print-root .p-text h4 { font: 600 11pt var(--f-head); text-transform: uppercase; margin: 4mm 0 2mm; }
.print-root .p-img { width: 100%; border-radius: 2mm; display: block; }
.print-root .p-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 3mm; }
.print-root .p-cap { font-size: 7.5pt; color: var(--ink-3); margin-top: 1.5mm; }
.print-root .p-legend { font-size: 7.5pt; margin-top: 2mm; }
.print-root .p-legend b { margin-right: 3mm; }
.print-root .p-legend .li { display: inline-flex; align-items: center; gap: 1.5mm; margin-right: 3mm; }
.print-root .p-legend .li i { width: 3mm; height: 3mm; border-radius: 0.6mm; display: inline-block; }
.print-root .p-legend .ramp { max-width: 90mm; }
.print-root .p-t { font-size: 8pt; margin: 0 0 4mm; }
.print-root .p-t td, .print-root .p-t th { padding: 1.3mm 2mm !important; }
.print-root .p-narrow { max-width: 90mm; }
.print-root .p-dense { font-size: 7.6pt; }
.print-root .p-dense td, .print-root .p-dense th { padding: 1mm 2mm !important; }
.print-root .p-kv th, .print-root .p-kv td { font-size: 8.5pt; }
.print-root .p-threats { display: grid; grid-template-columns: 1fr 1fr; gap: 4mm; }
.print-root .p-shot { position: relative; }
.print-root .p-shot img { width: 100%; display: block; }
.print-root .p-mark { position: absolute; translate: -50% -50%; width: 6mm; height: 6mm; border-radius: 50%; background: var(--verm); color: #fff; display: grid; place-items: center; font: 700 8pt/1 var(--f-body); box-shadow: 0 0 0 1.2mm rgba(232,85,58,0.25); }
.print-root .p-callouts { columns: 2; column-gap: 8mm; font-size: 8.3pt; color: var(--fail); margin: 3mm 0 0; padding-left: 5mm; }
.print-root .p-callouts li { margin-bottom: 2mm; break-inside: avoid; }
.print-root .p-callouts p { margin: 0; color: #b8341f; }
.print-root .p-carpet { margin: 4mm 0 0; }
.print-root .p-carpet img { width: 100%; height: 30mm; object-fit: fill; display: block; }
.print-root .p-carpet .ramp { max-width: 80mm; }
.print-root .p-fine p, .print-root .p-fine li { font-size: 7.6pt !important; line-height: 1.4 !important; margin-bottom: 1.6mm !important; }
.print-root .p-threecol { columns: 3; column-gap: 8mm; }
.print-root .p-threecol > p { break-after: avoid; }
.print-root .p-threecol ul { padding-left: 4mm; margin: 0 0 3mm; }
.print-root .p-threecol p, .print-root .p-threecol li { font-size: 8.6pt; line-height: 1.5; margin: 0 0 2mm; break-inside: avoid; color: var(--ink-2); }
.print-root .p-img-short { height: 88mm; object-fit: cover; }
.print-root .p-h4 { font: 600 11pt var(--f-head); text-transform: uppercase; margin: 3mm 0 1.5mm; }
.print-root .p-twocol { columns: 2; column-gap: 6mm; font-size: 7.6pt; }
.print-root .p-twocol ul { padding-left: 4mm; margin: 0 0 2mm; }
.print-root .p-twocol p, .print-root .p-twocol li { font-size: 7.6pt; line-height: 1.38; margin: 0 0 1.4mm; break-inside: avoid; }
.print-root .p-cols-wide .hourmatrix { margin: 2mm 0; }
.print-root .p-carpet figcaption { font-size: 7.5pt; color: var(--ink-3); }
.print-root .hourmatrix { padding: 2mm; }
.print-root .p-cover { padding: 0; display: grid; grid-template-columns: 50% 50%; }
.print-root .pc-left { background: #e4e2dd; padding: 16mm 14mm; display: flex; flex-direction: column; justify-content: space-between; }
.print-root .pc-left h1 { font: 300 34pt/1 var(--f-serif); margin: 0; }
.print-root .pc-left .wordmark.big { font-size: 40pt; }
.print-root .pc-right { position: relative; background: #fff; }
.print-root .pc-right img { width: 100%; height: 100%; object-fit: cover; }
.print-root .pc-plate { position: absolute; right: 0; bottom: 0; width: 62%; background: var(--rust); color: #f4e9e2; padding: 9mm 10mm; display: grid; gap: 1.5mm; }
.print-root .pc-plate span, .print-root .pc-plate b { font: 600 15pt/1.2 var(--f-head); }
.print-root .pc-plate small { font-size: 8pt; color: #d9bfb2; }
.print-root .p-stack { font-size: 8.4pt; padding-left: 5mm; }
.print-root .p-stack li { margin-bottom: 2mm; }

@media print {
  @page { size: 338.67mm 190.5mm; margin: 0; }
  html, body { height: auto; overflow: visible; background: #fff; }
  body > *:not(.print-root) { display: none !important; }
  .ed { outline: none !important; background: none !important; }
  .rl { color: inherit !important; text-decoration: none !important; }
  .ed::before, .ed::after { display: none !important; }
  .print-root { display: block; }
  /* ---- final report, A4 portrait (print_final.js injects @page + running header) ---- */
  body.printing-final .final-doc { font: 9.4pt/1.55 var(--f-body); color: #1a1a1a; }
  /* table fills, bands and status colours print as on screen even with the dialog's
     "Background graphics" off (as the 16:9 pages, .print-root .page) */
  .final-doc { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .final-doc .a4 { break-after: page; }
  .final-doc .a4:last-child { break-after: auto; }
  .final-doc .a4-cover { height: 250mm; display: flex; flex-direction: column; }
  .final-doc .a4-cover h1 { font: 700 30pt/1.1 var(--f-body); color: var(--navy); margin: 18mm 0 3mm; }
  .final-doc .a4-cover h2 { font: 400 17pt/1.2 var(--f-body); color: var(--navy); margin: 0 0 6mm; }
  .final-doc .a4-cover .by { font-size: 9pt; color: #333; }
  .final-doc .a4-cover img { width: 100%; max-height: 120mm; object-fit: contain; margin: 10mm 0; }
  .final-doc .a4-cover dl { margin-top: auto; font-size: 9pt; }
  .final-doc .a4-cover dt { margin-top: 3mm; }
  .final-doc .a4-cover dd { margin: 1mm 0 0 8mm; font-weight: 600; }
  .final-doc .revs { border-collapse: collapse; width: 60%; font-size: 9pt; margin-bottom: 120mm; }
  .final-doc .revs th { background: var(--navy); color: #fff; text-align: left; padding: 2mm; }
  .final-doc .revs td { border-bottom: 1px solid #ccc; padding: 1.5mm 2mm; }
  .final-doc .disc h3 { font: 600 11pt var(--f-body); }
  .final-doc .disc p { font-size: 8.8pt; text-align: justify; }
  .final-doc p, .final-doc li { font-size: 9.4pt !important; text-align: justify; line-height: 1.55; }
  .final-doc h1.doc-h { font: 600 15pt/1.2 var(--f-body); color: var(--navy); border: 0; margin: 8mm 0 3mm; break-after: avoid; }
  .final-doc h2.doc-h2 { font: 600 12pt/1.2 var(--f-body); margin: 6mm 0 2mm; break-after: avoid; }
  .final-doc h3.doc-h3 { font: 600 10pt/1.2 var(--f-body); margin: 4mm 0 1.5mm; break-after: avoid; }
  .final-doc .doc-h span, .final-doc .doc-h2 span, .final-doc .doc-h3 span { min-width: 12mm; color: inherit; }
  .final-doc .a4-sec > h1.doc-h:first-child { break-before: page; margin-top: 0; }
  .final-doc .a4-sec:first-child > h1.doc-h:first-child { break-before: auto; }
  .final-doc .ftable { font-size: 8pt; break-inside: avoid; margin: 3mm 0 5mm; }
  .final-doc .ftable.dense { font-size: 7pt; break-inside: auto; }
  .final-doc .ftable thead { display: table-header-group; }
  .final-doc .ftable caption { font-size: 7.8pt; }
  .final-doc .table-scroll { overflow: visible; max-height: none; }
  .final-doc blockquote.std p { font-size: 9pt !important; }
  .final-doc .fsnap { margin: 4mm 0; break-inside: avoid; }
  .final-doc .fsnap img { width: 100%; max-height: 105mm; object-fit: contain; }
  .final-doc .fsnap figcaption { font-size: 7.8pt; font-style: italic; color: #444; }
  .final-doc .snap { display: none; }
  .final-doc ol.toc { list-style: none; padding: 0; }
  .final-doc ol.toc li { font-size: 9.6pt !important; padding: 1mm 0; border-bottom: 1px dotted #bbb; text-align: left; }
  .final-doc ol.toc li span { display: inline-block; min-width: 14mm; }
  .final-doc ol.toc .toc1 { font-weight: 600; margin-top: 2mm; }
  .final-doc ol.toc .toc2 { padding-left: 6mm; }
  .final-doc ol.toc .toc3 { padding-left: 12mm; font-size: 8.8pt !important; color: #444; }
  .final-doc .rl { color: inherit; text-decoration: none; }
}
details.swap { margin: 2px 0 0; font-size: 13px; }
details.swap summary { cursor: pointer; color: var(--rust); font-weight: 600; }
details.swap ul { margin: 4px 0 0; padding-left: 16px; }

/* --- weather files + rounds (D-60/D-61/D-63) ------------------------------------------- */
.wx-switch { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin: 12px 0 6px; max-width: 100%; min-width: 0; }
.wx-switch .lab { font-size: 12.5px; color: var(--ink-3); }
.wx-select { position: relative; display: inline-flex; min-width: 0; max-width: 100%; }
.wx-select::after { content: ""; position: absolute; right: 12px; top: 50%; width: 7px; height: 7px; margin-top: -5px; border-right: 2px solid var(--ink-2); border-bottom: 2px solid var(--ink-2); transform: rotate(45deg); pointer-events: none; }
.wx-select select { appearance: none; -webkit-appearance: none; font: 600 13px var(--f-body); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 7px 34px 7px 12px; max-width: 100%; text-overflow: ellipsis; cursor: pointer; box-shadow: 0 1px 2px rgba(0,0,0,0.06); }
.wx-select select:hover { border-color: var(--ink-3); }
.wx-select select:focus-visible { outline: 2px solid var(--rust); outline-offset: 1px; }
#story-body > * { max-width: 100%; }
.wx-table { font-size: 13px; width: auto; min-width: 100%; }
.wx-table thead th { white-space: nowrap; }
.wx-table thead th.wx-loc { background: #d9b46a; text-align: left; font-size: 12px; letter-spacing: 0.03em; text-transform: uppercase; padding: 6px 10px; }
.wx-table thead th.wx-h { line-height: 1.3; white-space: normal; min-width: 112px; font-weight: 600; }
.wx-table thead th.wx-h b { display: block; font-size: 12.5px; white-space: nowrap; }
.wx-table thead th.wx-h small { margin: 1px 0 3px; }
.wx-table thead th.wx-c { font-size: 11px; font-weight: 600; text-align: right; padding: 4px 10px; }
.wx-table thead th.wx-comp { background: var(--navy, #16283a); color: #fff; }
.wx-table thead th.wx-rowh { vertical-align: bottom; }
.wx-table .wx-g0 { border-left: 2px solid rgba(28,23,16,0.18); }
.wx-table td.wx-comp, .wx-table tr.wx-comp > * { background: #f4f1ea; }
.wx-table td.wx-v { white-space: nowrap; }
.wx-table td.wx-v .bad, .wx-table td.bad { color: var(--fail); font-weight: 700; }
.wx-table td.wx-v .ok { color: var(--ink); }
.wx-table td.wx-v small.wx-crit { display: block; font-size: 10.5px; color: var(--ink-3); }
.wx-table td.is-fail { box-shadow: inset 3px 0 0 var(--fail); }
.wx-table td.is-pass { box-shadow: inset 3px 0 0 var(--pass); }
.wx-table td.na { color: var(--muted); text-align: center; font-size: 12px; }
.wx-table tbody th, .wx-table tfoot th, .wx-table thead th.wx-rowh { position: sticky; left: 0; z-index: 1; background: var(--card); }
.wx-table thead th.wx-rowh { background: var(--ochre); z-index: 2; }
.wx-table tbody tr:nth-child(even) > th { background: #f5f2ea; }
.wx-table tfoot th, .wx-table tfoot td { font-size: 12px; border-top: 1px solid var(--line); padding: 7px 10px; }
.wx-table tbody tr[data-room] { cursor: pointer; }
.wx-table tbody tr[data-room]:hover > th { background: #f7e9df; }
.wx-prev, ul.why { font-size: 13.5px; padding-left: 18px; color: var(--ink-2); }
.wx-prev li, ul.why li { margin: 4px 0; }
.wx-hist { font-size: 12.5px; }
.wx-hist td, .wx-hist th { vertical-align: top; }
.wx-badge { position: fixed; right: 84px; top: calc(var(--top-h) + 66px); z-index: 30; background: var(--risk-soft); color: #6b4a07; border: 1px solid #e7cf98; border-radius: 8px; padding: 6px 10px; font-size: 12.5px; box-shadow: var(--shadow); max-width: 46vw; }
.wx-badge small { display: block; font-size: 11px; opacity: 0.8; }
.round-select { font: 600 12.5px var(--f-body); color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 5px 8px; max-width: 260px; }
.pk-closed .pcell { cursor: not-allowed; opacity: 0.75; }
.pk-closed-note { margin-bottom: 10px; }
@media (max-width: 860px) {
  .wx-badge { left: 12px; right: 12px; top: auto; bottom: 12px; max-width: none; }
  .round-select { max-width: 150px; }
  .wx-table thead th.wx-h { min-width: 92px; }
  .wx-select select { font-size: 12.5px; }
}
@media print { .wx-badge, .wx-switch, .round-select { display: none !important; } }

/* "Issue final report" (D-77): the positive close of the design team's part */
.final-box { margin: 22px 0 10px; padding: 18px 20px; border: 1px solid var(--pass); border-radius: 12px; background: var(--pass-soft); }
.final-box h2 { margin: 0 0 6px; font-size: 18px; }
.final-box p { margin: 0 0 12px; }
.final-confirm { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(63,138,100,0.3); }
.final-confirm ul { margin: 0 0 12px; }
.final-done { display: flex; gap: 14px; align-items: flex-start; margin: 22px 0 10px; padding: 18px 20px; border-radius: 12px; background: var(--pass-soft); border: 1px solid var(--pass); }
.final-done h3 { margin: 0 0 4px; color: var(--pass); }
.final-done p { margin: 0; }
.final-tick { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--pass); color: #fff; font-size: 20px; font-weight: 700; }
