:root {
  --fond: #f4f6f9; --carte: #ffffff; --texte: #1c2433; --doux: #5b6576; --bord: #dde2ea;
  --marine: #1f2a44; --accent: #1f6feb; --accent-doux: #e8f0fe; --vert: #1b8a5a; --ambre: #b45309;
  --rouge: #c0392b; --violet: #6d28d9; --cyan: #0e7490; --ombre: 0 1px 3px rgba(20, 30, 50, .12);
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif; font-size: 14px; color: var(--texte);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; background: var(--fond); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3 { margin: 0; font-weight: 600; }

.barre { height: 48px; background: var(--marine); color: #fff; display: flex; align-items: center; gap: 16px; padding: 0 16px; }
.marque { display: flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 6px; background: var(--accent); display: grid; place-items: center; font-weight: 700; }
.marque .sous { font-weight: 400; opacity: .7; font-size: 12px; }
.fil { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; opacity: .9; }
.util { display: flex; gap: 12px; align-items: center; font-size: 13px; opacity: .9; white-space: nowrap; }
.lien { background: none; border: 0; color: inherit; text-decoration: underline; padding: 0; }

.corps { display: flex; height: calc(100% - 48px); }
.panneau { width: 380px; min-width: 300px; background: var(--carte); border-right: 1px solid var(--bord); overflow-y: auto; display: flex; flex-direction: column; }
.zone-carte { flex: 1; position: relative; min-width: 0; }
#carte { position: absolute; inset: 0; }

.bloc { padding: 14px 16px; border-bottom: 1px solid var(--bord); }
.bloc h2 { font-size: 15px; margin-bottom: 10px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.bloc h3 { font-size: 13px; color: var(--doux); margin: 12px 0 6px; text-transform: uppercase; letter-spacing: .03em; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 12px; font-weight: 600; text-decoration: none; }
.btn.second { background: var(--accent-doux); color: var(--accent); }
.btn.danger { background: #fdecea; color: var(--rouge); }
.btn.petit { padding: 5px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.ligne-btn { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }

label.champ { display: block; margin-bottom: 9px; font-size: 12px; color: var(--doux); }
label.champ input, label.champ select, label.champ textarea { display: block; width: 100%; margin-top: 3px; padding: 7px 9px; border: 1px solid var(--bord); border-radius: 6px; background: #fff; font-size: 14px; }
label.champ textarea { min-height: 60px; resize: vertical; }
label.case { display: flex; gap: 8px; align-items: center; margin: 6px 0 9px; font-size: 13px; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.aide { font-size: 12px; color: var(--doux); margin: 4px 0 8px; line-height: 1.4; }

.onglets { display: flex; border-bottom: 1px solid var(--bord); position: sticky; top: 0; background: var(--carte); z-index: 2; }
.onglets button { flex: 1; background: none; border: 0; border-bottom: 2px solid transparent; padding: 10px 4px; font-size: 13px; color: var(--doux); }
.onglets button.actif { color: var(--accent); border-bottom-color: var(--accent); font-weight: 600; }

.liste-projets { list-style: none; margin: 0; padding: 0; }
.liste-projets li { padding: 10px 16px; border-bottom: 1px solid var(--bord); cursor: pointer; }
.liste-projets li:hover { background: var(--accent-doux); }
.liste-projets .nom { font-weight: 600; }
.liste-projets .meta { font-size: 12px; color: var(--doux); margin-top: 2px; }
.vide { color: var(--doux); padding: 16px; text-align: center; }

.equip { list-style: none; margin: 0; padding: 0; }
.equip li { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-radius: 6px; cursor: pointer; font-size: 13px; }
.equip li:hover, .equip li.sel { background: var(--accent-doux); }
.equip .pastille { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.equip .nom-eq { white-space: nowrap; font-weight: 600; }
.equip .sec { color: var(--doux); margin-left: auto; font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; text-align: right; }

table.nomenc { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.nomenc th { text-align: left; color: var(--doux); font-weight: 600; padding: 4px; border-bottom: 1px solid var(--bord); }
table.nomenc td { padding: 5px 4px; border-bottom: 1px solid #eef1f5; vertical-align: top; }
table.nomenc td.n { text-align: right; white-space: nowrap; }
table.nomenc tr.cat td { background: #f6f8fb; font-weight: 600; color: var(--doux); }
.total { display: flex; justify-content: space-between; font-weight: 700; margin-top: 10px; font-size: 15px; }
.alerte { font-size: 12.5px; padding: 6px 8px; border-radius: 6px; margin: 4px 0; cursor: pointer; }
.alerte.erreur { background: #fdecea; color: #8e2a1f; }
.alerte.attention { background: #fff4e0; color: #7a4a05; }
.alerte.info { background: #eef3fb; color: #2b4a7a; }
.bilan { font-size: 12px; color: var(--doux); background: #f6f8fb; border-radius: 6px; padding: 6px 8px; margin-top: 6px; }
.synthese { padding: 10px 12px; border-radius: 8px; font-weight: 600; margin-bottom: 8px; }
.synthese.bonne { background: #e6f4ea; color: #145c38; }
.synthese.correcte { background: #eef3fb; color: #2b4a7a; }
.synthese.renforcer { background: #f3f4f6; color: #3f4654; }

.recherche { position: absolute; top: 10px; left: 56px; z-index: 800; width: min(440px, calc(100% - 120px)); }
.recherche input { width: 100%; padding: 9px 12px; border-radius: 8px; border: 1px solid var(--bord); box-shadow: var(--ombre); background: #fff; }
.resultats { list-style: none; margin: 4px 0 0; padding: 4px 0; background: #fff; border-radius: 8px; box-shadow: 0 4px 16px rgba(20, 30, 50, .18); max-height: 320px; overflow-y: auto; }
.resultats li { padding: 8px 12px; cursor: pointer; font-size: 13px; }
.resultats li:hover, .resultats li.act { background: var(--accent-doux); }
.resultats .src { color: var(--doux); font-size: 11px; margin-left: 6px; }

.outils { position: absolute; top: 58px; left: 56px; z-index: 800; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; background: #fff; border-radius: 8px; padding: 4px; box-shadow: var(--ombre); max-width: calc(100% - 120px); }
.outils button { display: inline-flex; align-items: center; gap: 5px; border: 0; background: none; padding: 6px 9px; border-radius: 6px; font-size: 13px; }
.outils button:hover { background: var(--accent-doux); }
.outils button.actif { background: var(--accent); color: #fff; }
.outils select { border: 1px solid var(--bord); border-radius: 6px; padding: 5px 6px; font-size: 13px; background: #fff; }
.outils .sep { width: 1px; height: 22px; background: var(--bord); margin: 0 2px; }
.ic { width: 14px; height: 14px; display: inline-block; border-radius: 50%; }
.ic-borne { background: var(--vert); }
.ic-coffret { background: var(--marine); border-radius: 2px; }
.ic-switch { background: var(--cyan); border-radius: 2px; height: 9px; }
.ic-onduleur { background: var(--rouge); border-radius: 2px; width: 9px; }
.ic-onde { background: conic-gradient(#2ea043, #fdd835, #f57c00, #d32f2f, #2ea043); }

.consigne { position: absolute; bottom: 24px; left: 50%; transform: translateX(-50%); z-index: 800; background: var(--marine); color: #fff; padding: 9px 14px; border-radius: 8px; font-size: 13px; box-shadow: var(--ombre); display: flex; gap: 12px; align-items: center; }
.consigne button { background: rgba(255,255,255,.15); color: #fff; border: 0; border-radius: 6px; padding: 5px 9px; }
.legende { position: absolute; bottom: 24px; right: 10px; z-index: 800; background: #fff; border-radius: 8px; padding: 8px 10px; box-shadow: var(--ombre); font-size: 12px; width: 300px; max-width: calc(100% - 20px); }
.legende .l { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legende .c { width: 14px; height: 10px; border-radius: 2px; }
.legende .bandes { display: flex; gap: 4px; margin-bottom: 6px; }
.legende .bandes button { flex: 1; border: 1px solid var(--bord); background: #fff; border-radius: 5px; padding: 3px 4px; font-size: 12px; }
.legende .bandes button.actif { background: var(--marine); color: #fff; border-color: var(--marine); }
.legende input[type=range] { width: 100%; }
.toast { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); background: var(--marine); color: #fff; padding: 10px 16px; border-radius: 8px; z-index: 2000; box-shadow: var(--ombre); max-width: 90vw; }
.toast.erreur { background: var(--rouge); }

.mk { width: 22px; height: 22px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4); display: grid; place-items: center; color: #fff; font-size: 11px; font-weight: 700; }
.mk.carre { border-radius: 4px; }
.mk.sel { outline: 3px solid #ffd33d; outline-offset: 1px; }
.mk-nom { background: rgba(31, 42, 68, .85); color: #fff; border: 0; border-radius: 4px; padding: 1px 5px; font-size: 11px; box-shadow: none; }
.mk-nom::before { display: none; }
.leaflet-container.placer { cursor: crosshair; }

.page-connexion { display: grid; place-items: center; min-height: 100%; background: var(--marine); }
.carte-connexion { background: #fff; padding: 28px; border-radius: 12px; width: min(360px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.carte-connexion h1 { font-size: 22px; }
.carte-connexion .sous { color: var(--doux); margin: 2px 0 18px; }
.carte-connexion label { display: block; font-size: 13px; color: var(--doux); margin-bottom: 10px; }
.carte-connexion input { display: block; width: 100%; padding: 9px; border: 1px solid var(--bord); border-radius: 6px; margin-top: 4px; }
.carte-connexion .btn { width: 100%; margin-top: 6px; }
.erreur { color: var(--rouge); }

@media (max-width: 760px) {
  .corps { flex-direction: column-reverse; }
  .panneau { width: 100%; min-width: 0; height: 45%; border-right: 0; border-top: 1px solid var(--bord); }
  .zone-carte { height: 55%; flex: none; }
  .recherche { left: 50px; width: calc(100% - 110px); }
  .outils { top: 54px; left: 50px; max-width: calc(100% - 60px); }
  .marque .sous, .util span { display: none; }
}
