:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c2330;
  --muted: #667085;
  --border: #dde1e7;
  --accent: #2563eb;
  --accent-text: #ffffff;
  --amber-bg: #fff4d6;
  --amber-line: #e0a100;
  --amber-text: #8a5a00;
  --red-bg: #fde4e2;
  --red-line: #d93025;
  --red-text: #a3221a;
  --green-bg: #dff5e6;
  --green-text: #1d6b3a;
  --radius: 8px;
  color-scheme: light;
}

/* `hidden` always hides. Without this, any rule that gives an element a display (button, .button, label ...)
   beat the browser's own [hidden] rule, and the scripts' "hidden = true" left buttons on screen. */
[hidden] { display: none !important; }

/* Dark when chosen with the switch (s2p.mode, shared with the public site), or when the device prefers it and
   light was not chosen. The media query alone ignored the switch: pick light on the website, open the
   owner panel, and it was dark again. */
:root[data-mode="dark"] {
    --bg: #12151b;
    --surface: #1b2029;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --border: #2c3340;
    --accent: #5b8def;
    --amber-bg: #3a2e10;
    --amber-line: #c8900a;
    --amber-text: #f2c566;
    --red-bg: #3d1b19;
    --red-line: #e2554b;
    --red-text: #ff9b92;
    --green-bg: #173323;
    --green-text: #7fd39d;
    color-scheme: dark;
  }

@media (prefers-color-scheme: dark) {
  :root:not([data-mode="light"]) {
    --bg: #12151b;
    --surface: #1b2029;
    --text: #e6e9ef;
    --muted: #98a2b3;
    --border: #2c3340;
    --accent: #5b8def;
    --amber-bg: #3a2e10;
    --amber-line: #c8900a;
    --amber-text: #f2c566;
    --red-bg: #3d1b19;
    --red-line: #e2554b;
    --red-text: #ff9b92;
    --green-bg: #173323;
    --green-text: #7fd39d;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
main { max-width: 1320px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.6rem; margin: 8px 0; }
h2 { font-size: 1.25rem; margin: 0 0 8px; }
h3 { font-size: 1rem; margin: 0 0 8px; }
a { color: var(--accent); }
code { font-size: 0.9em; }
pre { white-space: pre-wrap; margin: 0; }
.code { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; font-size: 12.5px; overflow-x: auto; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.ok { color: var(--green-text); }
.bad, .red-text { color: var(--red-text); }
.amber-text { color: var(--amber-text); }

/* layout */
.topbar { display: flex; gap: 24px; align-items: center; padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; color: var(--text); text-decoration: none; }
.topbar > :last-child { margin-left: auto; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; overflow-x: auto; }
.split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.spread { justify-content: space-between; }
@media (max-width: 1100px) { .split { grid-template-columns: minmax(0, 1fr); } }  /* 1fr alone grows to the widest table */
/* Phones: wide tables scroll inside their card instead of pushing the page sideways. */
@media (max-width: 700px) { table.dims, table.list, .quote table { display: block; overflow-x: auto; } }

/* steps */
.steps { display: flex; gap: 6px; list-style: none; margin: 0; padding: 0; counter-reset: step; }
.steps li { counter-increment: step; color: var(--muted); font-size: 0.9rem; padding: 2px 10px; border-radius: 99px; }
.steps li::before { content: counter(step) ". "; }
.steps li.current { background: var(--accent); color: var(--accent-text); }
.steps li.done { color: var(--green-text); }

/* controls */
button, .button { font: inherit; padding: 7px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .button:hover { border-color: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.danger { border-color: var(--red-line); color: var(--red-text); }
input, textarea, select { font: inherit; color: var(--text); background: var(--surface); border: 1px solid var(--border); border-radius: 6px; padding: 5px 8px; }
textarea { width: 100%; }
label { display: block; margin: 8px 0; }
.row label { margin: 0; }
input[type="number"] { width: 100px; }
.drop { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 28px;
  border: 2px dashed var(--border); border-radius: var(--radius); text-align: center; cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s; }
/* The picker itself stays (keyboard, the required check) but out of sight: its button spoke the browser's
   language, not the page's. Its "choose a file" bubble shows at the bottom of the box. */
.drop input { position: absolute; left: 50%; bottom: 10px; width: 1px; height: 1px; opacity: 0; }
.drop:hover, .drop.over { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, transparent); }
.drop:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.drop.chosen { border-style: solid; border-color: var(--accent); }
.drop-icon { width: 34px; height: 34px; color: var(--accent-ink, var(--accent)); }
.drop-title { font-weight: 600; overflow-wrap: anywhere; }
@media (max-width: 520px) { .drop { padding: 16px; } }

/* tags + callouts */
.tag { display: inline-block; font-size: 0.75rem; padding: 1px 8px; border-radius: 99px; background: var(--bg); border: 1px solid var(--border); }
.tag.amber { background: var(--amber-bg); border-color: var(--amber-line); color: var(--amber-text); }
.tag.red { background: var(--red-bg); border-color: var(--red-line); color: var(--red-text); }
.tag.green { background: var(--green-bg); border-color: var(--green-text); color: var(--green-text); }
.callout { padding: 10px 12px; border-radius: var(--radius); border-left: 4px solid; margin: 8px 0; }
.callout.amber { background: var(--amber-bg); border-color: var(--amber-line); }
.callout.red { background: var(--red-bg); border-color: var(--red-line); white-space: pre-line; }

/* dimension tables */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: 0.8rem; color: var(--muted); font-weight: 600; }
td.num { text-align: right; white-space: nowrap; }
.dims tr.assumed td { background: var(--amber-bg); }
.dims tr.conflict td { background: var(--red-bg); }
.dims tr.conflict input { border-color: var(--red-line); }
.dims.compact td { padding: 3px 6px; }
.dims tr.removed td:not(:last-child) { text-decoration: line-through; opacity: 0.55; }
.dims tr.added td { background: var(--green-bg); }
.add-dim { margin: 8px 0 4px; }
.add-dim summary { cursor: pointer; color: var(--accent-ink, var(--accent)); }
.jobs tbody tr { cursor: pointer; }
.jobs tbody tr:hover td, .jobs tr.selected td { background: var(--bg); }
.quote tr.total td { font-weight: 700; border-bottom: none; }

/* confirm page */
/* beside the form on wide screens only; stacked above it, a sticky sketch would cover the table while scrolling */
@media (min-width: 1101px) { .sketch { position: sticky; top: 12px; } }
.sketch img, .thumb { width: 100%; border-radius: var(--radius); border: 1px solid var(--border); background: #fff; }
.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 3px 0; }
.issue { border-top: 1px solid var(--border); padding: 8px 0; }
.issue:first-child { border-top: none; }
.issue p { margin: 4px 0; }
.issue textarea { flex: 1; min-width: 200px; }

/* model page */
.viewer { position: relative; height: 480px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.viewer canvas { display: block; }
.legend { position: absolute; left: 10px; bottom: 8px; font-size: 0.85rem; color: var(--muted); pointer-events: none; }
.downloads { margin: 10px 0 16px; }
.fit { display: block; padding: 6px 0; border-bottom: 1px solid var(--border); }
.fit input[type="number"] { width: 70px; }
.notes { padding-left: 18px; }

/* progress */
.wait { display: flex; gap: 16px; align-items: center; }
.spinner { width: 32px; height: 32px; border: 3px solid var(--border); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }
.attempts { padding-left: 20px; }
.attempts > li { margin-bottom: 10px; }
.attempts > li.bad > div { color: var(--red-text); }
.attempts > li.ok > div { color: var(--green-text); }
.attempts pre { font-size: 12.5px; color: var(--text); }

/* feature placement */
.features { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 12px; margin-bottom: 12px; }
.palette { list-style: none; margin: 0; padding: 0 8px 0 0; border-right: 1px solid var(--border); }
.palette button { width: 100%; text-align: left; border: none; background: none; padding: 5px 8px; border-radius: 6px; font-size: 0.9rem; }
.palette button:hover { background: var(--bg); }
.palette button.active { background: var(--accent); color: var(--accent-text); }
.palette .op { float: right; font-size: 0.7rem; opacity: 0.7; }
.feature-panel input[type="number"] { width: 78px; }
.feature-panel .params td { padding: 2px 6px; }
.feature-panel details { margin: 6px 0; }
.feature-panel summary { cursor: pointer; font-weight: 600; font-size: 0.9rem; }
.feature-panel label.inline { display: inline-block; margin: 4px 10px 4px 0; font-size: 0.9rem; }
.feature-panel .row.small input { width: 70px; }
.placed-list tr.selected td { background: var(--bg); }
#features-card.busy { opacity: 0.7; }
@media (max-width: 640px) {
  .features { grid-template-columns: 1fr; }
  .palette { display: flex; flex-wrap: wrap; gap: 4px; border-right: none; border-bottom: 1px solid var(--border); padding: 0 0 8px; }
  .palette li { flex: 1 1 45%; }
}

/* text commands, proposals, uploads */
#command-form { margin: 8px 0; }
#command-form input { flex: 1; min-width: 200px; }
.proposal { border-left: 4px solid var(--accent); padding: 8px 12px; margin: 8px 0; background: var(--bg); border-radius: var(--radius); }
.proposal.amber { border-color: var(--amber-line); }
.proposal ul { margin: 4px 0; padding-left: 18px; }
.palette-extra { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 6px; }
.faces label { display: block; padding: 3px 0; font-size: 0.85rem; }
.library-item { border-top: 1px solid var(--border); padding: 6px 0; }
.library-item:first-child { border-top: none; }

/* print farm */
.callout.green { background: var(--green-bg); border-color: var(--green-text); }
.printers { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.printer.card { margin: 0; }
.printer .snap { width: 100%; border-radius: 6px; border: 1px solid var(--border); margin: 6px 0; background: #000; aspect-ratio: 16 / 9; object-fit: cover; }
.printer .bar { height: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: 4px; overflow: hidden; margin: 6px 0; }
.printer .bar > div { height: 100%; background: var(--accent); }
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: 0.75rem; padding: 1px 8px; border-radius: 99px; border: 1px solid var(--border); margin: 2px 2px 2px 0; }
.chip .swatch { width: 10px; height: 10px; border-radius: 50%; border: 1px solid rgba(0,0,0,0.3); }
.state-printing { border-color: var(--accent); }
.state-error, .state-offline { border-color: var(--red-line); }
.state-finished { border-color: var(--green-text); }
.queue tr.dragging td { opacity: 0.4; }
.queue tr.drop-target td { border-top: 2px solid var(--accent); }
.queue .handle { cursor: grab; color: var(--muted); }
.queue tr.final td { opacity: 0.6; }
.alerts { margin-bottom: 12px; }
.alerts .callout { display: flex; justify-content: space-between; gap: 12px; align-items: center; margin: 4px 0; }
.events { font-size: 0.8rem; color: var(--muted); padding: 4px 0 8px 32px; }
#farm-status { font-size: 0.8rem; }
#printer-form label { margin: 4px 8px 4px 0; }

/* owner panel */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px 14px; }
.kpi strong { display: block; font-size: 1.4rem; line-height: 1.2; }
.kpi span { color: var(--muted); font-size: 0.85rem; }
.price-form { display: grid; grid-template-columns: max-content minmax(0, 9rem) 1fr; gap: 8px 12px; align-items: center; }
.price-materials { display: contents; }
.price-form label { margin: 0; }
.formula { font-family: ui-monospace, "Cascadia Mono", Consolas, monospace; font-size: 0.85rem; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 10px; }
table.list td, table.list th { font-size: 0.9rem; }
@media (max-width: 700px) { .price-form { grid-template-columns: 1fr; } }

/* customer order: once placed, the model and the price are fixed */
.locked [data-lock] { opacity: 0.5; pointer-events: none; }
.order-form .row label { flex: 1 1 200px; }
.order-form input:not([type="radio"]) { width: 100%; }
.delivery-options { border: 1px solid var(--border); border-radius: var(--radius); padding: 6px 12px; margin: 8px 0; }
.delivery-options legend { font-weight: 600; padding: 0 4px; }
.choice { display: block; margin: 6px 0; cursor: pointer; }
.choice .small { display: block; margin-left: 24px; }
.order-total { font-size: 1.05rem; }
.delivery-edit { display: grid; grid-template-columns: auto minmax(0, 12rem) minmax(0, 7rem) 1fr; gap: 6px 10px; align-items: center; margin: 8px 0; }
.delivery-edit input[type="text"] { width: 100%; }
.outbox details summary { cursor: pointer; }
.outbox pre { white-space: pre-wrap; font-size: 0.8rem; background: var(--bg); padding: 8px; border-radius: 6px; }

/* owner panel: website look */
.look { display: grid; grid-template-columns: minmax(0, 320px) minmax(0, 1fr); gap: 16px; align-items: start; }
.look fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 2px 10px 6px; margin: 8px 0; }
.look fieldset label, .look label.inline { display: inline-block; margin: 4px 12px 4px 0; }
.presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.presets button { font-size: 0.8rem; padding: 3px 10px; }
.look-preview iframe { width: 100%; height: 600px; border: 1px solid var(--border); border-radius: var(--radius); background: #fff; margin-top: 6px; }
@media (max-width: 900px) { .look { grid-template-columns: 1fr; } }

/* technical drawing next to the dimension tables (js/drawing.js): the part in the text colour, dimensions in the
   accent ink, amber when assumed and red when contradicting, like the table rows */
.tech-drawing { display: block; width: 100%; height: auto; }
.tech-drawing .dw-outline { fill: color-mix(in srgb, var(--text) 5%, transparent); stroke: var(--text); stroke-width: 1.6; stroke-linejoin: round; }
.tech-drawing .dw-hatch-line { stroke: var(--muted); stroke-width: 0.8; opacity: 0.55; }
.tech-drawing .dw-hole { fill: var(--surface); stroke: var(--text); stroke-width: 1.4; }
.tech-drawing .dw-centre { fill: none; stroke: var(--muted); stroke-width: 0.8; stroke-dasharray: 12 3 2 3; }
.tech-drawing .dw-title { font-size: 10px; fill: var(--muted); letter-spacing: 0.1em; text-transform: uppercase; }
.tech-drawing .dw-dim { color: var(--accent-ink, var(--accent)); cursor: pointer; outline: none; }
.tech-drawing .dw-line, .tech-drawing .dw-ext { fill: none; stroke: currentColor; stroke-width: 0.9; }
.tech-drawing .dw-arrow { fill: currentColor; }
.tech-drawing .dw-value { fill: currentColor; font-size: 12px; font-weight: 600; font-family: var(--font-body, system-ui, sans-serif); }
.tech-drawing .dw-hit { stroke: transparent; stroke-width: 14; }
.tech-drawing .dw-dim.assumed { color: var(--amber-text); }
.tech-drawing .dw-dim.conflict { color: var(--red-text); }
.tech-drawing .dw-dim.active, .tech-drawing .dw-dim:focus-visible { color: var(--accent); }
.tech-drawing .dw-dim.active .dw-line { stroke-width: 2; }
.dims tr.hover td { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--accent) 16%, transparent); }
.view-tabs { display: flex; gap: 6px; margin-bottom: 8px; }
.view-tabs button.active { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
.drawing-box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; }
.drawing-hint { margin: 6px 0 0; }

/* ------------------------------------------------------------------ owner panel */
.tabs { display: flex; gap: 4px; padding: 0 16px; background: var(--surface); border-bottom: 1px solid var(--border);
  overflow-x: auto; position: sticky; top: 0; z-index: 5; }
.tabs a { padding: 12px 14px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent;
  white-space: nowrap; font-weight: 500; }
.tabs a:hover { color: var(--text); }
.tabs a.active { color: var(--text); border-bottom-color: var(--accent); }
.tabs a[data-count]:not([data-count=""])::after { content: attr(data-count); margin-left: 6px; font-size: 0.75rem;
  padding: 1px 7px; border-radius: 999px; background: var(--amber-bg); color: var(--amber-text); }

.owner-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 380px), 1fr)); gap: 16px; }
.owner-grid .card { margin-bottom: 0; }
.section-title { font-size: 1rem; color: var(--muted); font-weight: 600; margin: 24px 0 10px; }

.company-grid { display: grid; grid-template-columns: minmax(260px, 1fr) minmax(360px, 1.5fr); gap: 24px; margin-top: 8px; }
.company-grid form { margin: 8px 0 12px; }
.company-grid .row label { display: flex; gap: 6px; align-items: center; }
.statement-preview:not(:empty) { margin: 4px 0 16px; padding: 12px; border: 1px solid var(--border); border-radius: 8px; }
@media (max-width: 1100px) { .company-grid { grid-template-columns: 1fr; } }
.attention, .setup { list-style: none; margin: 0; padding: 0; }
.attention li { padding: 10px 0; border-top: 1px solid var(--border); }
.attention li:first-child { border-top: 0; }
.attention .tag { margin-right: 6px; }
.all-clear { color: var(--muted); padding: 6px 0; }
.setup li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--border); }
.setup li:first-child { border-top: 0; }
.setup .mark { flex: none; width: 1.6rem; height: 1.6rem; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 0.85rem; }
.setup .done .mark { background: var(--green-bg); color: var(--green-text); }
.setup .todo .mark { background: var(--amber-bg); color: var(--amber-text); }
.setup .done strong { color: var(--muted); font-weight: 500; }

.prices-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 380px); gap: 16px; align-items: start; }
.prices-side { position: sticky; top: 64px; }
.price-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; margin: 14px 0; }
.price-group legend { font-weight: 600; padding: 0 6px; }
.price-group textarea { width: 100%; margin-top: 4px; }
.save-row { margin-top: 12px; }
.example-inputs { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 12px; margin: 10px 0 14px; }
.example-inputs label { margin: 0; font-size: 0.9rem; }
.example-inputs input, .example-inputs select { width: 100%; }
.example-inputs .unit { display: flex; align-items: center; gap: 6px; }
.example-result { border-top: 1px dashed var(--border); padding-top: 10px; }
.example-result .line { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; font-size: 0.92rem; }
.example-result .line span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.example-result .total { border-top: 1px solid var(--border); margin-top: 6px; padding-top: 8px; font-weight: 700; font-size: 1.05rem; }
details.card > summary { cursor: pointer; list-style: none; }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; }
details.card > summary::after { content: "  show"; color: var(--muted); font-size: 0.85rem; }
details.card[open] > summary::after { content: "  hide"; }
details.card[open] > summary { margin-bottom: 10px; }
.field-title { font-weight: 600; margin: 12px 0 0; }
details.advanced { margin: 14px 0; }
details.advanced > summary { cursor: pointer; color: var(--accent); font-size: 0.92rem; }

@media (max-width: 1000px) {
  .prices-layout { grid-template-columns: 1fr; }
  .prices-side { position: static; }
}

/* ------------------------------------------------------------------ model and price step
   The part stays in view on the left while the customer works through the right: the price and the order first,
   then what changes the model (dimensions, library features) and the files on their own, each folded away. */
.model-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 440px); gap: 24px; align-items: start; }
.model-stage { position: sticky; top: 16px; }
.model-stage .viewer { height: min(560px, calc(100vh - 220px)); min-height: 340px; }
.model-stage .downloads { margin: 10px 0 6px; }
.model-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; margin: 10px 0 0; font-size: 0.9rem; }
.model-checks p { margin: 0; }
.model-checks .callout { flex-basis: 100%; }
.model-side .card { margin-bottom: 14px; }
.price-card .price-label { margin: 0; font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); }
.price-big { margin: 2px 0 14px; }
.price-big strong { display: block; font-size: 2.6rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.01em;
  font-variant-numeric: tabular-nums; }
.price-big span { color: var(--muted); font-size: 0.9rem; }
.price-card.stale .price-big strong { opacity: 0.45; }
.quote-options { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px 12px; align-items: end;
  padding-top: 14px; border-top: 1px solid var(--border); }
.quote-options label { margin: 0; font-size: 0.85rem; color: var(--muted); }
.quote-options label select, .quote-options label input[type="number"] { display: block; width: 100%; margin-top: 4px;
  font-size: 1rem; color: var(--text); }
.quote-options label.inline { display: flex; align-items: center; gap: 8px; min-height: 40px; color: var(--text); }
.quote-options #quote-btn { min-height: 44px; }
.price-card.stale #quote-btn { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 35%, transparent); }
.price-lines { margin: 8px 0 0; }
.price-lines summary { cursor: pointer; color: var(--accent-ink, var(--accent)); font-weight: 600; font-size: 0.9rem; width: max-content; }
.price-lines .quote { margin-top: 8px; }
.price-card .order-form { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--border); }
.price-card .order-form .row label { flex: 1 1 160px; }
.price-card #order-btn { width: 100%; min-height: 48px; font-size: 1.05rem; margin-top: 4px; }
.fold { padding: 0 16px; }
.fold[open] { padding-bottom: 16px; }
.fold > summary { list-style: none; display: flex; flex-direction: column; gap: 2px; margin: 0 -16px; padding: 14px 44px 14px 16px; cursor: pointer;
  position: relative; }
.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::after { content: ""; position: absolute; right: 18px; top: 50%; width: 8px; height: 8px; margin-top: -6px;
  border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); transition: transform 0.15s; }
details.fold[open] > summary::after { transform: rotate(-135deg); margin-top: -2px; }
.fold-title { font-weight: 700; }
.fold-sub { font-size: 0.85rem; color: var(--muted); }
@media (max-width: 1000px) {
  .model-layout { grid-template-columns: minmax(0, 1fr); }
  .model-stage { position: static; }
  .model-stage .viewer { height: 320px; min-height: 0; }
}
/* Phones: the price and the way to the order stay at the bottom of the screen while the model is looked at. */
.price-bar { display: none; }
@media (max-width: 1000px) {
  .price-bar:not([hidden]) { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: flex; align-items: center;
    justify-content: space-between; gap: 12px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--border); box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.08); }
  .price-bar strong { display: block; font-size: 1.4rem; line-height: 1.1; }
  .price-bar span { font-size: 0.85rem; color: var(--muted); }
  .price-bar .button { min-height: 48px; padding: 0 26px; }
  #view-model:has(.price-bar:not([hidden])) { padding-bottom: 84px; }
}

/* Confirm step: the dimension names read as words; in a narrow column (a phone, or beside the drawing on a laptop)
   each dimension becomes a small card - name and remove button; value, unit, source and what the sketch said; the
   note - instead of a table that scrolled sideways with its notes one word a line. */
.dim-name { font-weight: 600; }
.formula { font-style: italic; }
.dims-wrap { container-type: inline-size; }
@container (max-width: 640px) {
  table.confirm-dims, table.confirm-dims tbody { display: block; overflow: visible; }
  table.confirm-dims thead { display: none; }
  table.confirm-dims tr { display: grid; grid-template-columns: auto auto auto minmax(0, 1fr) auto;
    grid-template-areas: "name name name name act" "val unit src raw raw" "note note note note note";
    align-items: center; gap: 6px 10px; padding: 10px 10px; border-bottom: 1px solid var(--border); border-radius: var(--radius); }
  table.confirm-dims td { padding: 0; border: 0; background: none !important; }
  table.confirm-dims td:nth-child(1) { grid-area: name; }
  table.confirm-dims td:nth-child(2) { grid-area: val; }
  table.confirm-dims td:nth-child(3) { grid-area: unit; }
  table.confirm-dims td:nth-child(4) { grid-area: src; }
  table.confirm-dims td:nth-child(5) { grid-area: raw; color: var(--muted); }
  table.confirm-dims td:nth-child(6) { grid-area: note; }
  table.confirm-dims td:nth-child(6):empty { display: none; }
  table.confirm-dims td:nth-child(7) { grid-area: act; }
  table.confirm-dims tr.assumed { background: var(--amber-bg); }
  table.confirm-dims tr.conflict { background: var(--red-bg); }
  table.confirm-dims tr.added { background: var(--green-bg); }
}
