:root {
  --navy: #0b2a5b;
  --navy-2: #1d4185;
  --red: #c8102e;
  --ink: #16202e;
  --muted: #5d6878;
  --line: #d5dbe5;
  --bg: #eef1f6;
  --card: #ffffff;
  --ok: #1b7a43;
  --warn-bg: #fff4e5;
  --err-bg: #fdecee;
  --radius: 12px;
  --tap: 52px;
  --footer-h: 76px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
[hidden] { display: none !important; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 12px; }
h2 { font-size: 24px; color: var(--navy); margin: 18px 0 12px; }
h3 { font-size: 17px; color: var(--navy); margin-top: 6px; }
p { margin: 0 0 8px; }
.muted { color: var(--muted); font-weight: 400; }
.small { font-size: 14px; }
.brand { font-weight: 800; letter-spacing: .12em; font-size: 13px; color: var(--red); margin: 0; }

/* access */
.access { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: var(--navy); }
.access-card { background: var(--card); border-radius: 16px; padding: 24px 20px; width: 100%; max-width: 380px; }
.access-card h1 { color: var(--navy); font-size: 26px; margin: 6px 0 20px; }
.access-card input { letter-spacing: .3em; font-size: 22px; text-align: center; }

/* header */
.top { position: sticky; top: 0; z-index: 20; background: var(--navy); color: #fff; padding: calc(10px + env(safe-area-inset-top)) 16px 10px; }
.top .brand { color: #fff; opacity: .9; }
.top-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.who { margin: 2px 0 0; font-size: 14px; opacity: .85; }
.menu { position: absolute; right: 16px; top: calc(56px + env(safe-area-inset-top)); background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.25); overflow: hidden; min-width: 220px; }
.menu-item { display: block; width: 100%; text-align: left; padding: 16px; font: inherit; color: var(--ink); background: none; border: 0; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.menu-item:last-child { border-bottom: 0; }
.progress { margin-top: 10px; }
.progress ol { list-style: none; display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 0; padding: 0; }
.progress li button { display: block; width: 100%; height: 44px; padding: 0; border: 0; background: transparent; cursor: pointer; }
.progress li button::before { content: ""; display: block; height: 6px; margin-top: 19px; border-radius: 3px; background: rgba(255,255,255,.25); }
.progress li.done button::before { background: #fff; }
.progress li.current button::before { background: var(--red); }
.progress li button:disabled { cursor: default; }
.step-label { margin: 2px 0 0; font-size: 15px; font-weight: 600; }

/* main */
main { padding: 0 16px calc(var(--footer-h) + 32px + env(safe-area-inset-bottom)); max-width: 640px; margin: 0 auto; }
.card { background: var(--card); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(11,42,91,.06); }
.card.meta { display: grid; grid-template-columns: 1fr; gap: 8px; }
.card.meta > div { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 8px; }
.card.meta strong { font-weight: 700; }
.banner { margin: 14px 0 0; padding: 12px 14px; border-radius: var(--radius); background: var(--err-bg); color: #8a1022; font-weight: 600; }

/* fields */
.field { margin-bottom: 14px; position: relative; }
.field:last-child { margin-bottom: 0; }
label, .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
input, select, textarea {
  width: 100%; min-height: var(--tap); padding: 12px 14px; font: inherit; font-size: 17px; color: var(--ink);
  background: #fff; border: 1.5px solid var(--line); border-radius: 10px; appearance: none; -webkit-appearance: none;
}
select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
textarea { min-height: 110px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(29,65,133,.18); }
.field.invalid input, .field.invalid select, .field.invalid textarea, .field.invalid .seg { border-color: var(--red); }
.err { color: var(--red); font-size: 14px; font-weight: 600; margin: 6px 0 0; min-height: 0; }
.err:empty { display: none; }
.hint { color: var(--muted); font-size: 15px; margin: 6px 0 0; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.row2 .field, .row3 .field { margin-bottom: 14px; }
.unit { position: relative; }
.unit input { padding-right: 40px; }
.unit span { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 15px; pointer-events: none; }

/* segmented choices */
.seg { display: flex; gap: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.seg button { flex: 1 1 0; min-height: var(--tap); padding: 8px 6px; font: inherit; font-size: 16px; font-weight: 600; color: var(--navy); background: #fff; border: 0; border-left: 1.5px solid var(--line); cursor: pointer; }
.seg button:first-child { border-left: 0; }
.seg button[aria-checked="true"] { background: var(--navy); color: #fff; }
.seg4 button { font-size: 15px; padding: 8px 2px; }
.seg2x2 { display: grid; grid-template-columns: 1fr 1fr; }
.seg2x2 button { border-left: 0; border-top: 1.5px solid var(--line); }
.seg2x2 button:nth-child(2n) { border-left: 1.5px solid var(--line); }
.seg2x2 button:nth-child(-n+2) { border-top: 0; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 12px 18px; font: inherit; font-weight: 700; border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; text-align: center; }
.btn.primary { background: var(--red); color: #fff; }
.btn.primary:active { filter: brightness(.92); }
.btn.secondary { background: #fff; color: var(--navy); border-color: var(--navy); }
.btn.ghost { background: transparent; color: var(--navy); border-color: var(--line); }
.top .btn.ghost { color: #fff; border-color: rgba(255,255,255,.4); }
.btn.block { display: flex; width: 100%; }
.btn.danger { background: #fff; color: var(--red); border-color: var(--red); }
.small-btn { min-height: 44px; padding: 8px 14px; font-size: 15px; }
.link { background: none; border: 0; padding: 10px 0; font: inherit; font-size: 15px; color: var(--navy-2); text-decoration: underline; min-height: 44px; cursor: pointer; }

/* footer */
.bottom { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: grid; grid-template-columns: 1fr 2fr; gap: 10px; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: rgba(255,255,255,.97); border-top: 1px solid var(--line); }
.bottom .btn { min-height: 56px; font-size: 17px; }

/* address suggestions */
.suggest { list-style: none; margin: 4px 0 0; padding: 0; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.suggest li { padding: 12px 14px; min-height: var(--tap); border-top: 1px solid var(--line); cursor: pointer; font-size: 16px; }
.suggest li:first-child { border-top: 0; }
.suggest li small { display: block; color: var(--muted); font-size: 14px; }
.suggest li:active, .suggest li[aria-selected="true"] { background: #e8eef9; }

/* sketch */
.sketch { margin-top: 8px; }
.sketch svg { display: block; width: 100%; height: auto; max-height: 320px; }
/* step 2: 4 typed numbers + taps on the sketch (2026-10-21 night) */
.unit.big input { min-height: 64px; font-size: 26px; font-weight: 700; letter-spacing: .02em; padding-right: 48px; }
.unit.big span { font-size: 17px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px -16px 4px; padding: 8px 16px; position: sticky; top: var(--header-h, 120px); z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.chip { min-height: 46px; padding: 8px 14px; border-radius: 23px; border: 1.5px solid var(--line); background: #fff; color: var(--navy); font: inherit; font-size: 16px; font-weight: 600; cursor: pointer; touch-action: manipulation; }
.chip.req::after { content: "*"; color: var(--red); margin-left: 2px; }
.chip.placed { border-color: var(--ok); color: var(--ok); background: #eaf5ee; }
.chip.placed::before { content: "\2713\00a0"; }
.chip[aria-checked="true"] { background: var(--navy); border-color: var(--navy); color: #fff; box-shadow: 0 0 0 3px rgba(29,65,133,.22); }
.chip[aria-checked="true"].req::after { color: #fff; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tap-hint { margin: 6px 0 0; min-height: 1.45em; font-size: 15px; font-weight: 600; color: var(--red); }
.sketch.tap { cursor: crosshair; touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.sketch.tap svg { max-height: 45vh; }
.door-opts { margin-top: 12px; }
.placed { list-style: none; margin: 12px 0 0; padding: 0; }
.placed li { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0 10px; margin: 0; padding: 8px 0; border-top: 1px solid var(--line); font-size: 15px; min-height: 44px; }
.placed li .what { flex: 1 1 200px; }
.placed li .err { flex-basis: 100%; margin: 2px 0 0; }
.placed li .err:empty { display: none; }
.placed li .link { padding: 6px 0; }
.placed .todo { color: var(--red); font-weight: 600; }
.placed li.opt { display: block; }

/* photos */
.slot { display: grid; grid-template-columns: 96px 1fr; gap: 12px; align-items: start; }
.slot-thumb { width: 96px; height: 96px; border-radius: 10px; background: #e7ebf2 center/cover no-repeat; display: grid; place-items: center; color: var(--muted); font-size: 13px; text-align: center; border: 1.5px dashed var(--line); overflow: hidden; }
.slot-thumb.has { border-style: solid; border-color: var(--ok); }
.slot h3 { margin-bottom: 4px; }
.slot .hint { margin-top: 0; }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.photo-actions .btn { flex: 1 1 140px; }
.slot .meta-line { font-size: 13px; color: var(--ok); margin-top: 4px; }
.card.invalid { box-shadow: 0 0 0 2px var(--red); }
.thumbs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.thumbs:empty { display: none; }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; background: #e7ebf2 center/cover no-repeat; }
.thumb button { position: absolute; top: 4px; right: 4px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 20px; line-height: 1; cursor: pointer; }
.busy { opacity: .6; pointer-events: none; }

/* configuration */
.passage { margin: 12px 0 0; padding: 12px 14px; border-radius: 10px; background: #e8eef9; color: var(--navy); font-weight: 700; }
.passage.warn { background: var(--warn-bg); color: #8a4b00; }
.spec { border: 1.5px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 10px; }
.spec-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.spec-head strong { color: var(--navy); }

/* recap */
.recap-sec { background: var(--card); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.recap-sec header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.recap-sec h3 { margin: 0; }
.recap-sec dl { margin: 0; display: grid; grid-template-columns: minmax(110px, 40%) 1fr; gap: 6px 10px; font-size: 15px; }
.recap-sec dt { color: var(--muted); }
.recap-sec dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.recap-thumbs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 8px; }
.recap-thumbs div { aspect-ratio: 1; border-radius: 8px; background: #e7ebf2 center/cover no-repeat; }
.price table { width: 100%; border-collapse: collapse; font-size: 14px; }
.price th, .price td { padding: 7px 4px; border-bottom: 1px solid var(--line); vertical-align: top; }
.price th { text-align: left; color: var(--muted); font-weight: 600; font-size: 13px; }
.price td.n, .price th.n { text-align: right; white-space: nowrap; }
.price tr.sup td:first-child::after { content: " (supplément)"; color: var(--muted); font-weight: 400; }
.price tfoot td { font-weight: 700; border-bottom: 0; }
.price .ttc td { font-size: 18px; color: var(--navy); border-top: 2px solid var(--navy); }
.price .note { font-size: 13px; color: var(--muted); margin-top: 8px; }
.price .tag-offert { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: #fff; background: var(--red, #c8102e); border-radius: 4px; padding: 1px 6px; margin-left: 4px; vertical-align: 1px; }
.warnbox { background: var(--warn-bg); color: #8a4b00; border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 10px; }
.done { border: 2px solid var(--ok); }
.done h3 { color: var(--ok); }

/* toast */
.toast { position: fixed; left: 50%; top: calc(var(--header-h, 120px) + 8px); transform: translateX(-50%); background: rgba(22,32,46,.92); color: #fff; padding: 10px 16px; border-radius: 20px; font-size: 14px; opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 30; max-width: calc(100% - 32px); text-align: center; }
.toast.show { opacity: 1; }

@media (min-width: 560px) {
  .card.meta { grid-template-columns: repeat(3, 1fr); }
  .card.meta > div { flex-direction: column; gap: 2px; }
}

#receveur-hint { margin-bottom: 8px; }

/* 2026-10-23 review fixes */
.progress { margin-top: 0; }
.progress ol { gap: 6px; }
.step-label { margin-top: -6px; }
.offer { border: 2px solid var(--navy-2); margin-top: 14px; }
.offer-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 8px; }
.to-recap { margin: 14px 0 0; }
.email-hint { margin: 4px 0 0; }
.email-hint .link { padding: 6px 0; min-height: 44px; font-weight: 600; }
.btn.confirm[aria-checked="true"] { background: #eaf5ee; border-color: var(--ok); color: var(--ok); }
.btn.confirm[aria-checked="true"]::before { content: "\2713"; }
.width-field { margin-top: 4px; }
.plain { margin: 8px 0 0; font-size: 15px; }
.plain .label-inline { font-weight: 600; }
.done-new { margin-top: 10px; }
/* sticky chip bar stays one row: scroll sideways rather than cover a third of the screen */
.chips { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: 0 0 auto; white-space: nowrap; }

/* 2026-10-23 backend wiring: send state of the finished visit */
.done.wait { border-color: #c77700; }
.done.wait h3 { color: #8a4b00; }
.done.bad { border-color: var(--red); background: var(--err-bg); }
.done.bad h3 { color: var(--red); }
.done .btn + .btn { margin-top: 10px; }
#reprise-note { margin: 0 0 12px; font-size: 15px; }
