.btnlink.go { border-color: var(--or, #e8a33d); background: #fff7e8; font-weight: 600; }
.btnlink.go:hover { background: #ffeecd; }

/* bandeau d'alerte de cohérence (adresse / commune / dossier ouvert dans un autre onglet) */
.alerte { margin: 0 0 8px; padding: 9px 14px; border: 2px solid #c62828; border-left-width: 6px; border-radius: 8px; background: #fff1f0; color: #7f1d1d; font-size: 13px; line-height: 1.45; }
.alerte b { color: #b71c1c; }
.alerte ul { margin: 4px 0 0 18px; padding: 0; }
.alerte .fix { margin-left: 8px; padding: 2px 8px; font-size: 12px; }

/* volet Dépôt : lignes à copier */
#depotFields { margin-top: 10px; }
#depotFields h4 { margin: 12px 0 5px; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; color: #6b7280; }
.crow { display: flex; align-items: center; gap: 8px; padding: 3px 0; border-bottom: 1px solid #f0f2f5; }
.crow .clab { flex: 0 0 210px; font-size: 12.5px; color: #4b5563; }
.crow .cval { flex: 1; font-family: ui-monospace, Consolas, monospace; font-size: 12.5px; background: #f7f8fa; border-radius: 6px; padding: 4px 8px; white-space: pre-wrap; word-break: break-word; }
.crow .cval.vide { color: #b91c1c; background: #fff1f0; }
.crow button { flex: 0 0 auto; padding: 3px 9px; font-size: 12px; }

/* bloc de panneaux sélectionné sur le plan : mise en avant dans la liste */
.blocitem { border-radius: 8px; transition: background .15s, box-shadow .15s; }
.blocitem.sel { background: #fff4e0; box-shadow: inset 0 0 0 2px #e11; }

/* reprise d'incomplétude */
.incbox { margin-top: 12px; padding: 10px 12px; border: 2px solid #fca5a5; border-radius: 10px; background: #fff8f8; }
.incbox h3 { display: flex; align-items: center; gap: 8px; margin-top: 0; }
.incList .item { gap: 6px; }
.incList { margin: 6px 0; }

/* visionneuse de pièce — sélecteurs par id pour passer devant les règles génériques de dialog */
/* display:flex ne doit s'appliquer QU'À la boîte ouverte : sinon il écrase le
   « dialog:not([open]) { display:none } » du navigateur et la fenêtre reste
   affichée en bas de page, fermée mais visible et impossible à faire partir. */
dialog#dlgVue { display: none; }
dialog#dlgVue[open] { width: 94vw; max-width: 1250px; height: 92vh; max-height: 92vh; padding: 0; border: none; border-radius: 12px; box-shadow: 0 18px 60px rgba(0,0,0,.35); display: flex; flex-direction: column; overflow: hidden; }
dialog#dlgVue::backdrop { background: rgba(15,23,42,.6); }
dialog#dlgVue[open] .vuehead { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #e5e7eb; background: #f8fafc; flex: 0 0 auto; }
dialog#dlgVue[open] .vuehead .grow { flex: 1; }
dialog#dlgVue[open] #vueBody { flex: 1 1 auto; min-height: 0; overflow: auto; background: #525659; display: flex; align-items: flex-start; justify-content: center; }
dialog#dlgVue[open] #vueBody img { max-width: 100%; height: auto; }
dialog#dlgVue[open] #vueBody iframe { width: 100%; height: 100%; border: 0; background: #fff; }
dialog#dlgVue[open] #vueOcrOut { flex: 0 0 auto; max-height: 38%; overflow: auto; background: #fff; border-top: 2px solid #111; padding: 10px 12px; font-size: 12.5px; white-space: pre-wrap; }

/* ---------- Aide repliée : un « ? » par outil au lieu de paragraphes partout ---------- */
.aide-btn {
  margin-left: auto; width: 18px; height: 18px; flex: 0 0 18px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #cbd5e1; border-radius: 50%; background: #fff; color: #64748b;
  font-size: 11.5px; font-weight: 700; line-height: 1; cursor: help;
}
.aide-btn:hover { background: #eef2f7; color: #334155; border-color: #94a3b8; }
.aide-btn.on { background: #2563eb; border-color: #2563eb; color: #fff; }
.tsec > summary:has(.aide-btn)::after { margin-left: 8px; }
.aide-pop {
  background: #f8fafc; border: 1px solid #dbe3ee; border-left: 3px solid #2563eb;
  border-radius: 6px; padding: 8px 10px; margin: 4px 0 10px;
  font-size: 11.5px; line-height: 1.45; color: #475569;
}
.aide-pop .hint { margin: 0 0 6px; padding: 0; border: none; background: none; font-size: 11.5px; }
.aide-pop .hint:last-child { margin-bottom: 0; }

/* ---------- Blocs liés : déplacement solidaire ---------- */
.blocitem.selgroupe { background: #fff8ec; box-shadow: inset 0 0 0 2px #f59e0b; }
.blocitem.selgroupe.sel { box-shadow: inset 0 0 0 2px #e11, inset 0 0 0 4px #f59e0b; }

/* ---------- Éditeur de photomontage ---------- */
dialog#dlgMontage { display: none; }
dialog#dlgMontage[open] {
  width: 96vw; max-width: 1500px; height: 94vh; max-height: 94vh; padding: 0;
  border: none; border-radius: 12px; box-shadow: 0 18px 60px rgba(0,0,0,.35);
  display: flex; flex-direction: column; overflow: hidden;
}
dialog#dlgMontage::backdrop { background: rgba(15,23,42,.65); }
dialog#dlgMontage .vuehead { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-bottom: 1px solid #e5e7eb; background: #f8fafc; flex: 0 0 auto; }
dialog#dlgMontage .vuehead .grow { flex: 1; }
dialog#dlgMontage .mtbar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 12px; border-bottom: 1px solid #e5e7eb; background: #fff; flex: 0 0 auto; }
dialog#dlgMontage .mtbar .sep { width: 1px; height: 20px; background: #e2e8f0; margin: 0 4px; }
dialog#dlgMontage .mtbar button.on { background: #2563eb; border-color: #2563eb; color: #fff; }
dialog#dlgMontage .mtnum { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: #475569; margin: 0; }
dialog#dlgMontage .mtnum input { width: 90px; }
/* PAS de centrage flex sur un contenu qui déborde : la partie haut-gauche deviendrait
   inatteignable au défilement. margin:auto sur le canvas centre quand il est petit,
   et laisse tout le débord accessible quand il est zoomé. */
dialog#dlgMontage #mtWrap { flex: 1 1 auto; min-height: 0; overflow: auto; background: #525659; display: flex; }
dialog#dlgMontage #mtCanvas { margin: auto; }
dialog#dlgMontage #mtCanvas { cursor: crosshair; background: #fff; box-shadow: 0 2px 14px rgba(0,0,0,.4); touch-action: none; }
dialog#dlgMontage .mthint { flex: 0 0 auto; padding: 7px 12px; border-top: 1px solid #e5e7eb; background: #f8fafc; font-size: 12px; color: #475569; }
dialog#dlgMontage .mtzoom { font-size: 11.5px; color: #475569; min-width: 46px; text-align: center; }
dialog#dlgMontage #mtWrap.pan, dialog#dlgMontage #mtWrap.pan #mtCanvas { cursor: grabbing; }
dialog#dlgMontage .mtgrp { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
dialog#dlgMontage #mtCanvas.main { cursor: grab; }
dialog#dlgMontage #mtCanvas.main.tire { cursor: grabbing; }
dialog#dlgMontage .mtongl { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; padding: 6px 12px; border-bottom: 1px solid #e5e7eb; background: #fbfcfe; flex: 0 0 auto; min-height: 34px; }
dialog#dlgMontage .mtongl .vide { font-size: 11.5px; color: #94a3b8; }
dialog#dlgMontage .mtongl .cal { display: inline-flex; align-items: center; gap: 4px; padding: 3px 6px 3px 10px; border: 1px solid #cbd5e1; border-radius: 999px; background: #fff; font-size: 11.5px; color: #334155; cursor: pointer; }
dialog#dlgMontage .mtongl .cal:hover { background: #eef2f7; }
dialog#dlgMontage .mtongl .cal.on { background: #2563eb; border-color: #2563eb; color: #fff; }
dialog#dlgMontage .mtongl .cal .x { border: none; background: none; color: inherit; font-size: 13px; line-height: 1; padding: 0 2px; cursor: pointer; opacity: .65; }
dialog#dlgMontage .mtongl .cal .x:hover { opacity: 1; }
dialog#dlgMontage .mtbar .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: #94a3b8; }
dialog#dlgMontage .mtopts { background: #f8fafc; border-bottom: 1px solid #e5e7eb; }

/* ---------- Choix des pièces du dossier (étape Export) ---------- */
#pieces { margin: 10px 0 4px; }
#pieces h4 { margin: 0 0 6px; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; color: #64748b; display: flex; align-items: center; gap: 8px; }
#pieces h4 button { margin-left: auto; font-size: 11.5px; padding: 2px 8px; }
/* Ici la ligne entière EST la cible voulue : on coche une pièce en cliquant sa ligne.
   Le curseur main le dit, contrairement aux cases isolées des formulaires. */
/* Treize pièces empilées faisaient une colonne interminable : on les range en grille,
   deux par ligne, dans un cadre. Une ligne = une pièce, et la ligne entière est la
   cible de clic — le curseur main le dit. */
#pieces .liste { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 4px 8px;
  border: 1px solid #e5e7eb; border-radius: 9px; padding: 8px; background: #fbfcfe; }
/* `label` est en flex-direction:column dans la feuille de base : sans ce row explicite,
   chaque pièce empilait sa case, son code et son libellé sur trois lignes. */
#pieces .pc { display: flex; flex-direction: row; align-items: center; gap: 7px; padding: 3px 6px; border: 1px solid transparent; border-radius: 6px; font-size: 12.5px; background: #fff; cursor: pointer; min-width: 0; }
#pieces .pc .d { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#pieces .pc:hover { background: #eef2f7; border-color: #dbe3ee; }
#pieces .pc .n { font-weight: 600; min-width: 42px; }
#pieces .pc .d { color: #475569; }
#pieces .pc .etat { margin-left: auto; font-size: 11px; color: #64748b; white-space: nowrap; }
#pieces .pc.vide { background: #f8fafc; color: #94a3b8; }
#pieces .pc.vide .d, #pieces .pc.vide .n { color: #94a3b8; }
#pieces .pc.vide .etat { color: #b45309; }
#pieces .pc.off { opacity: .55; }
