:root {
  --bg: #f7f5f0; --panel: #fff; --ink: #0f1940; --text: #2a3152; --muted: #6b7086; --line: #d9dbe3;
  --brand: #0f1940; --navy: #0f1940; --accent: #2175d9; --accent-2: #1b62bb; --accent-soft: #e6eefa; --ok: #15803d; --warn: #b45309; --bad: #b91c1c;
  --radius: 5px; --shadow: 0 1px 3px rgba(17,26,68,.08), 0 10px 28px rgba(17,26,68,.10); --hdr: 72px;
}
* { box-sizing: border-box }
a, a:hover { text-decoration: none }
[hidden] { display: none !important }
html, body { height: 100%; margin: 0 }
body { font: 15px/1.5 Tahoma, Verdana, sans-serif; color: var(--ink); background: var(--bg);
  display: grid; grid-template-rows: var(--hdr) 1fr; grid-template-columns: 420px 1fr; grid-template-areas: "top top" "panel map"; }

/* ---------- header ---------- */
header { grid-area: top; display: flex; align-items: center; gap: 20px; padding: 0 16px; background: var(--panel); border-bottom: 1px solid var(--line); z-index: 5 }
.logo { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 20px; letter-spacing: -.02em; color: var(--accent); text-decoration: none } .logo img { width: 36px; height: 19px } .logo .ver { font-size: 11px; color: var(--muted); font-weight: 600; margin-left: 2px }
.stepper { display: flex; gap: 4px; flex: 1; justify-content: center }
.stepper button { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 8px 12px; border-radius: 999px; color: var(--muted); font: inherit; font-weight: 600; cursor: pointer }
.stepper button i { font-style: normal; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: 12px }
.stepper button.done i { background: var(--ok); color: #fff } .stepper button.done i::before { content: "✓" } .stepper button.done i { font-size: 0 } .stepper button.done i::before { font-size: 12px }
.stepper button.active { color: #fff; background: var(--navy) } .stepper button.active i { background: #fff; color: var(--navy) }
.stepper button:disabled { cursor: default; opacity: .6 }
.tools { display: flex; gap: 6px }

/* ---------- panel ---------- */
#panel { grid-area: panel; background: var(--bg); border-right: 1px solid var(--line); overflow: auto; padding: 0; display: flex; flex-direction: column }
.step { display: none } .step.active { display: flex; flex-direction: column; min-height: 100% }
@keyframes fade { from { opacity: 0; transform: translateY(4px) } }
.step-head { padding: 22px 22px 18px; background: var(--navy); border-bottom: 0 } .step-head h2 { color: #fff } .step-head .lead { color: #c9d0e4 }
h2 { font-size: 22px; margin: 0 0 4px; letter-spacing: -.02em; font-weight: 500; color: var(--navy) }
.lead { color: var(--muted); margin: 0; font-size: 14px }
.card { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 14px 0; background: #fff }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft) }
.card-title { font-weight: 700; margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center }
.big { font-size: 17px; font-weight: 600 }
.checks { list-style: none; padding: 0; margin: 8px 0 0; font-size: 13px; color: var(--muted) } .checks li { padding: 2px 0 }
.search { display: flex; gap: 8px } .search input { flex: 1 }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; font-weight: 600 }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 500; color: var(--ink) } label.check input { width: auto }
input, select { width: 100%; padding: 9px 11px; border: 1px solid #c9d0e4; border-radius: 4px; font: inherit; background: #fff }
input:focus, select:focus { outline: 3px solid var(--accent-soft); border-color: var(--accent) }
input[type=range] { padding: 0; accent-color: var(--accent) }
.row { display: flex; gap: 10px } .row > * { flex: 1; min-width: 0 }
button { font: inherit; padding: 9px 14px; border-radius: 4px; border: 1px solid var(--line); background: #fff; cursor: pointer; color: var(--ink); font-weight: 600 }
button:hover { background: #f8fafc }
button.primary { background: var(--accent); color: #fff; border-color: var(--accent) } button.primary:hover { background: #1b62bb }
button.primary:disabled { background: #cbd5e1; border-color: #cbd5e1; cursor: default }
button.ghost { background: #fff } button.ghost.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft) }
button.small { padding: 6px 10px; font-size: 13px }
button.icon { width: 36px; height: 36px; padding: 0; display: grid; place-items: center; font-size: 16px }
button.link { background: none; border: 0; padding: 0; color: var(--accent); font-weight: 500; font-size: 13px; margin-top: 8px } button.link.danger { color: var(--bad); margin: 0 }
.btns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px } .btns.big button { flex: 1; padding: 13px 14px; font-size: 15px }
.nav { display: flex; justify-content: space-between; align-items: center; margin-top: 22px; padding-top: 16px; border-top: 1px solid var(--line) }
.nav .next { padding: 12px 20px; font-size: 15px }
.results { list-style: none; margin: 8px 0 0; padding: 0 }
.results li { padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; margin-bottom: 5px; cursor: pointer } .results li:hover { background: var(--accent-soft); border-color: var(--accent) }
.tip { font-size: 13px; color: var(--muted); margin: 10px 0 0 } .tip b.good { color: var(--ok) } .tip b.bad { color: var(--bad) }
.muted { color: var(--muted); font-size: 13px }
details.advanced { margin: 14px 0 } details.advanced > summary { cursor: pointer; font-weight: 600; color: var(--accent); font-size: 14px } details summary { cursor: pointer; font-size: 13px; color: var(--muted); margin: 8px 0 }

/* presets */
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px }
.presets button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 12px 6px; font-size: 13px; font-weight: 600; border-radius: var(--radius) }
.presets button .ic { font-size: 26px; line-height: 1 } .presets button:hover { border-color: var(--accent); background: var(--accent-soft) }
.quick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px } .quick button { font-size: 13px; padding: 7px 10px }
.palette { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-top: 6px }
.palette button { display: flex; align-items: center; gap: 7px; text-align: left; font-size: 12.5px; padding: 6px 8px; font-weight: 500 }
.palette .sw { width: 14px; height: 14px; border-radius: 3px; flex: none; border: 2px solid } .palette .sw.line { height: 0; border-width: 0 0 3px } .palette .sw.point { border-radius: 50% }
.group-title { grid-column: 1 / -1; font-size: 11px; color: var(--muted); margin-top: 6px; text-transform: uppercase; letter-spacing: .05em }
.objects { list-style: none; margin: 0; padding: 0 }
.objects li { display: flex; align-items: center; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px }
.objects li:last-child { border: 0 } .objects li.active { color: var(--accent); font-weight: 600 }
.objects .sw { width: 12px; height: 12px; border-radius: 3px; border: 2px solid; flex: none } .objects .area { margin-left: auto; color: var(--muted); font-size: 13px } .objects .del { background: none; border: 0; color: var(--muted); padding: 2px 6px } .objects .del:hover { color: var(--bad) }

/* rules */
.rules .rule { display: flex; gap: 10px; padding: 10px 12px; border-radius: 10px; margin-bottom: 6px; font-size: 14px }
.rule.ok { background: #f0fdf4 } .rule.warn { background: #fffbeb } .rule.block { background: #fef2f2 }
.rule .ic { font-size: 18px; line-height: 1.2 } .rule small { display: block; color: var(--muted); font-size: 13px }

/* ---------- map ---------- */
#map { grid-area: map; min-height: 0; position: relative; background: #e5e7eb }
.hint { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 1000; background: var(--ink); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 14px; font-weight: 500; box-shadow: var(--shadow); max-width: 80%; text-align: center; pointer-events: none }
.hint.accent { background: var(--accent) }
.livecard { position: absolute; left: 14px; bottom: 14px; z-index: 1000; background: #fff; border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow); font-size: 13px; min-width: 220px; cursor: pointer }
.livecard .stat { display: flex; justify-content: space-between; gap: 12px; padding: 2px 0 } .livecard b { font-variant-numeric: tabular-nums }
.livecard .alert { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); font-weight: 600 } .livecard .alert.bad { color: var(--bad) } .livecard .alert.ok { color: var(--ok) }
.obj-label { background: rgba(255,255,255,.85); border: 0; border-radius: 6px; color: var(--ink); font-weight: 700; font-size: 12px; text-align: center; padding: 3px 7px; box-shadow: 0 1px 3px rgba(0,0,0,.2); pointer-events: none } .obj-label small { font-weight: 500; color: var(--muted) } .obj-label::before { display: none }
.dim-label { background: #fff; border: 1.5px solid; font-weight: 700; font-size: 12px; padding: 2px 6px; border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.2) } .dim-label::before { display: none }
.dim-label.good { border-color: var(--ok); color: var(--ok) } .dim-label.bad { border-color: var(--bad); color: var(--bad) }
.dim-label.side { border-color: #94a3b8; color: #334155; font-weight: 600; font-size: 11px }
.leaflet-container { font: inherit }
.leaflet-control-layers { border-radius: 10px !important; box-shadow: var(--shadow) !important; border: 0 !important }

/* ---------- modal / toast ---------- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.55); z-index: 2000; display: grid; place-items: center; padding: 20px }
.modal-box { background: #fff; border-radius: 14px; width: min(1200px, 100%); max-height: 100%; overflow: auto; padding: 16px 18px; box-shadow: var(--shadow) }
.modal-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px } .modal-head .muted { flex: 1 }
#preview-box svg { width: 100%; height: auto; border: 1px solid var(--line); display: block }
#toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; box-shadow: var(--shadow); opacity: 0; transition: opacity .2s; pointer-events: none; z-index: 3000; max-width: 90vw; font-size: 14px }
#toast.show { opacity: 1 }
kbd { font: 11px ui-monospace, monospace; background: #f1f5f9; padding: 1px 5px; border-radius: 4px; border: 1px solid var(--line) }

@media (max-width: 900px) {
  body { grid-template-columns: 1fr; grid-template-rows: var(--hdr) 46vh 1fr; grid-template-areas: "top" "map" "panel" }
  #panel { border-right: 0; border-top: 1px solid var(--line); padding: 16px }
  .stepper button span, .stepper button { font-size: 12px; padding: 6px 8px } .tools .ghost { display: none }
  .presets { grid-template-columns: repeat(3, 1fr) }
}

/* Calques, licence */
.layers { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 6px } .layers label.check { margin: 4px 0 }
.licence-card.ok .badge { background: #dcfce7; color: var(--ok) }
.geo-status { list-style: none; margin: 8px 0 0; padding: 8px 10px; background: #f8fafc; border-radius: 8px; font-size: 12px; color: var(--muted); font-family: ui-monospace, monospace } .geo-status li.ok { color: var(--ok) } .geo-status li.bad { color: var(--bad) }
.metrics { font-size: 14px; font-weight: 500; color: var(--ink) }

/* ---------- accordéons ---------- */
.acc { background: var(--panel); border-bottom: 1px solid var(--line); margin: 0 }
.acc > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 10px; padding: 16px 22px; font-size: 12.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--navy); user-select: none }
.acc > summary::-webkit-details-marker { display: none }
.acc > summary::after { content: ""; margin-left: auto; width: 9px; height: 9px; border-right: 2px solid var(--ink); border-bottom: 2px solid var(--ink); transform: rotate(45deg); transition: transform .15s; flex: none }
.acc[open] > summary::after { transform: rotate(-135deg) }
.acc > summary:hover { background: #fafafa }
.acc-body { padding: 4px 22px 18px }
.acc .link.danger { margin-left: 8px; text-transform: none; letter-spacing: 0; font-size: 12px }
.pill { font-size: 10px; letter-spacing: .04em; padding: 2px 8px; border-radius: 999px; background: #f1f5f9; color: var(--muted); font-weight: 700 }
.pill.ok { background: #dcfce7; color: var(--ok) }
.cta { position: sticky; bottom: 0; margin-top: auto; padding: 14px 22px; background: var(--panel); border-top: 1px solid var(--line); display: flex; gap: 10px }
.cta .primary { flex: 1; padding: 14px 18px; font-size: 15px; border-radius: 4px }
.cta .back { padding: 14px 16px }
.presets { grid-template-columns: repeat(3, 1fr); gap: 10px }
.presets button { height: 92px; justify-content: center; gap: 8px; padding: 8px 4px; font-size: 12.5px; line-height: 1.15; border-radius: 10px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: #fff }
.presets button .ic { font-size: 30px; line-height: 1; display: block }
.presets button span:last-child { display: block; max-width: 100%; overflow: hidden; text-overflow: ellipsis }
.search input { font-size: 15px }
.results li { background: #fff }
.card { display: none }

/* distances & rotation précises */
.dist { display: grid; grid-template-columns: 1fr 1fr; gap: 8px } .dist > div { display: flex; align-items: center; gap: 8px; border: 1px solid var(--line); border-radius: 4px; padding: 6px 8px } .dist span { font-size: 12px; color: var(--muted); white-space: nowrap } .dist input { padding: 6px 8px; font-weight: 600 }
.dist .bad { border-color: #fecaca; background: #fef2f2 } .dist .bad input { color: var(--bad) } .dist .good { border-color: #bbf7d0; background: #f0fdf4 } .dist .good input { color: var(--ok) }
.rot { display: flex; align-items: center; gap: 6px } .rot input { width: 70px; text-align: center } .rot button { padding: 8px 12px }
.hint { background: var(--navy) } .hint.accent { background: var(--accent) }
.presets button { border-radius: 6px } .presets button:hover { border-color: var(--accent); background: #eef3fb }


/* ---------- Charte du site (v2.3) : même logo, police, couleurs, arrondis et boutons que les pages ---------- */
header { padding: 0 24px; gap: 24px }
.logo { gap: 10px; font-size: 24px; font-weight: 400; color: var(--accent) }
.logo img { width: 45px; height: 24px }
.logo .ver { font-size: 11px; font-weight: 400; color: var(--muted) }
button, .stepper button, .presets button, .palette button, .quick button, label, label.check, .acc > summary, .pill,
h2, .big, .hint, .metrics, .livecard .alert, .objects li.active, .dist input, .card-title, .obj-label small, .rules .rule { font-weight: 400 }
h2 { font-size: 22px; letter-spacing: -.01em }
.step-head { padding: 26px 24px 22px }
.step-head .lead { color: #c9cee3; font-size: 14.5px; line-height: 1.55 }
label { font-size: 13.5px; color: var(--muted); margin: 12px 0 6px }
input, select { height: 46px; padding: 0 14px; border: 1px solid var(--line); border-radius: var(--radius); font-size: 15px; color: var(--ink) }
input[type=range] { height: auto }
input[type=checkbox] { height: auto }
input:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent) }
button { min-height: 40px; padding: 0 16px; border-radius: var(--radius); border: 1px solid var(--line); color: var(--ink); font-size: 14.5px; display: inline-flex; align-items: center; justify-content: center; gap: 8px }
button:hover { background: var(--bg) }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff }
button.primary:hover { background: var(--accent-2); border-color: var(--accent-2) }
button.primary:disabled { background: #c7cbd8; border-color: #c7cbd8 }
button.ghost { background: #fff; border-color: var(--line) }
button.ghost:hover { border-color: var(--accent); color: var(--accent); background: #fff }
button.ghost.active { border-color: var(--accent); color: var(--accent); background: var(--accent-soft) }
button.small { min-height: 36px; padding: 0 12px; font-size: 13.5px }
button.link { min-height: 0; padding: 0; border: 0; font-size: 14px }
button.icon { width: 42px; height: 42px; min-height: 42px; padding: 0; color: var(--navy) }
button.icon svg { width: 20px; height: 20px }
button.icon:hover { color: var(--accent); border-color: var(--accent); background: #fff }
.tools { gap: 8px; align-items: center }
.tools .ghost { min-height: 42px; padding: 0 16px }
.search input { height: 50px; font-size: 15.5px }
.search button { min-height: 50px; padding: 0 20px }
.stepper button { min-height: 40px; padding: 0 14px; border: 0; color: var(--muted); font-size: 14.5px }
.stepper button:hover { background: var(--bg) }
.stepper button.active { background: var(--navy); color: #fff }
.stepper button.active:hover { background: var(--navy) }
.stepper button i { width: 24px; height: 24px; font-size: 12px }
.stepper button.done i { background: var(--ok) }
.acc > summary { font-size: 15px; letter-spacing: 0; text-transform: none; color: var(--navy); padding: 17px 24px }
.acc > summary:hover { background: var(--bg) }
.acc > summary::after { border-color: var(--navy) }
.acc-body { padding: 2px 24px 20px }
.pill { font-size: 11.5px; letter-spacing: 0; padding: 3px 10px }
.presets button { height: 92px; min-height: 0; flex-direction: column; border-radius: var(--radius); font-size: 13px; color: var(--ink) }
.presets button:hover { border-color: var(--accent); background: var(--accent-soft) }
.palette button { justify-content: flex-start; min-height: 34px; font-size: 13px }
.quick button { min-height: 36px; font-size: 13.5px }
.results li { border-radius: var(--radius); padding: 11px 14px }
.cta { padding: 16px 24px; gap: 10px }
.cta .primary { min-height: 52px; font-size: 16px; border-radius: var(--radius) }
.cta .back { min-height: 52px; padding: 0 20px; font-size: 15px }
.btns.big button { min-height: 52px; font-size: 16px }
.hint { border-radius: var(--radius); font-size: 14px; padding: 10px 18px }
.livecard, .modal-box, #toast { border-radius: 8px }
.rules .rule { border-radius: var(--radius) }
.dist > div { border-radius: var(--radius) }
.geo-status { border-radius: var(--radius) }
@media (max-width: 900px) {
  :root { --hdr: 60px }
  header { padding: 0 14px; gap: 10px }
  .logo { font-size: 20px; gap: 8px }
  .logo img { width: 38px; height: 20px }
  .logo .ver { display: none }
  .stepper button { min-height: 34px; padding: 0 8px; font-size: 12.5px }
  #panel { padding: 0 }
  body { grid-template-columns: minmax(0, 1fr) }
  header { min-width: 0 }
  .stepper { min-width: 0; justify-content: flex-end }
  .hint { max-width: calc(100% - 24px); font-size: 13px; padding: 8px 12px; top: 10px }
}
@media (max-width: 560px) {
  .tools { display: none }
  .stepper { gap: 6px }
  .stepper button { font-size: 0; gap: 0; padding: 0; min-height: 30px; width: 30px; justify-content: center; background: none }
  .stepper button.active { background: none }
  .stepper button i { width: 28px; height: 28px; font-size: 13px }
  .stepper button.active i { background: var(--navy); color: #fff }
}
@media (max-width: 560px) {
}


/* Bouton « Valider cet élément » : action principale de la fiche */
#valider { width: 100%; min-height: 48px; font-size: 15.5px }

/* Encart de marque sur la carte, et attribution IGN habillée aux couleurs du site */
.map-brand { position: absolute; left: 14px; bottom: 14px; z-index: 1000; display: flex; align-items: center; gap: 9px;
  background: #fff; border-radius: var(--radius); padding: 8px 14px; box-shadow: var(--shadow);
  font-size: 17px; color: var(--accent); pointer-events: none }
.map-brand img { width: 34px; height: 18px }
.leaflet-control-attribution { background: rgba(255,255,255,.92) !important; border-radius: var(--radius) 0 0 0;
  padding: 3px 8px !important; font-size: 11px !important; color: var(--muted) !important }
.leaflet-control-attribution a { color: var(--muted) !important }
@media (max-width: 900px) { .map-brand { display: none } }


/* =====================================================================
   MOBILE : un écran par étape, carte en plein écran, action fixe en bas.
   Les 4 étapes et toute la logique restent celles du bureau ; seule la
   présentation change. Hors de ce bloc, rien n'est modifié.
   ===================================================================== */
@media (max-width: 900px) {
  body { grid-template-rows: var(--hdr) 1fr; grid-template-areas: "top" "map"; }

  /* La carte occupe tout l'espace sous l'en-tête ; le panneau se pose dessus. */
  #map { grid-area: map; height: 100% }

  #panel { position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 1200;
    max-height: calc(100dvh - var(--hdr) - 72px); border: 0; border-radius: 16px 16px 0 0;
    background: var(--panel); box-shadow: 0 -8px 30px rgba(17,26,68,.18); overflow: hidden;
    display: flex; flex-direction: column; transition: transform .25s }
  #panel::before { content: ""; display: block; flex: none; width: 42px; height: 4px; margin: 9px auto 3px;
    border-radius: 2px; background: #cfd3e0 }
  .step.active { overflow-y: auto; -webkit-overflow-scrolling: touch; min-height: 0; padding-bottom: 4px }

  /* Étapes 1, 3 et 4 : le panneau prend l'écran (pas de carte à manipuler).
     `:not([data-step="2"])` couvre aussi le tout premier rendu, avant que
     l'application ait inscrit l'étape sur <body>. */
  body:not([data-step="2"]) #panel {
    top: var(--hdr); max-height: none; border-radius: 0; box-shadow: none }
  /* Étape 2 : la carte reste visible, le panneau est réduit en tiroir. */
  body[data-step="2"] #panel { max-height: 52dvh }
  body[data-step="2"].panel-min #panel { max-height: 148px }

  /* Titre d'étape compact */
  .step-head { padding: 16px 18px 14px }
  .step-head h2 { font-size: 19px }
  .step-head .lead { font-size: 13.5px; margin-top: 4px }
  body[data-step="2"] .step-head { padding: 12px 18px 10px }

  .acc > summary { padding: 14px 18px; font-size: 14.5px }
  .acc-body { padding: 2px 18px 16px }

  /* Bouton d'étape : toujours visible, au-dessus du panneau */
  .cta { position: fixed; left: 0; right: 0; bottom: 0; z-index: 1300; margin: 0;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--panel); border-top: 1px solid var(--line); box-shadow: 0 -2px 14px rgba(17,26,68,.10) }
  .cta .primary { min-height: 54px; font-size: 16.5px }
  .cta .back { min-height: 54px; padding: 0 16px }
  #panel { padding-bottom: 0 }
  .step.active { padding-bottom: 86px }

  /* Carte : repères déplacés pour ne pas passer sous le panneau */
  body[data-step="2"] .leaflet-bottom.leaflet-right { bottom: 56dvh }
  body[data-step="2"].panel-min .leaflet-bottom.leaflet-right { bottom: 160px }
  .livecard { left: 10px; right: 10px; bottom: auto; top: 10px; min-width: 0; font-size: 12.5px;
    display: grid; grid-template-columns: 1fr 1fr; gap: 2px 12px }
  .livecard .alert { grid-column: 1 / -1 }
  .hint { top: 8px; font-size: 12.5px }
  body[data-step="2"] .hint { display: none }

  /* Saisie d'adresse plus lisible */
  .search { flex-direction: column; gap: 10px }
  .search input, .search button { width: 100%; height: 52px }
  .results li { padding: 13px 14px; font-size: 15px }

  /* Choix du projet : grille de grandes tuiles */
  .presets { grid-template-columns: 1fr 1fr; gap: 10px }
  .presets button { height: 84px; font-size: 13.5px }
  .presets button .ic { font-size: 26px }
  .palette { grid-template-columns: 1fr }
  .quick button { flex: 1 1 45%; min-height: 44px }
  .dist { grid-template-columns: 1fr }
  .row { flex-direction: column; gap: 0 }
  .layers { grid-template-columns: 1fr }
  #valider { min-height: 52px; font-size: 16px }

  /* Journal technique de recherche : réservé au bureau, illisible sur mobile */
  .geo-status { display: none }
  /* Le message passager ne doit pas recouvrir le bouton d'étape */
  #toast { bottom: calc(86px + env(safe-area-inset-bottom)); max-width: calc(100% - 32px); font-size: 13.5px }
  /* Résumé en direct : compact, sous l'en-tête */
  .livecard { padding: 8px 12px }
  .livecard .stat span { font-size: 11.5px }
}
@media (max-width: 900px) and (display-mode: browser) { #panel { max-height: calc(100vh - var(--hdr) - 72px) } }


/* ===== MOBILE : parcours en 9 écrans ===== */
.mprog { display: none }
@media (max-width: 900px) {
  .mprog { display: block; position: sticky; top: 0; z-index: 1100; background: var(--panel);
    border-bottom: 1px solid var(--line); padding: 12px var(--gut, 16px) 10px }
  .mprog-txt { margin: 0 0 8px; font-size: 14px; color: var(--navy) }
  .mprog-txt b { font-weight: 400 }
  .mprog-txt em { font-style: normal; color: var(--muted) }
  .mprog-bar { display: flex; gap: 4px }
  .mprog-bar i { flex: 1; height: 5px; border-radius: 3px; background: var(--line) }
  .mprog-bar i.on { background: var(--accent) }

  /* Un seul panneau à la fois */
  .m-hide { display: none !important }

  /* La barre s'intercale sous l'en-tête : le panneau démarre dessous */
  body { grid-template-rows: var(--hdr) auto 1fr; grid-template-areas: "top" "prog" "map" }
  .mprog { grid-area: prog }
  body:not([data-mstep]) .mprog { display: none }

  /* Écrans « carte » (réglages, implantation) : la carte reste visible */
  body.m-carte #panel { top: auto; max-height: 48dvh; border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 30px rgba(17,26,68,.18) }
  body.m-carte.panel-min #panel { max-height: 148px }
  body:not(.m-carte) #panel { top: calc(var(--hdr) + 62px); max-height: none; border-radius: 0; box-shadow: none }
  body:not(.m-carte) #panel::before { display: none }
  body:not(.m-carte) .leaflet-bottom.leaflet-right { bottom: 0 }
  body.m-carte .leaflet-bottom.leaflet-right { bottom: 52dvh }

  /* Le titre de l'étape bureau fait doublon avec la barre */
  body[data-mstep] .step-head { display: none }
  /* Panneau unique : plus besoin de l'entête d'accordéon */
  body[data-mstep] .acc > summary { display: none }
  body[data-mstep] .acc { border-bottom: 0 }
  body[data-mstep] .acc-body { padding: 18px var(--gut, 16px) 20px }
}
