:root {
  --bg: #ecebe7;
  --panel: #f8f7f4;
  --card: #ffffff;
  --ink: #1d1d1b;
  --muted: #6b6a66;
  --line: #d9d7d1;
  --accent: #2f72d6;
  --accent-ink: #1d4fa0;
  --accent-soft: #e4ecf9;
  --danger: #a2321f;
  --warn: #8a5a00;
  --radius: 8px;
  --sheet: 400px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  color: var(--ink);
  -webkit-text-size-adjust: 100%;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--bg); }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.45; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app {
  display: grid;
  grid-template-columns: 1fr var(--sheet);
  grid-template-rows: auto 1fr;
  grid-template-areas: "bar bar" "stage sheet";
  height: 100vh;
  height: 100dvh;
}

/* ---------------------------------------------------------------- bar */
.bar {
  grid-area: bar;
  display: flex; align-items: center; gap: 12px;
  padding: 8px 16px; min-height: 52px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.brand {
  border: 0; background: none; padding: 4px 0; font-weight: 650; font-size: 16px; letter-spacing: 0.01em;
  white-space: nowrap; color: var(--ink); text-decoration: none;
}
.dots { flex: 1; display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; min-width: 0; }
.dot {
  width: 10px; height: 10px; padding: 0; border-radius: 50%;
  border: 1.5px solid #b9b6ae; background: transparent;
}
.dot.done { background: #b9b6ae; }
.dot.on { border-color: var(--accent); background: var(--accent); transform: scale(1.25); }
.prefs { display: flex; gap: 8px; align-items: center; }
.prefs select {
  padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; background: var(--card); }
.seg button { border: 0; background: transparent; padding: 6px 10px; }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] { background: var(--ink); color: #fff; }

/* -------------------------------------------------------------- stage */
.stage { grid-area: stage; position: relative; overflow: hidden; min-height: 0; touch-action: none; }
.stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: grab; }
.stage canvas.dragging { cursor: grabbing; }
.stage canvas.over-part { cursor: pointer; }
.stage canvas[hidden] { display: none; }
.stage img.still { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; display: block; }
.stage img.still[hidden] { display: none; }
.labels { position: absolute; inset: 0; pointer-events: none; }
.labels > div { position: absolute; transform: translate(-50%, -50%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.measure {
  background: var(--accent); color: #fff; font-weight: 650; font-size: 15px;
  padding: 3px 9px; border-radius: 999px; box-shadow: 0 0 0 3px rgba(47, 114, 214, 0.22);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.dim {
  background: rgba(248, 247, 244, 0.94); border: 1px solid var(--line); border-radius: 4px;
  padding: 2px 6px; font-size: 12px;
}
.note {
  transform: translate(-50%, calc(-100% - 14px)) !important;
  background: var(--danger); color: #fff; font-size: 13px; padding: 4px 9px; border-radius: 6px;
}
/* the compartments' clear sizes over the model: a tap types over them */
.labels > button.size, .labels > input.size-in {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; white-space: nowrap;
  font-variant-numeric: tabular-nums; font-size: 12px; font-weight: 650; border-radius: 999px;
}
.labels > button.size {
  min-height: 26px; padding: 3px 9px; cursor: text;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: rgba(255, 255, 255, 0.92); color: var(--accent-ink);
}
.labels > button.size:hover { background: var(--accent-soft); border-color: var(--accent); }
.labels > input.size-in {
  width: 84px; padding: 4px 8px; font-size: 15px; text-align: center; border-radius: 8px;
  border: 1.5px solid var(--accent); background: #fff; color: var(--ink); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent);
}
.labels > input.size-in:focus { outline: none; }
/* the outer size grips: a dot on a face over the scene's arrow, the size
   under it; a 44 px target, dragged or tapped (designer phase B) */
.labels > button.grip {
  position: absolute; transform: translate(-50%, -50%); pointer-events: auto; touch-action: none;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 50%; background: transparent; cursor: grab;
}
.labels > button.grip::before {
  content: ""; position: absolute; left: 50%; top: 50%; width: 16px; height: 16px; margin: -8px 0 0 -8px; border-radius: 50%;
  background: #fff; border: 3px solid var(--accent); box-sizing: border-box; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.28);
}
.labels > button.grip:hover::before, .labels > button.grip.active::before, .labels > button.grip:focus-visible::before { background: var(--accent); }
.labels > button.grip.active { cursor: grabbing; }
.labels > button.grip:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.labels > button.grip .gv {
  position: absolute; left: 50%; top: calc(50% + 15px); transform: translateX(-50%); white-space: nowrap; cursor: text;
  font-size: 12px; font-weight: 650; font-variant-numeric: tabular-nums; line-height: 1; padding: 4px 8px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); background: rgba(255, 255, 255, 0.94); color: var(--accent-ink);
}
.labels > button.grip.bare .gv { display: none; }
@media (pointer: coarse) {
  .labels > button.grip::before { width: 20px; height: 20px; margin: -10px 0 0 -10px; }
  .labels > button.grip .gv { top: calc(50% + 17px); font-size: 13px; padding: 5px 9px; }
}
.inspector .bays { display: flex; flex-wrap: wrap; gap: 6px; }
.inspector .bay { padding: 8px 10px; min-height: 44px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 13px; }
.inspector .bay:hover:not(:disabled) { border-color: var(--accent); }
.inspector .bay:disabled { opacity: 0.45; cursor: default; }
.inspector small.err:empty { display: none; }
.inspector .hint { margin: 0; font-size: 13px; }
.tag {
  transform: translate(12px, 12px) !important;
  background: var(--ink); color: #fff; font-size: 12px; padding: 3px 7px; border-radius: 4px;
}
.fail {
  position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center;
  color: var(--muted); pointer-events: none;
}

/* -------------------------------------------------------------- sheet */
.sheet {
  grid-area: sheet; overflow-y: auto; background: var(--panel); border-left: 1px solid var(--line);
  padding: 20px 20px calc(20px + env(safe-area-inset-bottom));
}
.q { display: flex; flex-direction: column; gap: 14px; min-height: 100%; }
.q-head { display: flex; flex-direction: column; gap: 2px; }
.q-head .count { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.q-head h2 { margin: 0; font-size: 24px; font-weight: 650; line-height: 1.2; }
.body { display: flex; flex-direction: column; gap: 12px; }
.label { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); }

.lenrow { display: flex; align-items: baseline; gap: 8px; }
input.big {
  width: 100%; min-width: 0; font-size: 40px; font-weight: 650; padding: 6px 12px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  font-variant-numeric: tabular-nums;
}
input.big:focus { border-color: var(--accent); outline: none; }
.lenrow .unit { font-size: 18px; color: var(--muted); }
input[type="range"] { width: 100%; accent-color: var(--accent); margin: 4px 0 0; }
.limits { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.follow { display: flex; flex-direction: column; gap: 8px; padding-top: 6px; }
.follow input.big { font-size: 28px; }

.err { margin: 0; color: var(--danger); font-size: 14px; min-height: 1em; }
.err:empty { display: none; }
.warn { margin: 0; color: var(--warn); font-size: 14px; }
.warn:empty { display: none; }

.options { display: grid; gap: 8px; }
.options.small { grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); }
.opt, .toggle, .chip, .gridtools button {
  padding: 12px 14px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
  text-align: left; font-size: 15px;
}
.options.small .opt { padding: 9px 10px; font-size: 14px; text-align: center; }
.opt[aria-checked="true"], .toggle[aria-pressed="true"], .chip[aria-selected="true"] {
  border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); font-weight: 600;
}

.stepper { display: flex; align-items: center; gap: 18px; }
.stepper .num { min-width: 2ch; text-align: center; font-size: 40px; font-weight: 650; font-variant-numeric: tabular-nums; }
.round {
  width: 48px; height: 48px; border-radius: 50%; border: 1.5px solid var(--line); background: var(--card);
  font-size: 24px; line-height: 1;
}
.tools .stepper { gap: 10px; }
.tools .stepper .num { font-size: 22px; }
.tools .round { width: 38px; height: 38px; font-size: 20px; }

.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.swatch {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); font-size: 13px;
}
.swatch i { width: 44px; height: 44px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.15); }
.swatch[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); }
/* the fronts' "as the carcass" choice: a word, no colour */
.swatch.same { justify-content: center; text-align: center; }

.hinges { display: flex; flex-direction: column; gap: 8px; }
.hinge { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.gridbox {
  height: 220px; display: flex; padding: 6px; border: 2px solid var(--ink); border-radius: 4px; background: var(--card);
}
.gsplit { flex: 1; display: flex; gap: 6px; min-width: 0; min-height: 0; }
.gsplit.cols { flex-direction: row; }
.gsplit.rows { flex-direction: column-reverse; }
.gcell {
  flex: 1; min-width: 0; min-height: 0; border: 1.5px solid #b9b6ae; border-radius: 3px; background: #faf9f6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 2px;
  font-size: 12px; overflow: hidden;
}
.gcell b { font-size: 11px; color: var(--muted); }
.gcell.sel { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-ink); }
.gcell.k-door { background-image: linear-gradient(90deg, transparent 47%, #c9c6bd 47%, #c9c6bd 53%, transparent 53%); }
.gcell.k-shelves { background-image: repeating-linear-gradient(0deg, transparent 0 18px, #d4d1c9 18px 20px); }
.gcell.k-drawers { background-image: repeating-linear-gradient(0deg, transparent 0 26px, #c9c6bd 26px 28px); }
.gcell.k-drawer_fronts { background-image: repeating-linear-gradient(0deg, transparent 0 30px, #b7b3a8 30px 33px); }
.gcell.sel.k-door, .gcell.sel.k-shelves, .gcell.sel.k-drawers, .gcell.sel.k-drawer_fronts { background-color: var(--accent-soft); }
.gridtools { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.gridtools button { text-align: center; padding: 10px; font-size: 14px; }
.gridtools #remove-cell { grid-column: span 2; }
.pick { display: flex; flex-direction: column; gap: 6px; }

/* kitchen: the run as two rows of unit chips, widths to scale */
.kplan { display: flex; flex-direction: column; gap: 8px; padding: 8px; border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card); }
.krow { display: flex; flex-direction: column; gap: 4px; }
.kunits { display: flex; gap: 3px; min-height: 52px; }
.kunit {
  min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px;
  padding: 4px 2px; border: 1.5px solid #b9b6ae; border-radius: 3px; background: #faf9f6; font-size: 12px; overflow: hidden;
}
.kunit b { font-size: 11px; font-weight: 600; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.kunit span { font-variant-numeric: tabular-nums; }
.kunit.k-space { border-style: dashed; background: transparent; }
.kunit.k-filler { background-image: repeating-linear-gradient(45deg, transparent 0 4px, #e6e3dc 4px 6px); }
.kunit.k-drawers { background-image: repeating-linear-gradient(0deg, transparent 0 12px, #d4d1c9 12px 13px); }
.kunit.sel { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent-ink); }
.kunit.sel b { color: var(--accent-ink); }
.kgap { display: block; min-width: 0; }
.ktools { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ktools button { padding: 9px 12px; font-size: 14px; }
.klen { margin-left: auto; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.kedit { display: flex; flex-direction: column; gap: 12px; padding-top: 4px; }
.kwidths { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); }
.kwrow { display: flex; align-items: center; gap: 6px; grid-column: span 2; }
input.kw {
  width: 100%; min-width: 0; padding: 8px 10px; font-size: 16px; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
}
input.kw:focus { border-color: var(--accent); outline: none; }
.kwrow .unit { color: var(--muted); font-size: 14px; }
.muted { color: var(--muted); font-size: 13px; margin: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
/* combinations: the units over the questions, adding one in the inspector */
.asm-units { margin-bottom: 10px; }
.asm-tools { display: flex; flex-direction: column; gap: 8px; }
.asm-tools .bay[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); }
.asm-tools .opt { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.asm-tools svg.mini { width: 34px; height: 34px; fill: none; stroke: var(--ink); stroke-width: 2.4; stroke-linejoin: round; stroke-linecap: round; }
.chip { padding: 7px 12px; font-size: 14px; }
.tools { display: flex; flex-direction: column; gap: 10px; }
.tool { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.tool .toggle { padding: 8px 14px; min-width: 72px; text-align: center; }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; font-variant-numeric: tabular-nums; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
.downloads { display: grid; gap: 8px; }
.downloads.main { margin: 6px 0 4px; }
.primary.big { padding: 15px 16px; font-size: 16px; }
.files { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 6px; }
.files .link { border: 0; background: none; padding: 6px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; text-align: left; }
.files .link:hover { color: var(--ink); }
.downloads.order { grid-template-columns: 1fr 1fr; margin: 4px 0 8px; }
.kv dd select { font-size: 14px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--card); }
.kv dd.muted-dd { font-weight: 400; font-size: 12px; color: var(--muted); }
.acct { color: var(--ink); text-decoration: none; font-weight: 550; white-space: nowrap; }
.tag-estimate { display: inline-block; font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--warn); border: 1px solid currentColor; border-radius: 4px; padding: 0 4px; vertical-align: 1px; }
.seg.rooms { display: flex; margin-bottom: 8px; }
.seg.rooms button { flex: 1; }
#room-view { width: 100%; }
figure.room { margin: 10px 0 0; scroll-margin-bottom: 80px; }
figure.room img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; border-radius: var(--radius); background: var(--line); }
figure.room figcaption { font-size: 12px; color: var(--muted); margin-top: 4px; }
.room-wait { aspect-ratio: 4 / 3; border-radius: var(--radius); display: grid; place-items: center; color: var(--muted); font-size: 13px;
  background: linear-gradient(100deg, var(--line) 30%, var(--panel) 50%, var(--line) 70%); background-size: 300% 100%; animation: wait 1.4s linear infinite; }
@keyframes wait { from { background-position: 100% 0; } to { background-position: 0 0; } }
@media (prefers-reduced-motion: reduce) { .room-wait { animation: none; } }
h3 { margin: 10px 0 0; font-size: 15px; }
.table { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--card); }
table { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
th, td { padding: 6px 8px; text-align: left; border-bottom: 1px solid #eceae5; white-space: nowrap; }
th { font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; }
td.n { text-align: right; }
tbody tr:last-child td { border-bottom: 0; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; font-size: 14px; }
.list li { display: flex; justify-content: space-between; gap: 10px; }
.list .n { font-variant-numeric: tabular-nums; white-space: nowrap; }
.find-shop { display: block; text-align: center; color: var(--ink); text-decoration: none; font-weight: 600; }
.hw-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.hw-head .link { border: 0; background: none; padding: 4px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 13px; }
.list.hw { gap: 0; }
.list.hw li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 4px 14px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.list.hw li:last-child { border-bottom: 0; }
.hw-name { display: flex; flex-direction: column; min-width: 0; }
.hw-name small { color: var(--muted); font-size: 12px; }
.buy { display: flex; flex-direction: column; align-items: flex-end; color: var(--accent-ink); font-weight: 600; text-decoration: none; line-height: 1.25; padding: 2px 0; }
.buy span { text-decoration: underline; text-underline-offset: 3px; }
.buy small { color: var(--muted); font-weight: 400; font-size: 11px; }

.nav { display: flex; gap: 10px; margin-top: auto; padding-top: 8px; position: sticky; bottom: 0; background: var(--panel); }
.nav button { flex: 1; padding: 13px; border-radius: var(--radius); font-size: 16px; font-weight: 600; }
.primary { background: var(--accent); border: 1.5px solid var(--accent); color: #fff; padding: 12px 14px; border-radius: var(--radius); font-weight: 600; }
.ghost { background: var(--card); border: 1.5px solid var(--line); padding: 12px 14px; border-radius: var(--radius); }

/* --------------------------------------------------------------- home */
.mode-home { grid-template-columns: 1fr; grid-template-areas: "bar" "sheet"; }
.mode-home .stage { display: none; }
.mode-home .dots { visibility: hidden; }
.mode-home .sheet { border-left: 0; background: var(--bg); }
.home { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; gap: 22px; padding-top: 4vh; }
.home h1 { margin: 0; font-size: 30px; font-weight: 650; }
.cards { display: grid; grid-template-columns: repeat(6, 1fr); gap: 14px; }
.card {
  display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 22px 12px 18px;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; font-weight: 600;
}
.card:hover { border-color: var(--accent); }
.card svg { width: 84px; height: 84px; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.resume { display: flex; }
.resume button { padding: 12px 18px; }

/* ---------------------------------------------------------- inspector */
.inspector {
  position: fixed; z-index: 20; top: 64px; right: calc(var(--sheet) + 12px); width: 300px;
  max-height: calc(100vh - 80px); max-height: calc(100dvh - 80px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 12px; padding: 14px 16px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.14);
}
.inspector:focus { outline: none; }
.inspector:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.insp-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.insp-head h3 { margin: 0; font-size: 16px; }
.insp-close { width: 36px; height: 36px; flex: none; border: 0; border-radius: 50%; background: transparent; font-size: 22px; line-height: 1; color: var(--muted); }
.insp-close:hover { background: var(--panel); color: var(--ink); }
.insp-body { display: flex; flex-direction: column; gap: 12px; }
.insp-body .tool { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.insp-body .hinge { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 14px; }
.inspector .err:empty { display: none; }
.ifield { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 2px 10px; }
.ifield label { font-size: 14px; font-weight: 600; }
.ifield .iin { display: inline-flex; align-items: center; gap: 6px; }
.ifield input {
  width: 104px; padding: 8px 10px; font-size: 18px; text-align: right; font-variant-numeric: tabular-nums;
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.ifield input:focus { border-color: var(--accent); outline: none; }
.ifield .unit { color: var(--muted); font-size: 14px; }
.ifield small { grid-column: 1 / -1; font-size: 12px; }
.ifield small.err:empty { display: none; }
.insp-more { align-self: flex-start; border: 0; background: none; padding: 4px 0; color: var(--accent-ink); text-decoration: underline; text-underline-offset: 3px; font-size: 14px; }
.swatches.small { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
.swatches.small .swatch { font-size: 12px; padding: 6px; }
.swatches.small .swatch i { width: 28px; height: 28px; }

/* ------------------------------------------------------------- presets */
.presets-head { margin: 0; font-size: 15px; font-weight: 600; color: var(--muted); }
.presets { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 10px; }
.preset {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card);
}
.preset:hover { border-color: var(--accent); }
.preset svg { width: 44px; height: 44px; flex: none; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.preset .ptext { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.preset .pname { font-weight: 600; }
.preset small { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ------------------------------------------------------------- phones */
@media (max-width: 760px) {
  :root { font-size: 15px; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 46vh 1fr;
    grid-template-rows: auto 46dvh 1fr;
    grid-template-areas: "bar" "stage" "sheet";
  }
  .mode-home { grid-template-rows: auto 1fr; grid-template-areas: "bar" "sheet"; }
  .bar { padding: 6px 10px; gap: 8px; flex-wrap: wrap; }
  .brand { font-size: 15px; }
  .dots { order: 3; flex-basis: 100%; gap: 5px; }
  .dot { width: 8px; height: 8px; }
  .prefs { margin-left: auto; }
  .sheet {
    border-left: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0;
    margin-top: -12px; position: relative; z-index: 1; padding: 14px 14px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.06);
  }
  .mode-home .sheet { margin-top: 0; border-radius: 0; box-shadow: none; }
  .q-head h2 { font-size: 20px; }
  input.big { font-size: 32px; }
  .cards { grid-template-columns: 1fr 1fr; }
  .card:first-child, .card:last-child { grid-column: span 2; }
  .card svg { width: 64px; height: 64px; }
  .gridbox { height: 170px; }
  /* the inspector is a bottom sheet over the questions */
  .inspector {
    top: auto; left: 0; right: 0; bottom: 0; width: auto; max-height: 62vh; max-height: 62dvh;
    border-radius: 14px 14px 0 0; border-bottom: 0; padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.16);
  }
  .presets { grid-template-columns: 1fr; }
}

/* ------------------------------------------- white-label shops (/s/<slug>/) */
.shop-brand { display: flex; align-items: center; padding: 0; }
.shop-logo { display: block; height: 40px; width: auto; max-width: 180px; object-fit: contain; }
html.embedded .bar { min-height: 46px; }
dialog#send-details {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; width: min(420px, calc(100vw - 32px));
  background: var(--card); color: var(--ink);
}
dialog#send-details::backdrop { background: rgba(0, 0, 0, 0.35); }
dialog#send-details h3 { margin: 0 0 12px; }
dialog#send-details .field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; font-size: 14px; }
dialog#send-details input { padding: 9px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; }
dialog#send-details .nav { display: flex; justify-content: space-between; gap: 10px; margin-top: 6px; }
@media (max-width: 760px) {
  .shop-logo { height: 30px; max-width: 120px; }
}

/* ------------------------------------------- fit to my space (phase D) */
.fit-card {
  display: flex; align-items: center; gap: 16px; padding: 14px 18px; text-align: left;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); font-size: 16px; font-weight: 600;
}
.fit-card:hover { border-color: var(--accent); }
.fit-card svg { width: 56px; height: 56px; flex: none; fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.fit-card .ptext { display: flex; flex-direction: column; gap: 3px; }
.fit-card small { font-weight: 400; color: var(--muted, #6b6a66); font-size: 14px; }
.fit-guide-box { border: 1px solid var(--line); border-radius: 10px; background: var(--card); padding: 8px; }
.fit-guide { display: block; width: 100%; height: auto; max-height: 240px; fill: none; stroke: var(--ink); stroke-width: 1.2; }
.fit-guide .wall { fill: var(--line); stroke: none; }
.fit-guide rect:not(.wall) { fill: var(--line); }
.fit-guide .m { stroke: var(--accent); stroke-width: 1.4; }
.fit-guide text.m { fill: var(--accent); stroke: none; font-size: 12px; font-weight: 700; }
.fit-notes { margin: 6px 0 4px; padding-left: 18px; font-size: 14px; line-height: 1.45; }
.fit-fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px 16px; margin: 4px 0 10px; }
.fit-fields .ifield { grid-template-columns: 1fr; align-items: start; }
.fit-fields .ifield label { font-size: 13px; }
.fit-fields .ifield input { width: 100%; max-width: 140px; }
.mode-home .q-fit { max-width: 760px; margin: 0 auto; width: 100%; }
.fit-guide-box { max-width: 520px; }
.fit-fields small.warn:empty, .fit-fields small.err:empty { display: none; }
.q-fit .seg { margin-bottom: 8px; }
.q-fit .bays { display: flex; flex-wrap: wrap; gap: 8px; margin: 6px 0; }
.fit-fills { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px; margin-bottom: 8px; }
.fit-fills .opt { display: flex; align-items: center; gap: 10px; text-align: left; }
td small.flag { display: block; color: var(--accent-ink, #1e4fa0); font-size: 11px; }
.fit-fills svg.mini { width: 34px; height: 34px; fill: none; stroke: currentColor; stroke-width: 2.4; }
.fit-review { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.fit-review h3 { margin: 0 0 4px; }
.fit-review p { margin: 2px 0; font-size: 14px; }
.chip.fit-chip { border-style: dashed; }

/* ------------------------------------ the design assistant (designer phase F) */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ask-fab {
  position: absolute; z-index: 15; right: 16px; bottom: 16px;
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 10px 16px 10px 12px;
  border: 0; border-radius: 999px; background: var(--accent); color: #fff; font-weight: 600;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}
.ask-fab:hover { background: var(--accent-ink); }
.ask-fab svg { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ask-panel {
  position: fixed; z-index: 25; right: calc(var(--sheet) + 16px); bottom: 16px; width: 360px;
  max-height: min(560px, calc(100vh - 96px)); max-height: min(560px, calc(100dvh - 96px));
  display: flex; flex-direction: column; gap: 8px; padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.16);
}
.ask-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ask-head h2 { margin: 0; font-size: 16px; }
.ask-log { flex: 1; min-height: 80px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 2px; }
.ask-msg { margin: 0; padding: 8px 10px; border-radius: 10px; font-size: 14px; line-height: 1.4; max-width: 92%; overflow-wrap: anywhere; }
.ask-msg p { margin: 0; }
.ask-msg.me { align-self: flex-end; background: var(--accent-soft); }
.ask-msg.bot { align-self: flex-start; background: var(--panel); border: 1px solid var(--line); }
.ask-msg.note { color: var(--muted); }
.ask-msg.busy { color: var(--muted); font-style: italic; }
.ask-changes { margin: 6px 0 0; padding-left: 18px; font-variant-numeric: tabular-nums; }
.ask-acts { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 8px; }
.ask-acts button { min-height: 40px; padding: 6px 14px; }
.ask-st { font-size: 13px; color: var(--muted); }
.ask-form { display: flex; gap: 8px; align-items: flex-end; }
.ask-form textarea, .ask-home textarea {
  flex: 1; min-width: 0; resize: none; padding: 8px 10px; font: inherit; color: var(--ink);
  border: 1.5px solid var(--line); border-radius: var(--radius); background: var(--card);
}
.ask-form textarea:focus, .ask-home textarea:focus { border-color: var(--accent); outline: none; }
.ask-form button { min-height: 44px; padding: 8px 14px; }
.ask-note { margin: 0; font-size: 12px; color: var(--muted); }
.ask-home { display: flex; flex-direction: column; gap: 8px; padding: 14px 16px; border: 1.5px solid var(--line); border-radius: 12px; background: var(--card); }
.ask-home h2 { margin: 0; font-size: 16px; }
.ask-home-row { display: flex; gap: 10px; align-items: stretch; }
.ask-home button { padding: 10px 18px; }
@media (max-width: 760px) {
  .ask-fab { right: 12px; bottom: 22px; padding: 8px 12px 8px 10px; }
  /* a bottom sheet over the questions */
  .ask-panel {
    left: 0; right: 0; bottom: 0; width: auto; max-height: 75vh; max-height: 75dvh;
    border-radius: 14px 14px 0 0; border-bottom: 0; padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -6px 22px rgba(0, 0, 0, 0.16);
  }
  .ask-home-row { flex-direction: column; }
}
@media (prefers-reduced-motion: no-preference) {
  .ask-msg.busy { animation: ask-wait 1.2s ease-in-out infinite alternate; }
}
@keyframes ask-wait { from { opacity: 0.55; } to { opacity: 1; } }
