/* Slatmill blueprint. One stylesheet: app shell, panes, and the login page.
   Light theme is drafting paper, dark theme is a blueprint.

   What the page's look follows:
   - One surface. The panel is a sheet: its sections are parted by space and a hairline, and nothing is boxed for
     being a group. Two things are filled: the mill's summary (a well, set into the sheet) and whatever the model
     is showing now (the part picked, the build step on the model), tinted with the accent.
   - Two voices. Barlow says what a thing is and what it does, in sentence case. Barlow Condensed in small capitals
     is the drawing's lettering: the tabs, a field's label, a table's head, a tag. Figures are in the mono face.
   - Weight is spent once a row: 600 for a title, a row's name and the option chosen. Everything else is 400.
   - The accent means on, or press here: a link, a switch on, the open tab, a pressed chip. A price that only
     stands there is ink. Green is done, orange is a warning. */

@font-face { font-family: "Barlow"; font-weight: 400; font-display: swap; src: url("vendor/fonts/barlow-400.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-weight: 600; font-display: swap; src: url("vendor/fonts/barlow-600.woff2") format("woff2"); }
@font-face { font-family: "Barlow Condensed"; font-weight: 600; font-display: swap; src: url("vendor/fonts/barlow-condensed-600.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-weight: 500; font-display: swap; src: url("vendor/fonts/jetbrains-mono-500.woff2") format("woff2"); }

:root {
  --bg: #f2efe8; --surface: #fbfaf6; --surface-2: #ebe7dc; --ink: #1c2a35; --muted: #5b6974;
  --line: #d5cfc0; --line-strong: #b9b2a1;
  --accent: #1f5fa8; --accent-ink: #ffffff; --accent-soft: #dde8f5;
  --warn: #a94a06; --warn-soft: #fbe8d2; --ok: #256f43; --ok-soft: #dcefe2; --danger: #b3261e;
  --track: #ebe7dc; --thumb: #ffffff;
  --stage: #e6ecf0; --stage-grid: #c3ced8; --stage-grid-2: #a9b8c5; --stage-shadow: .2; --dim: #b3261e; --trail: #2a64a8;
  --shadow: 0 1px 2px rgba(28, 42, 53, .08), 0 6px 20px rgba(28, 42, 53, .08);
  --lift: 0 1px 2px rgba(28, 42, 53, .2), 0 0 0 1px rgba(28, 42, 53, .05);
  --sans: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --cond: "Barlow Condensed", "Barlow", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --top: 52px; --tabs: 58px; --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0d1922; --surface: #13232f; --surface-2: #1a2f3e; --ink: #dfe9ef; --muted: #8fa5b4;
    --line: #26404f; --line-strong: #37586b;
    --accent: #6cb4ff; --accent-ink: #06223c; --accent-soft: #17354f;
    --warn: #f2a653; --warn-soft: #3a2a14; --ok: #71d49c; --ok-soft: #143524; --danger: #ff8a80;
    --track: #0d1922; --thumb: #2a4558;
    --stage: #0a151d; --stage-grid: #1b3344; --stage-grid-2: #2a4a5f; --stage-shadow: .5; --dim: #ffb86b; --trail: #8cc4ff;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    --lift: 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .05);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0d1922; --surface: #13232f; --surface-2: #1a2f3e; --ink: #dfe9ef; --muted: #8fa5b4;
  --line: #26404f; --line-strong: #37586b;
  --accent: #6cb4ff; --accent-ink: #06223c; --accent-soft: #17354f;
  --warn: #f2a653; --warn-soft: #3a2a14; --ok: #71d49c; --ok-soft: #143524; --danger: #ff8a80;
  --track: #0d1922; --thumb: #2a4558;
  --stage: #0a151d; --stage-grid: #1b3344; --stage-grid-2: #2a4a5f; --stage-shadow: .5; --dim: #ffb86b; --trail: #8cc4ff;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --lift: 0 1px 2px rgba(0, 0, 0, .45), 0 0 0 1px rgba(255, 255, 255, .05);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font: 400 16px/1.5 var(--sans);
  overflow: hidden; overscroll-behavior: none;
  -webkit-tap-highlight-color: transparent;
}
h1, h2, h3, h4, h5, p, ul, ol, dl, figure { margin: 0; padding: 0; }
ul, ol { list-style: none; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
a { color: var(--accent); text-underline-offset: 2px; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.mono { font-family: var(--mono); font-weight: 500; font-size: .92em; font-variant-numeric: tabular-nums; }

/* The drawing's lettering: every small label on the page is this one, and only its size or colour changes below. */
.eyebrow, .price-sub, .stat span, .sync, .hint, .dimlabel i, .tab, .tag, .kv dt, .choice-l, .pgroup > h4, .figgroup > h4, .strength-low > h4, .from h5,
.tbl th, .tbl td[data-l]::before, .board-h, .dwg figcaption b, .steplabel small, .step.onmodel .step-head::after, .gatebox label {
  font: 600 11px/1.2 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}

/* ---------- shell ---------- */
.app { height: 100vh; height: 100dvh; display: grid; grid-template-rows: var(--top) minmax(0, 1fr); }
.top {
  display: flex; align-items: center; gap: 14px; min-width: 0;
  padding: 0 max(14px, env(safe-area-inset-right)) 0 max(14px, env(safe-area-inset-left));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { min-width: 0; flex: 0 1 auto; overflow: hidden; }
.eyebrow { display: block; line-height: 1.1; letter-spacing: .14em; }
.brand h1 { font: 600 19px/1.15 var(--cond); letter-spacing: .03em; text-transform: uppercase; white-space: nowrap; }
/* The price, top right on every tab and every width: what the mill as chosen costs. A tap opens the shopping list. */
.toprice {
  position: relative; flex: none; margin-left: auto; display: grid; justify-items: end; align-content: center; gap: 3px;
  min-height: 44px; padding: 4px 12px 5px; text-align: right;
  background: var(--bg); border: 1px solid var(--line-strong); border-radius: 10px;
}
.toprice:hover { border-color: var(--accent); }
.price-sub { font-size: 10.5px; line-height: 1; white-space: nowrap; }
.price-total { font: 600 23px/1 var(--cond); letter-spacing: .01em; color: var(--accent); font-variant-numeric: tabular-nums; white-space: nowrap; }
.price-delta {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; padding: 5px 9px; border-radius: 999px; white-space: nowrap; pointer-events: none;
  font: 500 13px/1 var(--mono); background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
  animation: rise .25s ease-out;
}
.price-delta[data-dir="down"] { color: var(--ok); border-color: var(--ok); }
/* Wide: beside the price, in the header. Below it the chip would land on the side pane's tab bar. */
@media (min-width: 900px) {
  .price-delta { top: 0; bottom: 0; right: calc(100% + 8px); height: max-content; margin: auto 0; }
}
.toprice.bump { animation: bump .9s ease-out; }
@keyframes bump { 0% { box-shadow: 0 0 0 4px var(--accent-soft); border-color: var(--accent); } 100% { box-shadow: 0 0 0 0 transparent; } }
@keyframes rise { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.stat { display: flex; flex-direction: column; white-space: nowrap; }
.stat b { font: 500 14px/1.2 var(--mono); }
.stat span { font-size: 10.5px; }
.top-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.sync { line-height: 1; letter-spacing: .08em; white-space: nowrap; }
/* The dot's shape says it without the colour: hollow, kept on this device only; filled, shared; beating, saving. */
.sync::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 6px; box-shadow: inset 0 0 0 2px var(--line-strong); vertical-align: 1px; }
.sync[data-s="ok"]::before { background: var(--ok); box-shadow: none; }
.sync[data-s="busy"]::before { background: var(--accent); box-shadow: none; animation: beat 1s ease-in-out infinite alternate; }
.sync[data-s="off"]::before { box-shadow: inset 0 0 0 2px var(--warn); }
@keyframes beat { to { opacity: .3; } }
.iconbtn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0;
  background: transparent; border: 1px solid var(--line); border-radius: 8px;
}
.iconbtn:hover { border-color: var(--line-strong); background: var(--surface-2); }
.iconbtn svg, .tab svg, .chip svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.main { display: grid; grid-template-columns: minmax(0, 1fr) clamp(380px, 40vw, 580px); min-height: 0; }

/* ---------- 3D stage ---------- */
.stage {
  position: relative; min-width: 0; min-height: 0; overflow: hidden;
  background: radial-gradient(120% 90% at 50% 35%, var(--stage) 55%, var(--stage-grid) 130%);
}
#cv { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; outline-offset: -3px; }
#cv.dragging { cursor: grabbing; }
#cv.over-part { cursor: pointer; }
/* the name of the part under a mouse resting on the model, beside the pointer (placed by a transform from app.js) */
.tip {
  position: absolute; left: 0; top: 0; pointer-events: none; white-space: nowrap; z-index: 2;
  font: 600 13px/1 var(--sans); padding: 6px 9px; border-radius: 6px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); box-shadow: 0 1px 3px rgba(0, 0, 0, .12);
}
.labels { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.dimlabel {
  position: absolute; left: 0; top: 0; will-change: transform; white-space: nowrap;   /* placed by a transform from app.js */
  font: 500 11.5px/1 var(--mono); padding: 4px 6px; border-radius: 4px;
  background: var(--surface); color: var(--dim); border: 1px solid var(--dim);
}
.dimlabel i { font-size: 10px; line-height: 1; font-style: normal; letter-spacing: .08em; margin-right: 5px; }
.stage-tools { position: absolute; left: 10px; top: 10px; right: 10px; display: flex; flex-wrap: wrap; gap: 6px; pointer-events: none; }
.chip {
  pointer-events: auto; min-height: 40px; padding: 0 14px; display: inline-flex; align-items: center; gap: 6px;
  font: 600 14px/1 var(--sans);
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 999px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
/* While the model is apart: a row of its own under the stage buttons, the slider for how far, then Names. */
.exrow { flex: 1 0 100%; display: flex; align-items: center; gap: 6px; min-width: 0; pointer-events: none; }
.exslide {
  pointer-events: auto; flex: 0 1 340px; min-width: 0; min-height: 40px; display: flex; align-items: center; gap: 10px; padding: 0 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: 999px; box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
  font: 600 10.5px/1 var(--cond); letter-spacing: .1em; text-transform: uppercase; color: var(--muted);
}
.exslide input { flex: 1; min-width: 0; height: 38px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.exslide input:focus-visible { outline-offset: -2px; }
/* The part names on the model while it is apart: placed by a transform from kit/stage.js; a tap picks the part. */
.names { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.name {
  position: absolute; left: 0; top: 0; pointer-events: auto; will-change: transform; white-space: nowrap;
  min-height: 26px; padding: 0 9px; border-radius: 999px;
  font: 600 12.5px/1 var(--sans); background: color-mix(in srgb, var(--surface) 92%, transparent); color: var(--ink);
  border: 1px solid var(--line-strong); box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
}
.name:hover { border-color: var(--accent); }
.name[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.names.on ~ .hint { opacity: 0; }   /* the names may sit where the hint is */
/* Phones only: the model smaller, the list below it taller. The arrow points the way the stage will go. */
.chip.fold { display: none; margin-left: auto; width: 40px; padding: 0; justify-content: center; }
.chip.fold[aria-pressed="true"] { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.chip.fold svg { transition: transform .2s; }
.chip.fold[aria-pressed="true"] svg { transform: rotate(180deg); }
.stepbar {
  position: absolute; left: 10px; right: 10px; bottom: 10px; display: flex; align-items: center; gap: 6px;
  max-width: 560px; margin: 0 auto; padding: 4px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line-strong); box-shadow: var(--shadow);
}
.stepbar button { flex: none; height: 40px; border: 0; background: var(--surface-2); }
.stepbar button:hover { background: var(--accent-soft); }
.stepbar .arrow { width: 40px; border-radius: 50%; font: 600 20px/1 var(--cond); }
.stepbar .pill { padding: 0 16px; border-radius: 999px; font: 600 14px/1 var(--sans); }
.stepbar #wholeBtn { background: var(--accent); color: var(--accent-ink); }
.stepbar[data-mode="whole"] { left: 50%; right: auto; transform: translateX(-50%); }
.stepbar[data-mode="whole"] > :not(#stepStart),
.stepbar[data-mode="step"] > #stepStart,
.stepbar[data-mode="some"] > .arrow, .stepbar[data-mode="some"] > #stepStart { display: none; }
.stepbar .steplabel { flex: 1; min-width: 0; text-align: center; padding: 0 4px; line-height: 1.15; }
.steplabel small { display: block; font-size: 10.5px; letter-spacing: .12em; }
.steplabel span { display: block; font-weight: 600; font-size: 14.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hint {
  position: absolute; left: 50%; bottom: 66px; transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  line-height: 1;
  transition: opacity .4s;
}
.hint.gone { opacity: 0; }
/* The hint in the words of the hand in use: a mouse scrolls and clicks, a finger pinches and taps. */
.hint .by-mouse { display: none; }
@media (hover: hover) and (pointer: fine) { .hint .by-touch { display: none; } .hint .by-mouse { display: inline; } }
.labels:not([hidden]) ~ .hint { opacity: 0; }   /* size labels may sit where the hint is */
.fatal {
  position: fixed; left: 10px; right: 10px; top: calc(var(--top) + 8px); z-index: 50; max-height: 40vh; overflow: auto; padding: 10px 12px; border-radius: 8px;
  background: var(--warn-soft); color: var(--ink); border: 1px solid var(--warn); font: 500 12px/1.45 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere;
}

/* ---------- panel and tabs ---------- */
.panel { display: grid; grid-template-rows: auto minmax(0, 1fr); min-width: 0; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); }
.tabs { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-bottom: 1px solid var(--line); background: var(--surface); }
.tab {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-width: 0; height: var(--tabs); padding: 0 2px;
  background: transparent; border: 0; border-bottom: 3px solid transparent;
  font-size: 11.5px; line-height: 1; letter-spacing: .06em;
}
.tab span { max-width: 100%; overflow: hidden; text-overflow: clip; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.panes { min-height: 0; position: relative; }
.pane {
  --pad: 20px;
  position: absolute; inset: 0; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch;
  padding: var(--pad) var(--pad) 48px; scrollbar-width: thin; scrollbar-color: var(--line-strong) transparent;
}
.pane > * + * { margin-top: 20px; }
/* A pane's sections: space, then a hairline, then the heading. */
.pane > section.sec { margin-top: 30px; padding-top: 26px; border-top: 1px solid var(--line); }
#warnings:empty, #selcard:empty, #stepcard:empty, #mill:empty { display: none; }
#warnings > * + * { margin-top: 8px; }
.stage > .fatal { position: absolute; top: 58px; }

/* The Blueprint tab is long: a row at its top that stays, with a button to each part of it. The one being read is
   marked (app.js, as the pane scrolls). */
.jump {
  position: sticky; top: calc(-1 * var(--pad)); z-index: 3; display: flex; gap: 2px;
  margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 0; padding: 6px calc(var(--pad) - 10px);
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.jump button { flex: 0 1 auto; min-width: 0; min-height: 40px; padding: 0 10px; border: 0; border-radius: 8px; background: none; font: 400 14.5px/1 var(--sans); color: var(--muted); white-space: nowrap; }
.jump button:hover { color: var(--ink); background: var(--surface-2); }
.jump button[aria-current="true"] { color: var(--ink); font-weight: 600; }
.jump button:focus-visible { outline-offset: -3px; }
#pane-blueprint h3, #pane-blueprint .choice-l, #pane-blueprint section.sec, #choices { scroll-margin-top: 62px; }

/* ---------- content pieces ---------- */
h2 { font: 600 22px/1.2 var(--sans); }
h3 { font: 600 17.5px/1.25 var(--sans); }
h4 { font: 600 16px/1.3 var(--sans); }
.lede { color: var(--muted); max-width: 62ch; }
.sec > * + * { margin-top: 12px; }
.sec > h3 + .lede { margin-top: 4px; }
/* Drawings has Print beside its heading: the button is the taller, and must not set the heading lower than its neighbours'. */
#drawHead { margin: -9px 0; }
/* A well: set into the sheet, its hairlines the ink's own, thinned, so they read on any fill. */
.card { background: var(--bg); border-radius: var(--r); padding: 18px; --line: color-mix(in srgb, var(--ink) 14%, transparent); --line-strong: color-mix(in srgb, var(--ink) 32%, transparent); }
.card > * + * { margin-top: 10px; }
.note { background: var(--accent-soft); border-radius: 10px; padding: 12px 14px; }
.note.warn { background: var(--warn-soft); }
.note b:first-child { display: block; font-weight: 600; margin-bottom: 2px; }
.note.warn b:first-child { color: var(--warn); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 42px; padding: 0 16px;
  font: 600 14.5px/1 var(--sans); text-decoration: none;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong); border-radius: 9px;
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); color: var(--accent-ink); }
.btn.small { min-height: 40px; padding: 0 13px; font-size: 14px; }
/* A button that leads on from where it stands (to the shopping list, back from a card): a link's colour, no box. */
.btn.quiet { background: none; border-color: transparent; color: var(--accent); padding: 0 10px; }
.btn.quiet:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); border-color: transparent; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }   /* the copy's text box, while it is selected */
.spread { justify-content: space-between; }
.tag { display: inline-block; font-size: 10.5px; line-height: 1; padding: 3px 6px; border-radius: 4px; background: var(--surface-2); white-space: nowrap; }
.tag.ok { background: var(--ok-soft); color: var(--ok); }
.tag.warn { background: var(--warn-soft); color: var(--warn); }
.tag.found { background: none; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--ink); }

/* What it gives you: a sheet of figures, each under its label, ruled off above. */
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(138px, 1fr)); gap: 0 20px; }
.kv > div { padding: 11px 0 12px; min-width: 0; border-top: 1px solid var(--line); }
.kv dt { display: block; font-size: 10.5px; }
.kv dd { display: block; margin: 4px 0 0; font: 500 15.5px/1.25 var(--mono); overflow-wrap: anywhere; }
.kv dd small { display: block; margin-top: 3px; font: 400 13px/1.35 var(--sans); color: var(--muted); }
/* What it gives you, in two runs: the mill's own sizes, then with the dog on it, each under a small label */
.figgroup + .figgroup { margin-top: 22px; }
.figgroup > h4 { margin-bottom: 6px; }
.figgroup > .foot { margin: -2px 0 8px; }

.bullets > li { position: relative; padding-left: 16px; }
.bullets > li + li { margin-top: 7px; }
.bullets > li::before { content: ""; position: absolute; left: 3px; top: .66em; width: 5px; height: 5px; border-radius: 50%; background: var(--line-strong); }
.numbered { counter-reset: n; }
.numbered > li { counter-increment: n; position: relative; padding-left: 30px; }
.numbered > li + li { margin-top: 9px; }
.numbered > li::before { content: counter(n); position: absolute; left: 0; top: .24em; width: 20px; text-align: right; color: var(--muted); font: 500 12.5px/1.45 var(--mono); }

/* Blueprint: your mill and its price built up line by line, then the choices in their groups, then the parts */
.mill > * + * { margin-top: 12px; }
.mill-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.mill-title { min-width: 0; }
.mill-title h2 { margin-top: 5px; }
.mill-head .btn { flex: none; white-space: nowrap; }
.mill > .mill-says { margin-top: 6px; color: var(--muted); }
.costlist { margin: 0; }
.cost { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 9px 0; border-top: 1px solid var(--line); }
.cost dt { min-width: 0; font-size: 15.5px; line-height: 1.3; }
.cost dt small { display: block; margin-top: 1px; font-size: 13.5px; color: var(--muted); }
.cost dd { margin: 0; font: 500 14.5px/1.3 var(--mono); white-space: nowrap; }
.cost.down dd { color: var(--ok); }
.cost.total { border-top: 1px solid var(--ink); padding: 13px 0 0; }
.cost.total dt { font: 600 16px/1.2 var(--sans); }
.cost.total dd { font: 600 30px/1 var(--sans); letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.mill-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; color: var(--muted); font-size: 14px; }
.mill-foot .btn { margin: 0 -10px; }   /* its words in line with the card's, on whichever side it lands */

.pane > .cgroups { margin-top: 28px; }
.cgroups > * + * { margin-top: 30px; }
.cgroup + .cgroup { padding-top: 26px; border-top: 1px solid var(--line); }
.cgroup > .lede { font-size: 15px; }
.cgroups > .foot { margin-top: 18px; }
/* Upgrades: a row each, ruled off, the switch at its end. On, its price is ink; off, it is an offer, and grey. */
.upgrades { margin-top: 4px; }
.upg { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); cursor: pointer; }
.upg:first-child { border-top: 0; }
.upg-text { flex: 1; min-width: 0; }
.upg-top { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px 10px; }
.upg-top strong { font-weight: 600; font-size: 16px; }
.upg-cost { font: 500 14px/1.2 var(--mono); color: var(--muted); white-space: nowrap; }
.upg.on .upg-cost { color: var(--ink); }
.upg .help { margin: 3px 0 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
/* The track flush with the row's right edge, the hit area 54 by 44 px reaching left of it: a row has no padding to lend. */
.switch { flex: none; position: relative; width: 54px; height: 44px; padding: 0; border: 0; border-radius: 999px; background: transparent; }
.switch::before { content: ""; position: absolute; left: 6px; right: 0; top: 50%; height: 28px; margin-top: -14px; border-radius: 999px; background: var(--line-strong); transition: background .2s; }
.switch i { position: absolute; left: 10px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .35); transition: transform .2s; }
.upg:hover .switch[aria-checked="false"]::before { background: var(--muted); }
.switch[aria-checked="true"]::before { background: var(--accent); }
.switch[aria-checked="true"] i { transform: translateX(20px); }
.pgroups > * + * { margin-top: 16px; }
.pgroup > h4 { margin-bottom: 4px; }
.selcard h4 { display: flex; align-items: center; gap: 9px; font-size: 17.5px; }
.from h5 { margin: 6px 0 2px; }
.from li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 7px 0; border-top: 1px solid var(--line); font-size: 14.5px; }
.from li:first-child { border-top: 0; }
.from li > span { min-width: 0; }
.from li .tag { margin-left: 6px; vertical-align: 1px; }
.from li b { font: 500 13.5px/1.4 var(--mono); white-space: nowrap; }
/* How strong, on a part's card: its own rows of Strength, each name a link down to its row */
.from.strong li { padding: 0; }
.from.strong .linkish { flex: 1; min-width: 0; min-height: 40px; padding: 7px 0; border: 0; background: none; font: inherit; color: var(--ink); text-align: left;
  text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; cursor: pointer; }
.from.strong .linkish:hover { text-decoration-color: currentColor; }
.from.strong .linkish:focus-visible { outline-offset: -2px; }
.from.strong li b { font-size: 15px; }
.from.strong .yes { color: var(--ok); } .from.strong .low { color: var(--warn); font-weight: 600; } .from.strong .no { color: var(--danger); font-weight: 600; }

/* The part list: a row a part, its colour on the model first. No rules between them: the swatches make the column. */
.partlist { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 0 8px; margin: 0 -8px; }
.part { display: flex; align-items: stretch; min-width: 0; border-radius: 8px; }
.part.sel { background: var(--accent-soft); }
.part.sel .part-name { font-weight: 600; }
.part.off .part-name { color: var(--muted); text-decoration: line-through; }
.part.off .sw { opacity: .3; }
.part button { background: transparent; border: 0; min-height: 44px; }
.part-name { flex: 1; min-width: 0; display: flex; align-items: center; gap: 9px; padding: 0 4px 0 8px; border-radius: 8px 0 0 8px; text-align: left; font-size: 15px; }
.part-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sw { flex: none; width: 12px; height: 12px; border-radius: 3px; box-shadow: 0 0 0 1px color-mix(in srgb, var(--ink) 28%, transparent); }
.part-eye { flex: none; width: 44px; display: grid; place-items: center; border-radius: 0 8px 8px 0; color: var(--muted); }
.part-eye:hover { color: var(--accent); }
.part-eye svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) and (pointer: fine) { .part:not(.sel):hover { background: var(--surface-2); } }
/* What the model is showing now, tinted: the part picked, and the build step on the model (below). */
.selcard { background: var(--accent-soft); }
.selcard .facts { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 14.5px; }
.selcard .facts dt { color: var(--muted); }
.selcard .facts dd { margin: 0; font: 500 13.5px/1.55 var(--mono); }
.selcard .row:last-child { margin-top: 14px; }

/* choices: a track of options per choice, the chosen one raised on it */
.choices { display: grid; gap: 20px; margin-top: 14px; }
.choice { display: grid; gap: 7px; min-width: 0; }
.pane h3, .choice-l { scroll-margin-top: 14px; }                 /* a link that opens a tab at one: room above it */
.seg { display: flex; gap: 2px; padding: 3px; border-radius: 11px; background: var(--track); }
.seg button {
  flex: 1 1 0; min-width: 0; min-height: 44px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 5px 4px; border: 0; border-radius: 8px; background: transparent; font-size: 14.5px; line-height: 1.15; text-align: center;
}
/* The focus ring goes inside the button: the track is tight round it. The same for a part's two buttons. */
.seg button:focus-visible, .part button:focus-visible { outline-offset: -3px; }
.seg button:not(.on):hover { background: color-mix(in srgb, var(--thumb) 50%, transparent); }
.seg button small { font: 500 11.5px/1.2 var(--mono); color: var(--muted); }
.seg button.on { background: var(--thumb); font-weight: 600; box-shadow: var(--lift); }
.choice .help { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.45; }
.choice.idle .seg { opacity: .5; }
.choice.idle .seg button { cursor: default; }
.choice.idle .seg button:not(.on):hover { background: transparent; }
.price input {
  font: 500 16px/1 var(--mono); height: 42px; border: 1px solid var(--line-strong); border-radius: 8px; background: var(--surface); color: var(--ink); padding: 0 8px;
}
input[type="number"] { -moz-appearance: textfield; appearance: textfield; }
input[type="number"]::-webkit-outer-spin-button, input[type="number"]::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* shopping list */
.totals {
  position: sticky; top: calc(-1 * var(--pad)); z-index: 2; margin: calc(-1 * var(--pad)) calc(-1 * var(--pad)) 0; padding: 12px var(--pad);
  background: var(--surface); border-bottom: 1px solid var(--line); display: flex; gap: 18px; align-items: flex-end; flex-wrap: wrap;
}
.totals .stat b { font-size: 19px; }
.totals .stat b small { font-size: 13px; color: var(--muted); }
.totals .stat:first-child { margin-right: auto; }
.totals .progress { flex: 1 0 100%; height: 5px; margin-top: -6px; }
.bom-sec + .bom-sec { margin-top: 30px; }
.bom-sec > h3 { margin: 0 0 8px; }
.item { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 0 4px; padding: 12px 0; border-top: 1px solid var(--line); }
.item .tick { grid-row: 1 / span 3; }
.tick { display: grid; place-items: start center; padding-top: 2px; cursor: pointer; }
.tick input { width: 26px; height: 26px; margin: 0; accent-color: var(--ok); }
.item-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; }
.item-head strong { font-weight: 600; }
.item.done .item-head strong { text-decoration: line-through; color: var(--muted); }
.item .spec { color: var(--muted); font-size: 14.5px; margin-top: 2px; }
.item-foot { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; margin-top: 8px; }
.price { display: inline-flex; align-items: center; gap: 6px; font: 500 14px/1 var(--mono); white-space: nowrap; }
.price input { width: 84px; text-align: right; height: 40px; }   /* 16 px type: anything smaller makes iPhones zoom the page on focus */
.price b { font-weight: 500; min-width: 66px; text-align: right; }
.newprice { font: 500 13px/1 var(--mono); color: var(--muted); white-space: nowrap; }
/* on a line whose price was typed over: back to the listed price */
.relist { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px dashed var(--line-strong); border-radius: 999px; background: none;
  font: 500 13px/1 var(--mono); color: var(--accent); white-space: nowrap; cursor: pointer; }
.relist:hover { border-color: var(--accent); background: var(--accent-soft); }
.stores { display: flex; flex-wrap: wrap; gap: 6px; }
.stores a { display: inline-flex; align-items: center; min-height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 14px; line-height: 1; text-decoration: none; }
.stores a:hover { border-color: var(--accent); background: var(--accent-soft); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.tbl th { text-align: left; font-size: 10.5px; padding: 6px 8px; border-bottom: 1px solid var(--line-strong); }
.tbl td { padding: 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tbl td.q, .tbl th.q { text-align: right; width: 1%; white-space: nowrap; }
.tbl td.sz { font: 500 13px/1.5 var(--mono); white-space: nowrap; text-align: right; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl th:first-child, .tbl td:first-child { padding-left: 0; }
.tbl th:last-child, .tbl td:last-child { padding-right: 0; }
.tbl .yes { color: var(--ok); font-weight: 600; }
.tbl .no { color: var(--danger); font-weight: 600; }
.tbl td[data-l]::before { font-size: 10.5px; }
/* Strength rows: a block per part at every width (the panel is narrow on a desktop too), the margin big on the right. */
.tbl.strength, .tbl.strength tbody, .tbl.strength tr, .tbl.strength td { display: block; }
.tbl.strength thead { display: none; }
.tbl.strength tr { position: relative; padding: 11px 76px 11px 0; border-bottom: 1px solid var(--line); }
.tbl.strength tr:first-child { border-top: 1px solid var(--line); }
.tbl.strength tr:last-child { border-bottom: 0; }
.tbl.strength td { padding: 1px 0; border: 0; }
.tbl.strength td[data-l]::before { content: attr(data-l) ": "; }
.tbl.strength td.mg { position: absolute; right: 0; top: 11px; width: 68px; text-align: right; font: 500 20px/1.1 var(--mono); }
.tbl.strength td.mg::before { display: block; content: attr(data-l); line-height: 1.4; }
/* Each run of rows is headed by the load it is checked against: the load's name, and what it is in a sentence. */
.tbl.strength tr.grp { padding: 22px 0 8px; border-top: 0; border-bottom: 1px solid var(--line-strong); }
.tbl.strength tr.grp:first-child { padding-top: 6px; }
.tbl.strength tr.grp th { display: block; padding: 0; border: 0; font: 400 14px/1.45 var(--sans); letter-spacing: 0; text-transform: none; color: var(--muted); }
.tbl.strength tr.grp th strong { display: block; margin-bottom: 1px; font: 600 15.5px/1.3 var(--sans); color: var(--ink); }
.tbl.strength tr.grp + tr { border-top: 0; }
/* the worst case in the row's own words, quieter; the load and what the part takes on one line */
.tbl.strength td[data-l="Worst case"] { color: var(--muted); font-size: 14px; }
.tbl.strength td.num, .tbl.strength td.num + td { display: inline; }
.tbl.strength td.num + td::before { content: "  ·  " attr(data-l) ": "; white-space: pre; }
.tbl.strength tr[id] { scroll-margin-top: 62px; }
.tbl.strength tr[id]:focus:not(:focus-visible) { outline: none; }
.tbl.strength tr.hit { background: var(--accent-soft); box-shadow: -8px 0 0 var(--accent-soft), 8px 0 0 var(--accent-soft); }
.tbl .low, .strength-low .low { color: var(--warn); font-weight: 600; }
.strength-low .no { color: var(--danger); } .strength-low .yes { color: var(--ok); }
/* The parts under the aim, weakest first: a ruled list, each line a button to its row. */
.strength-low { margin: 16px 0 6px; }
.strength-low > h4 { margin-bottom: 4px; }
.strength-low ul { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.strength-low li + li { border-top: 1px solid var(--line); }
.strength-low button { display: flex; width: 100%; min-height: 42px; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border: 0;
  background: none; font: 400 14.5px/1.3 var(--sans); color: var(--ink); text-align: left; cursor: pointer; }
.strength-low button:hover span { text-decoration: underline; text-underline-offset: 3px; }
.strength-low button:focus-visible { outline-offset: -2px; }
.strength-low b { flex: none; font: 500 17px/1 var(--mono); }
.strength-notes { margin-top: 14px; }
#cuts > * + * { margin-top: 26px; }
/* A stock and what is cut from it: ruled off above, not boxed. */
.stock { padding-top: 22px; border-top: 1px solid var(--line); }
.stock > h4 + .foot, .stock > .row + .foot { margin-top: 4px; }
/* The cut list's ticks: a cut row greys and is struck through, its box stays easy to hit. */
.cutlist th.cut, .cutlist td.cut { width: 1%; padding-right: 0; }
.cutlist td.cut { padding: 0 0 0 2px; vertical-align: middle; }
.cutlist .tick { padding: 0; width: 40px; height: 40px; place-items: center; }
.cutlist .tick input { width: 24px; height: 24px; }
.cutlist tr.done td:not(.cut) { color: var(--muted); text-decoration: line-through; }
/* With a mouse and the model beside the list, the row pointed at is tinted while its part lights up on the model. */
@media (min-width: 900px) and (hover: hover) and (pointer: fine) { .cutlist tr[data-part]:hover { background: var(--accent-soft); } }
/* "Hide what is ticked" (Parts) and "Hide what is cut" (Cuts): a line ticked goes a moment later (`settled`), so
   a slip of the thumb shows before it disappears. A stock or section with nothing left goes with it. */
.hide-done .item.done.settled, .hide-done .cutrow.done.settled { display: none; }
.hide-done .bom-sec:not(:has(.item:not(.done.settled))) { display: none; }
#cuts.hide-done .sec:not(:has(.cutrow:not(.done.settled))) { display: none; }
#bom.hide-done:not(:has(.item:not(.done.settled)))::after { content: "Everything on the list is ticked."; display: block; padding: 18px 0; color: var(--muted); }
#cuts.hide-done:not(:has(.cutrow:not(.done.settled)))::after { content: "Every piece is cut."; display: block; padding: 18px 0; color: var(--muted); }
.board { margin-top: 12px; }
.board-h { display: flex; justify-content: space-between; margin-bottom: 4px; }
.bar { display: flex; height: 30px; border: 1px solid var(--line-strong); border-radius: 4px; overflow: hidden; background: repeating-linear-gradient(135deg, var(--surface-2) 0 6px, var(--surface) 6px 12px); }
.bar i { display: grid; place-items: center; min-width: 0; overflow: hidden; border-right: 2px solid var(--surface); font: 500 11px/1 var(--mono); font-style: normal; color: #2b2113; white-space: nowrap; }
.bar i:nth-child(4n+1) { background: #e3c48f; } .bar i:nth-child(4n+2) { background: #d4ae75; }
.bar i:nth-child(4n+3) { background: #ecd3a6; } .bar i:nth-child(4n+4) { background: #c99f63; }
.board ol { margin-top: 4px; font-size: 13.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 2px 12px; }
/* A piece whose row is ticked as cut fades on its board, still wood, not the hatched offcut; struck through below. */
.bar i.cut { background: color-mix(in srgb, #d4ae75 30%, var(--surface)); color: var(--muted); text-decoration: line-through; }
.board li.cut { text-decoration: line-through; opacity: .75; }

/* build steps, and the safety notes folded up above them */
.safety { border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.safety > summary { list-style: none; cursor: pointer; display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: 0 6px 0 0;
  font: 600 17.5px/1.2 var(--sans); }
.safety > summary::-webkit-details-marker { display: none; }
.safety > summary::after { content: ""; width: 8px; height: 8px; margin-top: -4px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .2s; }
.safety[open] > summary::after { margin-top: 4px; transform: rotate(-135deg); }
.safety > summary:hover { color: var(--accent); }
.safety-body { padding: 0 0 22px; }
.safety-body > * { margin-top: 22px; }
.safety-body > :first-child { margin-top: 4px; }
.safety-body h3 { font-size: 16px; }

.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: var(--ok); transition: width .3s; }
/* A step: a row ruled off above, its number quiet until it is done. The one the model is at is a tinted well. */
#steps .sec > * + * { margin-top: 0; }
.step { padding: 16px 0 18px; border-top: 1px solid var(--line); scroll-margin-top: 14px; }
.gonext { display: flex; width: fit-content; max-width: 100%; padding-top: 8px; padding-bottom: 8px; line-height: 1.25; text-align: left; }
.cutrow { scroll-margin-top: 14px; }
.step-head { display: flex; align-items: center; gap: 11px; }
.step-n { flex: none; width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--line-strong); color: var(--muted); font: 500 12.5px/1 var(--mono); }
.step.done .step-n { background: var(--ok-soft); color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.step-head h4 { flex: 1; min-width: 0; font-size: 16.5px; }
.step.onmodel, #stepcard .step {
  padding: 16px 16px 14px; border-top-color: transparent; border-radius: var(--r); background: var(--accent-soft);
  --line: color-mix(in srgb, var(--ink) 14%, transparent); --line-strong: color-mix(in srgb, var(--ink) 32%, transparent);
}
.step.onmodel + .step { border-top-color: transparent; }
.step.onmodel .step-head::after { content: "On the model"; flex: none; font-size: 10.5px; line-height: 1; color: var(--accent); white-space: nowrap; }
.step-body { padding-top: 12px; }
.step-body > * + * { margin-top: 12px; }
.step-foot { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.step-foot .check { font-weight: 600; }
/* "Fold what is done": a step done keeps its title and its tick, a moment after the tick (`settled`). */
#steps.hide-done .step.done.settled .numbered { display: none; }
#steps.hide-done .step.done.settled .step-body > * + * { margin-top: 0; }
#steps.hide-done .step.done.settled .step-body { padding-top: 4px; }
.check { display: inline-flex; align-items: center; gap: 9px; min-height: 42px; }
.check input { width: 22px; height: 22px; margin: 0; accent-color: var(--ok); }
.checklist > li { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.checklist > li:first-child { border-top: 0; }
.checklist > li::before { content: ""; flex: none; width: 18px; height: 18px; margin-top: 3px; border: 2px solid var(--line-strong); border-radius: 4px; }

/* Options: the other ways to a dog treadmill, a row each */
.opt { display: grid; gap: 3px; padding: 14px 0; border-top: 1px solid var(--line); }
.sec > .opt + .opt { margin-top: 0; }
.opt .price-line { font: 500 14px/1.4 var(--mono); color: var(--muted); }
.opt p { margin-top: 2px; }
.foot { color: var(--muted); font-size: 14px; }

/* ---------- drawings on the Blueprint tab: built in app.js, every colour from the theme ---------- */
.drawings { display: grid; }
.dwg { margin: 0; padding: 14px 0 18px; border-top: 1px solid var(--line); min-width: 0; }
.dwg:first-child { border-top: 0; padding-top: 2px; }
.dwg figcaption { font-size: 14px; color: var(--muted); margin-bottom: 8px; }
.dwg figcaption b { display: block; line-height: 1.5; color: var(--ink); }
.dwg svg { display: block; width: 100%; height: auto; max-width: 460px; margin: 0 auto; overflow: visible; }
.dwg.tall svg { max-width: 360px; }
.dwg svg * { vector-effect: non-scaling-stroke; stroke-width: 1px; stroke-linejoin: round; }
.dwg .dw-floor { stroke: var(--ink); stroke-width: 1.5px; }
.dwg .dw-far { fill: var(--bg); stroke: var(--line-strong); }
.dwg .dw-part { fill: var(--surface-2); stroke: var(--ink); stroke-opacity: .7; }
.dwg .dw-cut { fill: var(--line-strong); stroke: var(--ink); }
.dwg .dw-belt { fill: var(--accent-soft); stroke: var(--accent); fill-rule: evenodd; }
.dwg .dw-joint { stroke: var(--accent); stroke-opacity: .45; }
.dwg .dw-steel { fill: var(--muted); stroke: var(--ink); stroke-opacity: .6; }
.dwg .dw-tire { fill: var(--ink); fill-opacity: .72; stroke: var(--ink); }
.dwg .dw-hub { fill: var(--surface-2); stroke: var(--ink); }
.dwg .dw-pad { fill: var(--ink); fill-opacity: .35; stroke: none; }
.dwg .dw-brake { fill: var(--warn); fill-opacity: .5; stroke: var(--ink); }
.dwg .dw-eye, .dwg .dw-ring { fill: none; stroke: var(--muted); stroke-width: 2px; }
.dwg .dw-lead { stroke: var(--muted); stroke-width: 2px; stroke-dasharray: 4 2; }
.dwg .dw-dim { stroke: var(--dim); }
.dwg .dw-ext { stroke: var(--dim); stroke-opacity: .6; }
.dwg text { stroke: var(--surface); stroke-width: .28em; stroke-linejoin: round; paint-order: stroke; vector-effect: none; }
.dwg .dw-t { fill: var(--dim); font-family: var(--mono); font-weight: 500; }
.dwg .dw-note { fill: var(--muted); font-family: var(--mono); font-weight: 500; }

/* ---------- phone and narrow layouts (screens only: paper takes the wide layout, under @media print) ---------- */
@media screen and (max-width: 899px) {
  :root { --top: 48px; }
  .app { grid-template-rows: var(--top) minmax(0, 1fr) auto; }
  .main { display: flex; flex-direction: column; min-height: 0; }
  .top { gap: 10px; }
  .toprice { min-height: 40px; padding: 3px 10px 4px; gap: 2px; }
  .price-total { font-size: 21px; }
  /* The change takes the place of "parts total" for its moment: under the price it would cover the list or the stage. */
  .price-delta { top: 3px; right: 10px; padding: 0; border: 0; border-radius: 0; background: none; box-shadow: none; font-size: 11px; font-weight: 600; }
  .toprice.moved .price-sub { visibility: hidden; }
  .sync { display: inline-grid; place-items: center; width: 24px; height: 40px; overflow: hidden; font-size: 0; letter-spacing: 0; }   /* the dot alone: saved, saving, or not shared */
  .sync::before { margin: 0; width: 9px; height: 9px; }
  .brand h1 { font-size: 17px; }
  .stage { flex: 0 0 auto; height: min(52dvh, 108vw); min-height: 230px; }
  .app[data-short="1"] .stage { height: min(38dvh, 78vw); min-height: 220px; }
  .app[data-short="1"] .hint { display: none; }
  .chip.fold { display: inline-flex; }
  .app:not([data-tab="blueprint"]) .stage { display: none; }
  .panel { flex: 1 1 0; border-left: 0; border-top: 1px solid var(--line); grid-template-rows: minmax(0, 1fr); }
  .tabs {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; border-bottom: 0; border-top: 1px solid var(--line);
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, .08);
  }
  .tab { border-bottom: 0; border-top: 3px solid transparent; font-size: 10.5px; letter-spacing: .03em; }
  .tab[aria-selected="true"] { border-top-color: var(--accent); }
  .pane { --pad: 14px; padding-bottom: calc(var(--tabs) + env(safe-area-inset-bottom) + 28px); }
  .totals { padding: 10px var(--pad); gap: 14px; }
  .jump { padding: 2px calc(var(--pad) - 9px); }
  .jump button { padding: 0 9px; font-size: 14px; }
  #pane-blueprint h3, #pane-blueprint .choice-l, #pane-blueprint section.sec, #choices { scroll-margin-top: 54px; }
  .card { padding: 16px; }
  .chip { min-height: 40px; padding: 0 12px; font-size: 13.5px; }
  .name { min-height: 24px; padding: 0 8px; font-size: 12px; }
  .stage-tools { left: 8px; right: 8px; top: 8px; }
  .stepbar { left: 8px; right: 8px; bottom: 8px; }
  .hint { bottom: 62px; }
  .partlist { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .part-name { gap: 8px; font-size: 14.5px; }
  .part-name span { white-space: normal; line-height: 1.15; }
}
/* Tables as rows of lines wherever the panel is about a phone's width: on a phone, and on a desktop under 1200 px,
   where the panel (40% of the width) is under 480 px and a table's columns squeeze the names. */
@media screen and (max-width: 1199px) {
  .tbl.stack, .tbl.stack tbody, .tbl.stack tr, .tbl.stack td { display: block; }
  .tbl.stack thead { display: none; }
  .tbl.stack tr { padding: 8px 0; border-bottom: 1px solid var(--line); }
  .tbl.stack tr:last-child { border-bottom: 0; }
  .tbl.stack td { padding: 1px 0; border: 0; width: auto; text-align: left; white-space: normal; }
  .tbl.stack td.q { display: inline; font: 500 13px var(--mono); }
  .tbl.stack td.q::after { content: " x "; }
  .tbl.stack td.q + td { display: inline; font-weight: 600; }
  .tbl.stack td.sz { text-align: left; }
  .tbl.stack td[data-l]::before { content: attr(data-l) ": "; }
  .tbl.stack.cutlist tr { position: relative; padding-left: 38px; min-height: 44px; }
  .tbl.stack.cutlist td.cut { position: absolute; left: -8px; top: 0; padding: 0; }
}
/* phones on their side: model beside the panel, tabs back on top */
@media screen and (max-width: 899px) and (orientation: landscape) and (min-width: 560px) {
  .app { grid-template-rows: var(--top) minmax(0, 1fr); }
  .main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 46vw); }
  .stage, .app:not([data-tab="blueprint"]) .stage, .app[data-short="1"] .stage { display: block; height: auto; min-height: 0; }
  .chip.fold { display: none; }
  .app[data-short="1"] .hint { display: block; }
  .panel { grid-template-rows: auto minmax(0, 1fr); border-top: 0; border-left: 1px solid var(--line); }
  .tabs { position: static; box-shadow: none; border-top: 0; border-bottom: 1px solid var(--line); padding: 0; }
  .tab { height: 46px; border-top: 0; border-bottom: 3px solid transparent; }
  .tab svg { display: none; }
  .tab[aria-selected="true"] { border-bottom-color: var(--accent); }
  .pane { padding-bottom: 28px; }
}
@media (max-width: 420px) {
  .brand h1 .more { display: none; }
}
@media (max-width: 360px) {
  .brand .eyebrow .more { display: none; }   /* "Dog-powered" alone: the whole line would wrap beside the price */
  .jump button { padding: 0 6px; font-size: 13.5px; }
}
@media (max-width: 380px) {
  .exslide { padding: 0 12px; }
  .exslide span { display: none; }                 /* the track alone: its name is read out, and its ends are plain */
  .chip { padding: 0 10px; min-width: 40px; justify-content: center; }
  .bar i { font-size: 10px; letter-spacing: -.03em; }
  .tab { font-size: 10px; letter-spacing: 0; }
  .partlist { grid-template-columns: minmax(0, 1fr); }
}
/* ---------- print: the open tab on paper, for the store or the saw ----------
   Black on white whatever the theme (`:not(#_)` outranks the dark theme's selectors), the whole pane in the page's
   flow, no model, tabs or buttons. The Print buttons on Parts, Cuts and Build call the browser's own print. */
@media print {
  :root:not(#_) {
    --bg: #fff; --surface: #fff; --surface-2: #eee; --ink: #000; --muted: #444; --line: #bbb; --line-strong: #777;
    --accent: #000; --accent-ink: #fff; --accent-soft: #fff; --ok: #000; --ok-soft: #eee; --warn: #000; --warn-soft: #f4f4f4; --dim: #000;
    --track: #fff; --thumb: #fff; --shadow: none; --lift: none; color-scheme: light;
  }
  html, body { height: auto; overflow: visible; background: #fff; }
  .app { display: block; height: auto; }
  .main, .panel, .panes { display: block; border: 0; }
  .pane { position: static; overflow: visible; padding: 0; }
  .stage, .tabs, .jump, .top-actions, .price-delta, .stores, .printbtn, .noprint, #priceReset, .step-foot .btn, .fatal { display: none !important; }
  .top { padding: 0 0 6px; border-bottom: 2px solid #000; }
  .totals { position: static; margin: 0; padding: 0 0 10px; }
  .price input { border: 0; padding: 0; width: 4.5em; height: auto; }
  .item, .cutlist tr, .strength tr, .board, .dwg, .numbered > li, .step-head, .bullets > li, .checklist > li, .opt, .kv > div { break-inside: avoid; }
  h2, h3, h4, .step-head, .row.spread, .strength tr.grp { break-after: avoid; }
  .strength tr.hit { background: none; box-shadow: none; }
  .safety > summary::after { display: none; }
  .card { padding: 12px 14px; border: 1px solid var(--line-strong); }
  .note { border: 1px solid var(--line-strong); }
  .step.onmodel { padding: 16px 0 18px; border-radius: 0; border-top-color: var(--line); } .step.onmodel + .step { border-top-color: var(--line); } .step.onmodel .step-head::after { content: none; }
  .seg button.on { outline: 2px solid #000; }
  a[data-tab-link] { text-decoration: none; }
  /* the Blueprint on paper: the mill as chosen, what it gives, the drawings and the strength. The switches, the
     option buttons and the part list are for the screen; the mill card already lists what was chosen. Each drawing
     has its own title, so the Drawings heading goes too: Firefox would leave it alone at the foot of a page. */
  #choices, #selcard, #stepcard, #partsSec, #mill .mill-foot, #mill .btn, #drawHead { display: none !important; }
  #strengthSec { break-before: page; }                          /* the strength table is a sheet of its own */
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; scroll-behavior: auto !important; } }

/* ---------- login page ---------- */
body.gate { overflow: auto; display: grid; place-items: center; min-height: 100vh; min-height: 100dvh; padding: 20px;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px); background-size: 32px 32px; }
.gatebox { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 26px 22px; box-shadow: var(--shadow); }
.gatebox > * + * { margin-top: 14px; }
.gatebox h1 { font: 600 26px/1.1 var(--cond); letter-spacing: .03em; text-transform: uppercase; }
.gatebox label { display: block; font-size: 12px; letter-spacing: .12em; margin-bottom: 6px; }
.gatebox input { width: 100%; height: 52px; font: 500 20px/1 var(--mono); padding: 0 14px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--bg); color: var(--ink); }
.gatebox .btn { width: 100%; min-height: 52px; font-size: 16px; margin-top: 14px; }
.gatebox .err { color: var(--danger); font-weight: 600; margin-top: 10px; }
.gatebox p { color: var(--muted); font-size: 14.5px; }
