/* Configurateur devis - V4 art direction: light, monochrome, one accent.
   IBM Plex Sans / Plex Sans Condensed, tabular figures, 8 pt grid, 2 px radius. */
:root {
  --bg-stage: #ECEBE7;
  --surface: #FFFFFF;
  --surface-2: #F5F4F1;
  --line: #E2E0DB;
  --line-strong: #C9C6BF;
  --ink: #16181B;
  --ink-2: #4A4E55;
  --ink-3: #6E727A;
  --accent: #2B4C7E;
  --ok: #2F7D4F;
  --warn: #8F5E12;
  --err: #A8321E;
  --r: 2px;
  --ctl: 44px;
  --panel-w: 400px;
  --top-h: 56px;
  --font: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-c: "IBM Plex Sans Condensed", "IBM Plex Sans", system-ui, Arial, sans-serif;
}
body.theme-prospect { --accent: #7A2E2E; }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--surface);
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ul, fieldset { margin: 0; padding: 0; }
fieldset { border: 0; min-width: 0; }
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 8px; top: -48px; z-index: 50; padding: 8px 16px; background: var(--ink); color: #fff; border-radius: var(--r); }
.skip:focus-visible { top: 8px; }

/* ---------- top bar ---------- */
.topbar {
  height: var(--top-h);
  display: flex; align-items: center; gap: 24px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; }
.logo-slot {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px 0 10px;
  border: 0; border-radius: var(--r); background: var(--ink); color: #fff;
  font-family: var(--font-c); font-weight: 500; font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
}
.logo-mark { width: 16px; height: 16px; flex: none; }
body.theme-prospect .logo-slot { border: 0; background: var(--accent); color: #fff; }
.toplink { margin-left: auto; color: var(--ink-2); text-decoration: none; font-size: 14px; padding: 8px 0; border-bottom: 1px solid transparent; }
.toplink:hover { color: var(--ink); border-bottom-color: var(--ink); }
.top-title { font-family: var(--font-c); font-weight: 500; font-size: 13px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }

/* ---------- segmented controls (radios) ---------- */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg input, .swatches input, .checks input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.seg label {
  min-height: var(--ctl); padding: 0 16px;
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r);
  font-size: 14px; color: var(--ink-2); cursor: pointer; user-select: none;
}
.seg label:hover { border-color: var(--ink-3); color: var(--ink); }
.seg input:checked + label { border: 1.5px solid var(--ink); color: var(--ink); font-weight: 500; padding: 0 15.5px; }
.seg input:disabled + label { opacity: .45; cursor: not-allowed; }
.seg input:focus-visible + label, .swatches input:focus-visible + label, .checks input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg-col { flex-direction: column; }
.seg-col label { justify-content: space-between; }
.seg-sub { color: var(--ink-3); font-weight: 400; font-size: 13px; }
.seg-top label { min-height: 36px; padding: 0 12px; border-color: transparent; font-size: 14px; }
.seg-top input:checked + label { border: 0; border-bottom: 2px solid var(--ink); border-radius: 0; padding: 0 12px; }
.seg-top { gap: 4px; }

/* ---------- layout ---------- */
.app { height: 100%; display: flex; flex-direction: column; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--panel-w); }
.stage { position: relative; background: var(--bg-stage); min-height: 0; overflow: hidden; }
.viewport { position: absolute; inset: 0; }
.viewport canvas { display: block; touch-action: none; }
.labels-layer { position: absolute; inset: 0; pointer-events: none; }

.toolbar {
  position: absolute; left: 24px; top: 24px;
  display: flex; align-items: center; gap: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
}
.tool {
  height: 40px; padding: 0 16px; border: 0; background: transparent;
  font-size: 13px; color: var(--ink-2); border-right: 1px solid var(--line);
}
.tool:last-child { border-right: 0; }
.tool:hover { color: var(--ink); background: var(--surface-2); }
.tool[aria-pressed="true"] { color: var(--ink); font-weight: 500; box-shadow: inset 0 -2px 0 var(--ink); }
.tool-sep { width: 8px; align-self: stretch; background: var(--bg-stage); }
.legend {
  position: absolute; left: 24px; bottom: 24px; max-width: calc(100% - 48px);
  font-family: var(--font-c); font-weight: 500; font-size: 12px; letter-spacing: .04em; color: var(--ink-2);
}
.help {
  position: absolute; right: 24px; bottom: 24px; font-size: 12px; color: var(--ink-3);
  transition: opacity .4s;
}
.help.is-hidden { opacity: 0; pointer-events: none; }
.loader {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: var(--bg-stage); color: var(--ink-3); font-size: 13px; transition: opacity .4s;
}
.loader.is-done { opacity: 0; pointer-events: none; }
.fallback {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 360px;
  padding: 16px 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 14px; color: var(--ink-2); text-align: center;
}

/* dimension figures: technical drawing, number only, white plate */
.dim-label { pointer-events: none; }
.dim-label span {
  display: inline-block; padding: 1px 5px;
  background: #fff; border: 1px solid var(--ink); border-radius: 1px;
  font-family: var(--font-c); font-weight: 500; font-size: 12px; line-height: 16px; color: var(--ink);
  white-space: nowrap; transform-origin: 50% 50%;
}

/* ---------- panel ---------- */
.panel {
  display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-left: 1px solid var(--line);
}
.panel-head { padding: 24px 24px 16px; }
.eyebrow {
  font-family: var(--font-c); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 8px;
}
h1 { font-size: 20px; line-height: 28px; font-weight: 600; letter-spacing: -.005em; }
h3.eyebrow { margin-top: 24px; }

.tabs {
  display: flex; gap: 0; padding: 0 24px; border-bottom: 1px solid var(--line);
  overflow-x: auto; scrollbar-width: none; background: var(--surface);
}
.tabs::-webkit-scrollbar { display: none; }
.tabs [role="tab"] {
  flex: 0 0 auto; height: var(--ctl); padding: 0 10px; margin-bottom: -1px;
  border: 0; border-bottom: 2px solid transparent; background: transparent;
  font-size: 13px; color: var(--ink-3); white-space: nowrap;
}
.tabs [role="tab"]:first-child { padding-left: 0; }
.tabs [role="tab"]:hover { color: var(--ink); }
.tabs [role="tab"][aria-selected="true"] { color: var(--ink); font-weight: 500; border-bottom-color: var(--ink); }

.panel-body { flex: 1; min-height: 0; overflow-y: auto; padding: 24px; }
.step > * + * { margin-top: 16px; }
.step > .eyebrow + * { margin-top: 0; }

.field + .field { margin-top: 24px; }
.field-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.field-row label, legend { font-size: 14px; font-weight: 500; color: var(--ink); }
legend { margin-bottom: 8px; padding: 0; }
.num {
  display: inline-flex; align-items: center; height: var(--ctl); width: 136px;
  border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface);
}
.num:focus-within { border-color: var(--ink); }
.num input {
  width: 100%; height: 100%; border: 0; background: transparent; padding: 0 0 0 12px;
  text-align: right; font-size: 15px; font-variant-numeric: tabular-nums; -moz-appearance: textfield;
}
.num input::-webkit-outer-spin-button, .num input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.num input:focus-visible { outline: none; }
.num:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.num .u { padding: 0 12px 0 6px; color: var(--ink-3); font-size: 13px; }
.field.is-err .num { border-color: var(--err); }

input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 24px; background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-moz-range-track { height: 2px; background: var(--line-strong); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 16px; height: 16px; margin-top: -7px;
  background: var(--surface); border: 1.5px solid var(--ink); border-radius: 50%;
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; background: var(--surface); border: 1.5px solid var(--ink); border-radius: 50%; }
.lim { display: flex; justify-content: space-between; font-size: 12px; color: var(--ink-3); }

.msg { font-size: 13px; color: var(--warn); min-height: 0; }
.msg:empty, .note:empty, .status:empty { display: none; }
.note { font-size: 13px; color: var(--ink-3); }
.status { font-size: 13px; color: var(--ok); }

/* finishes */
.swatches { display: grid; grid-template-columns: 1fr; gap: 8px; }
.swatches label {
  display: grid; grid-template-columns: 40px 1fr auto; align-items: center; gap: 16px;
  min-height: 56px; padding: 8px 16px 8px 8px;
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer;
}
.swatches label:hover { border-color: var(--ink-3); }
.swatches input:checked + label { border: 1.5px solid var(--ink); padding: 7.5px 15.5px 7.5px 7.5px; }
.swatch {
  width: 40px; height: 40px; border-radius: 1px; background-size: cover; background-position: center;
  box-shadow: inset 0 0 0 1px rgba(22, 24, 27, .12);
}
.sw-name { font-size: 14px; }
.sw-delta { font-size: 13px; color: var(--ink-3); white-space: nowrap; }

/* options */
.checks { display: flex; flex-direction: column; gap: 8px; }
.checks label {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 12px;
  min-height: var(--ctl); padding: 8px 16px 8px 12px;
  border: 1px solid var(--line-strong); border-radius: var(--r); cursor: pointer; font-size: 14px;
}
.checks .box { width: 18px; height: 18px; border: 1.5px solid var(--ink-3); border-radius: 1px; position: relative; }
.checks input:checked + label { border: 1.5px solid var(--ink); padding: 7.5px 15.5px 7.5px 11.5px; }
.checks input:checked + label .box { background: var(--ink); border-color: var(--ink); }
.checks input:checked + label .box::after {
  content: ""; position: absolute; left: 4.5px; top: 1px; width: 5px; height: 10px;
  border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg);
}
#app-atelier .checks label { grid-template-columns: 18px 1fr; }
#app-atelier .checks label::before { content: ""; width: 18px; height: 18px; border: 1.5px solid var(--ink-3); border-radius: 1px; }
#app-atelier .checks input:checked + label::before { background: var(--ink); border-color: var(--ink); box-shadow: inset 0 0 0 3px #fff; }
.opt-l { display: flex; flex-direction: column; }
.opt-note { font-size: 12px; color: var(--ink-3); }
.opt-price { font-size: 13px; color: var(--ink-2); white-space: nowrap; }

.spec { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 13px; padding-top: 16px; border-top: 1px solid var(--line); }
.spec dt { color: var(--ink-3); }

/* recap */
.recap-list { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.recap-list dt { color: var(--ink-3); }
.recap-list dd { text-align: right; }
.recap-list dd.total { font-weight: 600; }
.stack { display: flex; height: 8px; margin-top: 8px; gap: 1px; background: var(--surface); }
.stack span { display: block; height: 100%; }
.stack .s0 { background: #16181B; }
.stack .s1 { background: #3E434A; }
.stack .s2 { background: #666B73; }
.stack .s3 { background: #8F939A; }
.stack .s4 { background: #B5B8BD; }
.stack .s5 { background: #D6D8DB; }
table.lines { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 8px; }
.lines th, .lines td { padding: 8px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; font-weight: 400; }
.lines td { text-align: right; white-space: nowrap; padding-left: 16px; }
.lines .det { display: block; color: var(--ink-3); font-size: 12px; }
.lines tr.tot th, .lines tr.tot td { font-weight: 600; border-bottom: 0; border-top: 1px solid var(--ink); }
.feas { list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.feas li { display: grid; grid-template-columns: 80px 1fr; gap: 12px; }
.feas-tag { font-family: var(--font-c); font-weight: 500; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.feas-ok .feas-tag { color: var(--ok); }
.feas-warn .feas-tag { color: var(--warn); }
.feas-err .feas-tag { color: var(--err); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }

.alerts { padding: 12px 24px 4px; border-top: 1px solid var(--line); }
.alerts:empty { display: none; }
.alert { font-size: 13px; padding: 8px 0 8px 12px; margin-bottom: 8px; border-left: 2px solid var(--warn); color: var(--ink-2); }
.alert-err { border-left-color: var(--err); }

/* buttons */
.btn {
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--ctl); padding: 0 16px;
  background: var(--surface); color: var(--ink); text-decoration: none;
  border: 1px solid var(--line-strong); border-radius: var(--r); font-size: 14px; font-weight: 500;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); color: #fff; border-color: var(--ink); }
.btn-primary:hover { background: #000; }
body.theme-prospect .btn-primary { background: var(--accent); border-color: var(--accent); }
.btn-ghost { border-color: transparent; color: var(--ink-2); }
.btn-ghost:hover { border-color: var(--line-strong); color: var(--ink); }
.btn-small { min-height: 36px; font-size: 13px; padding: 0 12px; }
.icon-btn { width: 40px; height: 40px; border: 0; background: transparent; font-size: 22px; line-height: 1; color: var(--ink-2); border-radius: var(--r); }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }

/* fixed bottom bar */
.bar {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 8px;
  padding: 16px 24px; border-top: 1px solid var(--line); background: var(--surface);
}
.price {
  display: grid; grid-template-columns: auto; justify-items: start; gap: 0;
  border: 0; background: transparent; padding: 0; text-align: left; min-height: var(--ctl);
}
.price-label { white-space: nowrap; font-family: var(--font-c); font-weight: 500; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.price-value { font-size: 22px; line-height: 28px; font-weight: 600; letter-spacing: -.01em; }
.price-range { white-space: nowrap; font-size: 12px; color: var(--ink-3); }
.price:hover .price-value { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }
.disclaimer { padding: 0 24px 12px; font-size: 11px; color: var(--ink-3); background: var(--surface); }

/* ---------- Atelier ---------- */
.atelier { min-height: 100%; background: var(--surface-2); }
.atelier-body { max-width: 1120px; margin: 0 auto; padding: 32px 24px 48px; }
.a-sec { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 24px; margin-bottom: 24px; }
.a-sec h2 { font-size: 17px; line-height: 24px; font-weight: 600; margin-bottom: 16px; }
.a-lead { font-size: 14px; color: var(--ink-2); }
.a-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.table-wrap { overflow-x: auto; margin-top: 16px; }
.grid-scroll { max-height: 360px; overflow: auto; border: 1px solid var(--line); }
table.grid-t { width: 100%; border-collapse: collapse; font-size: 13px; }
.grid-t caption { text-align: left; font-family: var(--font-c); font-weight: 500; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); padding-bottom: 8px; }
.grid-t th, .grid-t td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.grid-t thead th { font-weight: 500; color: var(--ink-3); font-size: 12px; background: var(--surface); position: sticky; top: 0; }
.grid-t tbody th { font-weight: 500; color: var(--ink-2); background: var(--surface); position: sticky; left: 0; }
.grid-t .r { text-align: right; }
.grid-t.small th, .grid-t.small td { padding: 4px 8px; font-size: 12px; }
.grid-t tr.is-current td { background: var(--surface-2); }
.grid-t tr.tot td { font-weight: 600; border-top: 1px solid var(--ink); }
.grid-t td.is-cell { background: var(--ink); color: #fff; font-weight: 600; }
body.theme-prospect .grid-t td.is-cell { background: var(--accent); }
#req-body td { white-space: normal; min-width: 72px; }
#req-body td:nth-child(4) { min-width: 240px; }
.grid-t .empty { color: var(--ink-3); text-align: center; padding: 24px; }
.drop {
  margin-top: 16px; padding: 24px; text-align: center; font-size: 13px; color: var(--ink-3);
  border: 1px dashed var(--line-strong); border-radius: var(--r);
}
.drop.is-over { border-color: var(--ink); color: var(--ink); background: var(--surface-2); }
.preview { margin-top: 16px; padding: 16px; border: 1.5px solid var(--ink); border-radius: var(--r); }
.preview .table-wrap { max-height: 220px; overflow: auto; }
.file-btn { cursor: pointer; }
.atelier .status { margin-top: 16px; }

/* ---------- dialogs ---------- */
.modal {
  width: min(640px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 24px; border: 1px solid var(--line); border-radius: var(--r);
  background: var(--surface); color: var(--ink); box-shadow: 0 24px 64px rgba(22, 24, 27, .18);
}
.modal::backdrop { background: rgba(22, 24, 27, .32); }
.modal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.modal-head h2 { font-size: 20px; line-height: 28px; font-weight: 600; }
.modal-summary { font-size: 14px; color: var(--ink-2); padding: 12px 16px; background: var(--surface-2); border-radius: var(--r); margin-bottom: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 24px; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f label { font-size: 13px; font-weight: 500; }
.f input, .f select {
  height: var(--ctl); padding: 0 12px; background: var(--surface);
  border: 1px solid var(--line-strong); border-radius: var(--r); font-size: 15px;
}
.f input:focus-visible, .f select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--ink); }
.f input[aria-invalid="true"] { border-color: var(--err); }
.f-err { font-size: 12px; color: var(--err); min-height: 18px; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.done-title { font-size: 17px; font-weight: 600; margin-bottom: 8px; }
.json {
  margin: 16px 0; padding: 16px; max-height: 280px; overflow: auto;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r);
  font: 12px/1.5 ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace; color: var(--ink-2);
}
.price-big { font-size: 28px; line-height: 36px; font-weight: 600; }

/* ---------- flat pattern (developpe) and AR ---------- */
.modal-wide { width: min(960px, calc(100vw - 32px)); }
.flat-view { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r); padding: 8px; }
.flat-view svg { display: block; width: 100%; height: auto; max-height: 48vh; }
.flat-cut { stroke: var(--ink); stroke-width: 1.25px; }
.flat-bend { stroke: var(--accent); stroke-width: 1px; stroke-dasharray: 6 3; }
.flat-txt { fill: var(--ink-2); font-family: var(--font-c); }
.flat-legend { display: flex; align-items: center; gap: 8px; margin: 8px 0 16px; font-size: 12px; color: var(--ink-2); }
.flat-legend span { display: inline-block; width: 24px; height: 0; border-top: 1.5px solid var(--ink); }
.flat-legend .k-bend { margin-left: 16px; border-top: 1.5px dashed var(--accent); }
.flat-hole { stroke: #2f8f4e; stroke-width: 1.25px; }
.flat-legend .k-hole { margin-left: 16px; border-top: 1.5px solid #2f8f4e; }
#flat-dialog .note { margin-top: 12px; }
#flat-dialog .status { min-height: 18px; margin-top: 8px; }
.ar-btn {
  position: absolute; right: 24px; top: 24px; height: 40px; padding: 0 16px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
  font-size: 13px; font-weight: 500; color: var(--ink);
}
.ar-btn:hover { border-color: var(--ink); }
.ar-cols { display: grid; grid-template-columns: 200px 1fr; gap: 24px; align-items: center; margin-bottom: 16px; }
.qr { width: 200px; height: 200px; background: #fff; border: 1px solid var(--line); border-radius: var(--r); }
.qr svg { display: block; width: 100%; height: 100%; }
.ar-url { word-break: break-all; margin-top: 8px; font-size: 12px; }
.mv-host model-viewer { width: 100%; height: 56vh; background: var(--bg-stage); border-radius: var(--r); }
.mv-ar { position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%); }
#ar-dialog .status { min-height: 18px; margin-top: 8px; }

/* ---------- mobile ---------- */
@media (max-width: 899px) {
  :root { --ctl: 48px; --top-h: 48px; }
  .topbar { padding: 0 16px; gap: 12px; }
  .logo-slot { height: 28px; padding: 0 8px; font-size: 11px; }
  .seg-top label { padding: 0 8px; }
  .seg-top input:checked + label { padding: 0 8px; }
  .seg-top label { min-height: 44px; }
  .toplink { min-height: 44px; display: inline-flex; align-items: center; padding: 0 4px; }
  .app { height: auto; min-height: 100%; }
  .layout { display: block; }
  .stage { height: 55vh; height: 55svh; }
  .toolbar { left: 8px; top: 8px; max-width: calc(100% - 16px); overflow-x: auto; scrollbar-width: none; }
  .tool { height: 44px; padding: 0 12px; flex: 0 0 auto; }
  .legend { left: 16px; bottom: 12px; }
  .help { display: none; }
  .ar-btn { top: auto; right: 8px; bottom: 8px; height: 44px; }
  .legend { max-width: calc(100% - 168px); }
  .ar-cols { grid-template-columns: 1fr; justify-items: center; }
  .panel { border-left: 0; padding-bottom: 88px; }
  .panel-head { padding: 16px 16px 8px; }
  h1 { font-size: 18px; line-height: 24px; }
  .tabs { position: sticky; top: 0; z-index: 5; padding: 0 16px; }
  .panel-body { padding: 16px; overflow: visible; }
  .alerts { padding: 0 16px; }
  .bar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
    grid-template-columns: 1fr auto; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    box-shadow: 0 -8px 24px rgba(22, 24, 27, .06);
  }
  #next-btn { display: none; }
  .price-value { font-size: 20px; line-height: 24px; }
  .price-range { display: none; }
  .disclaimer { padding: 0 16px 16px; }
  .form-grid { grid-template-columns: 1fr; }
  .a-cols { grid-template-columns: 1fr; }
  .atelier-body { padding: 16px; }
  .a-sec { padding: 16px; }
  .modal { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* V6: RGPD consent on the quote form */
.f-wide { grid-column: 1 / -1; }
.consent { display: flex; gap: 10px; align-items: flex-start; font-weight: 400 !important; cursor: pointer; }
.consent input { margin-top: 3px; width: 16px; height: 16px; flex: none; }
.rgpd-note { margin: 2px 0 0; font-size: 12px; color: var(--ink-3); line-height: 1.45; }
.disclaimer a, .rgpd-note a { color: inherit; }

/* V6 panel: rules merged into the price bar, legal line in the recap */
.bar .alerts { grid-column: 1 / -1; padding: 0; border: 0; margin: -4px 0 4px; }
.bar .alert { margin: 0 0 4px; padding: 2px 0 2px 10px; font-size: 12px; line-height: 16px; }
.disclaimer-recap { padding: 16px 0 0; margin-top: 16px; border-top: 1px solid var(--line); background: transparent; }
/* Toggles (state) vs actions: a toggle carries an indicator and fills when on. */
.tool[aria-pressed]::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin-right: 8px; vertical-align: 0;
  border: 1.5px solid currentColor; border-radius: 50%; box-sizing: border-box;
}
.tool[aria-pressed="true"] { background: var(--ink); color: #fff; box-shadow: none; }
.tool[aria-pressed="true"]::before { background: currentColor; }
.tool[aria-pressed="true"]:hover { background: var(--ink); color: #fff; }
/* Material cards */
.seg-col label.mat-card { display: grid; grid-template-columns: 44px 1fr auto; align-items: center; gap: 12px; padding: 10px 12px; min-height: 64px; text-align: left; }
.mc-sw { width: 44px; height: 44px; border-radius: 4px; background-size: cover; background-position: center; box-shadow: inset 0 0 0 1px rgba(0,0,0,.08); }
.mc-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.mc-name { font-weight: 500; }
.mc-args { font-size: 12px; color: var(--ink-3); line-height: 1.35; white-space: normal; }
.mc-delta { white-space: nowrap; }
.bar .price { min-width: 0; }
.bar .price-range { white-space: normal; }
/* V7: quote form actions always visible (sticky footer inside the scrolling dialog). */
#quote-dialog { max-height: calc(100dvh - 32px); overflow-y: auto; }
#quote-dialog .modal-actions {
  position: sticky; bottom: -24px; z-index: 2; margin: 8px -24px -24px; padding: 12px 24px;
  background: var(--surface); border-top: 1px solid var(--line);
}
/* V7.3 responsive: touch targets >= 44 px on touch screens (tablet landscape included),
   one-line header on phones (logo mark only below 480 px). */
.icon-btn { width: 44px; height: 44px; }
.consent { min-height: 44px; align-items: center; }
@media (pointer: coarse) {
  .tool { height: 44px; }
  .seg-top label { min-height: 44px; }
  .toplink { min-height: 44px; display: inline-flex; align-items: center; }
  .btn-small { min-height: 44px; }
}
@media (max-width: 899px) {
  .btn-small { min-height: 44px; }
  .seg-top { flex-wrap: nowrap; }
  .seg-top label, .logo-slot { white-space: nowrap; }
}
@media (max-width: 479px) {
  .topbar { gap: 8px; padding: 0 12px; }
  .logo-slot { font-size: 0; gap: 0; padding: 0 8px; }
  .logo-mark { width: 18px; height: 18px; }
  .seg-top label, .seg-top input:checked + label { padding: 0 8px; }
}
/* V7.4 viewer legend on a light pill (legible over the wall and the table). */
.legend { background: rgba(255, 255, 255, .85); border-radius: 4px; padding: 2px 6px; }
.legend:empty { display: none; }
/* V7.4 tabs: horizontal scroll with snap and a right fade; 44 px on touch; short "Recap" < 380 px. */
.tabs { scroll-snap-type: x proximity; }
.tabs [role="tab"] { scroll-snap-align: start; }
@media (pointer: coarse) { .tabs [role="tab"] { min-height: 44px; } }
@media (max-width: 379px) { .tab-long { display: none; } }
/* V7.4 mobile layout (< 900 px): one page scroll, clamped viewer, sticky tabs, 72 px bottom bar
   (price + CTA, feasibility rule as a pill). */
@media (max-width: 899px) {
  .stage { height: clamp(240px, 42svh, 420px); }
  .panel-head { padding: 12px 16px 4px; }
  .panel-head .eyebrow { margin-bottom: 2px; }
  h1 { font-size: 18px; line-height: 24px; }
  .tabs { position: sticky; top: 0; z-index: 6; -webkit-mask-image: linear-gradient(90deg, #000 85%, transparent); mask-image: linear-gradient(90deg, #000 85%, transparent); }
  .tabs [role="tab"] { height: 44px; }
  .panel { padding-bottom: 88px; }
  .panel-body { padding: 12px 16px 16px; overflow: visible; }
  .panel-body .step > h2.eyebrow { margin-bottom: 4px; }
  .bar {
    height: 72px; min-height: 72px; padding: 6px 12px calc(6px + env(safe-area-inset-bottom)); gap: 2px 8px;
    grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; align-content: center;
  }
  .bar .alerts { grid-column: 1; grid-row: 1; margin: 0; min-width: 0; }
  .bar .alert { display: none; }
  .bar .alert:first-child {
    display: block; margin: 0; padding: 1px 8px; border: 0; border-radius: 999px; background: #fbefd9; color: var(--ink);
    font-size: 11px; line-height: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
  }
  .bar .alert-err:first-child { background: #f8dcdc; }
  .bar .price { grid-column: 1; grid-row: 2; min-height: 0; }
  .bar .price-label { display: none; }
  .bar #cta-btn { grid-column: 2; grid-row: 1 / 3; height: 48px; }
  .bar .alerts:empty + .price { grid-row: 1 / 3; }
}
@media (max-width: 599px) { .table-wrap .grid-t { min-width: 640px; } }
@media (max-width: 899px) { .field + .field { margin-top: 16px; } }
@media (max-width: 899px) {
  /* price button keeps a 44 px target: it spans the bar height, the pill sits over its top */
  .bar .price, .bar .alerts:empty + .price { grid-row: 1 / 3; min-height: 56px; align-content: end; padding-bottom: 2px; }
  .bar .alerts { position: absolute; top: 6px; left: 12px; max-width: calc(100% - 210px); z-index: 1; pointer-events: none; }
}
/* V7.5: demo banner (fixed, top), CTA label full / short, swatch note */
.demo-banner { position: fixed; top: 0; left: 0; right: 0; z-index: 50; margin: 0; padding: 4px 12px; background: #fff3cd; color: #5c4600; font-size: 12px; line-height: 16px; text-align: center; }
body { padding-top: 24px; box-sizing: border-box; }
.cta-short { display: none; }
#cta-btn { white-space: nowrap; }
.swatch-note { margin-top: 8px; }
@media (min-width: 900px) { .bar #cta-btn { grid-column: 1 / -1; width: 100%; white-space: normal; line-height: 18px; min-height: 44px; } }
@media (max-width: 899px) { .bar #cta-btn .cta-full { display: none; } .bar #cta-btn .cta-short { display: inline; } .bar #cta-btn { padding: 0 12px; } }
@media (max-width: 719px) { .demo-banner { font-size: 11px; line-height: 14px; padding: 3px 10px; } body { padding-top: 34px; } }
@media (max-width: 899px) { .tabs { top: 24px; } }
@media (max-width: 719px) { .tabs { top: 34px; } }
/* V7.5-1: mobile bar: "HT" after the amount, small "prix d'exemple" under it */
.price-ex { display: none; }
@media (max-width: 899px) {
  .bar .price-value::after { content: "\00a0HT"; font-size: 13px; font-weight: 500; }
  .bar .price-ex { display: block; font-size: 11px; line-height: 13px; color: var(--ink-3); }
}
