/* Footing. Layout concept: a light table. The drawing is the hero, the engine marks it up like an
   estimator's takeoff (one muted highlighter per material family) and the carbon tally runs along
   the bottom edge like a scale bar. Palette: warm neutral greys, ink-black primary actions and a
   single burnt-orange accent for selection, edits and progress. */
:root {
  --paper: #f3f2ef;          /* workspace */
  --sheet: #ffffff;          /* drawing sheet, inputs */
  --panel: #fafaf8;          /* side surfaces */
  --ink: #1a1917;            /* text, primary actions */
  --graphite: #6b6760;       /* secondary text */
  --rule: #dedbd4;           /* hairlines */
  --accent: #c4501a;         /* selection, edits, progress */
  --accent-soft: rgba(196, 80, 26, .1);
  --on-ink: #fafaf8;         /* text on primary buttons */
  --ok: #2e7d4f; --warn: #a86a12; --crit: #b42318;
  --warn-soft: rgba(168, 106, 18, .12); --crit-soft: rgba(180, 35, 24, .09); --ok-soft: rgba(46, 125, 79, .11);
  /* highlighter per material family: muted, print-like */
  --m-concrete: #7d8794; --m-steel: #4a525c; --m-wood: #b98545; --m-panel: #8f6a43; --m-insul: #b5677f;
  --m-gyp: #a39e96; --m-clad: #4e8379; --m-roof: #6a6787; --m-win: #5687b0; --m-none: #a8a49c;
  --scan: #c4501a;
  --shadow: 0 1px 2px rgba(20, 18, 15, .08), 0 10px 30px -14px rgba(20, 18, 15, .35);
  --sheet-filter: none;
  --f-ui: "IBM Plex Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-cond: "IBM Plex Sans Condensed", "IBM Plex Sans", "Arial Narrow", system-ui, sans-serif;
  --r: 6px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #0f0f0e; --sheet: #161615; --panel: #1a1a18; --ink: #eceae5; --graphite: #9b978f; --rule: #2c2b28;
    --accent: #ee6a2c; --accent-soft: rgba(238, 106, 44, .15); --on-ink: #121211;
    --ok: #5db37e; --warn: #d9a245; --crit: #f07065; --warn-soft: rgba(217, 162, 69, .14); --crit-soft: rgba(240, 112, 101, .12); --ok-soft: rgba(93, 179, 126, .13);
    --m-concrete: #9aa4b0; --m-steel: #c2c8cf; --m-wood: #d7a563; --m-panel: #b98b5b; --m-insul: #d38aa0;
    --m-gyp: #b6b1a8; --m-clad: #6fa79c; --m-roof: #9894b8; --m-win: #7da9cf; --m-none: #77746d;
    --scan: #ee6a2c;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -14px rgba(0, 0, 0, .7);
    --sheet-filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.92);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --paper: #0f0f0e; --sheet: #161615; --panel: #1a1a18; --ink: #eceae5; --graphite: #9b978f; --rule: #2c2b28;
  --accent: #ee6a2c; --accent-soft: rgba(238, 106, 44, .15); --on-ink: #121211;
  --ok: #5db37e; --warn: #d9a245; --crit: #f07065; --warn-soft: rgba(217, 162, 69, .14); --crit-soft: rgba(240, 112, 101, .12); --ok-soft: rgba(93, 179, 126, .13);
  --m-concrete: #9aa4b0; --m-steel: #c2c8cf; --m-wood: #d7a563; --m-panel: #b98b5b; --m-insul: #d38aa0;
  --m-gyp: #b6b1a8; --m-clad: #6fa79c; --m-roof: #9894b8; --m-win: #7da9cf; --m-none: #77746d;
  --scan: #ee6a2c;
  --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 12px 32px -14px rgba(0, 0, 0, .7);
  --sheet-filter: invert(1) hue-rotate(180deg) brightness(.88) contrast(.92);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.45 var(--f-ui);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
h1, h2, h3 { font-family: var(--f-cond); font-weight: 600; text-wrap: balance; margin: 0; letter-spacing: .005em; }
.muted { color: var(--graphite); }
.num { font-family: var(--f-cond); font-variant-numeric: tabular-nums; }

/* ---------------------------------------------------------------- shell */
.app { display: grid; grid-template-rows: auto 1fr auto; grid-template-columns: minmax(0, 1fr); height: 100%; min-height: 0; }
.bar {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-bottom: 1px solid var(--rule); background: var(--paper);
}
.brand { display: flex; align-items: center; gap: 10px; border: 0; background: none; padding: 4px 6px; margin-left: -6px; border-radius: 8px; color: var(--ink); }
.brand:hover { background: var(--rule); }
.brand b { font: 700 22px/1 var(--f-cond); letter-spacing: -.01em; }
.brand svg { align-self: center; }
.bar .projname { display: inline-flex; align-items: center; gap: 8px; border-top: 0; border-right: 0; border-bottom: 0; background: none; cursor: pointer; margin-left: 22px; padding-left: 22px; border-left: 1px solid var(--rule); font: 500 16px var(--f-cond); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.icon-tg { width: 34px; height: 34px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--graphite); }
.icon-tg:hover { background: var(--rule); color: var(--ink); }
.icon-tg svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bar .spacer { flex: 1; }
.btn {
  border: 1px solid var(--rule); background: var(--sheet); border-radius: var(--r); padding: 7px 12px; font-weight: 500;
  display: inline-flex; align-items: center; gap: 8px; white-space: nowrap;
}
.btn:hover { border-color: var(--graphite); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: var(--on-ink); font-weight: 600; }
.btn.primary:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); border-color: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--graphite); }
.btn.ghost:hover { color: var(--ink); border-color: var(--rule); }
.btn.small { padding: 4px 9px; font-size: 13px; }
.iconbtn { width: 32px; height: 32px; justify-content: center; padding: 0; }

.work { display: grid; grid-template-columns: 112px minmax(0, 1fr) minmax(420px, 37%); min-height: 0; }
.rail { border-right: 1px solid var(--rule); overflow-y: auto; padding: 12px 10px; display: flex; flex-direction: column; gap: 10px; }
.thumb { flex: none; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); padding: 0; position: relative; overflow: hidden; text-align: left; transition: border-color .2s, box-shadow .2s; }
.thumb img { display: block; width: 100%; filter: var(--sheet-filter); opacity: .9; }
.thumb .tag { display: block; padding: 4px 6px 5px; font: 600 12px/1.15 var(--f-cond); border-top: 1px solid var(--rule); background: var(--panel); }
.thumb .tag small { display: block; font: 500 11px/1.2 var(--f-ui); color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thumb.active { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.thumb.pending { opacity: .45; }
.thumb .flag { position: absolute; top: 4px; right: 4px; width: 9px; height: 9px; border-radius: 50%; background: var(--warn); box-shadow: 0 0 0 2px var(--sheet); }
.thumb.missing { border-style: dashed; color: var(--crit); padding: 18px 6px; text-align: center; font: 600 12px/1.2 var(--f-cond); background: var(--crit-soft); }

/* ---------------------------------------------------------------- light table */
.table { position: relative; overflow: hidden; min-height: 320px; background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--graphite) 22%, transparent) 1px, transparent 1.2px) 0 0 / 24px 24px, var(--paper); }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.stage canvas { display: block; filter: var(--sheet-filter); box-shadow: 0 1px 2px rgba(0,0,0,.12), 0 12px 40px -18px rgba(20,18,15,.35); }
.stage svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.table .tools { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 6px; z-index: 3; }
.table .tools .btn { background: var(--panel); }
.table .caption { position: absolute; left: 14px; top: 12px; z-index: 3; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; max-width: calc(100% - 28px); }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px; font: 600 12.5px/1.3 var(--f-cond); background: var(--panel); border: 1px solid var(--rule); color: var(--ink); white-space: nowrap; }
.chip.live { border-color: var(--scan); color: var(--scan); }
.chip.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--scan); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: .25; } }

/* overlay vocabulary */
.ov { fill: none; vector-effect: non-scaling-stroke; }
.ov.draw { stroke-dasharray: 1; stroke-dashoffset: 1; animation: draw var(--d, 900ms) ease-out forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.ov-walls { stroke: var(--accent); stroke-width: 2.2; opacity: .85; }
.ov-dim { stroke: var(--ok); stroke-width: 2.2; }
.ov-textbox { fill: var(--accent); opacity: 0; animation: blip 1.1s ease-out forwards; }
@keyframes blip { 0% { opacity: 0; } 30% { opacity: .28; } 100% { opacity: .07; } }
.ov-fill { stroke-width: 1.4; transform-box: view-box; animation: spread var(--d, 700ms) cubic-bezier(.2,.7,.2,1) both; }
@keyframes spread { from { transform: scale(.2); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.ov-box { stroke-width: 1.6; }
.ov-pop { transform-box: fill-box; transform-origin: center; animation: pop .45s cubic-bezier(.2,1.6,.4,1) both; }
@keyframes pop { from { transform: scale(0); } to { transform: scale(1); } }
.ov-label { font: 600 10px var(--f-cond); paint-order: stroke; stroke: var(--sheet); stroke-width: 3px; stroke-linejoin: round; fill: var(--ink); }
.ov-label.big { font-size: 13px; }
.ov-label { opacity: 0; animation: fadein .35s ease-out forwards; animation-delay: var(--ld, 0ms); }
@keyframes fadein { to { opacity: 1; } }
.ov-warn { fill: url(#hatch-warn); stroke: var(--crit); stroke-width: 2; }
.ov-trace { stroke-width: 4; }
.ov-trace-fill { fill-opacity: .32; stroke-width: 2.5; }
.beam { fill: url(#beam); }
.stamp { font: 700 16px var(--f-cond); }

.m-concrete { --c: var(--m-concrete); } .m-steel { --c: var(--m-steel); } .m-wood { --c: var(--m-wood); } .m-panel { --c: var(--m-panel); }
.m-insul { --c: var(--m-insul); } .m-gyp { --c: var(--m-gyp); } .m-clad { --c: var(--m-clad); } .m-roof { --c: var(--m-roof); } .m-win { --c: var(--m-win); } .m-none { --c: var(--m-none); }
.ov.m { stroke: var(--c); }
.ov-tint.m { fill: color-mix(in srgb, var(--c) 30%, transparent); stroke: var(--c); }
.ov-fill.m { fill: color-mix(in srgb, var(--c) 30%, transparent); stroke: var(--c); }

/* ---------------------------------------------------------------- side panel */
.side { border-left: 1px solid var(--rule); background: var(--panel); display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.side-head { padding: 14px 18px 10px; border-bottom: 1px solid var(--rule); }
.side-body { overflow-y: auto; flex: 1; min-height: 0; padding: 14px 18px 24px; }
.tabs { display: flex; gap: 2px; overflow-x: auto; padding: 0 12px; border-bottom: 1px solid var(--rule); background: var(--panel); }
.tab { border: 0; background: none; padding: 11px 10px 9px; font: 600 14.5px var(--f-cond); color: var(--graphite); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tab .count { display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 5px; border-radius: 9px; background: var(--warn-soft); color: var(--warn); font-size: 12px; }

.now { font: 600 15px/1.3 var(--f-cond); display: flex; gap: 10px; align-items: baseline; }
.now small { font: 500 13px var(--f-ui); color: var(--graphite); }
.progress { height: 3px; background: var(--rule); border-radius: 2px; margin-top: 10px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--scan); transition: width .4s; }

/* live bill */
.bill-live { display: flex; flex-direction: column; gap: 1px; }
.bl-group { font: 600 12.5px var(--f-cond); color: var(--graphite); margin: 12px 0 4px; letter-spacing: .02em; }
.bl-row { display: grid; grid-template-columns: 10px minmax(0,1fr) auto auto; gap: 10px; align-items: baseline; padding: 6px 0; border-bottom: 1px dashed var(--rule); animation: slidein .45s ease-out both; }
@keyframes slidein { from { opacity: 0; transform: translateY(6px); } }
.bl-row .sw { width: 10px; height: 10px; border-radius: 2px; background: var(--c); align-self: center; }
.bl-row .el { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-row .q { color: var(--graphite); font-size: 13.5px; }
.bl-row .kg { font: 600 14px var(--f-cond); min-width: 64px; text-align: right; }
.note-row { display: flex; gap: 8px; padding: 7px 10px; margin: 6px 0; border-radius: 4px; font-size: 13.5px; background: var(--warn-soft); animation: slidein .4s both; }
.note-row.crit { background: var(--crit-soft); }
.note-row.ok { background: var(--ok-soft); }
.note-row b { font-family: var(--f-cond); white-space: nowrap; }

/* status encodings: solid / dashed / hatched */
.st { display: inline-flex; align-items: center; padding: 1px 7px; border-radius: 3px; font: 600 11.5px/1.5 var(--f-cond); letter-spacing: .02em; border: 1px solid; white-space: nowrap; }
.st.measured { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.st.inferred { color: var(--warn); border-color: var(--warn); border-style: dashed; }
.st.assumed { color: var(--crit); border-color: var(--crit); background: repeating-linear-gradient(135deg, var(--crit-soft) 0 3px, transparent 3px 6px); }
.st.overridden { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

/* ---------------------------------------------------------------- tally */
.tally {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 22px; align-items: center;
  padding-block: 10px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  border-top: 1px solid var(--rule); background: var(--paper);
}
.tally .total { display: flex; align-items: baseline; gap: 8px; }
.tally .total b { font: 700 30px/1 var(--f-cond); letter-spacing: -.01em; min-width: 3.6ch; text-align: right; }
.tally .total span { color: var(--graphite); font-size: 13px; line-height: 1.2; }
.stack { display: flex; height: 14px; border-radius: 3px; overflow: hidden; background: var(--rule); }
.stack i { display: block; height: 100%; background: var(--c); transition: width .6s cubic-bezier(.2,.7,.2,1); width: 0; flex: none; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 12.5px; color: var(--graphite); }
.legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.legend span::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--c); }
.tally .intensity { text-align: right; }
.tally .intensity b { font: 700 22px/1 var(--f-cond); }
.tally .intensity span { display: block; color: var(--graphite); font-size: 12.5px; }

/* ---------------------------------------------------------------- intake */
.intake { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 0; min-height: 0; overflow: auto; }
.drop {
  margin: 22px; border: 2px dashed var(--rule); border-radius: 10px; background: var(--sheet); position: relative;
  display: grid; place-items: center start; min-height: 420px; padding: 28px 28px 28px 6%; transition: border-color .2s, background .2s; overflow: hidden;
}
.drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, var(--sheet)); }
.drop .inner { max-width: min(520px, 48%); text-align: left; position: relative; z-index: 1; }
@media (max-width: 820px) { .drop .inner { max-width: 100%; } }
.drop h2 { font-size: clamp(30px, 4.2vw, 46px); line-height: 1.02; letter-spacing: -.015em; }
.drop p { color: var(--graphite); max-width: 52ch; margin: 14px 0 22px; }
.drop .actions { display: flex; gap: 10px; flex-wrap: wrap; }
.drop .plate { position: absolute; inset: 0; opacity: .5; pointer-events: none; }
.drop .hero-sheet { position: absolute; right: -4%; top: 50%; width: 54%; transform: translateY(-50%) rotate(-2deg); pointer-events: none; opacity: .9; }
.drop .hero-sheet canvas, .drop .hero-sheet img { width: 100%; display: block; filter: var(--sheet-filter); box-shadow: 0 10px 40px -18px rgba(20,18,15,.4); }
.drop .hero-sheet svg { position: absolute; inset: 0; width: 100%; height: 100%; }
.drop .inner { padding: 18px 0; }
@media (max-width: 820px) { .drop .hero-sheet { display: none; } }
.gap.click { cursor: pointer; }
.gap.click:hover p { color: var(--accent); }
.drop .plate svg { width: 100%; height: 100%; }
.facts { border-left: 1px solid var(--rule); background: var(--panel); padding: 4px 24px 8px; display: flex; flex-direction: column; }
.facts > div { padding: 24px 0; }
.facts > div + div { border-top: 1px solid var(--rule); }
.facts > div > :last-child { margin-bottom: 0; }
.facts h3 { font-size: 17px; margin-bottom: 6px; }
.facts p.help { margin: 0 0 16px; color: var(--graphite); font-size: 13.5px; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; }
.field select, .field input[type="text"] { padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); width: 100%; }
.facts .field input:not([type="checkbox"]):not([type="radio"]) { padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); font: inherit; width: 100%; }
.samples { display: grid; gap: 8px; }
.sample { display: grid; grid-template-columns: 70px minmax(0,1fr); gap: 12px; align-items: center; text-align: left; padding: 8px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
.sample:hover { border-color: var(--accent); }
.sample img { width: 70px; border-radius: 3px; border: 1px solid var(--rule); filter: var(--sheet-filter); }
.sample b { font: 600 15px var(--f-cond); display: block; }
.sample span { font-size: 13px; color: var(--graphite); }
.checkline { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-bottom: 6px; }

/* ---------------------------------------------------------------- results panels */
.kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.kpi b { display: block; font: 700 40px/1 var(--f-cond); letter-spacing: -.02em; }
.kpi span { color: var(--graphite); font-size: 13.5px; }
.kpi .unit { font: 600 18px var(--f-cond); margin-left: 4px; color: var(--graphite); }
.kpi b.sub { display: inline; font-size: 15px; letter-spacing: 0; color: var(--ink); }
.banner.plaus-high { border-left-color: var(--crit); }
.banner.plaus-medium { border-left-color: var(--warn); }
.tally-sub { display: block; width: 100%; margin-top: 2px; font-size: 12px; color: var(--graphite); line-height: 1.3; }
.tally-sub b { font: 600 13px var(--f-cond); color: var(--ink); }
.tally .total { flex-wrap: wrap; }
.decisions { display: flex; flex-direction: column; gap: 12px; }
.decision { border: 1px solid var(--rule); border-radius: var(--r); padding: 12px 14px; background: var(--sheet); }
.decision.settled { border-left: 3px solid var(--ok); }
.decision-h { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.decision-h b { font: 600 15px var(--f-cond); }
.decision-h .range { font: 600 14px var(--f-cond); color: var(--ink); white-space: nowrap; }
.decision-opts { display: flex; flex-wrap: wrap; gap: 6px; }
.decision-opt { display: inline-flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; max-width: 100%; }
.decision-opt span { font-size: 12.5px; line-height: 1.25; white-space: normal; }
.decision-opt b { font: 600 13px var(--f-cond); color: var(--accent); }
.decision-pick { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.decision-pick b { font: 600 14px var(--f-cond); }
.section { margin-top: 22px; }
.section > h3 { font-size: 16px; margin-bottom: 10px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.section > h3 small { font: 500 12.5px var(--f-ui); color: var(--graphite); }
.bench svg { width: 100%; height: auto; display: block; }
.bars { display: grid; gap: 7px; }
.barrow { display: grid; grid-template-columns: minmax(96px, 30%) minmax(0, 1fr) 70px; gap: 10px; align-items: center; font-size: 14px; }
.barrow .track { height: 12px; background: color-mix(in srgb, var(--rule) 55%, transparent); border-radius: 2px; overflow: hidden; }
.barrow .track i { display: block; height: 100%; background: var(--c); transition: width .6s cubic-bezier(.2,.7,.2,1); }
.barrow .v { text-align: right; font: 600 14px var(--f-cond); }
.barrow .v small { display: block; font: 500 11.5px var(--f-ui); color: var(--graphite); }
.quality { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.quality div { border: 1px solid var(--rule); border-radius: var(--r); padding: 8px 10px; background: var(--sheet); }
.quality b { font: 700 20px/1.1 var(--f-cond); display: block; }
.quality span { font-size: 12.5px; color: var(--graphite); }
.banner { border: 1px solid var(--rule); border-left: 3px solid var(--accent); background: var(--sheet); border-radius: var(--r); padding: 10px 12px; margin-bottom: 14px; font-size: 14px; }
.banner b { font-family: var(--f-cond); font-size: 15px; }
.modules { display: flex; gap: 6px; flex-wrap: wrap; }
.modules .chip.off { color: var(--graphite); border-style: dashed; background: transparent; }

/* BoQ */
.boq-tools { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.boq { width: 100%; border-collapse: collapse; font-size: 14px; table-layout: fixed; }
.boq col.c-q { width: 88px; } .boq col.c-u { width: 58px; } .boq col.c-b { width: 84px; } .boq col.c-k { width: 66px; }
.boq .el span:last-child { overflow: hidden; text-overflow: ellipsis; }
.detail td { overflow-wrap: anywhere; }
.factor select { width: 100%; }
.boq th { text-align: left; font: 600 12.5px var(--f-cond); color: var(--graphite); padding: 6px 6px; border-bottom: 1px solid var(--rule); position: sticky; top: -14px; background: var(--panel); z-index: 1; }
.boq td { padding: 7px 6px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.boq tr.line { cursor: pointer; }
.boq tr.line:hover td { background: color-mix(in srgb, var(--accent) 5%, transparent); }
.boq tr.line.open td { background: color-mix(in srgb, var(--accent) 7%, transparent); }
.boq .grp td { font: 600 13px var(--f-cond); color: var(--graphite); padding-top: 14px; border-bottom-color: transparent; }
.boq .el { display: flex; gap: 8px; align-items: center; min-width: 0; }
.boq .el .sw { flex: none; width: 9px; height: 9px; border-radius: 2px; background: var(--c); }
.boq .qty input { width: 100%; text-align: right; border: 1px solid transparent; background: transparent; border-radius: 4px; padding: 3px 5px; font: 600 14px var(--f-cond); }
.boq .qty input:hover { border-color: var(--rule); background: var(--sheet); }
.boq .qty input:focus { border-color: var(--accent); background: var(--sheet); }
.boq td.r { text-align: right; white-space: nowrap; }
.boq .kg { font: 600 14px var(--f-cond); }
.detail td { background: var(--sheet); padding: 12px 12px 14px; }
.detail .formula { font-size: 13.5px; margin-bottom: 8px; }
.inputs { display: grid; gap: 4px; margin: 6px 0 12px; }
.inp { display: grid; grid-template-columns: minmax(0,1fr) auto auto; gap: 8px; align-items: center; font-size: 13.5px; padding: 3px 0; border-bottom: 1px dotted var(--rule); }
.inp button.src { border: 0; background: none; color: var(--accent); padding: 0; font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; text-align: left; }
.factor { border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 12px; font-size: 13.5px; display: grid; gap: 6px; }
.factor .kv { display: grid; grid-template-columns: 112px minmax(0,1fr); gap: 2px 10px; }
.factor .kv span:nth-child(odd) { color: var(--graphite); }
.factor a { color: var(--accent); word-break: break-word; }
.flag { display: inline-flex; gap: 4px; align-items: center; font: 600 12px var(--f-cond); padding: 1px 6px; border-radius: 3px; background: var(--warn-soft); color: var(--warn); }
.flag.crit { background: var(--crit-soft); color: var(--crit); }
.flag.ok { background: var(--ok-soft); color: var(--ok); }
.factor select { padding: 5px 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); max-width: 100%; }
.recon { font-size: 13px; color: var(--graphite); }

/* swaps */
.scenario { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 10px; padding: 12px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); margin-bottom: 14px; }
.scenario b { display: block; font: 700 24px/1.1 var(--f-cond); }
.scenario span { font-size: 12.5px; color: var(--graphite); }
.scenario .delta b { color: var(--ok); }
.swap { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 6px 14px; padding: 12px 0; border-bottom: 1px solid var(--rule); align-items: center; }
.swap h4 { margin: 0; font: 600 15.5px var(--f-cond); }
.swap p { margin: 2px 0 0; font-size: 13px; color: var(--graphite); }
.swap .impact { grid-column: 1 / -1; display: grid; grid-template-columns: minmax(0,1fr) 92px; gap: 10px; align-items: center; }
.swap .impact .track { height: 8px; position: relative; background: color-mix(in srgb, var(--rule) 55%, transparent); border-radius: 2px; }
.swap .impact .track i { position: absolute; top: 0; bottom: 0; border-radius: 2px; }
.swap .impact .v { text-align: right; font: 600 14px var(--f-cond); }
.swap.save .impact i { background: var(--ok); right: 50%; }
.swap.cost .impact i { background: var(--crit); left: 50%; }
.swap .impact .track::after { content: ""; position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--graphite); }
.toggle { position: relative; width: 40px; height: 22px; border-radius: 11px; border: 1px solid var(--rule); background: var(--rule); padding: 0; flex: none; }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--sheet); transition: transform .2s; }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); }
.toggle[aria-pressed="true"]::after { transform: translateX(18px); }
.rank { font: 700 13px var(--f-cond); color: var(--graphite); margin-right: 6px; }

/* gaps */
.gap { display: grid; grid-template-columns: 4px minmax(0,1fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.gap .stripe { border-radius: 2px; background: var(--warn); }
.gap.high .stripe { background: var(--crit); }
.gap.low .stripe { background: var(--graphite); }
.gap p { margin: 0; font-size: 14px; }
.gap .act { margin-top: 3px; font-size: 13px; color: var(--graphite); }
.gap .res { margin-top: 4px; font-size: 13px; color: var(--ok); }
.assume { display: grid; grid-template-columns: minmax(0,1fr) 100px; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px dotted var(--rule); font-size: 14px; }
.assume input { width: 100%; padding: 5px 7px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); text-align: right; }
.assume small { display: block; color: var(--graphite); font-size: 12.5px; }

/* report */
.report { background: var(--sheet); border: 1px solid var(--rule); padding: 22px 24px; border-radius: 4px; font-size: 14px; }
.report h2 { font-size: 24px; }
.report h3 { font-size: 16px; margin: 18px 0 6px; }
.report table { width: 100%; border-collapse: collapse; font-size: 13px; }
.report td, .report th { border-bottom: 1px solid var(--rule); padding: 5px 4px; text-align: left; vertical-align: top; }
.report th { font: 600 12.5px var(--f-cond); color: var(--graphite); }
.report td.r, .report th.r { text-align: right; }
.report .sig { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; margin-top: 18px; font-size: 13px; }
.report .sig div { border-top: 1px solid var(--ink); padding-top: 4px; color: var(--graphite); }
.toast { position: fixed; top: calc(62px + env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--sheet); padding: 9px 16px; border-radius: 6px; font-size: 14px; z-index: 50; animation: slidein .25s both; }


/* ---------------------------------------------------------------- sheet review */
/* dock */
.table.reviewing .tools { top: 12px; bottom: auto; }
.table.reviewing .caption { max-width: calc(100% - 160px); }
.dock {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 4;
  display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; width: min(760px, calc(100% - 24px));
  background: color-mix(in srgb, var(--panel) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 12px 34px -14px rgba(0,0,0,.45), 0 1px 2px rgba(0,0,0,.08);
  animation: dockin .35s cubic-bezier(.2,.8,.2,1) both;
}
@keyframes dockin { from { opacity: 0; transform: translate(-50%, 12px); } }
.dock-btn { padding: 8px 14px; font-size: 14px; border-radius: 8px; }
.dock-btn:disabled { opacity: .4; cursor: default; }
.dock-btn:disabled:hover { border-color: var(--rule); }
.dock-btn { flex: none; }
#rv-next.finish { background: var(--accent); border-color: var(--accent); color: #fff; }
.dock-mid { display: grid; gap: 7px; flex: 1 1 auto; min-width: 0; padding: 0 6px; }
.dock-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.dock-title b { font: 600 14px var(--f-cond); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dock-title > span { flex: none; }
.chip.edits { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.dots { display: flex; gap: 5px; }
.dot { flex: 1 1 18px; max-width: 26px; }
.dot.cur { flex-grow: 2; max-width: 40px; }
.dot { min-width: 8px; height: 6px; padding: 0; border: 0; border-radius: 3px; background: var(--rule); position: relative; transition: background .2s, width .2s; }
.dot::before { content: ""; position: absolute; inset: -8px -2px; }
.dot.done { background: var(--ok); }
.dot.flagged::after { content: ""; position: absolute; top: -3px; right: -2px; width: 5px; height: 5px; border-radius: 50%; background: var(--warn); }
.dot.cur { background: var(--accent); }
.dot:hover { background: var(--graphite); }
.dot.cur:hover { background: var(--accent); }
.thumb.done .tag::after { content: "✓"; float: right; color: var(--ok); font-size: 12px; }

/* ---------------------------------------------------------------- immersive review: drawing full screen, UI floats */
.app { position: relative; }
.app.immersive { grid-template-rows: auto 1fr; }
.app.immersive .work { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
.app.immersive .table { grid-area: 1 / 1; }
.app.immersive .side { display: none; }
.app.immersive .rail { position: absolute; left: 10px; top: 10px; bottom: calc(var(--tally-h, 72px) + 10px + 44px); width: 112px; z-index: 5; background: var(--panel);
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 12px 12px 0 0; box-shadow: var(--shadow); transition: transform .25s cubic-bezier(.2,.8,.2,1), opacity .25s; }
.app.immersive .tally { position: absolute; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--paper); border-top: 1px solid var(--rule); }
.app.immersive .bar { padding-block: 6px; }
.app.immersive .table .caption { left: 142px; transition: left .25s; }
.app.immersive .dock { bottom: calc(var(--tally-h, 72px) + 8px); transition: bottom .25s; }
.tools-sep { width: 8px; }
.chip.step { font-weight: 500; max-width: 50vw; overflow: hidden; text-overflow: ellipsis; }

/* collapse toggles: only while immersive */
.edge-tg { display: none; }
.tally-tg { display: inline-flex; align-items: center; justify-content: center; position: absolute; left: 50%; top: -22px; transform: translateX(-50%); width: 56px; height: 22px; padding: 0; z-index: 6;
  border: 1px solid var(--rule); border-bottom: 0; border-radius: 8px 8px 0 0; background: var(--paper); color: var(--graphite); }
.tally-tg:hover { color: var(--ink); }
.tally-tg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.tally { position: relative; }
.app.immersive .edge-tg { display: inline-flex; align-items: center; justify-content: center; gap: 4px; border: 1px solid var(--rule); background: color-mix(in srgb, var(--panel) 80%, transparent);
  backdrop-filter: blur(6px); color: var(--graphite); padding: 0; z-index: 6; }
.app.immersive .edge-tg:hover { color: var(--ink); border-color: var(--graphite); }
.app.rail-collapsed.immersive .rail { transform: translateX(-130%); opacity: 0; pointer-events: none; }
.app.rail-collapsed.immersive .table .caption { left: 62px; }
.app.tally-collapsed .tally { position: absolute; left: 12px; right: auto; bottom: 10px; z-index: 5; padding: 6px 14px; grid-template-columns: auto auto; gap: 16px; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--paper); box-shadow: 0 8px 24px -12px rgba(0,0,0,.5); }
.app.tally-collapsed .tally .stackwrap { display: none; }
.app.tally-collapsed .tally .total b { font-size: 22px; }
.app.tally-collapsed .tally .intensity b { font-size: 18px; }
.app.tally-collapsed .tally-tg { left: auto; right: -10px; top: -10px; transform: none; width: 22px; height: 22px; border: 1px solid var(--rule); border-radius: 50%; background: var(--paper); }
.app.tally-collapsed.immersive .dock { bottom: 12px; }
.app.tally-collapsed.immersive .rail { bottom: calc(74px + 44px); }

/* blobs: one circle per value, sitting on what it measured */
.pins, .leaders { position: absolute; inset: 0; pointer-events: none; z-index: 3; overflow: visible; width: 100%; height: 100%; }
.leaders line { stroke: var(--c, var(--accent)); stroke: var(--accent); stroke-width: 1.4; stroke-dasharray: 2 3; }
.leaders circle { fill: var(--accent); stroke: var(--sheet); stroke-width: 1.5; }
.leaders g.near { display: none; }
.leaders .off, .pins .off { opacity: 0 !important; pointer-events: none !important; }
.leaders g.pin-in { animation: fadein .35s ease-out both; animation-delay: calc(var(--i, 0) * 45ms + 250ms); }
.blob { width: 42px; height: 42px; border-radius: 50%; padding: 0; display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: 0;
  border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 22%, var(--panel)); color: var(--ink); line-height: 1;
  box-shadow: 0 4px 14px -4px rgba(0,0,0,.55); pointer-events: auto; transition: box-shadow .15s; }
.pins .blob { position: absolute; left: 0; top: 0; }
.blob b { font: 700 13px/1 var(--f-cond); letter-spacing: .02em; }
.blob span { font: 600 9.5px/1.1 var(--f-cond); color: var(--graphite); margin-top: 1px; }
.blob.st-inferred { border-style: dashed; }
.blob.st-assumed { border-style: dotted; }
.blob.edited { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 26%, var(--panel)); }
.blob.edited span { color: var(--accent); }
.blob:hover, .blob.hot { z-index: 2; box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 40%, transparent), 0 6px 18px -4px rgba(0,0,0,.6); }
.blob.sel { box-shadow: 0 0 0 3px var(--accent), 0 6px 18px -4px rgba(0,0,0,.6); }
.blob.sel::after { content: ""; position: absolute; right: -2px; top: -2px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); border: 2px solid var(--sheet); }
.pins .blob.pin-in { animation: blobin .5s cubic-bezier(.2,1.5,.4,1) both; animation-delay: calc(var(--i, 0) * 45ms); }
@keyframes blobin { from { opacity: 0; translate: var(--fx, 0) var(--fy, 0); scale: .1; } }
.fblob { --c: var(--warn); width: 28px; height: 28px; background: var(--warn); border-color: var(--sheet); color: #fff; }
.fblob.high { --c: var(--crit); background: var(--crit); }
.fblob b { font-size: 15px; }

/* hover highlight on the drawing: no entrance animation, so hovering never makes the sheet pulse */
.hl .ov-fill, .hl .ov-pop, .hl .ov { animation: none !important; }

/* top bar while reviewing */
.app.immersive .table .caption { gap: 6px; }
.tb-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; padding: 0; border-radius: 8px; border: 1px solid var(--rule); background: var(--panel); color: var(--ink); }
.tb-btn:hover:not(:disabled) { border-color: var(--graphite); }
.tb-btn:disabled { opacity: .4; cursor: default; }
.tb-btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.tb-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tb-sheet { height: 34px; padding: 0 30px 0 12px; border-radius: 8px; border: 1px solid var(--rule); background: var(--panel); font: 600 14px var(--f-cond); max-width: 320px;
  appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--graphite) 50%), linear-gradient(135deg, var(--graphite) 50%, transparent 50%);
  background-position: right 14px center, right 9px center; background-size: 5px 5px; background-repeat: no-repeat; }
.chip.step.live::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--scan); animation: pulse 1s infinite; }

/* zoom: big magnifier buttons, bottom right above the carbon bar */
.zoomdock { position: absolute; right: 16px; bottom: calc(var(--tally-h, 72px) + 12px); z-index: 4; display: flex; gap: 8px; transition: bottom .25s; }
.app.tally-collapsed .zoomdock, .app:not(.immersive) .zoomdock { bottom: 12px; }
.zbtn { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; padding: 0; border: 1px solid var(--rule); background: var(--panel); color: var(--ink);
  box-shadow: 0 8px 22px -10px rgba(0,0,0,.55); }
.zbtn:hover { border-color: var(--accent); color: var(--accent); }
.zbtn svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* the stack of open values, right edge */
.vstack { position: absolute; right: 12px; top: 52px; bottom: calc(var(--tally-h, 72px) + 76px); z-index: 4; width: 300px; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.app.tally-collapsed .vstack { bottom: 72px; }
.vstack > * { pointer-events: auto; }
.vstack-h { display: flex; justify-content: space-between; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--panel) 70%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--rule); }
.vstack-h b { font: 600 13.5px var(--f-cond); }
.vstack-loose { padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--panel) 70%, transparent); backdrop-filter: blur(6px); border: 1px solid var(--rule); }
.vstack-loose small { display: block; color: var(--graphite); font-size: 12px; margin-bottom: 6px; }
.vstack-loose > div { display: flex; flex-wrap: wrap; gap: 6px; }
.vstack-loose .blob { position: relative; }
.vstack-b { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; min-height: 0; padding: 2px 2px 6px; scrollbar-width: thin; }
.vstack-b:empty { display: none; }
.vstack-hint { margin: 0; padding: 8px 10px; border-radius: 8px; font-size: 12.5px; color: var(--graphite); background: color-mix(in srgb, var(--panel) 60%, transparent); border: 1px dashed var(--rule); }
.card { flex: none; padding: 9px 11px 10px; border-radius: 10px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(8px);
  border: 1px solid var(--rule); border-left: 3px solid var(--c); box-shadow: 0 8px 24px -12px rgba(0,0,0,.55); font-size: 12.5px; }
.card.card-in { animation: cardin .3s cubic-bezier(.2,.8,.2,1) both; }
@keyframes cardin { from { opacity: 0; transform: translateY(-8px); } }
.card.flash { animation: cardflash .7s ease-out; }
@keyframes cardflash { 0% { box-shadow: 0 0 0 3px var(--accent); } 100% { box-shadow: 0 8px 24px -12px rgba(0,0,0,.55); } }
.card:focus-within, .card:hover { border-color: var(--accent); border-left-color: var(--c); }
.card-h { display: grid; grid-template-columns: auto minmax(0,1fr) auto; gap: 9px; align-items: center; }
.card .code { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font: 700 12px var(--f-cond); border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 22%, var(--panel)); }
.card-t b { display: block; font: 600 14.5px/1.15 var(--f-cond); }
.card-t small { display: block; color: var(--graphite); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-x { width: 24px; height: 24px; border-radius: 50%; border: 0; background: transparent; color: var(--graphite); font-size: 18px; line-height: 1; padding: 0; }
.card-x:hover { background: var(--rule); color: var(--ink); }
.card-v { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 10px; align-items: center; margin: 8px 0 6px; }
.card-kg { font: 700 15px var(--f-cond); }
.pin-q { display: flex; align-items: center; gap: 6px; border: 1px solid var(--rule); border-radius: 6px; padding-right: 8px; background: var(--sheet); cursor: text; }
.pin-q:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin-q input { width: 100%; min-width: 0; border: 0; background: transparent; padding: 5px 4px 5px 8px; text-align: right; font: 700 17px var(--f-cond); outline: none; }
.pin-q span { color: var(--graphite); white-space: nowrap; }
.card-s { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.pin-d { margin-top: 8px; padding-top: 7px; border-top: 1px dotted var(--rule); }
.pin-d .formula { font-weight: 600; margin-bottom: 4px; overflow-wrap: anywhere; }
.pin-d .inp { grid-template-columns: minmax(0,1fr) auto 8px; font-size: 12px; }
.card-fac { margin-top: 6px; font-size: 11.5px; color: var(--graphite); }
.flag-card { --c: var(--warn); } .flag-card.high { --c: var(--crit); }
.flag-card .code { background: var(--c); color: #fff; border-color: var(--c); font-size: 15px; }
.flag-card p { margin: 7px 0 0; } .flag-card .act { color: var(--graphite); } .flag-card .res { color: var(--ok); }
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ok); }
.st-dot.inferred { background: var(--warn); } .st-dot.assumed { background: var(--crit); } .st-dot.overridden { background: var(--accent); }
.inp.here { background: var(--accent-soft); border-radius: 3px; padding-inline: 4px; }
.linkbtn { border: 0; background: none; padding: 0; color: var(--accent); font-size: 12.5px; text-decoration: underline; text-underline-offset: 2px; }
.linkbtn[hidden] { display: none; }
.rv-was { color: var(--graphite); }

@media (max-width: 1100px) {
  .work { grid-template-columns: 84px minmax(0, 1fr) minmax(320px, 40%); }
  .thumb .tag small { display: none; }
}
@media (max-width: 820px) {
  .app { height: auto; min-height: 100%; }
  .work { grid-template-columns: 1fr; }
  .rail { flex-direction: row; border-right: 0; border-bottom: 1px solid var(--rule); overflow-x: auto; overflow-y: hidden; }
  .thumb { flex: 0 0 92px; }
  .table { height: 62vh; }
  .side { border-left: 0; border-top: 1px solid var(--rule); }
  .side-body { overflow: visible; }
  .intake { grid-template-columns: 1fr; }
  .facts { border-left: 0; border-top: 1px solid var(--rule); }
  .drop { margin: 14px 0; min-height: 360px; }
  .tally { grid-template-columns: 1fr auto; position: sticky; bottom: 0; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); }
  .brand span { display: none; }
  .bar .proj { flex-basis: 100%; order: 3; }
  .tally .stackwrap { grid-column: 1 / -1; grid-row: 2; }
  .kpis { grid-template-columns: 1fr 1fr; }
  .kpi b { font-size: 32px; }
  .quality, .scenario { grid-template-columns: 1fr 1fr 1fr; }
  .dock { left: 8px; right: 8px; transform: none; max-width: none; flex-wrap: wrap; bottom: 8px; animation: none; }
  .dock-mid { order: -1; flex-basis: 100%; }
  .dock-btn { flex: 1; justify-content: center; }
  #rv-replay { flex: 0 0 auto; }
  .table.reviewing .caption { max-width: calc(100% - 28px); }
  .table.reviewing .tools { top: 52px; }
  .dock { width: auto; }
  .app.immersive { height: 100%; }
  .app.immersive .table { height: auto; }
  .app.immersive .rail { right: 0; bottom: auto; width: auto; height: auto; flex-direction: row; }
  .app.immersive .table .caption, .app.rail-collapsed.immersive .table .caption { left: 14px; top: 110px; }
  .app.rail-collapsed.immersive .rail { transform: translateY(-100%); }
  .app.rail-collapsed.immersive .table .caption { top: 12px; }
  .vstack { left: 8px; right: 8px; width: auto; top: auto; max-height: 45%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
}
@media print {
  .dock, .bar, .rail, .table, .tabs, .tally, .boq-tools, .no-print { display: none !important; }
  .work { display: block; } .side { border: 0; } .side-body { overflow: visible; }
  body { background: #fff; }
}

/* ---------------------------------------------------------------- brand + loading */
.ftg-logo { flex: none; align-self: center; color: var(--ink); }
.ftg-loader .ftg-line { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: miter; }
.ftg-loader .ftg-fill { fill: var(--accent); }
.ftg-loader .ftg-grade path { fill: none; stroke: currentColor; stroke-width: 1.4; stroke-linecap: square; opacity: .45; }
/* full-screen veil between screens: always black, whatever the theme */
.veil { position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; background: #0b0b0a; color: #eceae5; opacity: 0; transition: opacity .3s ease; }
.veil.on { opacity: 1; }
.veil .ftg-loader .ftg-fill { fill: #ee6a2c; }
.veil-in { display: grid; justify-items: center; gap: 14px; }
.veil-word { font: 600 15px var(--f-ui); letter-spacing: .32em; text-transform: uppercase; margin-top: 6px; padding-left: .32em; }
.veil-msg { font: 400 13px var(--f-ui); color: #8f8b84; min-height: 1.2em; }
/* busy cursor: the pointer itself becomes the loader */
body.busy, body.busy * { cursor: none !important; }
.busycur { position: fixed; left: 0; top: 0; z-index: 2000; pointer-events: none; width: 28px; height: 28px; color: var(--ink);
  filter: drop-shadow(0 0 1.5px var(--paper)) drop-shadow(0 0 1.5px var(--paper)); }
@media (hover: none) { .busycur { display: none; } body.busy, body.busy * { cursor: auto !important; } }

.app.tally-collapsed .tally-tg svg { transform: rotate(180deg); }
.app:not(.immersive).tally-collapsed .tally { left: 124px; }
.app:not(.immersive).tally-collapsed .rail { padding-bottom: 12px; }

/* dock: icon buttons, plus a labelled Save & proceed when this sheet has edits */
.dock-ic { flex: none; width: 44px; height: 44px; display: inline-grid; grid-auto-flow: column; place-items: center; gap: 8px; padding: 0; border-radius: 10px;
  border: 1px solid var(--rule); background: var(--sheet); color: var(--ink); font-weight: 600; }
.dock-ic:hover:not(:disabled) { border-color: var(--graphite); }
.dock-ic:disabled { opacity: .35; cursor: default; }
.dock-ic svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.dock-ic .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.dock-ic .ic { display: grid; }
#rv-replay { border-color: transparent; background: transparent; color: var(--graphite); }
#rv-replay:hover { color: var(--ink); background: var(--rule); border-color: transparent; }
.dock-ic.go { background: var(--ink); border-color: var(--ink); color: var(--on-ink); }
.dock-ic.go.finish { background: var(--accent); border-color: var(--accent); color: #fff; }
.dock-ic.go.save { width: auto; padding: 0 16px 0 18px; background: var(--accent); border-color: var(--accent); color: #fff; animation: savein .25s cubic-bezier(.2,.8,.2,1); }
.dock-ic.go.save .lbl { position: static; width: auto; height: auto; clip-path: none; font-size: 14px; }
.dock-ic.go.save:hover { filter: brightness(1.08); }
@keyframes savein { from { opacity: .4; transform: scale(.92); } }
.dock-ic.go.save .ic { order: 2; }
/* dock buttons: bare media-player glyphs, no boxes */
.dock-ic { width: 46px; height: 46px; border: 0; background: transparent; border-radius: 50%; color: var(--ink); }
.dock-ic:hover:not(:disabled) { background: var(--rule); border-color: transparent; }
.dock-ic svg { width: 28px; height: 28px; stroke: none; fill: none; }
.dock-ic svg .f { fill: currentColor; stroke: none; }
.dock-ic svg .o { fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
#rv-replay { color: var(--ink); background: transparent; }
.dock-ic.go { background: transparent; border: 0; color: var(--ink); }
.dock-ic.go.finish { background: transparent; color: var(--accent); }
.dock-ic.go.save { width: auto; border-radius: 12px; padding: 0 16px 0 18px; background: var(--accent); color: #fff; }
.dock-ic.go.save svg { width: 20px; height: 20px; }
.dock-ic.go.save:hover { background: var(--accent); }
.dock-ic:disabled { opacity: .3; }

/* compact dock: three controls, nothing else */
.dock { gap: 4px; padding: 5px 8px; border-radius: 999px; width: auto; max-width: calc(100% - 24px); }
.dock-ic { width: 42px; height: 42px; }
.dock-ic svg { width: 24px; height: 24px; }
.dock-ic.go.save { height: 42px; border-radius: 999px; padding: 0 16px 0 18px; }
@media (max-width: 820px) { .dock { left: 50%; right: auto; transform: translateX(-50%); flex-wrap: nowrap; } .dock-btn { flex: none; } }

/* sheet list: a separate floating panel with its own footer holding the collapse button, bottom right */
.app.rail-collapsed .rail-tg svg { transform: rotate(180deg); }

/* dock: rectangular, evenly spaced controls with a short label on hover */
.dock { border-radius: 10px; padding: 6px; gap: 6px; }
.dock-ic { width: 44px; height: 44px; border-radius: 8px; color: var(--ink); position: relative; }
.dock-ic:hover:not(:disabled), .dock-ic.go:hover { background: var(--accent-soft); color: var(--accent); }
.dock-ic.go.finish { color: var(--ink); }
.dock-ic.go.save { height: 44px; border-radius: 8px; }
.dock-ic.go.save:hover { background: var(--accent); color: #fff; filter: brightness(1.1); }
.dock-skip { position: relative; height: 44px; padding: 0 14px; margin-left: 4px; border: 0; border-left: 1px solid var(--rule); border-radius: 0 8px 8px 0; background: transparent;
  color: var(--accent); font: 600 13px/1 var(--f-ui); white-space: nowrap; cursor: pointer; }
.dock-skip:hover { background: var(--accent-soft); }
.dock-skip[data-tip]::after { left: auto; right: 0; transform: translate(0, 4px); }
.dock-skip[data-tip]:hover::after { transform: translate(0, 0); }
[data-tip]::after { content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 10px); transform: translate(-50%, 4px); padding: 5px 9px; border-radius: 6px; background: var(--ink); color: var(--on-ink);
  font: 500 12px/1.2 var(--f-ui); white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s, transform .12s; z-index: 20; }
[data-tip]:hover::after, [data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }
.rail-tg[data-tip]::after { left: calc(100% + 8px); bottom: auto; top: 50%; transform: translate(-4px, -50%); }
.rail-tg[data-tip]:hover::after { transform: translate(0, -50%); }
.app.immersive .dock { bottom: calc(var(--tally-h, 72px) + 34px); }
.app.tally-collapsed.immersive .dock { bottom: 14px; }
.app.immersive .vstack { bottom: calc(var(--tally-h, 72px) + 100px); }
.app.tally-collapsed.immersive .vstack { bottom: 84px; }

/* Enter button appears inside the field as soon as the typed value differs from the applied one */
.enter-btn { flex: none; display: inline-flex; align-items: center; gap: 5px; margin: 3px 0 3px 2px; padding: 3px 8px; border: 0; border-radius: 5px; background: var(--accent); color: #fff; font: 600 12px var(--f-ui); animation: enterin .15s ease-out; }
.enter-btn[hidden] { display: none; }
.enter-btn:hover { filter: brightness(1.1); }
.enter-btn kbd { font: 600 12px var(--f-ui); opacity: .85; }
.pin-q span:not(.x) { flex: none; }
@keyframes enterin { from { opacity: 0; transform: translateX(6px); } }

/* sheet list: full-height floating panel; the collapse tab is orange and hangs on its right edge */
.rail-tg { display: none; }
.app.immersive .rail { bottom: calc(var(--tally-h, 72px) + 10px); border-bottom: 1px solid var(--rule); border-radius: 12px; }
.app.tally-collapsed.immersive .rail { bottom: 74px; }
.app.immersive .rail-tg { display: grid; place-items: center; position: absolute; z-index: 6; left: 121px; top: calc((100% - var(--tally-h, 72px)) / 2); transform: translateY(-50%);
  width: 22px; height: 56px; padding: 0; border: 0; border-radius: 0 9px 9px 0; background: var(--accent); color: #fff; box-shadow: 0 4px 14px -4px rgba(0,0,0,.5); transition: left .25s cubic-bezier(.2,.8,.2,1), filter .15s; }
.app.immersive .rail-tg:hover { filter: brightness(1.12); }
.rail-tg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
.app.rail-collapsed.immersive .rail-tg { left: 0; }
.app.rail-collapsed .rail-tg svg { transform: rotate(180deg); }
.app.rail-collapsed.immersive .table .caption { left: 40px; }
@media (max-width: 820px) {
  .app.immersive .rail-tg { display: none; }
  /* the sheet strip runs across the top on phones: keep the floating-rail bottom offsets above from stretching it */
  .app.immersive .rail, .app.tally-collapsed.immersive .rail { bottom: auto; }
}

/* "N open" header and the cards under it form one attached stack: no gaps */
.vstack { gap: 0; }
.vstack-loose { margin-bottom: 8px; }
.vstack-h { border-radius: 10px 10px 0 0; border-bottom: 0; background: var(--panel); backdrop-filter: none; }
.vstack-b { padding: 0; gap: 0; border: 1px solid var(--rule); border-top: 0; border-radius: 0 0 10px 10px; background: var(--panel); }
.vstack-b:empty { display: none; }
.vstack-b .card { border: 0; border-radius: 0; box-shadow: none; background: transparent; backdrop-filter: none; border-left: 3px solid var(--c); border-top: 1px solid var(--rule); }
.vstack-b .card:first-child { border-top: 0; }
.vstack-b .card:last-child { border-radius: 0 0 9px 9px; }
.vstack-b .card:hover, .vstack-b .card:focus-within { border-color: var(--rule); border-left-color: var(--c); box-shadow: inset 0 0 0 1px var(--accent); }
.vstack-b .card.flash { animation: cardflash2 .7s ease-out; }
@keyframes cardflash2 { 0% { box-shadow: inset 0 0 0 2px var(--accent); } 100% { box-shadow: none; } }

/* bottom bar collapse tab: orange, on the left edge of the bar */
.tally-tg { left: 24px; right: auto; transform: none; width: 56px; height: 22px; border: 0; border-radius: 8px 8px 0 0; background: var(--accent); color: #fff; box-shadow: 0 -4px 12px -6px rgba(0,0,0,.45); transition: filter .15s; }
.tally-tg:hover { color: #fff; filter: brightness(1.12); }
.app.tally-collapsed .tally-tg { left: auto; right: -10px; top: -10px; width: 22px; height: 22px; border-radius: 50%; background: var(--accent); }
.app.immersive .dock, .app.tally-collapsed.immersive .dock { }

/* bottom bar tab: orange (beats the generic floating-toggle style), clear of the sheet list */
.app .tally-tg, .app.immersive .tally-tg { left: 142px; right: auto; transform: none; background: var(--accent); color: #fff; border: 0; backdrop-filter: none; }
.app .tally-tg:hover, .app.immersive .tally-tg:hover { background: var(--accent); color: #fff; border: 0; filter: brightness(1.12); }
.app.rail-collapsed .tally-tg, .app.rail-collapsed.immersive .tally-tg { left: 24px; }
.app.tally-collapsed .tally-tg, .app.tally-collapsed.immersive .tally-tg { left: auto; right: -10px; top: -10px; width: 22px; height: 22px; border-radius: 50%; }

/* plan set switcher */
.bar { position: relative; }
.projname svg { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.projname:hover { color: var(--accent); }
.projname[aria-expanded="true"] svg { transform: rotate(180deg); }
.projmenu { position: absolute; top: calc(100% - 4px); left: 150px; z-index: 40; min-width: 320px; max-width: min(420px, calc(100vw - 24px)); padding: 6px; border-radius: 10px; background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow); }
.projmenu[hidden] { display: none; }
.pm-h { padding: 6px 10px 4px; font: 600 11.5px var(--f-ui); letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); }
.pm-i { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; text-align: left; color: var(--ink); cursor: pointer; }
.pm-i:hover, .pm-i:focus-visible { background: var(--accent-soft); }
.pm-i.cur .pm-t b { color: var(--accent); }
.pm-t b { display: block; font: 600 14px var(--f-cond); }
.pm-t small { display: block; font-size: 12px; color: var(--graphite); }
.pm-r { font: 600 13px var(--f-cond); color: var(--graphite); white-space: nowrap; }
.pm-i.cur .pm-r { color: var(--accent); }
.pm-sep { height: 1px; margin: 5px 4px; background: var(--rule); }

/* status bar over the drawing */
.capbar { display: inline-flex; align-items: center; gap: 10px; height: 36px; padding: 0 14px 0 5px; border-radius: 8px; background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow); max-width: 100%; }
.capbar > :only-child, .capbar .cb-title:first-child { margin-left: 9px; }
.cb-code { display: inline-grid; place-items: center; min-width: 32px; height: 26px; padding: 0 8px; border-radius: 5px; background: var(--ink); color: var(--on-ink); font: 700 12.5px var(--f-cond); letter-spacing: .04em; }
.cb-title { font: 600 14px var(--f-cond); white-space: nowrap; }
.cb-conf { font: 500 12.5px var(--f-cond); color: var(--graphite); }
.cb-sep { width: 1px; height: 16px; background: var(--rule); }
.cb-status { display: inline-flex; align-items: center; gap: 7px; font: 500 13px var(--f-ui); color: var(--graphite); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cb-status i { flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--graphite); }
.cb-status.ok i { background: var(--ok); } .cb-status.ok { color: var(--ink); }
.cb-status.live i { background: var(--accent); animation: pulse 1s infinite; } .cb-status.live { color: var(--ink); }
.cb-status .t { overflow: hidden; text-overflow: ellipsis; }

/* cards in the stack: one edge treatment (the material strip); hover/focus is a soft tint, never an orange ring */
.vstack-b .card:hover, .vstack-b .card:focus-within { border-color: var(--rule); border-left-color: var(--c); box-shadow: none; background: color-mix(in srgb, var(--accent) 6%, transparent); }
.vstack-b .card.flash { animation: cardflash3 .8s ease-out; }
@keyframes cardflash3 { 0% { background: color-mix(in srgb, var(--accent) 22%, transparent); } 100% { background: transparent; } }
.vstack-b .card:first-child { border-top: 0; }
/* bill status filter + benchmark marks */
.boq-filter .btn[aria-pressed="true"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.boq-filter .btn:disabled { opacity: .45; cursor: default; }
.boq-filter .btn .muted { font-size: 11.5px; margin-left: 2px; }
.bench .bm { cursor: help; }

/* ---------------------------------------------------------------- add a reading (measure on the sheet) */
:root { --added: #2f63b3; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) { --added: #79a7ee; } }
:root[data-theme="dark"] { --added: #79a7ee; }
.st.manual { color: var(--added); border-color: var(--added); background: color-mix(in srgb, var(--added) 11%, transparent); }
.blob.st-manual { border-style: double; border-width: 3px; border-color: var(--added); }
.btn.danger { color: var(--crit); border-color: color-mix(in srgb, var(--crit) 45%, var(--rule)); }
.btn.danger:hover { background: var(--crit-soft); }
kbd { font: 600 11px var(--f-cond); padding: 0 4px; border: 1px solid currentColor; border-radius: 3px; opacity: .6; margin-left: 4px; }
.btn.primary kbd { opacity: .75; }

/* idle: a tool button beside the zoom controls; measuring: a toolbar across the top of the drawing */
.mdock { position: absolute; right: calc(16px + 3 * 48px + 2 * 8px + 10px); bottom: calc(var(--tally-h, 72px) + 12px); z-index: 5; display: flex; align-items: center; gap: 8px; transition: bottom .25s; }
.app.tally-collapsed .mdock:not(.on), .app:not(.immersive) .mdock:not(.on) { bottom: 12px; }
.mdock:not(.on) .mbtn { height: 48px; border-radius: 12px; padding: 0 14px; }
.table.measuring .caption { visibility: hidden; }
.mdock.on { top: 12px; bottom: auto; right: auto; left: 50%; transform: translateX(-50%); padding: 6px; background: color-mix(in srgb, var(--panel) 94%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--rule); border-radius: 12px; box-shadow: 0 12px 34px -14px rgba(0,0,0,.45); width: min(980px, calc(100% - 28px)); flex-wrap: wrap; }
.mdock .mbtn { box-shadow: 0 6px 18px -10px rgba(0,0,0,.5); background: var(--panel); }
.mdock .mbtn svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; margin-right: 2px; }
.mtools { display: inline-flex; border: 1px solid var(--rule); border-radius: 9px; overflow: hidden; }
.mtool { border: 0; background: transparent; color: var(--graphite); font: 600 12.5px var(--f-cond); padding: 6px 10px; cursor: pointer; }
.mtool + .mtool { border-left: 1px solid var(--rule); }
.mtool[aria-checked="true"] { background: var(--ink); color: var(--on-ink, #fff); }
.mtool[aria-checked="true"] kbd { opacity: .7; }
.mread { font: 600 13px var(--f-cond); color: var(--ink); font-variant-numeric: tabular-nums; padding: 0 4px; }
.mread.warn, .mscale.warn { color: var(--warn); }
.mscale { border: 1px dashed var(--rule); background: transparent; border-radius: 999px; padding: 3px 9px; font: 600 12px var(--f-cond); color: var(--graphite); cursor: pointer; }
.mscale:hover { border-color: var(--accent); color: var(--accent); }
.mcal { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px var(--f-cond); }
.mcal input { width: 150px; padding: 4px 8px; border: 1px solid var(--accent); border-radius: 6px; background: var(--sheet); color: var(--ink); }
.table.measuring .stage, .table.measuring .stage * { cursor: crosshair; }

.mz-line, .mz-rubber { fill: none; stroke: var(--accent); stroke-width: 2.2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.mz-line.cal { stroke: var(--warn); stroke-dasharray: 6 4; }
.mz-rubber { stroke-dasharray: 5 4; opacity: .85; }
.mz-fill { fill: var(--accent); fill-opacity: .14; stroke: none; }
.mz-pt { fill: var(--sheet); stroke: var(--accent); stroke-width: 2; vector-effect: non-scaling-stroke; }
.mz-pt.first { fill: var(--accent); }
.mz-pt.count { fill: var(--accent); stroke: var(--sheet); }
.mz-n { font: 700 9px var(--f-cond); fill: var(--on-ink, #fff); text-anchor: middle; pointer-events: none; }

.mform { position: absolute; top: 64px; right: 16px; z-index: 7; width: min(380px, calc(100% - 32px)); max-height: calc(100% - 64px - var(--tally-h, 72px) - 24px);
  display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--rule); border-radius: 14px; box-shadow: 0 22px 48px -18px rgba(0,0,0,.55); }
.mform-h { display: flex; align-items: flex-start; gap: 10px; padding: 14px 14px 10px; border-bottom: 1px solid var(--rule); }
.mform-h > div { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.mform-h b { font-size: 15px; }
.mform-h small { color: var(--graphite); font-size: 12.5px; }
.mform-h .x { border: 0; background: transparent; color: var(--graphite); font-size: 20px; line-height: 1; cursor: pointer; padding: 0 4px; }
.mform-b { padding: 12px 14px; overflow: auto; display: flex; flex-direction: column; gap: 10px; }
.mform-b .field { margin: 0; }
.mform-b input, .mform-b select { width: 100%; }
.mchips { display: flex; flex-wrap: wrap; gap: 6px; }
.mchip { cursor: pointer; }
.mchip:hover { border-color: var(--accent); color: var(--accent); }
.mf-row { display: grid; grid-template-columns: 1fr 160px; align-items: center; gap: 8px; }
.mf-in { display: flex; align-items: center; gap: 6px; }
.mf-in input { text-align: right; font-variant-numeric: tabular-nums; }
.mf-in span { min-width: 46px; color: var(--graphite); font-size: 12.5px; }
.mwarn { color: var(--warn); font-size: 13px; margin: 0; }
.mresult { display: flex; justify-content: space-between; gap: 12px; padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); }
.mresult > div { display: flex; flex-direction: column; gap: 2px; }
.mresult .r { text-align: right; }
.mresult b { font-size: 17px; }
.mresult small { color: var(--graphite); font-size: 12px; }
.mform-f { display: flex; align-items: center; gap: 8px; padding: 10px 14px 14px; border-top: 1px solid var(--rule); }
.madded { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; }

@media (max-width: 820px) {
  .mdock:not(.on) { right: 16px; bottom: calc(var(--tally-h, 72px) + 72px); }
  .mdock.on { top: 8px; }
  .mdock.on { gap: 6px; }
  .mtool kbd, .mdock kbd { display: none; }
  .mform { left: 12px; right: 12px; top: auto; bottom: calc(var(--tally-h, 72px) + 12px); width: auto; max-height: 70%; }
}

/* intake: the verified accuracy numbers */
.proof { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 22px; }
.proof > div { display: flex; flex-direction: column; gap: 4px; padding: 12px 12px 11px; border: 1px solid var(--rule); border-radius: 12px; background: color-mix(in srgb, var(--panel) 88%, transparent); }
.proof b { font-size: 26px; line-height: 1; letter-spacing: -.01em; color: var(--ink); }
.proof span { font-size: 12.5px; line-height: 1.35; color: var(--graphite); }
.proof-how { margin-top: 10px; font-size: 13px; color: var(--graphite); }
.proof-how summary { cursor: pointer; color: var(--ink); font-weight: 600; }
.proof-how ul { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; max-width: 62ch; }
.proof-how b { color: var(--ink); font-weight: 600; }
@media (max-width: 820px) { .proof { grid-template-columns: 1fr; } .proof > div { flex-direction: row; align-items: baseline; gap: 10px; } .proof b { font-size: 20px; min-width: 64px; } }

/* calibrated range */
.range-bar { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; border: 1px solid var(--rule); border-radius: var(--r); padding: 10px 12px; background: var(--sheet); }
.range-bar > b { font: 600 24px/1.1 var(--f-cond); font-variant-numeric: tabular-nums; color: var(--ink); }
.range-bar span { font-size: 13px; color: var(--graphite); }
.range-bar span b { color: var(--ink); font-weight: 600; }

/* cross-sheet consensus */
.cc-list { display: grid; gap: 6px; }
.cc-row { display: grid; grid-template-columns: 86px 1fr auto; gap: 10px; align-items: center; border: 1px solid var(--rule); border-radius: var(--r); padding: 7px 10px; background: var(--sheet); }
.cc-st { font: 600 12px/1.2 var(--f-cond); text-transform: uppercase; letter-spacing: .04em; text-align: center; padding: 3px 6px; border-radius: 999px; border: 1px solid currentColor; }
.cc-row.agree .cc-st { color: var(--ok); background: var(--ok-soft); }
.cc-row.check .cc-st { color: var(--warn); border-style: dashed; }
.cc-row.conflict .cc-st { color: var(--crit); background: var(--crit-soft); }
.cc-what b { display: block; font: 600 14px/1.3 var(--f-cond); }
.cc-what small { color: var(--graphite); font-size: 12.5px; line-height: 1.35; }
.cc-d { font: 600 14px var(--f-cond); font-variant-numeric: tabular-nums; color: var(--graphite); }
@media (max-width: 640px) { .cc-row { grid-template-columns: 1fr auto; } .cc-st { grid-column: 1 / -1; justify-self: start; } }

/* ask this takeoff */
.ask { display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.ask-head h3 { margin: 0 0 4px; }
.ask-head p { margin: 0 0 8px; font-size: 13px; }
.ask-log { display: flex; flex-direction: column; gap: 8px; flex: 1; min-height: 240px; padding: 2px; }
.ask-empty { display: flex; flex-wrap: wrap; gap: 6px; align-content: flex-start; }
.ask-sugg { cursor: pointer; white-space: normal; text-align: left; }
.ask-sugg:hover { border-color: var(--accent); color: var(--accent); }
.ask-msg { scroll-margin-bottom: 64px; max-width: 92%; border-radius: 12px; padding: 9px 12px; font-size: 14px; line-height: 1.45; }
.ask-msg p { margin: 0; }
.ask-ul { margin: 6px 0 8px; padding-left: 18px; }
.ask-ul li { margin: 2px 0; }
.ask-msg.me { align-self: flex-end; background: var(--ink); color: var(--on-ink); border-bottom-right-radius: 4px; }
.ask-msg.bot { align-self: flex-start; background: var(--sheet); border: 1px solid var(--rule); border-bottom-left-radius: 4px; }
.ask-msg.pending .dot { display: inline-block; width: 6px; height: 6px; margin-right: 4px; border-radius: 50%; background: var(--graphite); animation: pulse 1s infinite; }
.ask-msg.pending .dot:nth-child(2) { animation-delay: .15s; } .ask-msg.pending .dot:nth-child(3) { animation-delay: .3s; }
.ask-cite { font: 600 12px/1 var(--f-cond); padding: 2px 6px; margin: 0 1px; border-radius: 999px; border: 1px solid var(--accent); color: var(--accent); background: var(--accent-soft); cursor: pointer; vertical-align: 1px; }
.ask-unv { background: var(--crit-soft); color: var(--crit); border-radius: 3px; padding: 0 2px; }
.ask-warn { margin-top: 6px; font-size: 12.5px; color: var(--crit); }
.ask-acts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.ask-follow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.ask-follow .chip { font-size: 12.5px; }
.ask-done { display: block; margin-top: 8px; color: var(--ok); font-size: 12.5px; }
.ask-undone { font-size: 12.5px; color: var(--graphite); align-self: center; }
.ask-form { display: flex; gap: 6px; position: sticky; bottom: 0; background: var(--panel); padding-top: 6px; }
.ask-form input { flex: 1; min-width: 0; padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); font: inherit; font-size: 14px; }
.ask-src { white-space: normal; }

/* ---------------------------------------------------------------- 3D model (results) */
:root {
  --mx-face: #ffffff; --mx-end: #e9e5dc; --mx-cap: #f7f5f0; --mx-edge: rgba(26, 25, 23, .62);
  --mx-ground: #e2ddd2; --mx-floor: rgba(107, 103, 96, .10); --mx-env: rgba(214, 208, 196, .55); --mx-none: #e6e3dd;
  --mx-grid: rgba(26, 25, 23, .045);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --mx-face: #2b2a27; --mx-end: #1f1e1c; --mx-cap: #36342f; --mx-edge: rgba(236, 234, 229, .55);
    --mx-ground: #24231f; --mx-floor: rgba(236, 234, 229, .07); --mx-env: rgba(80, 76, 68, .45); --mx-none: #3a3934;
    --mx-grid: rgba(236, 234, 229, .045);
  }
}
:root[data-theme="dark"] {
  --mx-face: #2b2a27; --mx-end: #1f1e1c; --mx-cap: #36342f; --mx-edge: rgba(236, 234, 229, .55);
  --mx-ground: #24231f; --mx-floor: rgba(236, 234, 229, .07); --mx-env: rgba(80, 76, 68, .45); --mx-none: #3a3934;
  --mx-grid: rgba(236, 234, 229, .045);
}
.mstage {
  position: absolute; inset: 0; z-index: 2; display: none; background: var(--paper);
  background-image: linear-gradient(var(--mx-grid) 1px, transparent 1px), linear-gradient(90deg, var(--mx-grid) 1px, transparent 1px);
  background-size: 28px 28px;
}
.table.model-on .mstage { display: block; animation: mx-in .35s ease-out; }
.table.model-on .zoomdock, .table.model-on .mdock { display: none; }
@keyframes mx-in { from { opacity: 0; } to { opacity: 1; } }
.mx-svg { position: absolute; inset: 92px 20px 64px; width: calc(100% - 40px); height: calc(100% - 156px); cursor: grab; touch-action: none; outline: none; }
.mx-svg.dragging { cursor: grabbing; }
.mx-svg polygon { stroke: var(--mx-edge); stroke-width: .035; stroke-linejoin: round; vector-effect: none; transition: opacity .18s; }
.mx-ground { fill: var(--mx-ground); }
.mx-floor { fill: var(--mx-floor); }
.mx-roof { fill: var(--mx-floor); }
.mx-env { fill: var(--mx-env); stroke-opacity: .45; }
.mx-part.face { fill: var(--mx-face); }
.mx-part.end { fill: var(--mx-end); }
.mx-part.cap { fill: var(--mx-cap); }
.mx-ghost { fill: none; stroke-dasharray: .25 .2; stroke-opacity: .35; }
.mstage.heat .mx-svg polygon { stroke: rgba(70, 22, 8, .55); }
.mstage.heat .mx-floor, .mstage.heat .mx-roof { opacity: .42; }
.mstage.heat .mx-env { opacity: .72; }
.mstage.heat .mx-ghost { stroke: var(--mx-edge); }
.mstage[data-focus] .mx-svg [class*=" s-"] { opacity: .14; }
.mstage[data-focus="slab"] .s-slab, .mstage[data-focus="foundation"] .s-foundation, .mstage[data-focus="ext"] .s-ext,
.mstage[data-focus="part"] .s-part, .mstage[data-focus="floor"] .s-floor, .mstage[data-focus="roof"] .s-roof { opacity: 1 !important; }
.mstage[data-focus] .mx-svg g.s-part { opacity: .14; }
.mstage[data-focus="part"] .mx-svg g.s-part { opacity: 1; }

.mx-top, .mx-bottom { position: absolute; left: 14px; right: 14px; display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; pointer-events: none; }
.mx-top { top: 52px; align-items: center; }
.mx-bottom { bottom: 36px; }
.mx-top > *, .mx-bottom > * { pointer-events: auto; }
.mx-seg { display: inline-flex; padding: 3px; gap: 2px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.mx-seg button { border: 0; background: none; padding: 6px 12px; border-radius: 5px; font: 600 13.5px var(--f-cond); color: var(--graphite); white-space: nowrap; }
.mx-seg button:hover { color: var(--ink); }
.mx-seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.mx-hint { font: 600 12.5px var(--f-cond); color: var(--graphite); padding: 5px 10px; border: 1px dashed var(--rule); border-radius: 999px; background: var(--panel); }
.mx-legend { min-width: 248px; padding: 10px 12px 8px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); }
.mx-lh { font: 600 11.5px var(--f-cond); letter-spacing: .04em; text-transform: uppercase; color: var(--graphite); margin-bottom: 6px; }
.mx-row { display: grid; grid-template-columns: 14px 1fr auto 52px; gap: 9px; align-items: center; padding: 4px 4px; border-radius: 4px; font-size: 13.5px; cursor: default; }
.mx-row:hover { background: var(--accent-soft); }
.mx-row i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid rgba(0, 0, 0, .15); }
.mx-row b { font-weight: 600; }
.mx-row em { font-style: normal; color: var(--graphite); font-size: 12.5px; text-align: right; }
.mx-cap { position: absolute; left: 96px; right: 16px; bottom: 10px; margin: 0; text-align: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; color: var(--graphite); }
.viewsw { display: inline-flex; padding: 2px; gap: 2px; border: 1px solid var(--rule); border-radius: 999px; background: var(--panel); }
.viewsw button { border: 0; background: none; padding: 3px 11px; border-radius: 999px; font: 600 12.5px/1.3 var(--f-cond); color: var(--graphite); }
.viewsw button[aria-pressed="true"] { background: var(--accent); color: #fff; }
@media (max-width: 820px) {
  .mx-svg { inset: 92px 8px 150px; width: calc(100% - 16px); height: calc(100% - 242px); }
  .mx-bottom { flex-direction: column; align-items: stretch; }
  .mx-seg { overflow-x: auto; }
  .mx-legend { min-width: 0; }
  .mx-hint { display: none; }
}

/* ---------------------------------------------------------------- overview: likely range, needs your eyes */
.likely { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: -6px 0 4px; font-size: 13.5px; color: var(--graphite); }
.likely b { color: var(--ink); font: 600 14px var(--f-cond); }
.likely svg { flex: none; }
.eyes h3 small { font-weight: 400; }
.eye-list { display: grid; gap: 6px; }
.eye { display: grid; grid-template-columns: 4px minmax(0, 1fr) auto; gap: 12px; align-items: center; width: 100%; text-align: left; padding: 9px 12px 9px 0; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); font: inherit; cursor: pointer; overflow: hidden; }
.eye:hover { border-color: var(--accent); }
.eye:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.eye .stripe { align-self: stretch; background: var(--warn); border-radius: 0 2px 2px 0; }
.eye.high .stripe { background: var(--crit); }
.eye.low .stripe { background: var(--graphite); }
.eye-t { display: grid; gap: 2px; min-width: 0; }
.eye-t b { font-weight: 600; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eye-t small { color: var(--graphite); font-size: 12.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.eye-go { font: 600 12.5px var(--f-cond); color: var(--accent); white-space: nowrap; }
.eyes.ok { border: 1px solid var(--rule); border-left: 3px solid var(--ok); border-radius: var(--r); padding: 10px 12px; background: var(--sheet); }
.eyes.ok h3 { margin-bottom: 4px; }
details.how { margin-top: 14px; border-top: 1px solid var(--rule); padding-top: 10px; }
details.how > summary { cursor: pointer; font: 600 13.5px var(--f-cond); color: var(--graphite); }
details.how > summary:hover { color: var(--ink); }
details.how .section.range { margin-top: 12px; }
.banner.scenario-note { border-left-color: var(--warn); background: var(--warn-soft); }
.banner.import-note { margin: 10px 0 0; }
/* ---------------------------------------------------------------- home: your plans */
.lead { display: flex; flex-direction: column; min-width: 0; }
.plans { margin: 22px 22px 0; }
.plans-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.plans-h h2 { font-size: 22px; }
.plans-h .muted { font-size: 13px; }
.plans-wrap { border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); overflow-x: auto; }
.plans-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.plans-t th { text-align: left; font: 600 12px var(--f-cond); letter-spacing: .04em; text-transform: uppercase; color: var(--graphite); padding: 9px 12px; border-bottom: 1px solid var(--rule); white-space: nowrap; }
.plans-t td { padding: 8px 12px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.plans-t tbody tr:last-child td { border-bottom: 0; }
.plans-t tfoot td { border-top: 1px solid var(--rule); border-bottom: 0; font: 600 13px var(--f-cond); color: var(--graphite); }
.plans-t .r { text-align: right; }
.plans-t .num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.plans-t td.num small { display: block; color: var(--graphite); font-size: 11.5px; }
.plan-open { display: grid; gap: 1px; text-align: left; background: none; border: 0; padding: 0; color: var(--ink); font: inherit; cursor: pointer; }
.plan-open b { font: 600 15px var(--f-cond); }
.plan-open small { color: var(--graphite); font-size: 12px; }
.plan-open:hover b { color: var(--accent); }
.plan-x { background: none; border: 0; color: var(--graphite); font-size: 18px; line-height: 1; cursor: pointer; padding: 2px 6px; border-radius: 4px; }
.plan-x:hover { color: var(--crit); background: var(--crit-soft); }
.plans-t .starts { width: 64px; text-align: right; padding: 5px 7px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--panel); color: var(--ink); font: inherit; font-variant-numeric: tabular-nums; }
.plans-t .starts:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.ibar { display: inline-block; width: 44px; height: 5px; border-radius: 3px; background: var(--rule); margin-right: 8px; vertical-align: middle; overflow: hidden; }
.ibar i { display: block; height: 100%; background: var(--m-concrete); }
.chip.warn { border-color: var(--warn); color: var(--warn); background: var(--warn-soft); }
.chip.ok { border-color: var(--ok); color: var(--ok); background: var(--ok-soft); }
.fleet { margin-top: 12px; border: 1px solid var(--rule); border-radius: 10px; background: var(--sheet); padding: 12px 14px; }
.fleet h3 { font-size: 15px; margin-bottom: 6px; }
.fleet h3 small { font-weight: 400; color: var(--graphite); font-size: 12.5px; margin-left: 6px; }
.fleet-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 52px; gap: 12px; align-items: baseline; padding: 6px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.fleet-row small { display: block; color: var(--graphite); font-size: 12px; }
.fleet-row b { color: var(--ok); font: 700 16px var(--f-cond); }
.fleet-row .muted { text-align: right; font-size: 12.5px; }
.drop.compact { min-height: 0; padding: 18px 24px; place-items: center start; }
.drop.compact .inner { max-width: 100%; padding: 0; }
.drop.compact h2 { font-size: 22px; }
.drop.compact .inner > p:not(.muted), .drop.compact .hero-sheet, .drop.compact .plate, .drop.compact .proof { display: none; }
.drop.compact .actions { margin-top: 12px; }
.watch { display: flex; align-items: center; gap: 8px; margin-top: 14px; font-size: 13.5px; color: var(--graphite); cursor: pointer; width: fit-content; }
.watch input { accent-color: var(--accent); width: 15px; height: 15px; }
.tally .total .whatif { color: var(--warn); font: 600 12px var(--f-cond); }
details.cc-ok { margin-top: 8px; }
details.cc-ok > summary { cursor: pointer; font-size: 13.5px; color: var(--graphite); padding: 8px 10px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
details.cc-ok > summary:hover { color: var(--ink); }
details.cc-ok[open] > summary { margin-bottom: 8px; }

.nw { white-space: nowrap; }

.cc-ai { color: var(--ink, inherit); font-weight: 500; }
.cc-ai i { font-weight: 400; opacity: .7; }

.learn-note { border-left: 3px solid var(--accent, #c8501e); }
button.link { background: none; border: 0; padding: 0; font: inherit; color: var(--accent, #c8501e); text-decoration: underline; cursor: pointer; }

/* autopilot */
.auto { border: 1px solid var(--rule); border-radius: 10px; padding: 14px 16px; margin: 0 0 14px; background: var(--sheet); }
.auto-h { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.auto-h h2 { margin: 0; font-size: 20px; }
.auto-a { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.auto-last { font-size: 13px; }
.auto-note { font-size: 13px; margin: 8px 0 0; }
.inbox { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 10px; border-radius: 8px; border-left: 3px solid var(--accent, #c8501e); background: color-mix(in srgb, var(--accent, #c8501e) 7%, transparent); }
.inbox.clear { border-left-color: #3d8a5f; background: color-mix(in srgb, #3d8a5f 8%, transparent); }
.inbox b { margin-right: 6px; }
.inbox-i { display: inline-flex; align-items: baseline; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid var(--rule); background: var(--sheet); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.inbox-i small { opacity: .7; }
.inbox-i.chg { border-style: dashed; }
.plans-h #co-report { margin-left: auto; }
small.rev { display: block; font-weight: 500; }
small.rev.up, .rev-d.up { color: #b4441a; } small.rev.down, .rev-d.down { color: #2f7d55; }
.rev-note { border-left: 3px solid #5b6f8f; }
.rev-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 4px; }
.rev-list li { display: grid; grid-template-columns: 74px auto 1fr; gap: 10px; align-items: baseline; font-size: 14px; }
.rev-d { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; }
.rev-list small { opacity: .75; }
.spec-note { border-left: 3px solid #3d8a5f; }
.coreport { max-width: 1040px; margin: 0 auto; padding: 24px 20px 60px; }
.coreport h1 { margin: 14px 0 4px; font-size: 28px; } .coreport h2 { margin: 26px 0 8px; font-size: 18px; }
.co-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.co-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin: 18px 0; }
.co-kpis div { border: 1px solid var(--rule); border-radius: 10px; padding: 12px 14px; }
.co-kpis b { display: block; font-size: 30px; line-height: 1.1; } .co-kpis span { font-size: 13px; opacity: .8; }
.co-t { width: 100%; border-collapse: collapse; font-size: 14px; }
.co-t th, .co-t td { padding: 7px 8px; border-bottom: 1px solid var(--rule); text-align: left; vertical-align: top; }
.co-t th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; opacity: .7; } .co-t .r { text-align: right; }
.co-rev { padding-left: 18px; display: grid; gap: 6px; font-size: 14px; }
@media (max-width: 720px) { .coreport { padding: 16px; } .co-t { display: block; overflow-x: auto; } .rev-list li { grid-template-columns: 64px 1fr; } .rev-list small { grid-column: 2; } }
@media print { .co-actions, .coreport ~ *, .app > header, .bar { display: none !important; } .coreport { max-width: none; padding: 0; } }

/* presenting a result: the model full-bleed, the headline over it, a five-step card beside it */
.app.presenting .rail, .app.presenting .side, .app.presenting .tally, .app.presenting .table .caption, .app.presenting .mx-top, .app.presenting .mx-bottom, .app.presenting .mx-cap { display: none !important; }
.app.presenting .work { grid-template-columns: minmax(0, 1fr); position: relative; overflow: hidden; }
.app.presenting .table { grid-area: 1 / 1; position: absolute; inset: 0; height: auto; }
.app.presenting .table.model-on > :not(.mstage) { visibility: hidden; }
.app.presenting .mstage { right: min(460px, 38vw); }
.app.presenting .mx-svg { inset: 150px 24px 30px; width: calc(100% - 48px); height: calc(100% - 180px); }
.present { position: absolute; inset: 0; z-index: 8; pointer-events: none; }
.present > * { pointer-events: auto; }
.p-head { position: absolute; left: 28px; top: 22px; pointer-events: none; }
.p-over { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--graphite); }
.p-total { display: flex; align-items: baseline; gap: 10px; line-height: .95; }
.p-total b { font-size: clamp(64px, 9vw, 132px); font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.p-total span { font-size: 20px; color: var(--graphite); }
.p-sub { margin-top: 6px; font-size: 15px; color: var(--graphite); } .p-sub b { color: var(--ink); }
.p-what { color: var(--accent); font-weight: 600; }
.p-exit { position: absolute; right: 28px; top: 20px; }
.p-card { position: absolute; right: 22px; top: 66px; bottom: 22px; width: min(440px, calc(100vw - 32px)); display: flex; flex-direction: column; border: 1px solid var(--rule); border-radius: 18px; overflow: hidden;
  background: color-mix(in srgb, var(--sheet) 86%, transparent); backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 18px 50px rgba(0, 0, 0, .14); }
.p-tabs { display: flex; gap: 2px; padding: 10px 10px 0; overflow-x: auto; scrollbar-width: none; }
.p-tabs button { flex: none; border: 0; background: none; color: var(--graphite); font: inherit; font-size: 13px; padding: 7px 9px; border-radius: 999px; cursor: pointer; }
.p-tabs button.on { background: var(--ink); color: var(--on-ink); }
.p-body { flex: 1; overflow-y: auto; padding: 16px 20px 12px; }
.p-body h3 { margin: 4px 0 8px; font-size: 22px; line-height: 1.2; } .p-body p { margin: 0 0 12px; color: var(--graphite); font-size: 14.5px; line-height: 1.5; }
.p-hint { font-size: 13px !important; }
.p-grid { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--rule); border-radius: 12px; overflow: hidden; margin-bottom: 14px; }
.p-grid div { padding: 10px 12px; border-bottom: 1px solid var(--rule); } .p-grid div:nth-child(odd) { border-right: 1px solid var(--rule); } .p-grid div:nth-last-child(-n+2) { border-bottom: 0; }
.p-grid small { display: block; font-size: 12px; color: var(--graphite); } .p-grid b { font-size: 17px; font-variant-numeric: tabular-nums; }
.p-basis { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 7px; font-size: 14px; }
.st { display: inline-block; font-size: 11.5px; padding: 1px 8px; border-radius: 999px; border: 1px solid; margin-right: 6px; }
.st-measured { color: #2f7d55; } .st-inferred { color: #3f62a8; } .st-assumed { color: #a86a14; }
.p-rows { display: grid; gap: 6px; margin-bottom: 12px; }
.p-row { display: flex; justify-content: space-between; gap: 12px; align-items: center; text-align: left; width: 100%; padding: 10px 12px; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); color: inherit; font: inherit; cursor: pointer; }
.p-row:hover { border-color: var(--ink); }
.p-row b { display: block; font-size: 14.5px; } .p-row small { display: block; font-size: 12.5px; color: var(--graphite); margin-top: 2px; }
.p-row .num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-size: 14.5px; }
.p-sheet { font-style: normal; font-size: 11.5px; padding: 1px 6px; border-radius: 5px; background: var(--accent-soft); color: var(--accent); }
.p-eye { border-left-width: 3px; } .p-eye.sev-high { border-left-color: #b4441a; } .p-eye.sev-medium { border-left-color: #b98a1f; }
.p-swap.on { border-color: #2f7d55; background: color-mix(in srgb, #2f7d55 8%, var(--sheet)); } .p-save { color: #2f7d55; font-weight: 600; }
.p-bars { display: grid; gap: 4px; margin-bottom: 12px; }
.p-bar { display: grid; grid-template-columns: minmax(90px, 1.1fr) 1.3fr auto 34px; gap: 10px; align-items: center; padding: 7px 8px; border-radius: 9px; font-size: 14px; cursor: default; }
.p-bar:hover { background: var(--accent-soft); }
.p-bar i { height: 6px; border-radius: 3px; background: var(--rule); overflow: hidden; } .p-bar u { display: block; height: 100%; background: var(--accent); border-radius: 3px; }
.p-bar small { color: var(--graphite); text-align: right; font-size: 12.5px; }
.p-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.p-pair div { border: 1px solid var(--rule); border-radius: 12px; padding: 10px 12px; } .p-pair div.on { border-color: #2f7d55; background: color-mix(in srgb, #2f7d55 8%, var(--sheet)); }
.p-pair small { display: block; font-size: 12px; color: var(--graphite); } .p-pair b { font-size: 24px; } .p-pair em { font-style: normal; color: #2f7d55; font-weight: 600; margin-left: 8px; font-size: 13.5px; }
.p-dec { margin-bottom: 12px; } .p-dec small { display: block; font-size: 12.5px; color: var(--graphite); margin-bottom: 6px; } .p-dec div { display: flex; flex-wrap: wrap; gap: 6px; }
.p-chip { border: 1px solid var(--rule); background: var(--sheet); color: inherit; font: inherit; font-size: 13px; padding: 5px 10px; border-radius: 999px; cursor: pointer; } .p-chip i { font-style: normal; color: var(--accent); margin-left: 4px; } .p-chip.on { background: var(--ink); color: var(--on-ink); border-color: var(--ink); }
.p-foot { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-top: 1px solid var(--rule); }
.p-nav { width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--rule); background: var(--sheet); color: inherit; font-size: 20px; line-height: 1; cursor: pointer; } .p-nav:disabled { opacity: .35; cursor: default; }
.p-dots { display: flex; gap: 6px; } .p-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--rule); cursor: pointer; transition: width .2s, background .2s; } .p-dots i.on { width: 20px; background: var(--accent); }
@media (max-width: 820px) {
  .app.presenting .mstage { right: 0; top: 96px; bottom: calc(50vh + 6px); }
  .app.presenting .mx-svg { inset: 8px; width: calc(100% - 16px); height: calc(100% - 16px); }
  .p-head { left: 16px; top: 12px; } .p-over { display: none; } .p-total b { font-size: 56px; } .p-exit { right: 12px; top: 12px; }
  .p-card { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; height: 50vh; }
}
@media (prefers-reduced-motion: reduce) { .p-dots i { transition: none; } }

/* landing hero: always a night scene, whatever the theme, so its own colours are fixed here */
.hero { grid-column: 1 / -1; position: relative; overflow: hidden; min-height: min(78vh, 760px); display: flex; flex-direction: column; justify-content: center; color: #f6f3ee; background: #0b1016; isolation: isolate; }
.hero.hero-slim { min-height: 400px; }
.hero-art { position: absolute; inset: 0; width: 100%; height: 100%; z-index: -2; }
.hero-scrim { position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(8, 12, 17, .96) 0%, rgba(8, 12, 17, .9) 34%, rgba(8, 12, 17, .1) 46%, rgba(8, 12, 17, 0) 60%), linear-gradient(0deg, rgba(8, 12, 17, .55) 0%, rgba(8, 12, 17, 0) 22%); }
.hero-in { max-width: 560px; padding: 52px clamp(20px, 5vw, 72px) 30px; box-sizing: content-box; }
.hero-slim .hero-in { padding-bottom: 40px; padding-top: 36px; }
.hero-over { display: inline-block; font-size: 12.5px; letter-spacing: .14em; text-transform: uppercase; color: #f0b27c; margin-bottom: 16px; }
.hero h1 { font-size: clamp(34px, 4.3vw, 58px); line-height: 1.02; letter-spacing: -.02em; margin: 0 0 18px; color: #fff; text-wrap: balance; }
.hero-slim h1 { font-size: clamp(28px, 3.4vw, 42px); }
.hero p { font-size: clamp(16px, 1.3vw, 19px); line-height: 1.5; color: #c9cfd6; margin: 0 0 26px; max-width: 52ch; }
.hero-slim p { display: none; }
.hero-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hero .btn { border-radius: 999px; padding: 12px 22px; font-size: 15.5px; font-weight: 600; cursor: pointer; }
.hero-primary { background: #f08a3c; border-color: #f08a3c; color: #1a0f06; } .hero-primary:hover { background: #ffa257; border-color: #ffa257; }
.hero-ghost { background: rgba(255, 255, 255, .07); border-color: rgba(255, 255, 255, .28); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); } .hero-ghost:hover { background: rgba(255, 255, 255, .16); border-color: #fff; }
.hero .btn:focus-visible { outline: 2px solid #fff; outline-offset: 3px; }
.hero-note { display: block; margin-top: 14px; font-size: 13px; color: #98a2ad; }
.hero-proof { margin: 6px clamp(20px, 5vw, 72px) 44px; padding: 0; list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); max-width: 640px;
  border: 1px solid rgba(255, 255, 255, .16); border-radius: 16px; background: rgba(10, 14, 19, .5); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
.hero-proof li { padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; } .hero-proof li + li { border-left: 1px solid rgba(255, 255, 255, .14); }
.hero-proof b { font-size: 21px; font-variant-numeric: tabular-nums; color: #fff; } .hero-proof span { font-size: 12.5px; line-height: 1.35; color: #b7c0ca; }
.hero-slim .hero-proof { display: none; }
.hero-cap { position: absolute; right: 18px; bottom: 8px; font-size: 11.5px; color: rgba(255, 255, 255, .55); }
.h-lvl text { font: 500 13px "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif; letter-spacing: .08em; fill: #9fc3ea; }
.h-dim text { font: 500 15px "IBM Plex Sans Condensed", "IBM Plex Sans", sans-serif; fill: #dbe9f8; }
.h-tag path { stroke: #ffd3a3; stroke-width: 1.5; fill: none; } .h-tag circle { fill: #ffb26b; } .h-tag rect { fill: rgba(12, 16, 21, .78); stroke: rgba(255, 211, 163, .6); }
.h-tag text { font: 500 16px "IBM Plex Sans", sans-serif; fill: #e7ebef; } .h-tag .h-v { fill: #ffb26b; font-weight: 700; }
@media (max-width: 900px) {
  .hero { min-height: 0; justify-content: flex-start; } .hero-art { height: 46vh; min-height: 300px; bottom: auto; }
  .hero-scrim { background: linear-gradient(0deg, #0b1016 0%, #0b1016 calc(100% - 46vh + 40px), rgba(11, 16, 22, 0) calc(100% - 46vh + 150px)); }
  .hero-in { padding: calc(max(46vh, 300px) - 40px) 20px 20px; max-width: none; } .hero-slim .hero-in { padding-top: calc(max(46vh, 300px) - 60px); }
  .hero-proof { margin: 0 20px 34px; grid-template-columns: 1fr; max-width: none; } .hero-proof li + li { border-left: 0; border-top: 1px solid rgba(255, 255, 255, .14); }
  .hero-proof li { flex-direction: row; align-items: baseline; gap: 12px; } .hero-proof b { min-width: 92px; font-size: 20px; }
  .hero-cap { left: 20px; right: auto; } .hero .btn { flex: 1 1 auto; text-align: center; }
  .hero.hero-slim .hero-art { height: 220px; min-height: 0; } .hero.hero-slim .hero-in { padding-top: 170px; } .hero-slim .hero-scrim { background: linear-gradient(0deg, #0b1016 0%, #0b1016 calc(100% - 180px), rgba(11, 16, 22, 0) calc(100% - 90px)); }
}
@media print { .hero { display: none; } }
.hero-slim .h-tags, .hero-slim .hero-cap { display: none; }
.hero-photo { position: absolute; inset: -40px; width: calc(100% + 80px); height: calc(100% + 80px); object-fit: cover; z-index: -2; filter: blur(26px) saturate(1.05) brightness(.62); }
.hero-has-photo .hero-scrim { background: linear-gradient(90deg, rgba(8, 12, 17, .9) 0%, rgba(8, 12, 17, .72) 36%, rgba(8, 12, 17, .2) 62%, rgba(8, 12, 17, .05) 100%), linear-gradient(0deg, rgba(8, 12, 17, .5) 0%, rgba(8, 12, 17, 0) 26%); }
.hero-shots { position: absolute; right: clamp(20px, 4vw, 64px); top: 50%; transform: translateY(-50%); width: min(46vw, 640px); aspect-ratio: 640 / 520; pointer-events: none; }
.shot { position: absolute; margin: 0; padding: 7px; border-radius: 14px; background: rgba(255, 255, 255, .92); box-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3); }
.shot img { display: block; width: 100%; border-radius: 8px; }
.hero-shots .s0 { width: 66%; left: 17%; top: 16%; z-index: 3; }
.hero-shots .s1 { width: 47%; left: 0; top: 0; transform: rotate(-3deg); z-index: 1; }
.hero-shots .s2 { width: 50%; right: 0; bottom: 0; transform: rotate(2.5deg); z-index: 2; }
.hero-shots.n1 .s0 { width: 86%; left: 7%; top: 8%; } .hero-shots.n2 .s1 { top: 4%; }
.hero-slim .hero-shots { width: min(34vw, 430px); }
@media (max-width: 900px) {
  .hero-has-photo .hero-scrim { background: linear-gradient(0deg, rgba(8, 12, 17, .88) 0%, rgba(8, 12, 17, .55) 60%, rgba(8, 12, 17, .25) 100%); }
  .hero-shots { position: relative; right: auto; top: auto; transform: none; width: auto; aspect-ratio: auto; display: flex; gap: 10px; overflow: hidden; padding: 18px 20px 0; }
  .hero-shots .shot { position: static; transform: none !important; flex: 0 0 72%; width: auto; padding: 5px; } .hero-shots .s1, .hero-shots .s2 { flex-basis: 60%; }
  .hero-has-photo .hero-in, .hero-has-photo.hero-slim .hero-in { padding-top: 22px; }
  .hero-has-photo.hero-slim .hero-shots .s1, .hero-has-photo.hero-slim .hero-shots .s2 { display: none; } .hero-has-photo.hero-slim .hero-shots .shot { flex-basis: 100%; max-width: 360px; }
}

/* the model: every part can be pointed at, pressed and pulled apart */
.mx-svg [data-cls] { cursor: pointer; }
.mx-svg polygon.hov, .mx-svg g.hov polygon { stroke: var(--accent) !important; stroke-width: .07 !important; filter: brightness(1.08); }
.mx-svg polygon.sel, .mx-svg g.sel polygon { stroke: var(--accent) !important; stroke-width: .09 !important; opacity: 1 !important; fill: color-mix(in srgb, var(--accent) 34%, var(--sheet)); }
.mstage[data-focus] .mx-svg g.sel { opacity: 1 !important; }
.mx-top { flex-wrap: wrap; row-gap: 8px; }
.mx-explode { display: inline-flex; align-items: center; gap: 8px; padding: 4px 12px; border: 1px solid var(--rule); border-radius: 999px; background: var(--sheet); font-size: 13px; }
.mx-explode input { width: 120px; accent-color: var(--accent); }
.mx-views button { min-width: 34px; }
.mx-tip { position: absolute; z-index: 6; pointer-events: none; padding: 6px 10px; border-radius: 8px; background: var(--ink); color: var(--on-ink); font-size: 12.5px; line-height: 1.3; max-width: 220px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.mx-tip b { display: block; } .mx-tip span { opacity: .8; }
.mx-info { position: absolute; z-index: 5; right: 14px; top: 140px; width: min(300px, calc(100% - 28px)); max-height: calc(100% - 220px); overflow: auto; padding: 14px 16px; border: 1px solid var(--rule); border-radius: 14px;
  background: color-mix(in srgb, var(--sheet) 92%, transparent); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); box-shadow: 0 14px 40px rgba(0, 0, 0, .16); font-size: 13.5px; }
.mx-info small { color: var(--graphite); } .mx-info h4 { margin: 2px 0 10px; font-size: 19px; } .mx-info h5 { margin: 14px 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); }
.mx-info dl { margin: 0 0 10px; display: grid; gap: 4px; } .mx-info dl div { display: flex; justify-content: space-between; gap: 10px; } .mx-info dt { color: var(--graphite); } .mx-info dd { margin: 0; font-variant-numeric: tabular-nums; font-weight: 600; }
.mx-kg { padding: 10px 12px; border-radius: 10px; background: var(--accent-soft); } .mx-kg b { display: block; font-size: 22px; color: var(--accent); } .mx-kg span { font-size: 12.5px; color: var(--graphite); }
.mx-info p { margin: 8px 0 0; color: var(--graphite); line-height: 1.45; }
.mx-line { display: flex; justify-content: space-between; gap: 10px; width: 100%; text-align: left; padding: 7px 9px; margin-bottom: 4px; border: 1px solid var(--rule); border-radius: 9px; background: var(--sheet); color: inherit; font: inherit; font-size: 13px; cursor: pointer; }
.mx-line:hover { border-color: var(--ink); } .mx-line em { font-style: normal; color: var(--graphite); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mx-lh2 { display: block; margin-top: 4px; }
.mx-x { position: absolute; right: 8px; top: 6px; border: 0; background: none; font-size: 20px; line-height: 1; color: var(--graphite); cursor: pointer; padding: 4px 8px; }
.app.presenting .mx-info { top: 150px; right: 14px; }
@media (max-width: 820px) { .mx-hint { display: none; } .mx-explode input { width: 84px; } .mx-info { left: 10px; right: 10px; width: auto; top: auto; bottom: 10px; max-height: 46%; } .app.presenting .mx-info { top: auto; } }
@media (min-width: 821px) { .mstage.has-info .mx-svg { width: calc(100% - 350px); } }

/* Lowest-Cost Carbon Plan: prices beside the carbon (Spec explorer, home screen, company report) */
.ct { border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); padding: 12px 14px; margin: 0 0 14px; }
.fleet .ct { margin: 12px 0 0; background: var(--panel); }
.ct-h { display: flex; align-items: baseline; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 8px; }
.ct-h h3 { margin: 0; font: 600 16px var(--f-cond); }
.ct-h h3 small { font-weight: 400; color: var(--graphite); font-size: 12.5px; margin-left: 6px; }
.ct-src { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 12.5px; margin-left: auto; }
.ct > p { font-size: 13.5px; margin: 0 0 10px; }
.ct-btns { display: flex; gap: 8px; flex-wrap: wrap; }
.banner.ct-sample { border-left-color: var(--warn); background: var(--warn-soft); font-size: 13px; margin-bottom: 10px; padding: 8px 10px; }
.ct-kpis { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 10px; }
.ct-kpis div { border: 1px solid var(--rule); border-radius: var(--r); padding: 9px 11px; }
.ct-kpis b { display: block; font: 700 24px/1.1 var(--f-cond); color: var(--ok); }
.ct-kpis span { font-size: 12.5px; color: var(--graphite); }
.ct-target { display: flex; align-items: baseline; gap: 6px 8px; flex-wrap: wrap; padding: 9px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.ct-target label { font: 600 14.5px var(--f-cond); }
.ct-target input.starts { width: 46px; text-align: right; }
.ct-target p { flex: 1 1 260px; margin: 0; font-size: 13.5px; }
.ct .ct-note { font-size: 12px; margin: 0 0 10px; }
.swap-sort { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 0 0 6px; }
.swap-sort p { flex: 1 1 240px; font-size: 13.5px; margin: 0; }
.seg { display: inline-flex; border: 1px solid var(--rule); border-radius: var(--r); overflow: hidden; flex: none; }
.seg button { border: 0; background: var(--sheet); color: var(--graphite); padding: 5px 10px; font: 500 13px var(--f-ui); cursor: pointer; }
.seg button + button { border-left: 1px solid var(--rule); }
.seg button[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.swap .ct-c { grid-column: 1 / -1; font-size: 13px; color: var(--graphite); }
.swap .ct-c b { color: var(--ink); font: 600 14px var(--f-cond); }
.swap .ct-c.free b { color: var(--ok); }
.swap .ct-c.none { font-style: italic; }
.fleet-row.ct-row { grid-template-columns: minmax(0, 1fr) auto 104px; }
.fleet-row .ct-d { text-align: right; font-size: 13.5px; }
.fleet-row .ct-d.free { color: var(--ok); font-weight: 600; }
@media print { .ct-btns, .ct-target input { display: none; } }
.ct-more { margin-top: 8px; font-size: 12.5px; }
.ct-more summary { cursor: pointer; color: var(--graphite); }
.ct-more p { font-size: 12.5px; margin: 6px 0 0; }

/* Scan with your phone: the link and its QR code */
dialog.phone-link { width: min(640px, calc(100vw - 32px)); padding: 26px 28px 28px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); color: var(--ink); box-shadow: var(--shadow); }
dialog.phone-link::backdrop { background: rgba(20, 18, 15, .45); }
.phone-link form { float: right; margin: -6px -8px 0 16px; }
.phone-link .pl-x { border: 0; background: none; padding: 6px 8px; color: var(--graphite); font: inherit; font-size: 14px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.phone-link h2 { margin: 0 0 18px; font: 600 24px/1.15 var(--f-cond); }
.phone-link .pl-body { display: grid; grid-template-columns: 188px minmax(0, 1fr); gap: 26px; align-items: start; }
.phone-link .pl-qr { display: block; width: 188px; height: 188px; border: 1px solid var(--rule); }
.phone-link p { margin: 0 0 12px; }
.phone-link .pl-link { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; }
.phone-link .pl-link a { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; text-underline-offset: 3px; }
.phone-link .pl-warn { padding-left: 10px; border-left: 3px solid var(--warn); font-size: 14px; }
.phone-link ul { margin: 14px 0 0; padding: 12px 0 0; list-style: none; border-top: 1px solid var(--rule); color: var(--graphite); font-size: 14px; }
.phone-link li + li { margin-top: 6px; }
.scan-link { display: inline-block; margin-top: 8px; padding: 2px 0; border: 0; background: none; color: var(--ink); font: inherit; font-size: 14px; text-decoration: underline; text-decoration-color: var(--graphite); text-underline-offset: 3px; cursor: pointer; }
@media (max-width: 560px) { .phone-link .pl-body { grid-template-columns: 1fr; } }

/* Overview, first view: the answer, then at most three next steps; the audit trail sits in one disclosure */
.section.next { margin-top: 18px; }
.eye.cut .stripe { background: var(--ok); }
.next-more { margin: 8px 0 0; font-size: 13px; }
details.behind { margin-top: 22px; border-top: 1px solid var(--rule); }
details.behind > summary { display: grid; gap: 3px; padding: 14px 22px 14px 0; cursor: pointer; list-style: none; position: relative; font: 600 16px/1.25 var(--f-cond); }
details.behind > summary::-webkit-details-marker { display: none; }
details.behind > summary::after { content: ""; position: absolute; right: 4px; top: 20px; width: 8px; height: 8px; border-right: 2px solid var(--graphite); border-bottom: 2px solid var(--graphite); transform: rotate(45deg); transition: transform .15s; }
details.behind[open] > summary::after { transform: rotate(-135deg); top: 24px; }
details.behind > summary small { font: 400 13px/1.4 var(--f-ui); color: var(--graphite); }
details.behind > summary:hover small { color: var(--ink); }
details.behind > summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
details.behind[open] > summary { border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
@media (prefers-reduced-motion: reduce) { details.behind > summary::after { transition: none; } }
.mx-more { padding: 7px 12px; border: 1px solid var(--rule); border-radius: 8px; background: var(--panel); box-shadow: var(--shadow); font: 600 13.5px var(--f-cond); color: var(--graphite); cursor: pointer; }
.mx-more:hover, .mx-more[aria-expanded="true"] { color: var(--ink); border-color: var(--graphite); }
.mx-opts { flex-basis: 100%; display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.mx-opts[hidden] { display: none; }
.mx-top { justify-content: flex-start; }
.mx-top .mx-hint { margin-left: auto; }
.mx-opts { order: 3; }
/* a phone has no room for the walk-through button beside the view switch, and it would wrap onto the model's controls */
@media (max-width: 640px) { #present-on { display: none; } }

/* 3D model card: show where a part was read, and correct a bill line's quantity in place */
.mx-src { display: block; width: 100%; margin: 2px 0 12px; padding: 8px 10px; border: 1px solid var(--ink); border-radius: 9px; background: var(--ink); color: var(--on-ink); font: 600 13.5px var(--f-cond); cursor: pointer; text-align: center; }
.mx-src:hover { background: color-mix(in srgb, var(--ink) 86%, var(--accent)); }
.mx-lines { display: grid; gap: 4px; }
.mx-info .mx-line { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 4px 8px; padding: 6px 8px; margin: 0; cursor: default; }
.mx-info .mx-line.edited { border-color: var(--accent); }
.mx-ln { min-width: 0; padding: 2px 0; border: 0; background: none; color: inherit; font: inherit; font-size: 13px; line-height: 1.3; text-align: left; cursor: pointer; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 3px; }
.mx-ln:hover { text-decoration-color: var(--ink); }
.mx-q { display: inline-flex; align-items: baseline; gap: 4px; }
.mx-q input { width: 5.4em; padding: 3px 6px; border: 1px solid var(--rule); border-radius: 6px; background: var(--paper); color: var(--ink); font: 600 13px var(--f-ui); font-variant-numeric: tabular-nums; text-align: right; }
.mx-q input:hover { border-color: var(--graphite); }
.mx-q input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; background: var(--sheet); }
.mx-q span { font-size: 12px; color: var(--graphite); min-width: 1.6em; }
.mx-info .mx-line em { font-style: normal; font-size: 12.5px; color: var(--graphite); white-space: nowrap; font-variant-numeric: tabular-nums; }
.mx-reset { grid-column: 1 / -1; justify-self: start; padding: 0; border: 0; background: none; color: var(--accent); font: inherit; font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.mx-info .mx-lh2 { display: block; margin-top: 8px; font-size: 12px; line-height: 1.4; }
/* on the sheet: the one wall, bold, and the rest of the storey's walls faint around it */
.ov.ov-ctx { opacity: .5; stroke-width: 3.5; }
.ov.ov-one { stroke-linecap: round; }
.hero-phone { display: inline-flex; align-items: center; gap: 8px; } .hero-phone svg { flex: none; opacity: .9; }
/* the hero's buttons may run past the text column into the free space before the house pictures, so the four of
   them sit on one line where there is room; where there isn't they wrap */
@media (min-width: 1101px) {
  .hero-cta { width: max-content; max-width: max(100%, calc(100vw - clamp(20px, 4vw, 64px) - min(46vw, 640px) - clamp(20px, 5vw, 72px) - 28px)); }
  .hero-slim .hero-cta { max-width: max(100%, calc(100vw - clamp(20px, 4vw, 64px) - min(34vw, 430px) - clamp(20px, 5vw, 72px) - 28px)); }
}

/* ---------------------------------------------------------------- 3D model in WebGL (js/ui/model3d.js) */
.mstage.mx3.gl { background-image: none; background: radial-gradient(120% 90% at 55% 30%, var(--sheet) 0%, var(--paper) 70%); }
.mx-gl { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; touch-action: none; outline: none; }
.mx-gl:active { cursor: grabbing; }
.mstage.no-gl .mx-gl { display: none; }
.mx-pill { border: 1px solid var(--rule); border-radius: 999px; background: var(--panel); box-shadow: var(--shadow); padding: 7px 14px; font: 600 13.5px var(--f-cond); color: var(--graphite); cursor: pointer; white-space: nowrap; }
.mx-pill:hover { color: var(--ink); border-color: var(--graphite); }
.mx-pill[aria-pressed="true"] { color: var(--ink); border-color: var(--ink); }
.mx-tk { color: var(--ink); border-color: var(--ink); }
.mx-tk[aria-pressed="true"] { background: var(--ink); color: var(--on-ink); }
.mx-opts { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.mx-explode input { width: 150px; }
.mx-note { font-size: 12.5px; padding: 8px 10px; border-left: 2px solid var(--rule); margin: 0 0 10px !important; }
.mx-arith { flex-basis: 100%; font-size: 11.5px; color: var(--graphite); font-variant-numeric: tabular-nums; font-family: var(--f-mono, ui-monospace, monospace); }
.mx-line { flex-wrap: wrap; }
.mx-row i.hatched, .mx-lfoot i { background-image: repeating-linear-gradient(135deg, rgba(0, 0, 0, .28) 0 2px, transparent 2px 6px) !important; }
.mx-lfoot { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--rule); font-size: 12px; color: var(--graphite); }
.mx-lfoot i { width: 14px; height: 14px; border-radius: 3px; border: 1px solid var(--rule); background-color: var(--mx-none); flex: none; }

/* takeoff view: the list of the bill's elements; each row's slot is where that element's pieces arrive */
/* the panel is open where the slots are: the pieces are drawn on the canvas underneath and must show through */
.mx-parts { position: absolute; z-index: 5; left: 14px; top: 104px; bottom: 56px; width: min(340px, calc(100% - 28px)); display: flex; flex-direction: column; gap: 8px;
  padding: 0; pointer-events: none; animation: mx-in .4s ease-out; }
.mx-parts > * { pointer-events: auto; }
.mx-ph, .mx-rebuild { border: 1px solid var(--rule); border-radius: 12px; background: color-mix(in srgb, var(--sheet) 90%, transparent); box-shadow: var(--shadow); }
.mx-ph { padding: 10px 14px 10px; }
.mx-ph small { display: block; font: 600 11.5px var(--f-cond); letter-spacing: .06em; text-transform: uppercase; color: var(--graphite); }
.mx-ptotal { display: block; font: 700 34px/1.1 var(--f-cond); font-variant-numeric: tabular-nums; color: var(--ink); margin-top: 2px; }
.mx-parts.done .mx-ptotal { color: var(--accent); }
.mx-psub { font-size: 12px; color: var(--graphite); }
.mx-plist { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; gap: 6px; scrollbar-width: thin; }
.mx-prow { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; width: 100%; padding: 6px 10px 6px 0; border: 0; border-radius: 10px;
  background: linear-gradient(90deg, transparent 0 102px, color-mix(in srgb, var(--sheet) 92%, transparent) 102px); color: inherit; font: inherit; text-align: left; cursor: pointer;
  box-shadow: inset -1px 0 0 var(--rule), inset 0 1px 0 var(--rule), inset 0 -1px 0 var(--rule); opacity: .5; transition: opacity .35s, box-shadow .2s; }
.mx-prow.landed { opacity: 1; }
.mx-prow:hover { box-shadow: inset -1px 0 0 var(--graphite), inset 0 1px 0 var(--graphite), inset 0 -1px 0 var(--graphite); }
.mx-prow[aria-pressed="true"] { box-shadow: inset -2px 0 0 var(--accent), inset 0 2px 0 var(--accent), inset 0 -2px 0 var(--accent); }
.mx-prow[aria-pressed="true"] .mx-pn b { color: var(--accent); }
.mx-prest { cursor: default; }
.mx-slot { height: 48px; border-radius: 10px 0 0 10px; border: 1px dashed var(--rule); border-right: 0; }
.mx-prow.landed .mx-slot { border-style: solid; border-color: var(--rule); }
.mx-pn { padding-left: 2px; }
.mx-prow .mx-pn, .mx-prow .mx-pk { text-shadow: none; }
.mstage.apart .mx-legend { display: none; }
.mx-prest .mx-slot { background: repeating-linear-gradient(135deg, var(--rule) 0 1px, transparent 1px 7px); }
.mx-pn b { display: block; font-size: 13.5px; } .mx-pn small { font-size: 11.5px; color: var(--graphite); }
.mx-pk { text-align: right; font-variant-numeric: tabular-nums; } .mx-pk b { display: block; font: 600 15px var(--f-cond); } .mx-pk small { font-size: 11.5px; color: var(--graphite); }
.mx-rebuild { border: 1px solid var(--rule); border-radius: 9px; background: var(--panel); padding: 8px; font: 600 13px var(--f-cond); color: var(--ink); cursor: pointer; }
.mx-rebuild:hover { border-color: var(--ink); }
.mstage.apart .mx-bottom .mx-seg { visibility: hidden; }
@media (max-width: 820px) {
  .mx-parts { left: 8px; right: 8px; width: auto; top: auto; bottom: 8px; height: 46%; }
  .mx-prow { grid-template-columns: 70px 1fr auto; }
  .mx-ptotal { font-size: 26px; }
  .mx-tk { padding: 6px 11px; }
}
/* showcase mode: no controls, carbon colours on (not used on a page yet) */
.mx-showcase { position: absolute; inset: 0; display: block; background: none !important; }
.mx-showcase .mx-gl { cursor: default; pointer-events: none; }
.mx-showcase .mx-tip, .mx-showcase .mx-info, .mx-showcase .mx-parts { display: none !important; }
.mx-info .mx-arith { grid-column: 1 / -1; margin-top: -2px; }

/* results screen: the sheet list (left), the side panel (right) and the carbon bar (bottom) each collapse.
   Orange tabs hang on the inner edge of each panel, like the review screen's. */
.side-tg { display: none; }
@media (min-width: 821px) {
  .app:not(.immersive):not(.presenting) .work { position: relative; --rail-w: 112px; --side-w: max(420px, 37%);
    grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--side-w); }
  .app:not(.immersive):not(.presenting).rail-collapsed .work { --rail-w: 0px; }
  .app:not(.immersive):not(.presenting).side-collapsed .work { --side-w: 0px; }
  .app:not(.immersive):not(.presenting).rail-collapsed .rail,
  .app:not(.immersive):not(.presenting).side-collapsed .side { visibility: hidden; overflow: hidden; padding: 0; border: 0; min-width: 0; }
  .app:not(.immersive):not(.presenting) .rail-tg,
  .app:not(.immersive):not(.presenting) .side-tg { display: grid; place-items: center; position: absolute; z-index: 6; top: 50%; transform: translateY(-50%);
    width: 22px; height: 56px; padding: 0; border: 0; background: var(--accent); color: #fff; cursor: pointer;
    box-shadow: 0 4px 14px -4px rgba(0, 0, 0, .5); transition: filter .15s; }
  .app:not(.immersive):not(.presenting) .rail-tg { left: var(--rail-w); border-radius: 0 9px 9px 0; }
  .app:not(.immersive):not(.presenting) .side-tg { right: var(--side-w); border-radius: 9px 0 0 9px; }
  .app:not(.immersive) .rail-tg:hover, .app:not(.immersive) .side-tg:hover { filter: brightness(1.12); }
  .side-tg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; transition: transform .25s; }
  .app.side-collapsed .side-tg svg { transform: rotate(180deg); }
  .app:not(.immersive).rail-collapsed.tally-collapsed .tally { left: 12px; }
  .rail-tg[data-tip]::after { left: calc(100% + 8px); }
  .side-tg[data-tip]::after { left: auto; right: calc(100% + 8px); bottom: auto; top: 50%; transform: translate(4px, -50%); }
  .side-tg[data-tip]:hover::after { transform: translate(0, -50%); }
}
@media (max-width: 1100px) and (min-width: 821px) {
  .app:not(.immersive):not(.presenting) .work { --rail-w: 84px; --side-w: max(320px, 40%); }
}

/* settings menu (top right): who is signed in, theme, sign out */
.setmenu { position: absolute; top: calc(100% - 4px); right: max(12px, env(safe-area-inset-right, 0px)); z-index: 40; width: 268px; padding: 6px;
  border-radius: 12px; background: var(--panel); border: 1px solid var(--rule); box-shadow: var(--shadow); animation: smin .14s ease-out; }
.setmenu[hidden] { display: none; }
@keyframes smin { from { opacity: 0; transform: translateY(-4px); } }
.sm-who { display: flex; align-items: center; gap: 10px; padding: 8px 8px 12px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.sm-who b { display: block; font: 600 15px/1.2 var(--f-cond); }
.sm-who small { color: var(--graphite); font-size: 12.5px; }
.sm-av { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: #fff; font: 700 15px var(--f-cond); }
.sm-sec { padding: 8px 8px 10px; border-bottom: 1px solid var(--rule); margin-bottom: 4px; }
.sm-l { display: block; font-size: 12.5px; color: var(--graphite); margin-bottom: 7px; }
.sm-seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 2px; padding: 3px; border-radius: 9px; background: var(--paper); border: 1px solid var(--rule); }
.sm-seg button { display: inline-flex; align-items: center; justify-content: center; gap: 5px; min-height: 30px; padding: 0 6px; border: 0; border-radius: 7px; background: none; color: var(--graphite); font: 500 13px var(--f-ui); }
.sm-seg button:hover { color: var(--ink); }
.sm-seg button[aria-checked="true"] { background: var(--sheet); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .18); }
.sm-seg svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sm-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 8px; border: 0; border-radius: 8px; background: none; color: var(--ink); font: 500 14px var(--f-ui); text-align: left; }
.sm-item:hover { background: var(--accent-soft); color: var(--accent); }
.sm-item svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* carbon colour key: a card on the left under the toolbar (the part card uses the right), collapsible to its
   title; while it is open the building is framed in the space beside it, so the key never covers the model */
.mx3 .mx-legend { position: absolute; z-index: 4; left: 36px; top: 128px; width: 262px; max-height: calc(100% - 210px); overflow: auto; min-width: 0; padding: 4px 8px 6px; }
.mx3 .mx-legend.shut { width: auto; padding: 0; overflow: visible; }
.mx3 .mx-legend .mx-lh { display: flex; align-items: center; justify-content: space-between; gap: 10px; width: 100%; margin: 0; padding: 7px 4px; border: 0; background: none; text-align: left; cursor: pointer; color: var(--graphite); }
.mx3 .mx-legend.shut .mx-lh { padding: 7px 12px; }
.mx3 .mx-legend .mx-lh:hover { color: var(--ink); }
.mx3 .mx-legend .mx-lh svg { flex: none; width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .2s; }
.mx3 .mx-legend.shut .mx-lh svg { transform: rotate(-90deg); }
.mx3 .mx-legend.shut .mx-lbody { display: none; }
.mx3 .mx-legend .mx-row { font-size: 13px; padding: 3px 4px; grid-template-columns: 13px 1fr auto 44px; gap: 8px; }
.mx3 .mx-legend .mx-row i { width: 13px; height: 13px; }
.mx3 .mx-legend .mx-lfoot { font-size: 11.5px; line-height: 1.35; }
.app.rail-collapsed:not(.immersive) .mx3 .mx-legend { left: 32px; }
@media (max-width: 820px) {
  .mx3 .mx-legend { left: 10px; right: 10px; top: auto; bottom: 74px; width: auto; max-height: 38%; }
  .mx3 .mx-legend.shut { right: auto; }
}

/* takeoff list and colour key start under the toolbar's last row, so the View options row never runs over them */
.mx3 .mx-parts { top: calc(var(--mx-top-b, 92px) + 12px); }
.mx3 .mx-legend { top: calc(var(--mx-top-b, 92px) + 12px); }
@media (max-width: 820px) { .mx3 .mx-parts, .mx3 .mx-legend { top: auto; } }

/* ---- scope, what the total leaves out, measured accuracy, data sources (js/ui/trust.js) */
.scope-line { margin: 2px 0 0; font-size: 13.5px; color: var(--graphite); }
.scope-line b { color: var(--ink); font: 600 14px var(--f-cond); }
.eye-t b, .eye-t small { -webkit-line-clamp: 3; }
details.missing { margin-top: 14px; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); }
details.missing > summary { cursor: pointer; padding: 9px 12px; font: 600 14px var(--f-cond); color: var(--graphite); list-style: none; display: flex; justify-content: space-between; align-items: center; gap: 10px; }
details.missing > summary::-webkit-details-marker { display: none; }
details.missing > summary::after { content: ""; flex: none; width: 7px; height: 7px; border-right: 2px solid var(--graphite); border-bottom: 2px solid var(--graphite); transform: rotate(45deg) translateY(-2px); transition: transform .15s; }
details.missing[open] > summary::after { transform: rotate(-135deg) translateX(-2px); }
details.missing > summary:hover { color: var(--ink); }
details.missing.warn { border-left: 3px solid var(--warn); }
details.missing.warn > summary { color: var(--ink); }
.miss-list { list-style: none; margin: 0; padding: 0 12px 6px; }
.miss-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1px 12px; padding: 7px 0; border-top: 1px solid var(--rule); font-size: 14px; }
.miss-list li b { font-weight: 600; }
.miss-list li .num { font: 600 13.5px var(--f-cond); font-variant-numeric: tabular-nums; white-space: nowrap; }
.miss-list li small { grid-column: 1 / -1; color: var(--graphite); font-size: 12.5px; line-height: 1.4; }
.miss-list.scope li b { font-weight: 500; }
.miss-h { margin: 6px 12px 0; font: 600 12px var(--f-cond); text-transform: uppercase; letter-spacing: .05em; color: var(--graphite); }
.acc-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 8px; margin-bottom: 14px; }
.acc-kpis div { border: 1px solid var(--rule); border-radius: var(--r); padding: 9px 11px; background: var(--sheet); }
.acc-kpis b { display: block; font: 700 22px/1.1 var(--f-cond); }
.acc-kpis span { font-size: 12.5px; line-height: 1.35; color: var(--graphite); display: block; margin-top: 3px; }
.acc-bars .barrow { --c: var(--ink); }
.acc-t { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.acc-t th, .acc-t td { text-align: left; padding: 5px 4px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.acc-t th { font: 600 12.5px var(--f-cond); color: var(--graphite); }
.acc-t .r { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.acc-t tr.tot td { font-weight: 600; }
.acc-note { font-size: 12.5px; line-height: 1.45; margin: 8px 0 0; }
.src-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.src-list li { border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); padding: 8px 11px; display: grid; gap: 2px; }
.src-h { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.src-h b { font: 600 14px/1.3 var(--f-cond); }
.src-h .num { font: 600 14px var(--f-cond); font-variant-numeric: tabular-nums; }
.src-list small { color: var(--graphite); font-size: 12.5px; line-height: 1.4; }
.src-list small.cite a { color: inherit; text-decoration: underline; text-decoration-color: var(--rule); text-underline-offset: 2px; }
.src-list small.cite a:hover { color: var(--accent); text-decoration-color: currentColor; }
details.how .src-list { margin-top: 8px; }
.cc-look { color: var(--ink); }

/* ---- assumptions to settle (Gaps tab) */
.settle-p { font-size: 13px; margin: 0 0 10px; }
.settle-list { display: grid; gap: 6px; }
.settle-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 12px; border: 1px solid var(--rule); border-left: 3px solid var(--crit); border-radius: var(--r); background: var(--sheet); }
.settle-row.ok { border-left-color: var(--ok); }
.settle-t { display: grid; gap: 2px; min-width: 0; }
.settle-t b { font-weight: 600; font-size: 14px; line-height: 1.35; }
.settle-t small { color: var(--graphite); font-size: 12.5px; line-height: 1.4; }
.settle-b { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.st-ok { color: var(--ok); font-weight: 700; }
@media (max-width: 640px) { .settle-row { grid-template-columns: 1fr; } .settle-b { justify-content: flex-start; } }
.stored-row { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 14px; align-items: baseline; border: 1px solid var(--rule); border-radius: var(--r); background: var(--sheet); padding: 10px 12px; }
.stored-row b { font: 700 22px/1.1 var(--f-cond); white-space: nowrap; }
.stored-row span { font-size: 13px; line-height: 1.45; color: var(--graphite); }

/* Add a plan set: the picker opened by "Choose a PDF plan set", and the whole window as a drop target */
dialog.pick { width: min(600px, calc(100vw - 32px)); padding: 0; border: 1px solid var(--rule); border-radius: 12px; background: var(--sheet); color: var(--ink); box-shadow: 0 1px 2px rgba(20, 18, 15, .1), 0 30px 70px -20px rgba(20, 18, 15, .55); overflow: hidden; }
dialog.pick[open] { animation: pick-in .22s cubic-bezier(.2, .8, .2, 1); }
dialog.pick::backdrop { background: rgba(20, 18, 15, .5); backdrop-filter: blur(3px); }
@keyframes pick-in { from { opacity: 0; transform: translateY(10px) scale(.985); } }
.pick-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 0 26px; }
.pick-head h2 { font: 600 22px/1.2 var(--f-cond); }
.pick-x { width: 36px; height: 36px; display: grid; place-items: center; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--graphite); cursor: pointer; }
.pick-x:hover { background: var(--panel); color: var(--ink); }
.pick-x svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
/* the drop zone is a drawing sheet on the table: dot grid, registration marks at the corners */
.pick-zone { position: relative; display: flex; flex-direction: column; align-items: center; margin: 16px 26px 26px; padding: 40px 20px 30px; border-radius: 8px; cursor: pointer; text-align: center;
  background: radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--graphite) 26%, transparent) 1px, transparent 1.3px) 0 0 / 22px 22px, var(--panel);
  box-shadow: inset 0 0 0 1px var(--rule); transition: background-color .18s, box-shadow .18s; }
.pk-c { position: absolute; width: 18px; height: 18px; border: 0 solid var(--ink); opacity: .55; transition: border-color .18s, opacity .18s, transform .18s; }
.pk-c.tl { top: 10px; left: 10px; border-top-width: 2px; border-left-width: 2px; }
.pk-c.tr { top: 10px; right: 10px; border-top-width: 2px; border-right-width: 2px; }
.pk-c.bl { bottom: 10px; left: 10px; border-bottom-width: 2px; border-left-width: 2px; }
.pk-c.br { bottom: 10px; right: 10px; border-bottom-width: 2px; border-right-width: 2px; }
.pk-art { width: 200px; height: 132px; overflow: visible; }
.pk-s rect { fill: var(--sheet); stroke: color-mix(in srgb, var(--graphite) 70%, transparent); stroke-width: 1.4; }
.pk-s path { fill: none; stroke: color-mix(in srgb, var(--graphite) 45%, transparent); stroke-width: 1.2; }
.pk-s .pk-plan { stroke: var(--ink); stroke-width: 1.8; stroke-linejoin: round; }
.pk-s { transition: transform .28s cubic-bezier(.2, .8, .2, 1); transform-box: fill-box; transform-origin: 50% 100%; }
.pk-s3 { filter: drop-shadow(0 6px 8px rgba(20, 18, 15, .14)); }
.pk-up circle { fill: var(--accent); stroke: var(--panel); stroke-width: 3; }
.pk-up path { fill: none; stroke: #fff; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pk-up { transition: transform .28s cubic-bezier(.2, .8, .2, 1); transform-box: fill-box; transform-origin: center; }
.pk-t { margin-top: 14px; font: 600 22px/1.2 var(--f-cond); }
.pk-live { display: none; color: var(--accent); }
.pk-browse { margin-top: 16px; padding: 9px 20px; font-size: 15px; }
.pk-kinds { display: flex; gap: 6px; margin-top: 18px; }
.pk-kinds em { padding: 2px 8px; border: 1px solid var(--rule); border-radius: 4px; background: var(--sheet); color: var(--graphite); font: 600 11px/1.5 var(--f-cond); letter-spacing: .08em; }
.pick-zone:hover .pk-c { opacity: .9; }
.pick-zone:hover .pk-s1 { transform: rotate(-5deg) translate(-6px, 1px); }
.pick-zone:hover .pk-s2 { transform: rotate(-2deg) translate(-3px, 0); }
.pick-zone.over { background-color: var(--accent-soft); box-shadow: inset 0 0 0 2px var(--accent); }
.pick-zone.over .pk-c { border-color: var(--accent); opacity: 1; }
.pick-zone.over .pk-c.tl { transform: translate(4px, 4px); } .pick-zone.over .pk-c.tr { transform: translate(-4px, 4px); }
.pick-zone.over .pk-c.bl { transform: translate(4px, -4px); } .pick-zone.over .pk-c.br { transform: translate(-4px, -4px); }
.pick-zone.over .pk-s1 { transform: rotate(-9deg) translate(-12px, 2px); }
.pick-zone.over .pk-s2 { transform: rotate(-4deg) translate(-6px, 0); }
.pick-zone.over .pk-up { transform: translateY(-6px) scale(1.08); }
.pick-zone.over .pk-idle { display: none; } .pick-zone.over .pk-live { display: inline; }
.pick-zone.over .pk-browse, .pick-zone.over .pk-kinds { visibility: hidden; }
.pick-zone.over * { pointer-events: none; }
@media (prefers-reduced-motion: reduce) { dialog.pick[open] { animation: none; } .pk-s, .pk-up, .pk-c { transition: none; } }
#drop-veil { position: fixed; inset: 0; z-index: 90; display: grid; place-items: center; padding: 24px; background: rgba(20, 18, 15, .45); pointer-events: none; }
#drop-veil > div { display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(560px, 100%); padding: 56px 24px; border: 2px dashed var(--accent); border-radius: var(--r); background: var(--sheet); color: var(--ink); text-align: center; box-shadow: var(--shadow); }
#drop-veil b { font: 600 24px/1.2 var(--f-cond); }
#drop-veil span { color: var(--graphite); font-size: 14.5px; }

/* The home hero with photographs follows the theme: warm paper with a soft wash of the photo in the light theme,
   the night version in the dark theme. (The drawn-scene hero, with no photographs, is a night scene in both.) */
.hero-has-photo { --h-bg: #f1eee8; --h-fg: var(--ink); --h-sub: #4d4a44; --h-over: var(--accent); --h-note: var(--graphite); --h-cap: var(--graphite);
  --h-photo: blur(34px) saturate(1.15) brightness(1.08); --h-photo-op: .5;
  --h-scrim: linear-gradient(90deg, #f1eee8 0%, rgba(241, 238, 232, .94) 30%, rgba(241, 238, 232, .55) 58%, rgba(241, 238, 232, .25) 100%), linear-gradient(0deg, rgba(241, 238, 232, .7) 0%, rgba(241, 238, 232, 0) 30%);
  --h-scrim-m: linear-gradient(0deg, #f1eee8 0%, rgba(241, 238, 232, .86) 60%, rgba(241, 238, 232, .6) 100%);
  --h-pri-bg: var(--accent); --h-pri-fg: #fff; --h-pri-hover: #a84110;
  --h-ghost-bg: rgba(255, 255, 255, .7); --h-ghost-bd: rgba(26, 25, 23, .2); --h-ghost-fg: var(--ink); --h-ghost-hover: #fff; --h-ghost-hover-bd: var(--ink); --h-focus: var(--ink);
  --h-proof-bg: rgba(255, 255, 255, .6); --h-proof-bd: rgba(26, 25, 23, .14); --h-proof-sub: var(--graphite);
  --h-shot-shadow: 0 22px 44px -14px rgba(60, 48, 30, .38), 0 2px 6px rgba(60, 48, 30, .14); --h-edge: var(--rule); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .hero-has-photo { --h-bg: #0b1016; --h-fg: #fff; --h-sub: #c9cfd6; --h-over: #f0b27c; --h-note: #98a2ad; --h-cap: rgba(255, 255, 255, .55);
  --h-photo: blur(26px) saturate(1.05) brightness(.62); --h-photo-op: 1;
  --h-scrim: linear-gradient(90deg, rgba(8, 12, 17, .9) 0%, rgba(8, 12, 17, .72) 36%, rgba(8, 12, 17, .2) 62%, rgba(8, 12, 17, .05) 100%), linear-gradient(0deg, rgba(8, 12, 17, .5) 0%, rgba(8, 12, 17, 0) 26%);
  --h-scrim-m: linear-gradient(0deg, rgba(8, 12, 17, .88) 0%, rgba(8, 12, 17, .55) 60%, rgba(8, 12, 17, .25) 100%);
  --h-pri-bg: #f08a3c; --h-pri-fg: #1a0f06; --h-pri-hover: #ffa257;
  --h-ghost-bg: rgba(255, 255, 255, .07); --h-ghost-bd: rgba(255, 255, 255, .28); --h-ghost-fg: #fff; --h-ghost-hover: rgba(255, 255, 255, .16); --h-ghost-hover-bd: #fff; --h-focus: #fff;
  --h-proof-bg: rgba(255, 255, 255, .05); --h-proof-bd: rgba(255, 255, 255, .14); --h-proof-sub: #b7c0ca;
  --h-shot-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3); --h-edge: transparent; } }
:root[data-theme="dark"] .hero-has-photo { --h-bg: #0b1016; --h-fg: #fff; --h-sub: #c9cfd6; --h-over: #f0b27c; --h-note: #98a2ad; --h-cap: rgba(255, 255, 255, .55);
  --h-photo: blur(26px) saturate(1.05) brightness(.62); --h-photo-op: 1;
  --h-scrim: linear-gradient(90deg, rgba(8, 12, 17, .9) 0%, rgba(8, 12, 17, .72) 36%, rgba(8, 12, 17, .2) 62%, rgba(8, 12, 17, .05) 100%), linear-gradient(0deg, rgba(8, 12, 17, .5) 0%, rgba(8, 12, 17, 0) 26%);
  --h-scrim-m: linear-gradient(0deg, rgba(8, 12, 17, .88) 0%, rgba(8, 12, 17, .55) 60%, rgba(8, 12, 17, .25) 100%);
  --h-pri-bg: #f08a3c; --h-pri-fg: #1a0f06; --h-pri-hover: #ffa257;
  --h-ghost-bg: rgba(255, 255, 255, .07); --h-ghost-bd: rgba(255, 255, 255, .28); --h-ghost-fg: #fff; --h-ghost-hover: rgba(255, 255, 255, .16); --h-ghost-hover-bd: #fff; --h-focus: #fff;
  --h-proof-bg: rgba(255, 255, 255, .05); --h-proof-bd: rgba(255, 255, 255, .14); --h-proof-sub: #b7c0ca;
  --h-shot-shadow: 0 24px 60px rgba(0, 0, 0, .5), 0 2px 8px rgba(0, 0, 0, .3); --h-edge: transparent; }
.hero.hero-has-photo { background: var(--h-bg); color: var(--h-fg); border-bottom: 1px solid var(--h-edge); }
.hero-has-photo .hero-photo { filter: var(--h-photo); opacity: var(--h-photo-op); }
.hero-has-photo .hero-scrim { background: var(--h-scrim); }
.hero-has-photo .hero-over { color: var(--h-over); font-weight: 600; }
.hero-has-photo h1 { color: var(--h-fg); }
.hero-has-photo p { color: var(--h-sub); }
.hero-has-photo .hero-note { color: var(--h-note); }
.hero-has-photo .hero-cap { color: var(--h-cap); }
.hero-has-photo .hero-primary { background: var(--h-pri-bg); border-color: var(--h-pri-bg); color: var(--h-pri-fg); }
.hero-has-photo .hero-primary:hover { background: var(--h-pri-hover); border-color: var(--h-pri-hover); }
.hero-has-photo .hero-ghost { background: var(--h-ghost-bg); border-color: var(--h-ghost-bd); color: var(--h-ghost-fg); }
.hero-has-photo .hero-ghost:hover { background: var(--h-ghost-hover); border-color: var(--h-ghost-hover-bd); }
.hero-has-photo .btn:focus-visible { outline-color: var(--h-focus); }
.hero-has-photo .hero-proof { background: var(--h-proof-bg); border-color: var(--h-proof-bd); }
.hero-has-photo .hero-proof li + li { border-color: var(--h-proof-bd); }
.hero-has-photo .hero-proof b { color: var(--h-fg); } .hero-has-photo .hero-proof span { color: var(--h-proof-sub); }
.hero-has-photo .shot { background: #fff; box-shadow: var(--h-shot-shadow); }
@media (max-width: 900px) { .hero-has-photo .hero-scrim { background: var(--h-scrim-m); } }
