/* Outil « Relever son terrain avec son téléphone » (scripts/blocks/releve-gps.mjs, assets/js/tools/releve-gps-ui.js) */
.rg-tool { max-width: 980px; display: grid; gap: 1.4rem; container: rg / inline-size; min-width: 0; }
.rg-tool * { min-width: 0; }
.rg-tool .sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.rg-tool .form { gap: 1rem; }
.rg-tool .hint { margin: 0; }
.rg-intro { margin: 0; }
.rg-opt { font-weight: 400; color: var(--muted); }
.rg-h2 { font-size: clamp(1.15rem, 1rem + .6vw, 1.4rem); margin: 0; display: flex; align-items: center; gap: .6rem; }
.rg-h3 { font-size: 1.05rem; margin: 0; }
.rg-step { display: inline-grid; place-items: center; flex: none; width: 2rem; height: 2rem; border-radius: 50%; background: var(--ink); color: #fff; font: 700 .95rem/1 var(--mono); }
.rg-err { margin: 0; color: #b3261e; font-size: .88rem; font-weight: 600; }
.rg-err:empty { display: none; }
:root[data-theme="dark"] .rg-err { color: #ffb4ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rg-err { color: #ffb4ab; } }
.rg-tool [aria-invalid="true"] { border-color: #b3261e !important; box-shadow: inset 0 0 0 1px #b3261e; }
.rg-tool button:focus-visible, .rg-tool a:focus-visible, .rg-tool summary:focus-visible, .rg-tw:focus-visible, .rg-out:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
.rg-actions { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; }
.rg-tool .btn { cursor: pointer; font: inherit; font-weight: 650; max-width: 100%; white-space: normal; text-align: start; }
.rg-tool .btn:disabled { opacity: .55; cursor: default; }
.rg-tool .form .btn.ghost, .rg-tool .btn.ghost { color: var(--text); border: 1px solid var(--input-line); padding: .7rem 1.1rem; background: transparent; }
.rg-tool .btn.ghost:hover:not(:disabled) { border-color: var(--copper); }
.rg-tool details > summary { cursor: pointer; font-weight: 650; }
.rg-tool details[open] { display: grid; gap: .8rem; }

/* Avertissement de précision, bien visible */
.rg-honest { border: 2px solid var(--copper-btn); border-inline-start-width: 6px; border-radius: 12px; padding: 1rem 1.2rem; background: var(--surface); display: grid; gap: .5rem; }
.rg-honest-t { margin: 0; font-weight: 750; color: var(--copper-ink); }
.rg-honest-t::before { content: "⚠ "; }
.rg-honest ul { margin: 0; padding-inline-start: 1.2rem; display: grid; gap: .3rem; }

/* Sur ordinateur : QR code */
.rg-desk { border: 1px solid var(--line); border-radius: 14px; padding: .9rem 1.1rem; background: var(--sand); }
.rg-desk-body { display: grid; grid-template-columns: minmax(0, 200px) 1fr; gap: 1.2rem; align-items: start; }
@container rg (max-width: 34rem) { .rg-desk-body { grid-template-columns: 1fr; } }
.rg-qr { margin: 0; display: grid; gap: .4rem; justify-items: center; }
.rg-qr-img { width: min(100%, 200px); aspect-ratio: 1; background: #fff; border-radius: 8px; padding: 0; }
.rg-qr-img svg { display: block; width: 100%; height: 100%; }
.rg-desk-txt { display: grid; gap: .6rem; }
.rg-desk-txt p, .rg-desk-steps { margin: 0; }
.rg-desk-steps { padding-inline-start: 1.2rem; display: grid; gap: .25rem; }
.rg-desk-txt .btn { justify-self: start; }
.rg-url { font-family: var(--mono); font-size: .85rem; overflow-wrap: anywhere; }

/* Panneaux */
.rg-panel { border: 1px solid var(--line); border-radius: 16px; padding: clamp(1rem, .8rem + 1vw, 1.5rem); background: var(--surface); }
.rg-live { border: 1px solid var(--line); border-radius: 12px; padding: .8rem 1rem; display: grid; gap: .5rem; background: var(--paper); }
.rg-live-h { margin: 0; font-weight: 650; }
.rg-live-dl { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr)); gap: .5rem 1rem; }
.rg-live-dl dt { font-size: .8rem; color: var(--muted); }
.rg-live-dl dd { margin: 0; font-family: var(--mono); font-size: 1rem; overflow-wrap: anywhere; }
[dir="rtl"] .rg-live-dl dd { font-family: var(--sans); }
.rg-l-acc { font-size: 1.25rem; font-weight: 650; }
.rg-l-q { font-family: var(--sans); font-size: .85rem; font-weight: 650; }
.rg-l-q[data-q="good"] { color: var(--g-text); }
.rg-l-q[data-q="bad"] { color: #b3261e; }
:root[data-theme="dark"] .rg-l-q[data-q="bad"] { color: #ffb4ab; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .rg-l-q[data-q="bad"] { color: #ffb4ab; } }
.rg-l-wake:empty { display: none; }
.rg-gps-err { border-inline-start: 4px solid #b3261e; background: rgba(179, 38, 30, .08); border-radius: 8px; padding: .7rem 1rem; }
.rg-gps-err p { margin: 0; }
.rg-helps { display: grid; gap: .5rem; }
.rg-helps[hidden] { display: none; }
.rg-help { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .9rem; }
.rg-help ol { margin: 0; padding-inline-start: 1.3rem; display: grid; gap: .3rem; }
.rg-set-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr)); gap: .8rem 1rem; align-items: end; }
.rg-set-grid > p { grid-column: 1 / -1; margin-top: -.4rem; }
.rg-set-grid label[hidden] { display: none; }
.rg-tool .chk { display: flex; gap: .5rem; align-items: center; font-weight: 400; }

/* Enregistrement d'un point */
.rg-rec-row { display: flex; flex-wrap: wrap; gap: .8rem; align-items: end; }
.rg-rec-row label { flex: 1 1 12rem; }
.rg-meas { border: 2px solid var(--copper-btn); border-radius: 12px; padding: .9rem 1rem; display: grid; gap: .6rem; }
.rg-meas[hidden] { display: none; }
.rg-meas p { margin: 0; }
.rg-meas-t { font-weight: 700; }
.rg-meas-d { font-family: var(--mono); font-size: .9rem; }
[dir="rtl"] .rg-meas-d { font-family: var(--sans); }
.rg-prog { width: 100%; height: 1rem; accent-color: var(--copper-btn); }
.rg-meas-msg p { margin: 0; }
.rg-meas-msg:empty { display: none; }
.rg-ok-p { border-inline-start: 4px solid var(--g-text); padding-inline-start: .7rem; }
.rg-warn-p { border-inline-start: 4px solid var(--copper-btn); padding-inline-start: .7rem; }

/* Carte */
.rg-mapbox { display: grid; gap: .6rem; }
.rg-map { position: relative; height: clamp(300px, 55vh, 500px); border-radius: var(--radius); border: 1px solid var(--line); overflow: hidden; background: var(--sand); z-index: 0; }
.rg-map:focus-visible { outline: 3px solid var(--copper); outline-offset: 2px; }
.rg-tool .leaflet-container { font: inherit; font-size: .8rem; }
.rg-tool .leaflet-control-attribution { font-size: .72rem; }
.rg-tool .leaflet-control-attribution a { color: #0b4a8b; }
.rg-tool .leaflet-control-layers { color: #191b33; }
.rg-vx { display: grid !important; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: #0b0d22; color: #fff; border: 2px solid #fff; font: 700 12px/1 var(--mono); box-shadow: 0 1px 4px rgba(0, 0, 0, .5); cursor: grab; }
.rg-vx.moved { background: #9c5a2a; border-style: dashed; }
.rg-vx.manual { background: #0b4a8b; }
.rg-vx:focus-visible { outline: 3px solid #0b0d22; outline-offset: 2px; box-shadow: 0 0 0 5px #fff; }

/* Liste des points */
.rg-pts { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.rg-empty { color: var(--muted); }
.rg-pt { display: grid; grid-template-columns: 2rem 1fr auto; gap: .4rem .7rem; align-items: start; border: 1px solid var(--line); border-radius: 12px; padding: .6rem .7rem; }
.rg-num { font-family: var(--mono); font-weight: 700; text-align: center; padding-top: .55rem; }
.rg-pt-main { display: grid; gap: .25rem; }
.rg-pt-main p { margin: 0; font-size: .86rem; overflow-wrap: anywhere; }
.rg-tool .form .rg-pt input { padding: .5rem .7rem; }
.rg-pt-name { display: block; font-weight: 400; }
.rg-pt-xy { font-family: var(--mono); color: var(--muted); }
.rg-tag { display: inline-block; font-size: .75rem; font-weight: 700; border: 1px solid currentColor; border-radius: 999px; padding: 0 .5rem; margin-inline-end: .2rem; }
.rg-tag[data-src="moved"] { border-style: dashed; color: var(--copper-ink); }
.rg-row-act { display: inline-flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
.rg-row-act button { font: inherit; width: 2.5rem; height: 2.5rem; border-radius: 10px; border: 1px solid var(--input-line); background: var(--surface); color: var(--text); cursor: pointer; display: inline-grid; place-items: center; }
.rg-row-act button:disabled { opacity: .4; cursor: default; }
.rg-row-act button:hover:not(:disabled) { border-color: var(--copper); }
.rg-edit { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .6rem; border-top: 1px solid var(--line); padding-top: .6rem; }
.rg-edit > p, .rg-edit > .rg-actions { grid-column: 1 / -1; margin: 0; }
@container rg (max-width: 30rem) {
  .rg-pt { grid-template-columns: 1.6rem 1fr; }
  .rg-row-act { grid-column: 1 / -1; }
}

/* Résultat (carte sombre, comme le convertisseur Lambert) */
.rg-out:empty { display: none; }
.rg-out:focus { outline: none; }
.rg-need { color: var(--muted); }
.rg-res { background: var(--ink); color: #eeecff; border-radius: 14px; padding: clamp(1.1rem, .8rem + 1.5vw, 1.8rem); display: grid; gap: 1rem; overflow-wrap: anywhere; }
.rg-res > * { margin: 0; }
.rg-res .rg-rt { font-size: 1.1rem; color: #fff; }
.rg-res .zn { font-family: var(--mono); font-size: .78rem; color: var(--copper-l); }
[dir="rtl"] .rg-res .zn { font-family: var(--sans); }
.rg-res .rg-big { font-family: var(--mono); font-size: clamp(1.8rem, 1.2rem + 2.5vw, 2.6rem); font-weight: 600; color: #fff; line-height: 1.1; }
.rg-range { font-size: 1rem; }
.rg-units { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: .6rem 1.2rem; margin: 0; }
.rg-units dt { font-size: .8rem; color: rgba(236, 234, 255, .78); }
.rg-units dd { margin: 0; font-family: var(--mono); font-size: 1.05rem; }
.rg-res p { font-size: .92rem; }
.rg-res .hint { color: rgba(236, 234, 255, .78); font-size: .82rem; }
.rg-warn { margin: 0; padding: .8rem 1rem; list-style: none; border-inline-start: 4px solid var(--copper-l); background: rgba(224, 153, 92, .12); border-radius: 8px; display: grid; gap: .4rem; font-size: .92rem; }
.rg-warn strong::before { content: "⚠ "; }
.rg-sketch { margin: 0; display: grid; gap: .3rem; justify-items: center; }
.rg-sketch svg { width: min(100%, 420px); height: auto; background: rgba(255, 255, 255, .04); border-radius: 10px; }
.rg-sk-poly { fill: rgba(224, 153, 92, .18); stroke: var(--copper-l); stroke-width: 2; stroke-linejoin: round; }
.rg-sk-unc { fill: rgba(255, 255, 255, .08); stroke: rgba(236, 234, 255, .55); stroke-width: 1; stroke-dasharray: 3 3; }
.rg-sk-pt { fill: #fff; }
.rg-sk-lb { fill: #eeecff; font: 600 11px var(--mono); direction: ltr; unicode-bidi: plaintext; }
.rg-sk-n path { fill: var(--copper-l); } .rg-sk-n text { fill: #eeecff; font: 700 11px var(--sans); }
.rg-tw { overflow-x: auto; border-radius: 10px; border: 1px solid var(--line-d); }
.rg-tab { width: 100%; border-collapse: collapse; font-size: .84rem; overflow-wrap: normal; }
.rg-tab caption { text-align: start; font-weight: 650; padding: .6rem .8rem; color: #fff; }
.rg-tab th, .rg-tab td { padding: .45rem .7rem; text-align: end; border-top: 1px solid var(--line-d); white-space: nowrap; font-family: var(--mono); font-weight: 400; }
.rg-tab td.rg-src { font-family: var(--sans); text-align: start; }
.rg-tab th[scope="row"], .rg-tab thead th:first-child { text-align: start; }
.rg-tab thead th { font-family: var(--sans); font-weight: 650; font-size: .78rem; color: rgba(236, 234, 255, .82); white-space: normal; }
.rg-method { border-top: 1px solid var(--line-d); padding-top: .8rem; }
.rg-method[open] > p { margin: 0; }
.rg-formula { font-family: var(--mono); font-size: .88rem; overflow-x: auto; }
.rg-res summary:focus-visible, .rg-res .rg-tw:focus-visible { outline-color: var(--copper-l); }
.rg-print-head, .rg-print-foot { display: none; }

/* Suite : exports, Superficie, devis */
.rg-next[hidden] { display: none; }
.rg-x-msg:empty { display: none; }
.rg-x-msg { font-weight: 600; }
.rg-sup, .rg-help-cab { display: grid; gap: .6rem; border-top: 1px solid var(--line); padding-top: 1rem; }
.rg-sup > *, .rg-help-cab > * { margin: 0; }
.rg-store { display: flex; flex-wrap: wrap; gap: .4rem .8rem; align-items: center; }
.rg-clear-all { font: inherit; font-size: .85rem; background: none; border: 1px solid var(--input-line); color: var(--text); border-radius: 999px; padding: .35rem .9rem; cursor: pointer; }

@media (prefers-reduced-motion: reduce) { .rg-tool * { transition: none !important; animation: none !important; } }
.a11y-rm .rg-tool * { transition: none !important; animation: none !important; }

/* Impression : seul le résultat est imprimé, en noir sur blanc */
@media print {
  body * { visibility: hidden !important; }
  .rg-out, .rg-out * { visibility: visible !important; }
  .rg-out { position: absolute; inset: 0 0 auto 0; }
  .rg-res { background: #fff !important; color: #000 !important; padding: 0; border-radius: 0; }
  .rg-res *, .rg-res .zn, .rg-res .hint, .rg-units dt, .rg-tab thead th, .rg-tab caption, .rg-res .rg-rt, .rg-res .rg-big { color: #000 !important; }
  .rg-tab th, .rg-tab td, .rg-tw, .rg-method { border-color: #999 !important; }
  .rg-tw { overflow: visible; }
  .rg-tab th, .rg-tab td { white-space: normal; }
  .rg-sketch svg { background: none; }
  .rg-sk-poly { fill: #eee; stroke: #000; } .rg-sk-pt, .rg-sk-n path { fill: #000; } .rg-sk-lb, .rg-sk-n text { fill: #000; } .rg-sk-unc { fill: none; stroke: #666; }
  .rg-warn { background: none; border-color: #000; }
  .rg-method > p { display: block; }
  .rg-method > summary { display: none; }
  .rg-print-head { display: block; border-bottom: 2px solid #000; padding-bottom: .4rem; }
  .rg-print-head p { margin: 0; } .rg-print-t { font-weight: 700; font-size: 1.2rem; }
  .rg-print-foot { display: block; border-top: 1px solid #000; padding-top: .4rem; font-size: .8rem; }
  .rg-units, .rg-tab tr, .rg-sketch { break-inside: avoid; }
}
