:root {
  --noir: #0A0E14; --ardoise: #141A22; --graphite: #3A4654; --gris: #9AA7B5;
  --brume: #F3F5F7; --blanc: #fff; --bleu: #2E7CF6; --bleu-fonce: #1F5FD0;
  --rouge: #c0392b; --orange: #d9822b; --vert: #2e8b57;
  --texte: #141A22; --bord: #d8dee5;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Archivo, "Helvetica Neue", Arial, sans-serif; color: var(--texte); background: var(--brume); font-size: 15px; }
a { color: var(--bleu); }
header.barre { display: flex; align-items: center; gap: 20px; background: var(--noir); color: var(--blanc); padding: 0 16px; height: 60px; }
.logo { width: 110px; height: 60px; background: url(logo-gva-elec.png) center / 160px no-repeat; flex: none; }
header.barre nav { display: flex; gap: 16px; flex-wrap: wrap; }
header.barre nav a { color: var(--blanc); text-decoration: none; font-weight: 600; font-size: 14px; letter-spacing: .04em; }
header.barre nav a:hover { color: var(--bleu); }
header.barre .droite { margin-left: auto; }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 26px; margin: 0 0 16px; }
h2 { font-size: 19px; margin: 28px 0 12px; }
.carte { background: var(--blanc); border: 1px solid var(--bord); border-radius: 10px; padding: 20px; margin-bottom: 16px; }
.grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; }
label { display: block; font-size: 13px; color: var(--graphite); margin: 8px 0 4px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--bord); border-radius: 6px; width: 100%; background: #fff; }
input[type=checkbox] { width: auto; }
button, .bouton { font: inherit; font-weight: 600; padding: 9px 16px; border-radius: 6px; border: 1px solid var(--bleu); background: var(--bleu); color: #fff; cursor: pointer; text-decoration: none; display: inline-block; }
button:hover, .bouton:hover { background: var(--bleu-fonce); }
button.secondaire, .bouton.secondaire { background: #fff; color: var(--bleu); }
button.danger { background: #fff; color: var(--rouge); border-color: var(--rouge); }
button:disabled { opacity: .5; cursor: default; }
table { width: 100%; border-collapse: collapse; background: #fff; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--bord); text-align: left; vertical-align: top; }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--graphite); background: var(--brume); }
td.n, th.n { text-align: right; white-space: nowrap; }
.discret { color: var(--gris); font-size: 13px; }
.flash { background: #e8f1ff; border: 1px solid #b9d3ff; padding: 10px 14px; border-radius: 6px; margin-bottom: 16px; }
.etiquette { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.ok { background: #e3f4ea; color: var(--vert); } .attention { background: #fff1e0; color: var(--orange); } .erreur { background: #fde8e6; color: var(--rouge); }
.manque-ref { color: var(--orange); font-style: italic; }
.ligne-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tableau-defile { overflow-x: auto; }

/* ---------- éditeur ---------- */
body.editeur { overflow: hidden; }
.editeur-cadre { display: grid; grid-template-columns: 1fr 330px; height: calc(100vh - 60px); }
.outils { position: absolute; z-index: 5; top: 66px; left: 10px; display: flex; flex-direction: column; gap: 6px; max-height: calc(100vh - 80px); overflow-y: auto; padding-right: 4px; }
.outils button { background: #fff; color: var(--texte); border: 1px solid var(--bord); padding: 7px 10px; font-size: 13px; text-align: left; min-width: 150px; }
.outils button.actif { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.outils .sep { height: 1px; background: var(--bord); margin: 4px 0; }
.outils .pastille { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; border: 1px solid rgba(0,0,0,.2); }
#scene { background: #e9edf1; position: relative; overflow: hidden; touch-action: none; }
.panneau { background: #fff; border-left: 1px solid var(--bord); overflow-y: auto; padding: 14px; font-size: 14px; }
.panneau h3 { font-size: 15px; margin: 18px 0 8px; }
.panneau h3:first-child { margin-top: 0; }
.niveaux-onglets { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.niveaux-onglets a { padding: 5px 10px; border-radius: 6px; border: 1px solid var(--bord); text-decoration: none; color: var(--texte); font-size: 13px; }
.niveaux-onglets a.actif { background: var(--noir); color: #fff; border-color: var(--noir); }
.circuit { display: flex; align-items: center; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--brume); font-size: 13px; cursor: pointer; }
.circuit .num { width: 24px; height: 24px; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.circuit.actif { background: #eef4ff; }
.alerte { font-size: 13px; padding: 6px 8px; border-radius: 6px; margin-bottom: 6px; }
.alerte.manque { background: #fff1e0; } .alerte.erreur { background: #fde8e6; }
.aide { position: absolute; bottom: 10px; left: 10px; right: 10px; z-index: 5; background: rgba(10,14,20,.85); color: #fff; padding: 8px 12px; border-radius: 6px; font-size: 13px; pointer-events: none; text-align: center; }
.attente { position: absolute; inset: 0; background: rgba(255,255,255,.75); z-index: 20; display: none; place-items: center; font-size: 17px; font-weight: 600; text-align: center; padding: 20px; }
.attente.visible { display: grid; }
dialog { border: 1px solid var(--bord); border-radius: 10px; padding: 20px; max-width: 560px; width: calc(100% - 32px); }
dialog::backdrop { background: rgba(10,14,20,.45); }
@media (max-width: 900px) {
  .editeur-cadre { grid-template-columns: 1fr; grid-template-rows: 1fr 40vh; }
  .panneau { border-left: none; border-top: 1px solid var(--bord); }
  .outils button { min-width: 0; font-size: 12px; padding: 6px 8px; }
}
@media print {
  header.barre, .outils, .panneau, .aide, .non-imprime { display: none !important; }
}
#toile { position: absolute; inset: 0; }
.outils button.glissable { touch-action: pan-y; cursor: grab; }
.fantome { position: fixed; z-index: 50; pointer-events: none; background: #fff; border: 1px solid var(--bleu); border-radius: 6px; padding: 6px 10px; font-size: 13px; font-weight: 600; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.groupe-logement { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--graphite); margin: 10px 0 2px; }
