:root {
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-2: #f8fafb;
  --border: #dde3ea;
  --border-2: #e9eef3;
  --text: #1f2a37;
  --muted: #5b6b7c;
  --accent: #0f6f8f;
  --accent-dark: #0b5670;
  --accent-soft: #e3f1f6;
  --danger: #c62828;
  --ok: #2e7d32;
  --warn: #b26a00;
  --header: #1f2a37;
  --header-2: #2b3a4b;
  --header-3: #3d4f63;
  --radius: 8px;
  --shadow: 0 2px 10px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 10px 34px rgba(16, 24, 40, 0.22);
  --header-h: 52px;
  --left-w: 300px;
  --right-w: 400px;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 13.5px; color: var(--text); background: var(--bg); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; font-weight: 600; }
.hidden { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* ---------- icônes */
.ic { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ic.big { width: 26px; height: 26px; stroke-width: 1.6; }

/* ---------- boutons */
.btn { border: 1px solid var(--border); background: #fff; border-radius: 6px; padding: 6px 11px; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; line-height: 1.25; }
.btn:hover { background: #f0f3f6; }
.btn.primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #f1c0c0; }
.btn.danger:hover { background: #fdecec; }
.btn.danger.plein { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.ghost:hover { background: #eef2f6; color: var(--text); }
.btn.small { padding: 3px 8px; font-size: 12px; }
.btn.large { width: 100%; justify-content: center; padding: 9px 12px; font-weight: 600; }
.btn.icon { padding: 6px 7px; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn.active { background: var(--accent-soft); border-color: var(--accent); color: var(--accent-dark); }

/* ---------- en-tête */
header {
  position: fixed; top: 0; left: 0; right: 0; height: var(--header-h); z-index: 20;
  display: flex; align-items: center; gap: 12px; padding: 0 14px;
  background: var(--header); color: #fff; box-shadow: var(--shadow);
}
header .brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 6px; background: linear-gradient(135deg, #f3a35d 0 33%, #b7da92 33% 66%, #4da6c7 66%); flex: none; }
header .brand small { display: block; font-weight: 400; font-size: 11px; color: #b8c4d1; }
header select { background: var(--header-2); color: #fff; border: 1px solid var(--header-3); border-radius: 6px; padding: 6px 8px; width: auto; max-width: 230px; }
header .spacer { flex: 1; }
.stats-pills { display: flex; gap: 6px; }
.pill { background: var(--header-2); border: 1px solid var(--header-3); border-radius: 999px; padding: 4px 11px; font-size: 12px; color: #cfd8e2; white-space: nowrap; }
.pill b { color: #fff; font-variant-numeric: tabular-nums; }
.pill.actif { border-color: #d98c8c; }
.pill.actif b { color: #ffb4a8; }
.btn-group { display: flex; gap: 2px; background: var(--header-2); border: 1px solid var(--header-3); border-radius: 7px; padding: 2px; }
header .btn { background: transparent; color: #e7edf3; border: 1px solid transparent; white-space: nowrap; padding: 5px 10px; }
header .btn.icon { padding: 5px 7px; }
header .btn:hover:not(:disabled) { background: var(--header-3); color: #fff; }
header .btn:disabled { opacity: .4; cursor: default; }
header .btn.primary { background: var(--accent); border-color: #1b87aa; color: #fff; padding: 7px 12px; }
header .btn.primary:hover { background: var(--accent-dark); }
body.right-open header #btn-scan { background: var(--accent-dark); box-shadow: inset 0 0 0 1px #5fb4d0; }

/* ---------- disposition */
#carte-zone { position: fixed; top: var(--header-h); left: var(--left-w); right: 0; bottom: 0; }
#map { position: absolute; inset: 0; }
body.right-open #carte-zone { right: var(--right-w); }
#left { position: fixed; top: var(--header-h); left: 0; bottom: 0; width: var(--left-w); background: var(--panel); border-right: 1px solid var(--border); overflow-y: auto; z-index: 10; }
#right { position: fixed; top: var(--header-h); right: 0; bottom: 0; width: var(--right-w); background: var(--panel-2); border-left: 1px solid var(--border); overflow-y: auto; z-index: 10; transform: translateX(100%); transition: transform .2s, visibility .2s; visibility: hidden; }
body.right-open #right { transform: none; visibility: visible; }

.section { padding: 12px 14px; border-bottom: 1px solid var(--border-2); }
.section h2 { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; white-space: nowrap; }
.section h2 .btn { text-transform: none; letter-spacing: 0; }
.row { display: flex; align-items: center; gap: 8px; margin: 6px 0; flex-wrap: wrap; }
.row label { color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 5px; }
.help { color: var(--muted); font-size: 12px; line-height: 1.45; }
.astuce { margin-top: 6px; font-size: 11.5px; }
input[type=text], input[type=password], input[type=number], select, textarea { border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; background: #fff; width: 100%; }
input[type=text]:focus, input[type=password]:focus, select:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px rgba(15, 111, 143, .15); }
input[type=range] { width: 100%; accent-color: var(--accent); }
input[type=checkbox] { accent-color: var(--accent); }
#motif { margin-top: 8px; }
.credits { font-size: 11px; border-bottom: 0; }

/* sections repliables */
details.repliable summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 600; padding: 2px 0; }
details.repliable summary::-webkit-details-marker { display: none; }
details.repliable summary::after { content: ""; margin-left: auto; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; }
details.repliable[open] summary::after { transform: rotate(45deg); }
details.repliable[open] summary { margin-bottom: 6px; }
details.repliable summary:hover { color: var(--text); }

/* ---------- sélection */
.tools { display: flex; gap: 4px; }
.tools .btn { flex: 1; justify-content: center; padding: 6px 6px; font-size: 12.5px; }
.search { position: relative; margin: 8px 0 6px; }
.search .ic { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 14px; height: 14px; }
.search input { padding-left: 29px; }
#selection-info b { color: var(--text); }
.chip { display: inline-flex; align-items: center; gap: 5px; background: #eef2f6; border-radius: 12px; padding: 2px 8px; font-size: 12px; margin: 2px 2px 0 0; white-space: nowrap; }
.chip .dot { width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0,0,0,.3); }
.pt-dot { width: 11px; height: 11px; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.25); flex: none; }

/* ---------- palette compacte */
.zone-active-lbl { text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--text); font-size: 12px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pal-famille { display: grid; grid-template-columns: 26px 1fr; align-items: start; gap: 6px; margin: 4px 0; }
.pal-famille .fam { font-size: 10.5px; font-weight: 700; color: var(--muted); padding-top: 6px; }
.pal-zones { display: flex; flex-wrap: wrap; gap: 4px; }
.zchip { min-width: 40px; height: 26px; padding: 0 6px; border-radius: 5px; border: 1px solid rgba(0,0,0,.18); font-size: 11.5px; font-weight: 600; letter-spacing: .01em; display: inline-flex; align-items: center; justify-content: center; position: relative; }
.zchip.hatch { background-image: repeating-linear-gradient(135deg, var(--c) 0 2px, #fff 2px 6px) !important; color: #1f2a37 !important; }
.zchip.hatch span { background: rgba(255,255,255,.92); border-radius: 3px; padding: 0 3px; line-height: 16px; }
.zchip:hover { filter: brightness(1.06); box-shadow: 0 1px 4px rgba(0,0,0,.2); }
.zchip.active { outline: 2px solid var(--accent); outline-offset: 2px; box-shadow: 0 0 0 1px #fff inset; }
.swatch { width: 18px; height: 14px; border-radius: 3px; border: 1px solid rgba(0,0,0,.25); flex: none; display: inline-block; vertical-align: middle; }
.swatch.hatch { background-image: repeating-linear-gradient(135deg, var(--c) 0 3px, #fff 3px 6px); }

/* ---------- barre d'action flottante */
#barre-action { position: absolute; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 6; display: flex; align-items: center; gap: 10px; background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 10px; max-width: calc(100% - 24px); }
.ba-info { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.ba-info b { font-size: 13.5px; }
.ba-info span { font-size: 11.5px; color: var(--muted); }
.ba-zones { display: flex; flex-wrap: wrap; gap: 2px; max-width: 260px; max-height: 48px; overflow: hidden; }
.ba-sep { width: 1px; align-self: stretch; background: var(--border); }
.ba-cible { position: relative; }
#ba-choix { min-width: 120px; white-space: nowrap; }
.popover { position: absolute; bottom: calc(100% + 10px); left: 50%; transform: translateX(-50%); background: #fff; border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px; width: 300px; z-index: 8; }
.popover .titre { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; margin-bottom: 4px; }

/* ---------- légende de carte */
#legende-carte { position: absolute; left: 10px; top: 10px; z-index: 4; background: rgba(255,255,255,.92); border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px; font-size: 11px; color: var(--muted); line-height: 1.7; box-shadow: 0 1px 4px rgba(16,24,40,.08); }
#legende-carte div { display: flex; align-items: center; gap: 7px; white-space: nowrap; }
.lg { display: inline-block; width: 18px; height: 11px; border-radius: 2px; flex: none; }
.lg-modif { border: 2.5px solid #d40000; background: rgba(212,0,0,.06); }
.lg-mixte { border: 1.6px dashed #b26a00; }
.lg-hors { background: rgba(120,130,140,.28); border: 1px solid rgba(61,107,47,.5); }
.lg-apercu { border: 2.5px dashed #0f6f8f; background: rgba(15,111,143,.18); }

/* ---------- panneau carte annotée */
.right-head { position: sticky; top: 0; z-index: 3; display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; background: #fff; border-bottom: 1px solid var(--border); }
.right-head h2 { font-size: 14px; display: flex; align-items: center; gap: 8px; }
.step { padding: 12px 14px; border-bottom: 1px solid var(--border-2); background: #fff; margin-bottom: 6px; }
.step h3 { font-size: 13px; display: flex; align-items: center; gap: 8px; margin-bottom: 9px; }
.step h3 .num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step > summary.step-titre { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 600; }
.step > summary.step-titre::-webkit-details-marker { display: none; }
.step[open] > summary.step-titre { margin-bottom: 9px; }
.step > summary.step-titre .num { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 11.5px; display: inline-flex; align-items: center; justify-content: center; flex: none; }
.step-fichier { margin-left: auto; font-weight: 400; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 230px; }
.step > summary.step-titre::after { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 6px; flex: none; }
.step[open] > summary.step-titre::after { transform: rotate(45deg); }
.step h3.plain { font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.step h3 .badge { margin-left: auto; }
.num-val { font-variant-numeric: tabular-nums; font-size: 12px; color: var(--muted); width: 24px; text-align: right; }
.drop { border: 2px dashed #c9d3dd; border-radius: var(--radius); padding: 14px; color: var(--muted); background: #fafbfc; cursor: pointer; display: flex; align-items: center; gap: 12px; transition: background .15s, border-color .15s; }
.drop b { color: var(--text); font-weight: 600; }
.drop:hover, .drop:focus-visible { border-color: var(--accent); background: var(--accent-soft); }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop.occupe { opacity: .55; pointer-events: none; }
.alerte { border-radius: 7px; padding: 8px 10px; font-size: 12.5px; line-height: 1.45; margin: 8px 0; display: flex; gap: 8px; align-items: flex-start; }
.alerte .ic { margin-top: 1px; }
.alerte.err { background: #fdecec; color: #8e1c1c; border: 1px solid #f3c4c4; }
.alerte.warn { background: #fff4e0; color: #7a4a00; border: 1px solid #f2d59f; }
.alerte.ok { background: #e8f5ea; color: #1d5a21; border: 1px solid #bfe0c3; }
.plan-titre { font-weight: 600; font-size: 13px; margin-bottom: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 10px; font-size: 12px; margin: 6px 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.chiffres { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin: 8px 0 4px; }
.chiffres div { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 7px; padding: 5px 4px; text-align: center; }
.chiffres b { display: block; font-size: 15px; font-variant-numeric: tabular-nums; }
.chiffres span { font-size: 10.5px; color: var(--muted); }
.ov-row { margin-top: 8px; }
.qualite { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.qualite::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.qualite.bon { background: #e3f4e5; color: var(--ok); }
.qualite.moyen { background: #fff3e0; color: var(--warn); }
.qualite.faible, .qualite.echec { background: #fdecec; color: var(--danger); }
.badge { font-size: 11px; padding: 2px 7px; border-radius: 10px; background: #eef2f6; color: var(--muted); font-weight: 500; white-space: nowrap; }
.badge.ok { background: #d7efd9; color: var(--ok); font-weight: 600; }
.progress { height: 6px; background: #e6ebf0; border-radius: 3px; overflow: hidden; margin: 8px 0; }
.progress i { display: block; height: 100%; width: 40%; background: var(--accent); animation: slide 1.2s infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
#btn-appliquer-retenues { margin: 4px 0 2px; }

/* groupes de propositions */
.groupe { margin-top: 10px; }
.groupe > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 12.5px; padding: 6px 2px; border-bottom: 1px solid var(--border-2); }
.groupe > summary::-webkit-details-marker { display: none; }
.groupe > summary::before { content: ""; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(-45deg); transition: transform .15s; margin: 0 3px; }
.groupe[open] > summary::before { transform: rotate(45deg); }
.groupe > summary .badge { margin-left: auto; }
.groupe .vide { padding: 8px 2px; }

.card { border: 1px solid var(--border); border-radius: var(--radius); padding: 9px; margin: 8px 0; background: #fff; transition: border-color .15s, box-shadow .15s; }
.card:hover { border-color: #b9c6d3; box-shadow: 0 1px 6px rgba(16,24,40,.07); }
.card.retenue { border-left: 3px solid var(--accent); }
.card.done { background: #f3f9f4; border-color: #bfe0c3; border-left: 3px solid var(--ok); }
.card.muet { background: #fafbfc; }
.card-top { display: flex; gap: 10px; }
.vignette { width: 84px; height: 84px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); background: #f3f5f7; flex: none; cursor: zoom-in; }
.card.mention .vignette { width: 120px; height: 72px; object-fit: contain; }
.card-corps { flex: 1; min-width: 0; }
.card .head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 3px; }
.card .head b { font-size: 12.5px; }
.card .dot { width: 11px; height: 11px; border-radius: 50%; border: 1px solid rgba(0,0,0,.3); flex: none; }
.card .ligne { font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.card .parcelles { font-size: 11.5px; color: var(--text); max-height: 34px; overflow: auto; margin: 2px 0; }
.card .cible { display: flex; gap: 6px; align-items: center; margin-top: 7px; }
.card .cible select { flex: 1; min-width: 0; padding: 5px 6px; font-size: 12.5px; }
.card .cible input { flex: 1; padding: 5px 6px; font-size: 12.5px; }
.card .raison { font-size: 11.5px; color: var(--muted); margin-top: 3px; font-style: italic; }
.card .pied { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.card .pied .retenir { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--text); margin-right: auto; cursor: pointer; }
.card .pied .etat { margin-right: auto; display: inline-flex; gap: 6px; align-items: center; }
.id-prop { font-size: 10.5px; color: #8b98a6; font-variant-numeric: tabular-nums; }

/* cartes déjà traitées */
.scan-ligne { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--border-2); }
.scan-ligne:last-child { border-bottom: 0; }
.scan-nom { display: flex; gap: 7px; align-items: flex-start; min-width: 0; color: var(--text); font-size: 12.5px; }
.scan-nom .ic { margin-top: 2px; color: var(--muted); }
.scan-nom span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scan-nom small { display: block; color: var(--muted); font-size: 11px; }

/* ---------- fenêtres modales */
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 40; display: flex; align-items: center; justify-content: center; }
.modal { background: #fff; border-radius: 10px; width: min(900px, 94vw); max-height: 88vh; overflow: auto; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal.petit { width: min(460px, 94vw); }
.modal.moyen { width: min(640px, 94vw); }
.modal .head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: #fff; z-index: 1; }
.modal .head h3 { font-size: 15px; }
.modal .body { padding: 14px 16px; }
.modal .actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }
.modal label.champ { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
table { border-collapse: collapse; width: 100%; font-size: 12.5px; }
th, td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 11.5px; text-transform: uppercase; letter-spacing: .04em; }
tr.annule td { color: #9aa7b4; text-decoration: line-through; }
tr.annule td:last-child { text-decoration: none; }
tr.annule td:last-child .btn { color: var(--accent-dark); }
tr.trace td { color: #7d8894; font-size: 11.5px; }

/* export */
.export-bloc { border: 1px solid var(--border); border-radius: 9px; padding: 12px; margin-bottom: 12px; }
.export-bloc h4 { margin: 0 0 3px; font-size: 13.5px; }
.export-vedette { display: flex; gap: 14px; align-items: center; background: var(--accent-soft); border: 1px solid #b5d8e5; border-radius: 9px; padding: 12px; margin: 10px 0; }
.export-vedette .btn { flex: none; }
.export-vedette .resume { flex: 1; font-size: 12.5px; }
.export-liste { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.export-liste .btn { justify-content: flex-start; text-align: left; padding: 8px 10px; }
.export-liste .btn small { display: block; color: var(--muted); font-size: 11px; font-weight: 400; }
.export-liste .btn span { display: block; }

/* ---------- feuille d'un autre outil et calage manuel par points d'appui */
#import-row .btn { width: 100%; justify-content: center; }
.modal.calage { width: 96vw; height: 90vh; max-height: 90vh; display: flex; flex-direction: column; overflow: hidden; }
.modal.calage .body { flex: 1; min-height: 0; display: flex; flex-direction: column; padding: 10px 14px 12px; overflow: auto; }
.calage { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 8px; }
.calage-aide { display: flex; gap: 8px; align-items: flex-start; font-size: 12.5px; line-height: 1.4; background: var(--accent-soft); color: var(--accent-dark); border: 1px solid #b5d8e5; border-radius: 7px; padding: 7px 10px; flex: none; }
.calage-aide .ic { margin-top: 1px; }
.calage-vues { flex: 1; min-height: 220px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.calage-vue { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.calage-vue-titre { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; min-height: 24px; font-size: 12.5px; white-space: nowrap; overflow: hidden; }
.calage-vue-titre .help { overflow: hidden; text-overflow: ellipsis; }
.calage-img, .calage-carte { position: relative; flex: 1; min-height: 0; border: 1px solid var(--border); border-radius: 7px; overflow: hidden; background: #e9edf1; }
.calage-img { cursor: crosshair; user-select: none; -webkit-user-select: none; touch-action: none; outline-offset: -2px; }
.calage-img.glisse { cursor: grabbing; }
.calage-img img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; box-shadow: 0 1px 6px rgba(0,0,0,.25); background: #fff; }
.calage-pts { position: absolute; inset: 0; pointer-events: none; }
.calage-img-etat { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 20px; color: var(--muted); font-size: 13px; }
.calage-img-etat.err { color: #8e1c1c; background: #fdecec; }
.calage-zoom { margin-left: auto; display: inline-flex; gap: 3px; flex: none; }
.calage-zoom .btn { min-width: 26px; justify-content: center; font-weight: 600; padding: 1px 7px; }
.calage-point { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid #f76707; box-shadow: 0 0 0 1.5px #fff, 0 1px 4px rgba(0,0,0,.4); cursor: move; }
.calage-point::after { content: ""; position: absolute; left: 50%; top: 50%; width: 4px; height: 4px; margin: -2px 0 0 -2px; border-radius: 50%; background: #f76707; box-shadow: 0 0 0 1px #fff; }
.calage-point b { position: absolute; left: 13px; top: -15px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px; background: #f76707; color: #fff; font-size: 11px; font-weight: 700; display: flex; align-items: center; justify-content: center; border: 1.5px solid #fff; line-height: 1; }
.calage-pastille { position: absolute; transform: translate(-50%, -50%); pointer-events: auto; }
.calage-point.suspect { border-color: var(--danger); animation: calage-alerte 1s ease-in-out infinite alternate; }
.calage-point.suspect::after, .calage-point.suspect b { background: var(--danger); }
@keyframes calage-alerte { to { box-shadow: 0 0 0 1.5px #fff, 0 0 0 6px rgba(198, 40, 40, .35); } }
.calage-carte .maplibregl-canvas { cursor: crosshair; }
.calage-bas { flex: none; display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 14px; max-height: 38vh; min-height: 0; }
.calage-liste { display: flex; flex-direction: column; min-height: 0; }
.calage-liste-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.calage-table { overflow: auto; min-height: 0; max-height: 26vh; border: 1px solid var(--border-2); border-radius: 7px; }
.calage-table table th { position: sticky; top: 0; background: #fff; z-index: 1; }
.calage-table td, .calage-table th { padding: 3px 8px; vertical-align: middle; }
.calage-table td.num, .calage-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.calage-table tr.suspect td { background: #fdecec; color: #8e1c1c; font-weight: 600; }
.calage-table tr.suspect .ic { color: var(--danger); width: 14px; height: 14px; margin-right: 4px; vertical-align: -2px; }
.calage-num { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; border-radius: 10px; background: #f76707; color: #fff; font-size: 11px; font-weight: 700; padding: 0 5px; }
tr.suspect .calage-num { background: var(--danger); }
.calage-ok { display: inline-flex; align-items: center; gap: 3px; color: var(--ok); font-weight: 600; }
.calage-ok .ic { width: 14px; height: 14px; }
.calage-attente { color: var(--warn); font-style: italic; }
.calage-reglages { display: flex; flex-direction: column; gap: 4px; min-height: 0; overflow: auto; }
.calage-reglages .row { margin: 0; flex-wrap: nowrap; justify-content: space-between; }
.calage-modes { display: flex; flex-direction: column; gap: 3px; margin: 4px 0; font-size: 12.5px; }
.calage-modes label { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.calage-modes input { accent-color: var(--accent); margin: 0; }
.calage-controle { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 7px; padding: 6px 9px; }
.calage-ecart { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--text); font-size: 13px; }
.calage-err { color: var(--danger); display: inline-flex; gap: 5px; align-items: center; }
.calage-err .ic { width: 14px; height: 14px; }
.calage-reglages .alerte { margin: 2px 0; }
.calage-reglages .actions { margin-top: 4px; }

/* ---------- carte */
#tooltip { position: fixed; pointer-events: none; background: rgba(31, 42, 55, .95); color: #fff; padding: 6px 9px; border-radius: 6px; font-size: 12px; z-index: 30; max-width: 260px; line-height: 1.35; }
#toast { position: fixed; top: calc(var(--header-h) + 12px); left: 50%; transform: translateX(-50%); background: #1f2a37; color: #fff; padding: 9px 16px; border-radius: 8px; z-index: 60; box-shadow: var(--shadow-lg); font-size: 13px; max-width: min(640px, 90vw); }
#toast.err { background: var(--danger); }
#toast.ok { background: var(--ok); }
.lasso-canvas { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.maplibregl-ctrl-scale { font-size: 11px; }
.maplibregl-popup-content { border-radius: 8px; padding: 10px 12px; box-shadow: var(--shadow-lg); font-size: 12.5px; }
.pop-point h4 { margin: 0 0 6px; font-size: 13px; display: flex; align-items: center; gap: 7px; padding-right: 14px; }
.pop-point .kv { margin: 4px 0 8px; }
.kbd { display: inline-block; border: 1px solid #c9d2dc; border-bottom-width: 2px; border-radius: 4px; padding: 0 5px; font-size: 11px; background: #fff; }
.stats-table td { padding: 3px 6px; font-size: 12px; }
.stats-table td.num, .stats-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.delta-plus { color: var(--ok); }
.delta-minus { color: var(--danger); }

/* ---------- écran de chargement */
#chargement { position: fixed; inset: 0; z-index: 100; background: var(--bg); display: flex; align-items: center; justify-content: center; transition: opacity .3s; }
#chargement.fini { opacity: 0; pointer-events: none; }
.chargement-boite { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; font-size: 15px; font-weight: 600; }
.chargement-boite .logo { width: 44px; height: 44px; border-radius: 10px; }
.chargement-boite .help { font-weight: 400; }
.spinner { width: 30px; height: 30px; border: 3px solid #d5dee7; border-top-color: var(--accent); border-radius: 50%; animation: tourne .8s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }
#chargement.erreur .spinner { display: none; }
#chargement.erreur #chargement-txt { color: var(--danger); }

/* ---------- écrans plus étroits */
@media (max-width: 1400px) {
  header .brand small { display: none; }
}
@media (max-width: 1320px) {
  header { gap: 8px; }
  #btn-journal .lbl, #btn-imprimer .lbl { display: none; }
  #btn-journal, #btn-imprimer { padding: 5px 7px; }
}
@media (max-width: 1100px) {
  .stats-pills #stat-ops { display: none; }
  #btn-export .lbl { display: none; }
}

/* ---------- identité, temps réel, lecture seule (version web 0.3) */
#btn-menu { display: none; }
.direct { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #b8c4d1; white-space: nowrap; flex: none; }
.direct i { width: 9px; height: 9px; border-radius: 50%; background: #8a97a5; box-shadow: 0 0 0 2px rgba(138, 151, 165, .25); flex: none; }
.direct.en-direct { color: #d9f2dd; }
.direct.en-direct i { background: #3fbf5a; box-shadow: 0 0 0 2px rgba(63, 191, 90, .3); }
.direct.secours { color: #f3e3bd; }
.direct.secours i { background: #e0a526; box-shadow: 0 0 0 2px rgba(224, 165, 38, .3); }
.utilisateur { position: relative; flex: none; }
#btn-utilisateur { padding: 3px 8px 3px 3px; gap: 8px; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: #4da6c7; color: #fff; font-size: 12px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; letter-spacing: .02em; flex: none; }
.avatar.grand { width: 38px; height: 38px; font-size: 14px; }
.utilisateur .nom { max-width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-u { position: absolute; right: 0; top: calc(100% + 8px); width: 280px; max-width: calc(100vw - 16px); background: #fff; color: var(--text); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 12px; z-index: 30; display: flex; flex-direction: column; gap: 10px; }
.mu-tete { display: flex; gap: 10px; align-items: center; min-width: 0; }
.mu-tete > div { min-width: 0; }
.mu-nom { font-weight: 600; overflow-wrap: anywhere; }
.mu-email { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.mu-role { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu-u .mu-deco { justify-content: center; color: var(--text); background: #fff; border: 1px solid var(--border); text-decoration: none; min-height: 36px; }
.menu-u .mu-deco:hover { background: #f0f3f6; }
#bandeau-lecture { flex: none; font-size: 11.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: #fff4e0; color: #7a4a00; border: 1px solid #f2d59f; white-space: nowrap; cursor: default; }
.drop.inactif { opacity: .5; cursor: not-allowed; }
.modal-bg.au-dessus { z-index: 120; }
body.lecture-seule .zchip { cursor: not-allowed; opacity: .55; }
body.outil-trace .maplibregl-canvas-container { touch-action: none; }

/* sélection multiple et recherche par zone */
#btn-multi { width: 100%; justify-content: center; margin-top: 6px; }
.suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 12; background: #fff; border: 1px solid var(--border); border-radius: 8px; box-shadow: var(--shadow); padding: 4px; }
.suggestion { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: transparent; border-radius: 6px; padding: 8px; min-height: 36px; }
button.suggestion:hover, button.suggestion:focus-visible { background: var(--accent-soft); }
.suggestion.vide { color: var(--muted); font-size: 12px; }

/* fenêtre Détail : une zone par parcelle */
.detail-tete { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; margin-bottom: 10px; }
.detail-table { max-height: 52vh; overflow: auto; border: 1px solid var(--border-2); border-radius: 7px; }
.detail-table th { position: sticky; top: 0; background: #fff; z-index: 1; }
.detail-table td { vertical-align: middle; }
.detail-table td.num, .detail-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.detail-table select { min-width: 150px; padding: 4px 6px; }
.detail-table tr.change td { background: #eef7fa; }
.detail-table tr.change td:first-child { box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
#detail-compte { margin-right: auto; align-self: center; }
.table-defil { overflow-x: auto; }
.lbl-fermer { display: none; }
#voile { display: none; }
.seulement-mobile { display: none; }

/* ---------- tablette et téléphone (moins de 900 px) */
@media (max-width: 1320px) {
  .utilisateur .nom { display: none; }
  #btn-utilisateur { padding: 3px; }
}
@media (max-width: 1100px) {
  .direct .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  header select { max-width: 190px; }
}
@media (max-width: 899px) {
  :root { --left-w: 0px; }
  /* le menu du compte passe au-dessus du tiroir et du panneau plein écran */
  header { gap: 6px; padding: 0 8px; z-index: 30; }
  #btn-menu { display: inline-flex; }
  header .brand > div:last-child { display: none; }
  header select { flex: 0 1 auto; min-width: 0; max-width: 180px; }
  .stats-pills { display: none; }
  #btn-scan .lbl, #btn-export .lbl { display: none; }
  header .btn, header .btn.icon, header .btn.primary { min-width: 44px; min-height: 44px; justify-content: center; padding: 5px 8px; }
  #btn-utilisateur { padding: 0; }
  #carte-zone, body.right-open #carte-zone { left: 0; right: 0; }
  #left { width: min(340px, 88vw); z-index: 25; transform: translateX(-100%); transition: transform .2s, visibility .2s; visibility: hidden; box-shadow: var(--shadow-lg); }
  body.left-open #left { transform: none; visibility: visible; }
  body.left-open #voile { display: block; position: fixed; inset: var(--header-h) 0 0 0; background: rgba(15, 23, 42, .35); z-index: 24; }
  #right { width: 100%; z-index: 26; border-left: 0; }
  .right-head { min-height: 56px; }
  #btn-right-close { min-height: 44px; padding: 6px 12px; border: 1px solid var(--border); color: var(--text); }
  .lbl-fermer { display: inline; }
  /* cibles tactiles */
  .tools .btn, #btn-multi, .section h2 .btn, .zchip, #btn-appliquer, .search input, #motif, #auteur, .row select { min-height: 44px; }
  .zchip { min-width: 48px; }
  #barre-action { left: 8px; right: 8px; bottom: 12px; transform: none; max-width: none; flex-wrap: wrap; gap: 8px; padding: 8px; }
  #barre-action .btn { min-height: 44px; }
  .ba-info { flex: 1 1 auto; }
  .ba-sep { display: none; }
  .ba-cible { position: static; flex: 1 1 140px; }
  #ba-choix { width: 100%; min-width: 0; justify-content: center; }
  #ba-appliquer { flex: 1 1 120px; justify-content: center; }
  #ba-detail { flex: 0 0 auto; }
  #barre-action .popover { left: 0; right: 0; bottom: calc(100% + 8px); width: auto; transform: none; max-height: 55vh; overflow: auto; }
  /* fenêtres en plein écran */
  .modal-bg { align-items: stretch; }
  .modal, .modal.petit, .modal.moyen, .modal.calage { width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; display: flex; flex-direction: column; }
  .modal .head { min-height: 56px; }
  .modal .head .btn[data-fermer] { min-width: 44px; min-height: 44px; justify-content: center; }
  .modal .body { flex: 1; overflow: auto; }
  .modal .actions { flex-wrap: wrap; }
  .modal .actions .btn { min-height: 44px; }
  .export-liste { grid-template-columns: 1fr; }
  .export-vedette { flex-direction: column; align-items: stretch; }
  .detail-tete { grid-template-columns: 1fr; }
  .detail-table { max-height: none; }
  .detail-table th, .detail-table td { padding: 6px 5px; }
  .detail-table select { min-width: 0; width: 100%; min-height: 44px; }
  .detail-table td:last-child { width: 44%; }
  #detail-compte { flex-basis: 100%; }
  .modal .actions .btn { flex: 1 1 auto; justify-content: center; }
  .calage-vues { grid-template-columns: 1fr; min-height: 520px; }
  .calage-bas { grid-template-columns: 1fr; max-height: none; }
  .suggestion { min-height: 44px; }
  #tooltip { display: none; }
}
@media (max-width: 599px) {
  header .brand, #groupe-outils { display: none; }
  .seulement-mobile { display: block; }
  header select { max-width: 150px; }
  .direct .lbl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  #legende-carte { display: none; }
  .ba-zones { display: none; }
  /* lecteur sur téléphone : Annuler et Rétablir (inactifs) laissent la place à la pastille Lecture seule */
  body.lecture-seule header .btn-group { display: none; }
  #bandeau-lecture { padding: 3px 8px; font-size: 11px; }
}

/* ---------- page de connexion (comptes locaux) */
body.page-connexion { height: auto; min-height: 100%; display: flex; flex-direction: column; }
body.page-connexion header { position: static; }
/* sur la page de connexion, le nom de l'application reste visible même sur téléphone */
body.page-connexion header .brand { display: flex !important; }
body.page-connexion header .brand > div:last-child { display: block !important; }
a.btn { text-decoration: none; }
.connexion { flex: 1; display: flex; align-items: flex-start; justify-content: center; padding: 56px 16px 32px; }
.connexion-carte { background: var(--panel); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow); width: min(430px, 100%); padding: 24px 24px 20px; display: flex; flex-direction: column; gap: 12px; }
.connexion-carte h1 { font-size: 20px; }
.connexion-carte p { margin: 0; }
.connexion-carte form { display: flex; flex-direction: column; gap: 6px; }
.connexion-carte label.champ { font-size: 12px; color: var(--muted); margin-top: 4px; }
.connexion-carte input { min-height: 38px; font-size: 14px; }
.connexion-carte .btn.large { min-height: 40px; margin-top: 8px; }
.connexion-carte #bloc-microsoft { display: flex; flex-direction: column; gap: 6px; }
.connexion-carte #bloc-microsoft.hidden, .connexion-carte form.hidden { display: none; }
.mdp { display: flex; gap: 6px; align-items: center; }
.mdp input { flex: 1; }
.separateur { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.separateur::before, .separateur::after { content: ""; flex: 1; border-top: 1px solid var(--border); }
.connexion-erreur { background: #fdecec; color: var(--danger); border: 1px solid #f1c0c0; border-radius: 6px; padding: 8px 10px; }
.connexion-info { background: var(--accent-soft); color: var(--accent-dark); border-radius: 6px; padding: 8px 10px; }

/* ---------- gestion des comptes locaux (administrateurs) */
.table-comptes { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-top: 6px; }
.table-comptes th, .table-comptes td { text-align: left; padding: 6px 6px; border-bottom: 1px solid var(--border-2); vertical-align: middle; }
.table-comptes th { color: var(--muted); font-weight: 600; font-size: 11.5px; }
.table-comptes tr.inactif td { color: var(--muted); }
.table-comptes td.actions-compte { text-align: right; }
.table-comptes td.actions-compte .btn { margin: 2px 0 2px 4px; }
.table-comptes select { width: auto; padding: 3px 6px; }
.grille-compte { display: grid; grid-template-columns: 1fr 1.3fr 140px auto; gap: 8px; align-items: end; }
.mdp-genere { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 16px; letter-spacing: .5px; background: var(--panel-2); border: 1px dashed var(--accent); border-radius: 6px; padding: 10px 12px; user-select: all; overflow-wrap: anywhere; }
.encart { background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 899px) {
  .grille-compte { grid-template-columns: 1fr; }
  .table-comptes .col-secondaire { display: none; }
  .connexion { padding-top: 24px; }
}

/* ---------- version 0.5 : légende complète, dessin, découpage, prescriptions, bilan, vue communautaire */
/* cases de zone hachurées : fond (--f) et hachure diagonale, croisée ou en grille (zone ENR) */
.swatch.hatch, .zchip.hatch { background-color: var(--f, #fff) !important; }
.zchip.hatch { background-image: repeating-linear-gradient(135deg, var(--c) 0 2px, transparent 2px 6px) !important; }
.zchip.hatch.croisee, .swatch.hatch.croisee { background-image: repeating-linear-gradient(135deg, var(--c) 0 1.5px, transparent 1.5px 5px), repeating-linear-gradient(45deg, var(--c) 0 1.5px, transparent 1.5px 5px) !important; }
.zchip.hatch.grille, .swatch.hatch.grille { background-image: linear-gradient(var(--c) 1.5px, transparent 1.5px), linear-gradient(90deg, var(--c) 1.5px, transparent 1.5px) !important; background-size: 6px 6px !important; }
.swatch.hatch { background-image: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 6px); }

/* symboles des prescriptions (légende, boutons, fiches) */
.symb { width: 20px; height: 13px; border-radius: 2px; flex: none; display: inline-block; vertical-align: middle; position: relative; box-sizing: border-box;
  border: 1.5px solid var(--c); background-color: transparent; }
.symb.contour-tirets { border-style: dashed; }
.symb.motif-plein { background-color: var(--f, var(--c)); }
.symb.motif-croisillons { background-image: repeating-linear-gradient(45deg, var(--c) 0 1px, transparent 1px 5px), repeating-linear-gradient(-45deg, var(--c) 0 1px, transparent 1px 5px); }
.symb.motif-cercles { background-color: color-mix(in srgb, var(--f, #fff) calc(var(--o, .5) * 100%), transparent);
  background-image: radial-gradient(circle, transparent 1.2px, var(--c) 1.3px 2px, transparent 2.1px); background-size: 6px 6px; }
.symb.motif-points { background-color: color-mix(in srgb, var(--f, #fff) calc(var(--o, .5) * 100%), transparent);
  background-image: radial-gradient(circle, var(--c) 1px, transparent 1.3px); background-size: 4px 4px; }
.symb.motif-aucun.contour-tirets { border-width: 2px; }
.symb-ligne { width: 20px; height: 13px; flex: none; display: inline-block; vertical-align: middle;
  background-image: radial-gradient(circle, var(--c) 2px, transparent 2.3px); background-size: 6px 13px; background-repeat: repeat-x; background-position: 0 50%; }

/* légende de la carte, repliable */
#legende-carte { padding: 0; max-height: calc(100% - 90px); display: flex; flex-direction: column; width: 270px; color: var(--text); }
#legende-carte .legende-tete { display: flex; align-items: center; gap: 7px; width: 100%; border: 0; background: transparent; padding: 6px 10px; font-weight: 600; font-size: 12px; color: var(--text); border-bottom: 1px solid var(--border-2); }
#legende-carte .legende-tete::after { content: ""; margin-left: auto; width: 6px; height: 6px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg); transition: transform .15s; }
#legende-carte.replie { width: auto; }
#legende-carte.replie .legende-tete { border-bottom: 0; }
#legende-carte.replie .legende-tete::after { transform: rotate(-45deg); }
#legende-carte.replie #legende-corps { display: none; }
#legende-corps { overflow-y: auto; padding: 4px 10px 8px; }
#legende-corps > div { display: flex; align-items: center; gap: 7px; line-height: 1.35; padding: 2px 0; font-size: 11px; white-space: normal; }
#legende-corps > div > span:not(.symb):not(.symb-ligne):not(.pt-dot) { min-width: 0; }
#legende-corps .swatch { width: 20px; height: 13px; }
#legende-corps .pt-dot { margin: 0 4px; }
#legende-corps .lg-titre { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; margin-top: 6px; padding-top: 4px; }
#legende-corps .lg-titre:first-child { margin-top: 0; }
.lg { width: 20px; height: 13px; }
.lg-decoupe { border-top: 2px dashed #7b1fa2; height: 0; margin: 6px 0; }
.lg-dp { border: 2px dashed #37474f; background: rgba(55,71,79,.08); }
.lg-commune { border-top: 2px dashed #684635; height: 0; margin: 6px 0; }
.lg-absente { background: rgba(138, 150, 163, .3); border: 1px dashed #8a96a3; }
.lg-modif-ligne.masque > span, .lg-modif-ligne.masque > .lg { opacity: .4; }
.lg-oeil { margin-left: auto; border: 1px solid var(--border); background: #fff; border-radius: 5px; padding: 1px 4px; display: inline-flex; color: var(--muted); }
.lg-oeil .ic { width: 14px; height: 14px; }
.lg-oeil.actif { color: var(--accent-dark); border-color: var(--accent); background: var(--accent-soft); }

/* boutons de prescriptions et de découpage */
.presc-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; margin-bottom: 6px; }
.presc-grille .btn { justify-content: flex-start; padding: 5px 6px; font-size: 12px; min-width: 0; }
.presc-grille .btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.presc-points { grid-template-columns: 1fr 1fr; }
.outils-dessin .btn { padding: 6px 4px; font-size: 12px; gap: 4px; }

/* barre du tracé en cours */
#barre-dessin { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 7; background: #fff; border: 1px solid var(--border); border-left: 4px solid #e65100;
  border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px 10px; display: flex; flex-direction: column; gap: 6px; width: min(640px, calc(100% - 24px)); }
.bd-ligne { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.bd-titre { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; }
.bd-formes { display: inline-flex; gap: 3px; }
.bd-mesure { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 600; color: #e65100; font-size: 12.5px; }
.bd-consigne { font-size: 12px; color: var(--muted); }
.bd-espace { flex: 1; }
body.dessin-en-cours #barre-action, body.apercu-decoupe #barre-action { display: none; }

/* aperçu du découpage */
#panneau-decoupe { position: absolute; top: 12px; right: 12px; z-index: 7; width: min(390px, calc(100% - 24px)); max-height: calc(100% - 24px); overflow: auto; background: #fff;
  border: 1px solid var(--border); border-left: 4px solid #7b1fa2; border-radius: 10px; box-shadow: var(--shadow-lg); padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.pd-tete { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.pd-tete b { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; }
.pd-table { border: 1px solid var(--border-2); border-radius: 7px; overflow: auto; max-height: 46vh; }
.pd-table td, .pd-table th { padding: 5px 6px; vertical-align: middle; }
.pd-table td small { display: block; color: var(--muted); font-size: 11px; }
.pd-table td.num, .pd-table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.pd-table select { padding: 4px 6px; min-width: 130px; }
.pd-num { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-weight: 700; font-size: 12px; text-shadow: 0 0 2px rgba(0,0,0,.6); border: 2px solid #4a148c; }
.pd-plan { color: var(--muted); font-size: 11px; }
.pd-presc-lib { margin-top: 4px; width: 100%; padding: 4px 6px; font-size: 12px; }
.pd-table tr.pd-dp td:nth-child(2) { color: #37474f; font-style: italic; }
.pd-actions { display: flex; justify-content: flex-end; gap: 8px; }
button.lien { border: 0; background: none; color: var(--accent); padding: 0; text-decoration: underline; font-size: inherit; cursor: pointer; }

/* fiche d'une prescription, saisie d'une nouvelle prescription */
.presc-entete { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding: 8px 10px; background: var(--panel-2); border: 1px solid var(--border-2); border-radius: 8px; }
.presc-entete .symb, .presc-entete .symb-ligne { width: 30px; height: 20px; }
.pop-presc h4 .symb { margin-right: 2px; }
.pop-presc hr { border: 0; border-top: 1px solid var(--border-2); margin: 8px 0; }
.imp-option { margin-top: 10px; }
.imp-option label { color: var(--text); font-size: 12.5px; }

/* bilan des surfaces */
.stats-table tr.total td { border-top: 1px solid var(--border); font-weight: 600; background: var(--panel-2); }
.stats-table td:first-child:not(.help) { white-space: nowrap; }
.stats-table td.help { white-space: normal; padding-top: 6px; }
.stats-table .swatch { width: 13px; height: 11px; }
.stats-table th, .stats-table td { padding-left: 4px; padding-right: 4px; }
.stats-table td { font-size: 11.5px; }
.stats-table td.num { white-space: nowrap; }
.bilan-actions { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 8px; }
.bilan-actions .btn { flex: 1 1 auto; justify-content: center; }
.table-bilan td.num, .table-bilan th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table-bilan tr.total td { background: var(--panel-2); font-weight: 600; }
.modal h4 { margin: 14px 0 6px; font-size: 13px; }

/* vue communautaire : consultation, les outils de modification sont masqués */
.cc-liste { display: flex; flex-direction: column; max-height: 46vh; overflow-y: auto; border: 1px solid var(--border-2); border-radius: 7px; }
.cc-ligne { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--border-2); }
.cc-ligne:last-child { border-bottom: 0; }
.cc-nom { flex: 1; min-width: 0; text-align: left; border: 0; background: transparent; padding: 2px; border-radius: 5px; }
.cc-nom:hover { background: var(--accent-soft); }
.cc-nom b { display: block; font-weight: 600; font-size: 12.5px; }
.cc-nom small { display: block; color: var(--muted); font-size: 11px; }
.cc-ligne.absente .cc-nom b { color: var(--muted); font-weight: 500; }
body.vue-communaute .edition, body.vue-communaute #btn-scan, body.vue-communaute header .btn-group:not(#groupe-outils),
body.vue-communaute #btn-journal, body.vue-communaute #btn-imprimer, body.vue-communaute #btn-journal-m, body.vue-communaute #btn-imprimer-m,
body.vue-communaute #btn-bilan-commune, body.vue-communaute #barre-action { display: none !important; }
body.vue-communaute #lyr-source, body.vue-communaute #lyr-batiments, body.vue-communaute #lyr-points, body.vue-communaute #lyr-labels, body.vue-communaute #lyr-decoupe { pointer-events: none; }
body.vue-communaute .repliable .row:has(#lyr-source), body.vue-communaute .repliable .row:has(#lyr-batiments), body.vue-communaute .repliable .row:has(#lyr-points),
body.vue-communaute .repliable .row:has(#lyr-labels), body.vue-communaute .repliable .row:has(#lyr-decoupe) { display: none; }

@media (max-width: 899px) {
  #barre-dessin { top: 8px; width: calc(100% - 16px); }
  #barre-dessin .btn { min-height: 40px; }
  #panneau-decoupe { top: auto; bottom: 8px; right: 8px; left: 8px; width: auto; max-height: 55%; }
  .presc-grille .btn, .outils-dessin .btn { min-height: 44px; }
  #legende-carte { max-height: 60%; width: min(270px, calc(100% - 20px)); }
}
@media (max-width: 599px) {
  #legende-carte { display: flex; }
  .bd-consigne { display: none; }
}
#legende-carte #legende-corps { display: block; white-space: normal; }
