/* =====================================================================
   Roboda CNC — owner-gated area
   Serves login.html, owner.html, pack.html under /cnc-machines/.

   NOTE ON cnc.css: this file deliberately does NOT `@import "cnc.css"`.
   The gated area must be *visually distinct* from the public catalog so
   that a screenshot or a printout is instantly identifiable as
   restricted material, and importing the public sheet would couple the
   two token sets. Everything needed is defined below. If you later want
   the public shell, add `@import "cnc.css";` as the very first line.
   ===================================================================== */

*,
*::before,
*::after { box-sizing: border-box; }

[hidden] { display: none !important; }

:root {
  --bg:        #f4f5f7;
  --surface:   #ffffff;
  --surface-2: #eceef2;
  --sunken:    #f7f8fa;
  --ink:       #14171c;
  --ink-2:     #454b56;
  --muted:     #6b7280;
  --line:      #d5d9e0;
  --line-2:    #b9bfc9;

  --accent:      #16507d;
  --accent-ink:  #ffffff;
  --accent-soft: #e5eef6;

  --hazard:      #b3200f;
  --hazard-soft: #fdecea;
  --hazard-line: #f0a79e;

  --warn:      #8a5a00;
  --warn-soft: #fdf3dd;
  --warn-line: #e8ce98;

  --ok:        #17603a;
  --ok-soft:   #e4f3ea;
  --ok-line:   #a9d6bd;

  --core:  #16507d;
  --infra: #6d4b8f;

  --radius: 6px;
  --shadow: 0 1px 2px rgba(16, 20, 30, .08), 0 6px 18px rgba(16, 20, 30, .05);

  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SFMono-Regular", Menlo, Consolas,
          "DejaVu Sans Mono", monospace;

  --maxw: 1200px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #101318;
    --surface:   #171b22;
    --surface-2: #1f242d;
    --sunken:    #12151b;
    --ink:       #e8eaee;
    --ink-2:     #b6bdc8;
    --muted:     #8b93a1;
    --line:      #2b313c;
    --line-2:    #3b4350;
    --accent:      #5aa7e0;
    --accent-ink:  #0b1017;
    --accent-soft: #17293a;
    --hazard:      #ff6b57;
    --hazard-soft: #2e1613;
    --hazard-line: #6a2a20;
    --warn:        #e0a94a;
    --warn-soft:   #2b2213;
    --warn-line:   #5c4a20;
    --ok:          #5fc48d;
    --ok-soft:     #14271d;
    --ok-line:     #2c5741;
    --core:  #5aa7e0;
    --infra: #b48fd8;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 6px 18px rgba(0, 0, 0, .3);
  }
}

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { line-height: 1.25; margin: 0 0 .4em; font-weight: 650; }
h1 { font-size: 1.5rem; letter-spacing: -.01em; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.02rem; }
h4 { font-size: .93rem; }
p  { margin: 0 0 .8em; }

a { color: var(--accent); }
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

code, kbd, pre, .mono { font-family: var(--mono); }

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: var(--accent-ink);
  padding: 10px 16px;
  z-index: 999;
}
.skip:focus { left: 0; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.vh {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; border: 0;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  overflow: hidden; white-space: nowrap;
}

/* ---------------------------------------------------------------------
   RESTRICTED band — screen + print. Colour is a cue, not the message:
   the wording and the heavy rule carry it on a mono printer too.
   --------------------------------------------------------------------- */

.band {
  background: #14171c;
  color: #fff;
  border-bottom: 3px solid var(--hazard);
  padding: 7px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 14px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.band::before {
  content: "";
  align-self: stretch;
  width: 42px;
  min-height: 16px;
  background: repeating-linear-gradient(
    -45deg, #e2b400 0 7px, #14171c 7px 14px);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.band-main {
  font-weight: 800;
  font-size: .82rem;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.band-sub {
  font-size: .74rem;
  color: #b6bdc8;
  letter-spacing: .02em;
}

.watermark { display: none; }

/* --------------------------------------------------------------------- */
/* Top bar                                                               */
/* --------------------------------------------------------------------- */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 10px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.brand {
  font-weight: 800;
  letter-spacing: .04em;
  text-decoration: none;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: .95rem;
}

.brand .dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--hazard);
  flex: none;
}

.brand small {
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .09em;
  font-size: .66rem;
  text-transform: uppercase;
}

.topbar-spacer { flex: 1 1 auto; }

.whoami {
  font-size: .8rem;
  color: var(--muted);
  max-width: 30ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --------------------------------------------------------------------- */
/* Controls                                                              */
/* --------------------------------------------------------------------- */

.btn {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  line-height: 1.2;
  padding: 8px 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  text-decoration: none;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-2); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); }

.btn-danger { border-color: var(--hazard-line); color: var(--hazard); }
.btn-danger:hover:not(:disabled) { background: var(--hazard-soft); }

.btn-sm { padding: 5px 10px; font-size: .78rem; }
.btn-block { width: 100%; justify-content: center; padding: 11px 14px; font-size: .95rem; }

.field { margin: 0 0 16px; }
.field label {
  display: block;
  font-size: .82rem;
  font-weight: 650;
  margin-bottom: 5px;
  color: var(--ink-2);
}

.input, select.input, textarea.input {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
}
.input::placeholder { color: var(--muted); }

.hint { font-size: .76rem; color: var(--muted); margin: 6px 0 0; }

/* --------------------------------------------------------------------- */
/* Login                                                                 */
/* --------------------------------------------------------------------- */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.login-main {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
}

.login-card {
  width: 100%;
  max-width: 400px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 30px 28px;
}

.login-card h1 { font-size: 1.28rem; margin-bottom: 4px; }

.login-lede {
  color: var(--muted);
  font-size: .85rem;
  margin-bottom: 22px;
}

.login-foot {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  font-size: .76rem;
  color: var(--muted);
}

/* --------------------------------------------------------------------- */
/* Messages                                                              */
/* --------------------------------------------------------------------- */

.msg {
  border: 1px solid var(--line-2);
  border-left-width: 4px;
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: .86rem;
  margin: 0 0 16px;
  background: var(--surface-2);
}
.msg-error { background: var(--hazard-soft); border-color: var(--hazard-line); border-left-color: var(--hazard); color: var(--hazard); }
.msg-warn  { background: var(--warn-soft);  border-color: var(--warn-line);   border-left-color: var(--warn);   color: var(--warn); }
.msg-ok    { background: var(--ok-soft);    border-color: var(--ok-line);     border-left-color: var(--ok);     color: var(--ok); }

.loading {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted);
  font-size: .9rem;
}

/* --------------------------------------------------------------------- */
/* Page furniture                                                        */
/* --------------------------------------------------------------------- */

.page { padding: 26px 0 80px; }

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.section { margin: 0 0 34px; }

.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  padding-bottom: 8px;
  margin-bottom: 16px;
}

.eyebrow {
  font-size: .68rem;
  font-weight: 750;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 4px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--line-2);
  background: var(--surface-2);
  color: var(--ink-2);
  white-space: nowrap;
}
.chip-ok     { background: var(--ok-soft);     border-color: var(--ok-line);     color: var(--ok); }
.chip-warn   { background: var(--warn-soft);   border-color: var(--warn-line);   color: var(--warn); }
.chip-hazard { background: var(--hazard-soft); border-color: var(--hazard-line); color: var(--hazard); }
.chip-accent { background: var(--accent-soft); border-color: var(--accent);      color: var(--accent); }

/* --------------------------------------------------------------------- */
/* Machine picker (owner console)                                        */
/* --------------------------------------------------------------------- */

.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 16px;
}
.filters .input { width: auto; min-width: 200px; flex: 1 1 220px; }
.filters select.input { flex: 0 0 auto; min-width: 150px; }

/* v1 had a per-machine card here. v2 picks a VARIANT, so the card styles
   live with the variant picker further down (.plat / .variant). */

.price { font-weight: 750; color: var(--ink); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------------- */
/* Enquiry inbox                                                         */
/* --------------------------------------------------------------------- */

.enq {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  margin-bottom: 10px;
  overflow: hidden;
}
.enq[data-status="new"] { border-left: 4px solid var(--accent); }

.enq-head {
  width: 100%;
  font: inherit;
  text-align: left;
  background: none;
  border: 0;
  padding: 13px 16px;
  cursor: pointer;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  color: inherit;
}
.enq-head:hover { background: var(--surface-2); }

.enq-who { font-weight: 650; }
.enq-sub { font-size: .78rem; color: var(--muted); }
.enq-grow { flex: 1 1 auto; }

.enq-body {
  padding: 4px 16px 16px;
  border-top: 1px dashed var(--line);
}

.kv {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 4px 16px;
  font-size: .85rem;
  margin: 12px 0;
}
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; }

.enq-msg {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  white-space: pre-wrap;
  font-size: .87rem;
  margin: 12px 0;
}

.enq-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* --------------------------------------------------------------------- */
/* Machine identity strip (pack)                                         */
/* --------------------------------------------------------------------- */

.ident {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 18px;
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
}

.ident h1 { margin-bottom: 2px; }
.ident-tag { color: var(--muted); font-size: .88rem; margin: 0; }

.ident-stats {
  display: flex;
  gap: 22px;
  flex-wrap: wrap;
}

.stat { min-width: 96px; }
.stat-k {
  display: block;
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}
.stat-v {
  display: block;
  font-size: 1.02rem;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Pack self-checks (mirrors tests/validate_seeds.py thresholds) */
.checks {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

/* --------------------------------------------------------------------- */
/* Tabs                                                                  */
/* --------------------------------------------------------------------- */

.tabs {
  display: flex;
  gap: 2px;
  flex-wrap: wrap;
  border-bottom: 2px solid var(--line);
  margin-bottom: 22px;
}

.tab {
  font: inherit;
  font-size: .87rem;
  font-weight: 620;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--muted);
}
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--hazard); }

.tab-count {
  font-size: .72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-left: 4px;
}

.panel-title { display: none; }

/* --------------------------------------------------------------------- */
/* Rendered markdown                                                     */
/* --------------------------------------------------------------------- */

.md { font-size: .92rem; color: var(--ink-2); }
.md > *:last-child { margin-bottom: 0; }
.md h2 { font-size: 1.05rem; margin-top: 1.1em; color: var(--ink); }
.md h3 { font-size: .95rem; margin-top: 1em; color: var(--ink); }
.md ul, .md ol { margin: 0 0 .8em; padding-left: 1.4em; }
.md li { margin-bottom: .25em; }
.md code {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: .5px 4px;
  font-size: .88em;
}
.md pre {
  background: var(--sunken);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  overflow-x: auto;
  font-size: .82rem;
}
.md pre code { background: none; border: 0; padding: 0; }
.md blockquote {
  margin: 0 0 .8em;
  padding-left: 12px;
  border-left: 3px solid var(--line-2);
  color: var(--muted);
}
.md strong { color: var(--ink); }

/* --------------------------------------------------------------------- */
/* Design dossier — subsystems and worked calcs                          */
/* --------------------------------------------------------------------- */

.subsys {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.subsys-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.subsys-key {
  font-family: var(--mono);
  font-size: .72rem;
  color: var(--muted);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 1px 6px;
}

.calcs { margin-top: 16px; display: grid; gap: 12px; }

.calc {
  border: 1px solid var(--line-2);
  border-radius: var(--radius);
  background: var(--sunken);
  padding: 12px 14px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.calc-label {
  font-size: .8rem;
  font-weight: 700;
  letter-spacing: .02em;
  margin-bottom: 9px;
  color: var(--ink);
}

/* The worked block: fixed-width key column so formula / substitution /
   result start at the same x and can be checked by eye. */
.calc-work {
  display: grid;
  grid-template-columns: 6.6rem 1fr;
  align-items: baseline;
  font-family: var(--mono);
  font-size: .82rem;
  line-height: 1.7;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
  padding: 9px 11px;
  overflow-x: auto;
}

.calc-row { display: contents; }

.calc-row > .calc-k {
  color: var(--muted);
  font-size: .68rem;
  letter-spacing: .09em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-right: 10px;
  border-right: 1px solid var(--line);
}

.calc-row > .calc-v {
  padding-left: 11px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--ink);
}

.calc-arrow {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: .78rem;
  line-height: 1.1;
  padding-left: 6.6rem;
  margin-left: 11px;
}

.calc-row-result > .calc-k { color: var(--accent); }
.calc-row-result > .calc-v { font-weight: 700; color: var(--accent); }

.calc-note {
  font-size: .78rem;
  color: var(--muted);
  margin: 8px 0 0;
}

.calcs-empty {
  font-size: .8rem;
  color: var(--muted);
  font-style: italic;
  margin-top: 12px;
}

/* --------------------------------------------------------------------- */
/* Gotchas — hazard vs note must read differently, colour-blind safe:     */
/* hazard gets a striped rail, an icon and a HAZARD word; note does not.  */
/* --------------------------------------------------------------------- */

.gotcha {
  position: relative;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  padding: 15px 18px 15px 22px;
  margin-bottom: 12px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.gotcha::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 6px;
  border-radius: 8px 0 0 8px;
  background: var(--line-2);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.gotcha-hazard { border-color: var(--hazard-line); background: var(--hazard-soft); }
.gotcha-hazard::before {
  width: 10px;
  background: repeating-linear-gradient(
    -45deg, var(--hazard) 0 6px, #14171c 6px 12px);
}
.gotcha-hazard { padding-left: 26px; }

.gotcha-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 6px;
}

.gotcha-title { font-weight: 700; font-size: .97rem; }
.gotcha-hazard .gotcha-title { color: var(--hazard); }

.sev {
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--line-2);
  color: var(--muted);
  white-space: nowrap;
}
.sev-hazard {
  background: var(--hazard);
  border-color: var(--hazard);
  color: #fff;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* --------------------------------------------------------------------- */
/* Construction steps                                                    */
/* --------------------------------------------------------------------- */

.phase-head {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  margin: 26px 0 12px;
}
.phase-head:first-child { margin-top: 0; }

.step {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px 18px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 0 16px;
  break-inside: avoid;
  page-break-inside: avoid;
}

.step-ord {
  grid-row: 1 / span 99;
  font-family: var(--mono);
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--muted);
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.step-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.step-title { font-weight: 700; font-size: 1rem; flex: 1 1 auto; }

.step-facts {
  display: flex;
  gap: 8px 18px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--muted);
  margin: 10px 0 0;
}

.step-facts b { color: var(--ink-2); font-weight: 650; }

.tools { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 0; padding: 0; list-style: none; }
.tools li {
  font-size: .74rem;
  border: 1px solid var(--line-2);
  border-radius: 3px;
  padding: 1px 7px;
  background: var(--sunken);
  color: var(--ink-2);
}

/* The acceptance criterion is the gate: it must not read as body text. */
.accept {
  margin: 12px 0 0;
  border: 2px solid var(--ok-line);
  border-left-width: 6px;
  border-radius: var(--radius);
  background: var(--ok-soft);
  padding: 10px 13px;
  display: flex;
  gap: 11px;
  align-items: flex-start;
}

.accept-k {
  font-size: .62rem;
  font-weight: 850;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ok);
  white-space: nowrap;
  padding-top: 2px;
  flex: none;
}

.accept-v { font-size: .88rem; font-weight: 600; color: var(--ink); }

.step-done {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: .78rem;
  color: var(--muted);
  margin-top: 10px;
  cursor: pointer;
  user-select: none;
}
.step[data-done="1"] { opacity: .62; }
.step[data-done="1"] .step-title { text-decoration: line-through; }

/* --------------------------------------------------------------------- */
/* Tables (BOM)                                                          */
/* --------------------------------------------------------------------- */

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 14px;
}
.toolbar .input { flex: 1 1 200px; width: auto; min-width: 160px; }
.toolbar select.input { flex: 0 0 auto; min-width: 140px; }
.toolbar-spacer { flex: 1 1 auto; }

.totals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.total-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-top: 3px solid var(--line-2);
  border-radius: var(--radius);
  padding: 11px 14px;
}
.total-core  { border-top-color: var(--core); }
.total-infra { border-top-color: var(--infra); }
.total-sum   { border-top-color: var(--ink); }

.total-k {
  display: block;
  font-size: .66rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 750;
}
.total-v {
  display: block;
  font-size: 1.16rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
  line-height: 1.3;
}
.total-n {
  display: block;
  font-size: .74rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.tablewrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

table.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: .84rem;
}

table.grid th,
table.grid td {
  padding: 7px 10px;
  text-align: left;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

table.grid thead th {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  border-bottom: 2px solid var(--line-2);
  font-size: .68rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  font-weight: 750;
  color: var(--ink-2);
  white-space: nowrap;
  z-index: 1;
}

table.grid th.sortable { cursor: pointer; user-select: none; }
table.grid th.sortable:hover { background: var(--line); }
table.grid th.sortable::after { content: " \2195"; opacity: .3; }
table.grid th[aria-sort="ascending"]::after  { content: " \25B2"; opacity: 1; }
table.grid th[aria-sort="descending"]::after { content: " \25BC"; opacity: 1; }

table.grid tbody tr:hover { background: var(--sunken); }

.num { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-item { font-family: var(--mono); font-size: .78rem; white-space: nowrap; }
.cell-spec { color: var(--muted); font-size: .8rem; }
.cell-note { color: var(--muted); font-size: .78rem; }
.running { color: var(--muted); }

tr.group-row td {
  background: var(--surface-2);
  font-weight: 750;
  font-size: .74rem;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--ink-2);
  border-bottom: 1px solid var(--line-2);
  border-top: 1px solid var(--line-2);
}

tfoot td {
  font-weight: 750;
  background: var(--surface-2);
  border-top: 2px solid var(--line-2);
}

.klass {
  font-size: .64rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  border-radius: 3px;
  padding: 1px 6px;
  border: 1px solid currentColor;
  white-space: nowrap;
}
.klass-core  { color: var(--core); }
.klass-infra { color: var(--infra); }

.empty-row td { color: var(--muted); font-style: italic; text-align: center; padding: 26px; }

/* --------------------------------------------------------------------- */
/* Kit packing + dispatch checklist                                      */
/* (v2 layout container is .pack-grid, defined with the v2 blocks below) */
/* --------------------------------------------------------------------- */

/* Carton facts read as a spec sheet: label left, value right, one per row. */
.crate {
  display: block;
  margin: 4px 0 0;
}

.checklist { list-style: none; margin: 0; padding: 0; }

.checklist li {
  border-bottom: 1px dashed var(--line);
  break-inside: avoid;
  page-break-inside: avoid;
}
.checklist li:last-child { border-bottom: 0; }

.check {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 9px 2px;
  cursor: pointer;
  font-size: .89rem;
}

.check input[type="checkbox"] {
  width: 17px;
  height: 17px;
  margin: 2px 0 0;
  flex: none;
  accent-color: var(--ok);
  cursor: pointer;
}

.check input:checked + .check-t { color: var(--muted); text-decoration: line-through; }

.progress {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: .8rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.bar {
  flex: 1 1 auto;
  height: 7px;
  min-width: 90px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  overflow: hidden;
}
.bar > i {
  display: block;
  height: 100%;
  width: var(--pct, 0%);
  background: var(--ok);
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

/* =====================================================================
   v2 — VARIANT PICKER (owner.html)
   The unit of work is a variant, so the picker groups variants under the
   platform they inherit their dossier from.
   ===================================================================== */

.plat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 16px 16px;
  margin: 0 0 16px;
}

.plat-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
  padding-bottom: 9px;
  margin-bottom: 12px;
}

.plat-code {
  font-family: var(--mono);
  font-size: .92rem;
  font-weight: 700;
  letter-spacing: .04em;
  color: var(--ink);
}

.plat-name { font-size: .92rem; color: var(--ink-2); flex: 1 1 auto; }
.plat-env  { font-size: .76rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.variant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 10px;
}

.variant {
  display: block;
  text-decoration: none;
  color: inherit;
  background: var(--sunken);
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-2);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.variant:hover {
  border-color: var(--line-2);
  border-left-color: var(--accent);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.variant-head { display: flex; align-items: baseline; gap: 8px; }

.variant-suffix {
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .1em;
  background: var(--accent-soft);
  border: 1px solid var(--accent);
  color: var(--accent);
  border-radius: 3px;
  padding: 1px 6px;
}

.variant-code {
  font-family: var(--mono);
  font-size: .76rem;
  color: var(--muted);
  letter-spacing: .03em;
}

.variant-name { font-size: .93rem; font-weight: 650; margin: 6px 0 8px; }

.variant-meta {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: var(--muted);
}

.variant-margin { font-variant-numeric: tabular-nums; }

.variant-sub {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 6px;
  font-size: .73rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.chip-off { opacity: .75; text-decoration: line-through; }

.total-ok  { border-top-color: var(--ok); }
.total-bad { border-top-color: var(--hazard); }
.total-bad .total-v { color: var(--hazard); }

/* =====================================================================
   v2 — PACK HEADER: identity, siblings, section notes
   ===================================================================== */

.ident-id { min-width: 260px; flex: 1 1 320px; }

.ident-platform {
  margin: 6px 0 0;
  font-size: .78rem;
  color: var(--muted);
  font-family: var(--mono);
}

.sibs {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin: 0 0 18px;
}

.sibs-k {
  font-size: .68rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--muted);
}

.sib {
  font-size: .78rem;
  font-weight: 620;
  text-decoration: none;
  color: var(--accent);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 11px;
}
.sib:hover { border-color: var(--accent); background: var(--accent-soft); }

.sib-here {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  cursor: default;
}

.panel-note {
  font-size: .84rem;
  color: var(--muted);
  background: var(--sunken);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line-2);
  border-radius: var(--radius);
  padding: 9px 12px;
  margin: 0 0 18px;
}

.sub-head {
  font-size: .74rem;
  font-weight: 800;
  letter-spacing: .13em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--line);
  padding-bottom: 5px;
  margin: 30px 0 14px;
}

.gotcha-wrap { margin-top: 26px; }

/* =====================================================================
   v2 — FORCE BUDGET: the number every other number descends from
   ===================================================================== */

.fb {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-top: 3px solid var(--accent);
  border-radius: 8px;
  padding: 16px 18px;
  margin: 0 0 18px;
}

.fb-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}
.fb-head h3 { margin: 0; }

.fb-vals {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.fb-val {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--sunken);
  padding: 8px 14px;
  min-width: 108px;
}

.fb-val-derived { border-style: dashed; }

.fb-k {
  display: block;
  font-family: var(--mono);
  font-size: .7rem;
  letter-spacing: .06em;
  color: var(--muted);
}

.fb-v {
  display: block;
  font-size: 1.06rem;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

/* =====================================================================
   v2 — HEAD DELTA
   ===================================================================== */

.head-card { margin-bottom: 18px; }
.head-card h3 { margin-top: 2px; }

.kv-head { margin-top: 10px; }

.md-delta {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: 8px;
  padding: 16px 18px;
}

.spec-card { margin-bottom: 12px; }

/* =====================================================================
   v2 — ASSEMBLY MANUAL
   ===================================================================== */

.manual-lede {
  background: var(--warn-soft);
  border: 1px solid var(--warn-line);
  border-left: 5px solid var(--warn);
  border-radius: var(--radius);
  padding: 12px 15px;
  margin: 0 0 16px;
  font-size: .9rem;
}
.manual-lede p { margin: 0; }

.manual-summary {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin: 0 0 16px;
}

.phase-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  justify-content: space-between;
}

.phase-mins {
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: none;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.bags { margin-top: 10px; }

.bag-pill {
  font-family: var(--mono);
  font-weight: 700;
  background: var(--accent-soft) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

.accept-missing { color: var(--hazard); font-weight: 700; }
.accept:has(.accept-missing) { border-color: var(--hazard); background: var(--hazard-soft); }

.manual-end {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 14px;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 14px 18px;
  margin-top: 18px;
  background: var(--surface);
}

.manual-end-k {
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--muted);
}

.manual-end-v {
  font-size: 1.3rem;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
}

/* Printed manual cover — hidden on screen, first page on paper. */
.print-only { display: none; }

.cover-eyebrow {
  font-size: .68rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0;
}
.cover-title { margin: 2px 0 0; }
.cover-code { font-family: var(--mono); color: var(--muted); margin: 0 0 12px; }
.cover-h { margin: 16px 0 6px; }
.cover-list { margin: 0 0 10px; padding-left: 1.3em; }
.cover-kv { margin-bottom: 12px; }
.cover-table { margin: 6px 0 12px; }

/* =====================================================================
   v2 — KIT BOM grouped by bag
   ===================================================================== */

.cell-bag {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .78rem;
  white-space: nowrap;
}

.group-bag {
  font-family: var(--mono);
  font-weight: 800;
  letter-spacing: .05em;
  margin-right: 12px;
}

.group-meta { color: var(--muted); font-weight: 500; margin-right: 12px; }

.group-sub {
  float: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

/* =====================================================================
   v2 — KIT PACKING
   ===================================================================== */

.pack-grid {
  display: grid;
  grid-template-columns: minmax(260px, 380px) 1fr;
  gap: 16px;
  margin-bottom: 18px;
  align-items: start;
}

.crate-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  border-bottom: 1px dashed var(--line);
  font-size: .88rem;
}
.crate-row:last-child { border-bottom: 0; }
.crate-k { color: var(--muted); }
.crate-v { font-weight: 650; font-variant-numeric: tabular-nums; text-align: right; }

.bag-card { margin-bottom: 12px; }

.bag-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.bag-code {
  font-family: var(--mono);
  font-size: .95rem;
  font-weight: 800;
  letter-spacing: .05em;
}

/* =====================================================================
   v2 — COSTING + MARGIN
   ===================================================================== */

.band-money {
  position: static;
  margin: 0 0 18px;
  border-radius: 6px;
  background: var(--hazard-soft);
  border: 1px solid var(--hazard-line);
  color: var(--hazard);
}
.band-money .band-main { color: var(--hazard); }
.band-money .band-sub { color: var(--ink-2); }

.cost-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 12px;
  align-items: start;
}

.grid-margin { font-size: .84rem; }

.row-thin { background: var(--warn-soft); }
.row-off  { box-shadow: inset 3px 0 0 var(--hazard); }

.flag-thin {
  margin-left: 7px;
  font-size: .6rem;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
  background: var(--warn);
  color: #fff;
  border-radius: 3px;
  padding: 1px 5px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.strong-num { font-weight: 750; }
.delta-ok  { color: var(--ok); }
.delta-bad { color: var(--hazard); font-weight: 700; }

/* =====================================================================
   Print rules live in print.css, linked with media="print" from every
   gated page. Keep them there: the assembly manual is a shipped document,
   not a screenshot, and it deserves one file you can read end to end.
   ===================================================================== */

@media (max-width: 900px) {
  .pack-grid { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .ident { flex-direction: column; gap: 14px; }
  .calc-work { grid-template-columns: 1fr; }
  .calc-row > .calc-k { border-right: 0; padding-right: 0; }
  .calc-row > .calc-v { padding-left: 0; padding-bottom: 4px; }
  .calc-arrow { padding-left: 0; margin-left: 0; }
  .step { grid-template-columns: 30px 1fr; gap: 0 10px; }
  .variant-grid { grid-template-columns: 1fr; }
  .manual-end { flex-direction: column; align-items: flex-start; gap: 4px; }
}
