/* Écran de supervision AGAPE — charte de référence : maquette CES · SOPEI (indice D, 04/12/2026,
   décision du DG). Produit « AGAPE Supervision », logos AGAPE et du membre inchangés.
   Toutes les couleurs passent par les jetons de la charte (tokens.json, indice D) ; aucune valeur en dur
   ailleurs que dans les deux blocs de thème ci-dessous. Les synoptiques (SVG insérés dans la
   page) utilisent les mêmes jetons. */

/* --- Polices de la charte CES · SOPEI, embarquées (polices/, licence SIL OFL 1.1) ------------
   Barlow (texte), Barlow Semi Condensed (titres), JetBrains Mono (valeurs). Jamais chargées depuis Internet. */
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("polices/barlow-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("polices/barlow-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("polices/barlow-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("polices/barlow-semi-condensed-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Barlow Semi Condensed"; font-style: normal; font-weight: 600; font-display: swap;
  src: url("polices/barlow-semi-condensed-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("polices/jetbrains-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "JetBrains Mono"; font-style: normal; font-weight: 500; font-display: swap;
  src: url("polices/jetbrains-mono-latin-500-normal.woff2") format("woff2"); }

/* --- Thème Jour (exploitation, bureau) : jetons de la maquette CES · SOPEI ------------------
   Écarts voulus avec la maquette (contraste, charte indice D) : faint #809094 au lieu de #869599
   (3:1 sur la scène), textes d'état sur fond « soft » ok-txt, warn-txt, crit-txt assombris (4,5:1). */
:root {
  --haut-bandeau: 65px;   /* bandeau fixe (64 px + filet) : le menu et les panneaux fixes se placent dessous */
  --bg: #EDF1F1; --panel: #FFFFFF; --panel-2: #F5F8F8;
  --ink: #12232A; --muted: #55666C; --faint: #809094; --line: #D6DFE0; --line-2: #E6ECEC;
  --accent: #08766F; --accent-ink: #FFFFFF; --accent-soft: #D9EEEC; --focus: #2C7BE5;
  --ok: #2B8752;   --ok-soft: #E1F1E7;   --ok-txt: #27794A;   --ok-ink: #FFFFFF;
  --warn: #B87406; --warn-soft: #FAEFD7; --warn-txt: #9A6105; --warn-ink: #12232A;
  --crit: #CC3527; --crit-soft: #FAE2DE; --crit-txt: #C13225; --crit-ink: #FFFFFF;
  --comm: #7450A6; --comm-soft: #ECE5F6; --comm-txt: #7450A6;
  --sea: #D7E6ED; --land: #F8F9F5; --land-ctx: #EBEEE8; --land-stroke: #B7C2BE; --map-label: #7F8E8A;
  --aep: #2477C9; --eu: #97661E;
  --s1: #08766F; --s2: #2C67B8; --s3: #C0661A; --s4: #8A4DBE; --s5: #4F7A14;
  --scene: #F2F5F5; --scene-floor: #E3E9E9;
  --ground-t: #DCE3DF; --ground-l: #BCC6C1; --ground-r: #CBD3CF;
  --conc-t: #ECEFEE; --conc-l: #C7CDCB; --conc-r: #D9DEDC;
  --soil-t: #C9B08C; --soil-l: #A88B66; --soil-r: #B99D78;
  --aq-l: #86AFCF; --aq-r: #9CC0DB;
  --cab-t: #E9ECEE; --cab-l: #B9C1C6; --cab-r: #CDD3D7;
  --dark-t: #58646A; --dark-l: #3B454A; --dark-r: #4A555B;
  --steel-1: #8C979D; --steel-2: #E3E8EB; --steel-3: #A3AEB4; --steel-4: #6E797F;
  --water-1: #1E6FB5; --water-2: #5AA6E3; --water-3: #2A7CC4; --water-top: #8CC4EE;
  --eff-1: #6B5A2E; --eff-2: #A18A4E; --eff-top: #B9A266;
  --cl-1: #DCC448; --cl-2: #F1DE72; --cl-top: #F8EFB4; --cl-bord: #4A555B;
  --pipe-d: #4F6A7C; --pipe-l: #9EB7C7; --pipe-w: #335E83;
  --glass: rgba(255,255,255,.16); --glass-line: #7E8E95;
  --tag-bg: #FFFFFF; --tag-line: #C9D3D5;
  --shadow: 0 1px 2px rgba(18,35,42,.06), 0 4px 14px rgba(18,35,42,.05);
  color-scheme: light;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 4px; --radius-md: 8px; --radius-lg: 12px; --radius-pill: 999px;
  --stroke-equip: 2px; --stroke-pipe: 6px; --stroke-alarm: 3px;
  --f-ui: "Barlow", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-head: "Barlow Semi Condensed", "Barlow", system-ui, sans-serif;
  --f-num: "JetBrains Mono", ui-monospace, Menlo, monospace;

  font: 400 15px/22px var(--f-ui);          /* corps */
  color: var(--ink);
  background: var(--bg);
}

/* --- Thème Nuit (astreinte, salle sombre) : mêmes noms, valeurs de la maquette CES · SOPEI -- */
:root[data-theme="nuit"] {
  --bg: #0C1417; --panel: #121D21; --panel-2: #16232A;
  --ink: #E3ECEE; --muted: #93A6AC; --faint: #6C7F85; --line: #24353B; --line-2: #1C2B30;
  --accent: #2BB3A7; --accent-ink: #06211F; --accent-soft: #143A37; --focus: #6FA8F5;
  --ok: #4CBF7C;   --ok-soft: #163626;   --ok-txt: #4CBF7C;   --ok-ink: #0C1417;
  --warn: #E7A93A; --warn-soft: #3A2D12; --warn-txt: #E7A93A; --warn-ink: #0C1417;
  --crit: #F06A5B; --crit-soft: #41201C; --crit-txt: #F06A5B; --crit-ink: #0C1417;
  --comm: #AC8BDB; --comm-soft: #2E2543; --comm-txt: #AC8BDB;
  --sea: #0F2730; --land: #1A2A2F; --land-ctx: #152125; --land-stroke: #34494F; --map-label: #6E858B;
  --aep: #5EA6EE; --eu: #D09A4C;
  --s1: #2BB3A7; --s2: #6EA2EC; --s3: #E89A4F; --s4: #B88AE6; --s5: #9CC45A;
  --scene: #0F191C; --scene-floor: #16242A;
  --ground-t: #31403F; --ground-l: #212C2C; --ground-r: #293636;
  --conc-t: #3F4A4A; --conc-l: #283131; --conc-r: #333D3D;
  --soil-t: #6B5A42; --soil-l: #4D3F2D; --soil-r: #5B4B36;
  --aq-l: #2F5574; --aq-r: #386383;
  --cab-t: #5A666C; --cab-l: #38434A; --cab-r: #46525A;
  --dark-t: #6B777D; --dark-l: #2B3439; --dark-r: #384248;
  --steel-1: #56636A; --steel-2: #A9B6BC; --steel-3: #6F7C83; --steel-4: #3D484E;
  --water-1: #1B5F9C; --water-2: #4C98D6; --water-3: #2470B2; --water-top: #6FB0E3;
  --eff-1: #4E4220; --eff-2: #87743F; --eff-top: #9C8752;
  --cl-1: #EEE6A4; --cl-2: #F6F0BE; --cl-top: #FCF9E0; --cl-bord: #1C2427;
  --pipe-d: #3A5363; --pipe-l: #7896A9; --pipe-w: #5585B0;
  --glass: rgba(255,255,255,.05); --glass-line: #5D6F76;
  --tag-bg: #16242A; --tag-line: #2F444B;
  --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 14px rgba(0,0,0,.2);
  color-scheme: dark;
}

/* Faces des matières de scène (dessus t, gauche l, droite r) à partir des jetons ci-dessus */
:root {
  --aq-t: var(--aq-r);
  --steel-t: var(--steel-2); --steel-l: var(--steel-1); --steel-r: var(--steel-4);
  --water-t: var(--water-top); --water-l: var(--water-3); --water-r: var(--water-1);
  --eff-t: var(--eff-top); --eff-l: var(--eff-2); --eff-r: var(--eff-1);
  --cl-t: var(--cl-top); --cl-l: var(--cl-2); --cl-r: var(--cl-1);
  --glass-t: var(--glass); --glass-l: var(--glass); --glass-r: var(--glass);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }   /* « hidden » gagne toujours sur display (étapes de connexion, pages) */
body { margin: 0; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
a { color: var(--accent); }
:root[data-theme="nuit"] a { color: var(--ink); }

/* Styles typographiques de la charte */
.titre-ecran   { font-family: var(--f-head); font-size: 28px; line-height: 34px; font-weight: 700; }
.titre-panneau { font-family: var(--f-head); font-size: 20px; line-height: 26px; font-weight: 600; }
.valeur        { font-family: var(--f-num); font-size: 22px; line-height: 28px; font-weight: 500; font-variant-numeric: tabular-nums; }
.libelle       { font-size: 13px; line-height: 18px; font-weight: 600; }
.legende       { font-size: 12px; line-height: 16px; font-weight: 400; color: var(--muted); }

/* --- Bandeau (composant Bandeau) : barre claire de la maquette CES · SOPEI -------------------
   Logo AGAPE officiel à gauche (sur son fond bleu, tel quel), logo du membre à droite dans une
   pastille blanche de même hauteur, avec un filet fin. Aucun logo n'est jamais recoloré. */
.bandeau {
  --logo-h: 44px;
  position: sticky; top: 0; z-index: 20;
  display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: var(--space-4);
  min-height: 64px; padding: var(--space-2) var(--space-6);
  background: var(--panel); color: var(--ink); border-bottom: 1px solid var(--line);
}
.logo-agape { display: block; height: var(--logo-h); width: auto; border-radius: var(--radius-sm); }
.pastille-membre {
  height: var(--logo-h); padding: 4px var(--space-3); display: grid; place-items: center;
  background: #FFFFFF; border: 1px solid var(--tag-line); border-radius: var(--radius-sm);
}
.pastille-membre img { display: block; height: calc(var(--logo-h) - 10px); max-width: 150px; object-fit: contain; }
.bandeau .titre { min-width: 0; padding-left: var(--space-4); border-left: 1px solid var(--line); }
.bandeau .produit { font: 600 12px/16px var(--f-ui); color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.bandeau .titre-ecran { font-size: 22px; line-height: 28px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bandeau .sous-titre { display: inline; font: 400 14px/20px var(--f-ui); color: var(--muted); }
.bandeau .ligne-titre { display: flex; align-items: baseline; gap: var(--space-3); min-width: 0; }

.ligne-etat {
  display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap;
  padding: var(--space-2) var(--space-6); border-bottom: 1px solid var(--line); background: var(--panel);
}
.ligne-etat .espace { flex: 1; }
.direct { display: inline-flex; align-items: center; gap: 6px; }
.direct::before { content: ""; width: 10px; height: 10px; border-radius: var(--radius-pill); background: var(--muted); }
.direct.ko { color: var(--comm); font-weight: 600; }
.direct.ko::before { background: transparent; border: 2px dashed var(--comm); width: 8px; height: 8px; }

/* Boutons : accent sarcelle, jamais une couleur d'alarme */
.bouton, button.acquitter, .segments button, #theme {
  font: 600 13px/18px var(--f-ui); border-radius: var(--radius-md); cursor: pointer;
  padding: 6px 14px; border: 1px solid var(--accent); text-decoration: none;
}
.bouton, #theme, .segments button { background: var(--panel); color: var(--ink); border-color: var(--line); }
.bouton:hover, #theme:hover, .segments button:hover { background: var(--panel-2); }
button.acquitter, .segments button.actif { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
button.acquitter:disabled { opacity: .5; cursor: default; }

/* --- Mise en page ------------------------------------------------------------------------ */
.grille {
  display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: var(--space-6);
  padding: var(--space-6) var(--space-8); max-width: 1700px; margin: 0 auto;
}
.panneau { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); padding: var(--space-4); }
.panneau-titre { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.vue { display: grid; gap: var(--space-6); min-width: 0; }
.sites { grid-row: span 2; position: sticky; top: calc(var(--haut-bandeau) + var(--space-4)); align-self: start; }
#liste-sites { max-height: calc(100vh - var(--haut-bandeau) - 90px); overflow-y: auto; padding: 2px 6px 2px 2px; scrollbar-gutter: stable; }
.sites .site { padding: var(--space-2) var(--space-3); gap: 0; }
.sites .site .nom { margin-bottom: var(--space-1); }
.sites .site .pied { margin-top: var(--space-1); }
.sites .site.alarme { padding: calc(var(--space-2) - 2px) calc(var(--space-3) - 2px); }
.sites .site.perdu { padding: calc(var(--space-2) - 1px) calc(var(--space-3) - 1px); }
.sites ul { gap: var(--space-2); }
/* Le synoptique tient dans la hauteur de l'écran (la liste des sites défile à part) : il reste visible
   en entier sans défiler ; il n'est pas « collant », sinon il masquerait la courbe placée dessous. */
#panneau-synoptique .synoptique-cadre svg { max-height: calc(100vh - var(--haut-bandeau) - 120px); }
.sites h2 { margin-bottom: var(--space-3); }

/* --- Carte de site (composant CarteSite) ------------------------------------------------ */
.sites ul { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.site {
  width: 100%; text-align: left; font: inherit; color: inherit; cursor: pointer; display: grid; gap: 2px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4);
}
.site:hover { background: var(--panel-2); }
.site[aria-current="true"] { box-shadow: 0 0 0 2px var(--accent); }       /* sélection : accent */
.site .nom { margin-bottom: var(--space-2); }
.site .l { display: flex; justify-content: space-between; gap: var(--space-2); }
.site .l b { font-weight: 600; font-variant-numeric: tabular-nums; }
.site .pied { margin-top: var(--space-3); }
.site.alarme { border-width: var(--stroke-alarm); padding: calc(var(--space-4) - 2px); }
.site.alarme.u1 { border-color: var(--crit); }
.site.alarme.u2 { border-color: var(--warn); }
.site.alarme.u3 { border-color: var(--muted); }
.site.perdu { border: 2px dashed var(--comm); padding: calc(var(--space-4) - 1px); }
.site.perdu .l b { color: var(--muted); }

/* Pastille de liaison */
.pastille { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; line-height: 16px; color: var(--muted); }
.pastille::before { content: ""; width: 10px; height: 10px; border-radius: var(--radius-pill); background: var(--accent); }   /* liaison OK : sarcelle, jamais le gris de l'arrêt */
.pastille.perdue { color: var(--comm); font-weight: 600; }
.pastille.perdue::before { background: transparent; border: 2px dashed var(--comm); width: 8px; height: 8px; }

/* --- Badge d'alarme (composant BadgeAlarme) --------------------------------------------- */
.badge {
  display: inline-flex; align-items: baseline; gap: var(--space-2); padding: 2px 10px;
  border-radius: var(--radius-sm); font: 700 13px/18px var(--f-ui); border: 1px solid transparent;
}
.badge span { font-weight: 400; }
.badge.u1 { background: var(--crit); color: var(--crit-ink); }
.badge.u2 { background: var(--warn-soft); color: var(--warn-txt); border-color: var(--warn); }
.badge.u3 { background: var(--panel-2); color: var(--muted); border-color: var(--muted); }
.badge.vide { background: var(--panel); color: var(--ink); }
.badge.vide.u1 { border: 2px solid var(--crit); }
.badge.vide.u2 { border: 2px solid var(--warn); }
.badge.vide.u3 { border: 2px solid var(--muted); }
.badge.clignote, .sy-mini.clignote { animation: clignote 1s steps(1) infinite; }   /* une fois par seconde */
@keyframes clignote { 50% { opacity: .55; } }
@media (prefers-reduced-motion: reduce) { .badge.clignote, .sy-mini.clignote { animation: none; } }

/* --- Synoptique --------------------------------------------------------------------------- */
.synoptique-cadre { border-radius: var(--radius-md); overflow: hidden; position: relative; background: var(--scene); border: 2px solid transparent; }
.synoptique-cadre svg { display: block; width: 100%; height: auto; }
.synoptique-cadre.incertain { border: 2px dashed var(--comm); }
.synoptique-cadre .liaison-perdue { display: none; }
.synoptique-cadre.incertain .liaison-perdue {
  display: block; position: absolute; top: var(--space-3); left: var(--space-4);   /* coin libre des synoptiques */
  background: var(--panel); color: var(--comm); border: 2px dashed var(--comm);
  border-radius: var(--radius-md); padding: var(--space-1) var(--space-4); font-weight: 600;
}
/* Composant Mesure, liaison perdue : valeurs en ink-muted barrées (la date de dernière lecture reste lisible) */
.synoptique-cadre.incertain [data-var]:not([data-var="TLG_DCOM"]),
.synoptique-cadre.incertain [data-pompe-col][data-var] { fill: var(--muted); text-decoration: line-through; stroke: none; }
.liaison { font-size: 12px; line-height: 16px; }

/* --- Courbe -------------------------------------------------------------------------------- */
.filtres { display: flex; gap: var(--space-4); align-items: center; }
.filtres label { display: inline-flex; gap: var(--space-2); align-items: center; }
select { font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 4px 8px; }
.segments { display: inline-flex; }
.segments button { border-radius: 0; margin-left: -1px; }
.segments button:first-child { border-radius: var(--radius-md) 0 0 var(--radius-md); }
.segments button:last-child { border-radius: 0 var(--radius-md) var(--radius-md) 0; }
.courbe { position: relative; height: 240px; }
.courbe svg { width: 100%; height: 100%; display: block; overflow: visible; font-family: var(--f-ui); }
.courbe .axe text { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.courbe .grille-l { stroke: var(--panel-2); }
.courbe .base { stroke: var(--line); }
.courbe .serie { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.courbe .ref { stroke: var(--line); stroke-dasharray: 4 4; stroke-width: 1.5; }
.courbe .ref-txt { fill: var(--muted); font-size: 12px; }
.courbe .viseur { stroke: var(--muted); stroke-width: 1; }
.courbe .point { fill: var(--ink); stroke: var(--panel); stroke-width: 2; }
.infobulle {
  position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 6px 10px; font-size: 13px; white-space: nowrap;
  font-variant-numeric: tabular-nums; display: none;
}
.infobulle b { display: block; }
.courbe .vide { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }

/* --- Alarmes -------------------------------------------------------------------------------- */
.alarmes { grid-column: 2; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font: 600 13px/18px var(--f-ui); color: var(--muted); padding: 6px 8px; background: var(--panel-2); }
td { padding: var(--space-3) 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
td.vide { color: var(--muted); text-align: center; padding: var(--space-6); }
.consigne { display: block; margin-top: var(--space-1); }

@media (max-width: 1000px) {
  .grille { grid-template-columns: 1fr; padding: var(--space-4); }
  .sites, .alarmes { grid-row: auto; grid-column: auto; }
  .bandeau { padding: var(--space-2) var(--space-4); --logo-h: 36px; }
  .bandeau .sous-titre { display: none; }
}

/* --- Synoptique 3D (charte indice B) : perspective isométrique, matières scene-*, mêmes états ---
   Les états et alarmes sont ceux du schéma 2D : pompe en marche equip-run, à l'arrêt equip-off ;
   équipement en alarme entouré de stroke-alarm à la couleur du niveau ; tirets si liaison perdue. */
#choix-vue { margin-left: auto; }
#choix-vue button:disabled { opacity: .45; cursor: not-allowed; }
.s3 text { font-family: var(--f-ui); font-variant-numeric: tabular-nums; }
.s3-fond { fill: var(--scene); }
.s3-tuyau { fill: none; stroke: var(--steel-r); stroke-width: 11px; stroke-linecap: round; stroke-linejoin: round; }
.s3-reflet { fill: none; stroke: var(--steel-t); stroke-width: 4px; stroke-linecap: round; stroke-linejoin: round; }
.s3-flux { fill: none; stroke: var(--water-t); stroke-width: 3.5px; stroke-linecap: round; stroke-dasharray: 9 11; display: none; }
.coule > .s3-flux, .s3-flux.actif { display: inline; animation: s3-coule 1.1s linear infinite; }
.s3-flux.actif.u1 { stroke: var(--crit); }
.s3-flux.actif.u2 { stroke: var(--warn); }
.s3-flux.actif.u3 { stroke: var(--muted); }
.s3-verre path { stroke: var(--glass-line); stroke-width: 1.5px; }
.s3-ouverture { fill: var(--conc-r); }
.s3-seuil { fill: none; stroke: var(--muted); stroke-width: 1.2px; stroke-dasharray: 5 4; }
.s3-nappe-ligne { fill: none; stroke: var(--aq-l); stroke-width: 2px; stroke-dasharray: 7 5; }   /* niveau statique habituel */
/* Hypochlorite : jaune pâle (jamais de vert, réservé à la marche), bordé d'un trait neutre foncé pour le contraste sur le béton */
.s3-dosage-bord { fill: none; stroke: var(--cl-bord); stroke-width: 6px; stroke-linecap: round; stroke-linejoin: round; }
.s3-sonde-faisceau { stroke: var(--ink); stroke-width: 1.2px; stroke-dasharray: 3 4; opacity: .7; }
.s3-tuyau-fin { stroke: var(--steel-r); stroke-width: 3px; }
.s3-manometre { fill: var(--panel); stroke: var(--ink); stroke-width: 1.5px; }
.s3-manometre-aiguille { stroke: var(--ink); stroke-width: 1.5px; stroke-linecap: round; }
.s3-dosage { fill: none; stroke: var(--cl-r); stroke-width: 3px; stroke-linecap: round; stroke-linejoin: round; }
.s3-dosage-flux { fill: none; stroke: var(--cl-bord); stroke-width: 2px; stroke-dasharray: 4 6; display: none; }
.coule > .s3-dosage-flux { display: inline; animation: s3-coule 1.1s linear infinite; }
.s3-injection { fill: var(--cl-r); stroke: var(--cl-bord); stroke-width: 1.5px; }
.s3-cuve-liq, .s3-cuve-surface { stroke: var(--cl-bord); stroke-width: 1px; }
.s3-couvercle { fill: var(--steel-t); stroke: var(--steel-r); stroke-width: 1px; }
.s3-seuil-txt, .s3-repere { fill: var(--muted); font-size: 14px; stroke: var(--scene); stroke-width: 6px; stroke-linejoin: round; paint-order: stroke; }
.s3-contour { fill: none; stroke: none; stroke-linejoin: round; }
.s3-armoire-contour { fill: none; stroke: var(--tag-line); stroke-width: 1px; stroke-linejoin: round; }
.s3-antenne { stroke: var(--steel-r); stroke-width: 2.5px; }
.s3-antenne-pt { fill: var(--steel-r); }
.s3 .alarme { stroke-width: var(--stroke-alarm); }
.s3 .alarme.u1 { stroke: var(--crit); }
.s3 .alarme.u2 { stroke: var(--warn); }
.s3 .alarme.u3 { stroke: var(--muted); }
.s3 .alarme.tirets { stroke-dasharray: 6 4; }
/* Pompes : un seul état à la fois, le plus grave l'emporte (composant EtatPompe) */
.s3 .pompe { --pf: var(--panel-2); --pt: var(--faint); --px: var(--muted); --pe: 1.5px; --pd: none; }
.s3 .pompe.marche { --pf: var(--ok); --pt: var(--ok); --px: var(--ok-ink); }
.s3 .pompe.manu { --pt: var(--ink); --pd: 5 4; }
.s3 .pompe.defaut { --pe: 3px; }
.s3 .pompe.defaut.u1 { --pf: var(--crit); --pt: var(--crit); --px: var(--crit-ink); }
.s3 .pompe.defaut.u2 { --pf: var(--warn); --pt: var(--warn); --px: var(--warn-ink); }
.s3 .pompe.perdu { --pf: url(#s3-hach); --pt: var(--comm); --px: var(--comm); --pd: 4 3; }
.s3 .pompe.alarme { --pe: 3px; stroke: none; }
.s3 .pompe.alarme.u1 { --pt: var(--crit); }
.s3 .pompe.alarme.u2 { --pt: var(--warn); }
.s3 .pompe.alarme.u3 { --pt: var(--muted); }
.s3 .pompe.tirets { --pd: 4 3; }
/* Vanne d'adduction (réservoir) : ouverte comme une pompe en marche, fermée comme à l'arrêt,
   en manœuvre en tirets ; le mot (Ouverte, Fermée, En manœuvre, Défaut) est dans l'étiquette */
.s3-vanne-corps { fill: var(--panel-2); stroke: var(--faint); stroke-width: 1.5px; }
.s3-vanne.ouverte .s3-vanne-corps { fill: var(--ok); stroke: var(--ok); }
.s3-vanne.manoeuvre .s3-vanne-corps { stroke: var(--ink); stroke-dasharray: 4 3; }
.s3-pompe-corps { fill: var(--pf); stroke: var(--pt); stroke-width: var(--pe); stroke-dasharray: var(--pd); }
.s3 .pompe .code { fill: var(--px); font-size: 13px; font-weight: 700; }
.s3-roue { display: none; transform-box: fill-box; transform-origin: center; }
.s3-roue path { stroke: var(--px); stroke-width: 2.4px; stroke-linecap: round; }
.s3 .pompe.marche:not(.defaut) .s3-roue { display: inline; animation: s3-tourne 1.4s linear infinite; }
.s3 .pompe.marche .code { display: none; }
.s3 .pompe .croix, .s3 .pompe .m-angle { display: none; }
.s3 .pompe.defaut .croix, .s3 .pompe.manu .m-angle { display: inline; }
.s3 .pompe.defaut .code { display: none; }
.s3 .pompe .croix { stroke: var(--px); stroke-width: 2.5px; stroke-linecap: round; fill: none; }
.s3 .pompe .m-fond { fill: var(--panel); stroke: var(--ink); stroke-width: 1.5px; }
.s3 .pompe .m-txt { fill: var(--ink); font-size: 12px; font-weight: 700; }
.s3-hach-fond { fill: var(--panel); }
.s3-hach-trait { stroke: var(--comm); stroke-width: 1.5px; }
/* Étiquettes reliées : libellé SITE_EQUIP_MESURE, valeur en chiffres tabulaires, badge du niveau */
.s3-etiq[data-courbe] { cursor: pointer; }
.s3-etiq[data-courbe]:focus-visible { outline: none; }
.s3-etiq[data-courbe]:focus-visible .s3-cadre, .s3-etiq[data-courbe]:hover .s3-cadre:not(.alarme) { stroke: var(--focus); stroke-width: 2px; }
.s3-cadre { fill: var(--tag-bg); stroke: var(--tag-line); stroke-width: 1px; }
.s3-fil { stroke: var(--muted); stroke-width: 1.5px; stroke-dasharray: 4 4; }
.s3-fil-pt { fill: var(--muted); }
.s3-etiq:has(.s3-cadre.alarme.u1) .s3-fil { stroke: var(--crit); }
.s3-etiq:has(.s3-cadre.alarme.u1) .s3-fil-pt { fill: var(--crit); }
.s3-etiq:has(.s3-cadre.alarme.u2) .s3-fil { stroke: var(--warn); }
.s3-etiq:has(.s3-cadre.alarme.u2) .s3-fil-pt { fill: var(--warn); }
.s3-code { fill: var(--muted); font-size: 14px; }
.s3-val { fill: var(--ink); font-family: var(--f-num); font-size: 19px; font-weight: 500; }
.s3-unite { fill: var(--muted); font-size: 14px; }
.s3-panneau { fill: var(--tag-bg); stroke: var(--tag-line); stroke-width: 1px; }
.s3-titre { fill: var(--ink); font-family: var(--f-head); font-size: 15px; font-weight: 600; }
.s3-ligne { fill: var(--muted); font-size: 15px; }
/* Mini-badges (panneau Sécurités et étiquettes) : mêmes règles que le schéma 2D */
.s3 .sy-mini rect { fill: none; stroke: none; }
.s3 .sy-mini text { fill: var(--muted); font-size: 13px; font-weight: 700; }
.s3 .s3-etiq .sy-mini:not(.u1):not(.u2):not(.u3) { display: none; }
.s3 .sy-mini.u1 rect { fill: var(--crit); }
.s3 .sy-mini.u1 text { fill: var(--crit-ink); }
.s3 .sy-mini.u2 rect { fill: var(--warn-soft); stroke: var(--warn); stroke-width: 1px; }
.s3 .sy-mini.u2 text { fill: var(--warn-txt); }
.s3 .sy-mini.u3 rect { fill: var(--panel-2); stroke: var(--muted); stroke-width: 1px; }
.s3 .sy-mini.u3 text { fill: var(--muted); }
.s3 .sy-mini.vide rect { fill: none; stroke-width: 1.5px; }
.s3 .sy-mini.vide.u1 rect { stroke: var(--crit); }
.s3 .sy-mini.vide.u1 text { fill: var(--crit); }
.s3 .sy-mini.vide.u2 rect { stroke: var(--warn); }
.s3 .sy-mini.vide.u2 text { fill: var(--ink); }
.s3 .sy-mini.vide.u3 rect { stroke: var(--muted); }
.s3 .sy-mini.vide.u3 text { fill: var(--muted); }
/* Liaison perdue : voile léger sur la scène, valeurs barrées (règle de la charte) */
.s3-voile { fill: var(--scene); opacity: 0; pointer-events: none; }
.synoptique-cadre.incertain .s3-voile { opacity: .35; }
.synoptique-cadre.incertain .s3 [data-var] { fill: var(--muted); text-decoration: line-through; }
@keyframes s3-coule { to { stroke-dashoffset: -20; } }
@keyframes s3-tourne { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .coule > .s3-flux, .coule > .s3-dosage-flux, .s3-flux.actif, .s3 .pompe.marche .s3-roue { animation: none; } }
/* En vue 3D, le coin haut gauche porte l'étiquette du trop-plein : l'avis « Liaison perdue » va en bas à droite */
.synoptique-cadre:has(.s3) .liaison-perdue { top: auto; left: auto; bottom: var(--space-3); right: var(--space-4); }
/* Animations de la scène 3D : surface de l'effluent qui ondule, contour de bâche qui pulse en
   déversement (une fois toutes les 1,6 s, bien en dessous de 3 fois par seconde) */
.s3-onde { transform-box: fill-box; transform-origin: center; animation: s3-onde 2.8s ease-in-out infinite; }
.s3-bache-contour.pulse { animation: s3-pulse 1.6s ease-in-out infinite; }
@keyframes s3-onde { 50% { transform: scale(1.015, 0.93); } }
@keyframes s3-pulse { 50% { stroke-opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .s3-onde, .s3-bache-contour.pulse { animation: none; } }
/* Liaison perdue : rien ne bouge sur des valeurs figées ; une alarme reste visible, immobile */
.synoptique-cadre.incertain .coule > .s3-flux:not(.actif) { display: none; }
.synoptique-cadre.incertain .s3-flux, .synoptique-cadre.incertain .s3-onde, .synoptique-cadre.incertain .s3-bache-contour { animation: none; }

/* --- Structure de l'outil : menu à gauche, six entrées (maquette CES · SOPEI, charte AGAPE) --- */
.coquille { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: calc(100vh - 120px); }
.menu {
  display: flex; flex-direction: column; gap: var(--space-1); padding: var(--space-4) var(--space-3);
  background: var(--panel); border-right: 1px solid var(--line);
  position: sticky; top: var(--haut-bandeau); align-self: start; height: calc(100vh - var(--haut-bandeau)); overflow-y: auto;    /* menu fixe au défilement, sous le bandeau */
}
.menu a {
  display: flex; align-items: center; gap: var(--space-3); padding: 10px var(--space-3); border-radius: var(--radius-md);
  color: var(--ink); text-decoration: none; font: 600 15px/20px var(--f-ui);
}
.menu a:hover { background: var(--panel-2); }
.menu a[aria-current] { background: var(--accent); color: var(--accent-ink); }
.menu a[hidden] { display: none; }
.menu svg { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.compteur {
  margin-left: auto; min-width: 22px; padding: 0 6px; border-radius: var(--radius-pill); text-align: center;
  font: 700 12px/20px var(--f-ui); background: var(--panel-2); color: var(--ink);
}
.compteur.u1 { background: var(--crit); color: var(--crit-ink); }
.compteur.u2 { background: var(--warn-soft); color: var(--warn-txt); box-shadow: inset 0 0 0 1px var(--warn); }
.compteur.u3 { background: var(--panel-2); color: var(--muted); box-shadow: inset 0 0 0 1px var(--muted); }
.pages { padding: var(--space-6) var(--space-8); min-width: 0; }
.page[hidden] { display: none; }
.pages .grille { padding: 0; margin: 0; max-width: none; }
.page:not(.grille) { display: grid; gap: var(--space-6); max-width: 1500px; }
.utilisateur { font-weight: 600; color: var(--ink); }
.panneau.a-venir { display: grid; gap: var(--space-3); max-width: 760px; }
@media (max-width: 1000px) {
  .coquille { grid-template-columns: 1fr; }
  .menu { flex-direction: row; flex-wrap: wrap; border-right: 0; border-bottom: 1px solid var(--line); height: auto; z-index: 10; }
  .pages { padding: var(--space-4); }
}

/* --- Tableaux, étiquettes, formulaires ----------------------------------------------------- */
.tableau { width: 100%; border-collapse: collapse; }
.tableau th { text-align: left; font: 600 13px/18px var(--f-ui); color: var(--muted); border-bottom: 1px solid var(--line); padding: var(--space-2) var(--space-2); }
.tableau td { border-bottom: 1px solid var(--line); padding: var(--space-2); vertical-align: middle; }
.matrice th:not(:first-child), .matrice td:not(:first-child) { text-align: center; }
.coche { font-weight: 700; color: var(--accent); }
:root[data-theme="nuit"] .coche { color: var(--ink); }
.etiquette { display: inline-block; padding: 1px 10px; border-radius: var(--radius-pill); font: 600 12px/18px var(--f-ui); background: var(--panel-2); color: var(--ink); border: 1px solid var(--line); }
.etiquette.ok { border-color: var(--accent); }
.etiquette.forte { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.acces-droits { display: grid; gap: var(--space-6); }
.deux-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: var(--space-6); }
.defilant { max-height: 440px; overflow: auto; }
.actions-ligne { display: flex; gap: var(--space-2); justify-content: flex-end; white-space: nowrap; }
.formulaire { display: grid; gap: var(--space-3); }
.encadre { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); background: var(--bg); margin-bottom: var(--space-4); display: grid; gap: var(--space-3); }
.ligne-champs { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: end; }
.ligne-champs .champ { flex: 1 1 220px; }
.ligne-champs input { flex: 1 1 320px; }
.champ { display: grid; gap: var(--space-1); font: 600 13px/18px var(--f-ui); }
.formulaire input:not([type="checkbox"]), .formulaire select, .liste-commandes input, .ligne-champs input {
  font: 400 15px/22px var(--f-ui); color: var(--ink); background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius-md); padding: 7px 10px;
}
.formulaire input:disabled { color: var(--muted); background: var(--panel-2); }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); margin: 0; display: grid; gap: var(--space-2); }
fieldset .case { display: inline-flex; }
.case { display: inline-flex; align-items: center; gap: 6px; margin-right: var(--space-4); font: 400 15px/22px var(--f-ui); }
.case[hidden] { display: none; }
.actions { display: flex; gap: var(--space-2); justify-content: flex-end; flex-wrap: wrap; }
.bouton.principal, button.bouton.principal { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.bouton.principal:hover { background: var(--accent); border-color: var(--accent); }
.bouton:disabled { opacity: .5; cursor: default; }
button.bouton { font: 600 13px/18px var(--f-ui); cursor: pointer; }
button.lien { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; cursor: pointer; font: inherit; justify-self: start; }
:root[data-theme="nuit"] button.lien { color: var(--ink); }
/* Messages : jamais une couleur d'alarme (réservée aux alarmes) */
.erreur { border-left: 4px solid var(--ink); background: var(--panel-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); font-weight: 600; }
.info { border-left: 4px solid var(--accent); background: var(--panel-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); }
.erreur[hidden], .info[hidden] { display: none; }
.aide { color: var(--ink); }
code { font-family: var(--f-num); font-size: 14px; letter-spacing: .04em; }

/* --- Connexion et activation ------------------------------------------------------------------- */
.acces { display: grid; justify-items: center; padding: 48px var(--space-4); }
.carte-acces { width: min(440px, 100%); display: grid; gap: var(--space-4); padding: var(--space-6); }
.carte-acces.large { width: min(600px, 100%); }
.pied-acces { border-top: 1px solid var(--line); padding-top: var(--space-3); }
.code-totp { font-size: 26px !important; letter-spacing: .32em; text-align: center; font-variant-numeric: tabular-nums; }
.qr { display: grid; place-items: center; }
.qr svg { width: 210px; height: 210px; border: 1px solid var(--line); border-radius: var(--radius-md); }

/* --- Commandes : boîte de dialogue de confirmation ------------------------------------------------ */
.dialogue { border: 1px solid var(--line); border-radius: var(--radius-lg); padding: var(--space-6); background: var(--panel); color: var(--ink); width: min(600px, 92vw); }
.dialogue[open] { display: grid; gap: var(--space-4); }
.dialogue::backdrop { background: var(--ink); opacity: .45; }
.liste-commandes { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-3); }
.liste-commandes li { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.confirmation { display: grid; gap: var(--space-2); border: 2px solid var(--accent); border-radius: var(--radius-md); padding: var(--space-4); }
:root[data-theme="nuit"] .confirmation { border-color: var(--accent); }
.page[data-page="alarmes"] .alarmes { grid-column: auto; }

/* --- Vue d'ensemble (lot 2) : tuiles, carte des sites, fiche du site ------------------------ */
.ensemble { display: grid; gap: var(--space-4); }
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(138px, 1fr)); gap: var(--space-3); }
/* Au-delà de 8 indicateurs : deux lignes équilibrées plutôt que des valeurs coupées */
.indicateurs:has(> :nth-child(9)) { grid-template-columns: repeat(5, 1fr); }
.tuile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); }
.tuile-libelle { font: 600 13px/18px var(--f-ui); color: var(--muted); }
.tuile-valeur { font: 500 26px/36px var(--f-num); color: var(--ink); font-variant-numeric: tabular-nums; }
.tuile-complement { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; min-height: 18px; }
/* État signalé par un contour (couleur + épaisseur), le libellé et le badge disent lequel */
.tuile.u1 { border: var(--stroke-alarm) solid var(--crit); }
.tuile.u2 { border: var(--stroke-alarm) solid var(--warn); }
.tuile.u3 { border: var(--stroke-alarm) solid var(--muted); }
.tuile.perdue { border: 2px dashed var(--comm); }
/* « Volumes sur 24 h » : une tuile qui s'ouvre sur le détail par famille (posé sous la tuile, sans décaler la grille) */
.tuile-volumes { position: relative; }
.tuile-unite { font: 500 15px/20px var(--f-ui); color: var(--muted); }
.tuile-volumes > summary { display: flex; flex-direction: column; cursor: pointer; list-style: none; }
.tuile-volumes > summary::-webkit-details-marker { display: none; }
.tuile-volumes > summary .tuile-libelle::after { content: " ▾"; color: var(--muted); }
.tuile-volumes[open] > summary .tuile-libelle::after { content: " ▴"; }
.tuile-volumes > summary:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; border-radius: var(--radius-md); }
.volumes-detail { position: absolute; top: calc(100% + var(--space-2)); right: 0; z-index: 20; min-width: 360px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4);
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.18); }
.table-volumes { width: 100%; border-collapse: collapse; }
.table-volumes caption { text-align: left; font: 600 13px/18px var(--f-ui); color: var(--muted); padding-bottom: var(--space-2); }
.table-volumes th { text-align: left; font: 600 14px/20px var(--f-ui); color: var(--ink); padding: var(--space-1) var(--space-3) var(--space-1) 0; }
.table-volumes td { padding: var(--space-1) var(--space-3) var(--space-1) 0; border-top: 1px solid var(--line); white-space: nowrap; }
.table-volumes th { border-top: 1px solid var(--line); }
.table-volumes td.num { font: 500 15px/20px var(--f-num); font-variant-numeric: tabular-nums; text-align: right; color: var(--ink); }

.ensemble-grille { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--space-4); align-items: start; }
.ensemble-cote { display: grid; gap: var(--space-4); }
@media (max-width: 1100px) { .ensemble-grille { grid-template-columns: 1fr; } }
.carte-fond { height: 520px; border-radius: var(--radius-sm); background: var(--bg); overflow: hidden; touch-action: none; cursor: grab; background: var(--sea); }
.carte-fond.glisse { cursor: grabbing; }
.carte-svg { width: 100%; height: 100%; display: block; user-select: none; }
.carte-svg .dep { fill: var(--land); stroke: var(--land-stroke); stroke-width: 1px; vector-effect: non-scaling-stroke; }
.carte-svg .dep:hover { fill: var(--land-ctx); }
.carte-svg .encart rect { fill: none; stroke: var(--line); stroke-dasharray: 6 4; vector-effect: non-scaling-stroke; }
.carte-svg .encart text { fill: var(--map-label); font: 600 15px var(--f-ui); text-anchor: middle; }
.carte-svg .encart .encart-note { font-weight: 400; font-size: 12px; }
.carte-site, .carte-groupe { cursor: pointer; }
.carte-site:focus, .carte-groupe:focus { outline: none; }
.carte-site:focus-visible .anneau, .carte-groupe:focus-visible .anneau { stroke: var(--focus); stroke-width: 3px; }
.carte-svg .anneau { fill: var(--panel); }                  /* liseré de la couleur du fond */
.carte-svg .marque { fill: var(--accent); stroke: var(--panel); stroke-width: 2px; }
.carte-svg .u1 .marque { fill: var(--crit); }
.carte-svg .u2 .marque { fill: var(--warn); }
.carte-svg .u3 .marque { fill: var(--panel-2); stroke: var(--muted); }
.carte-svg .perdue .marque { fill: var(--panel); stroke: var(--comm); stroke-width: 2.5px; stroke-dasharray: 3 2; }
.carte-svg .carte-groupe .marque { fill: var(--accent); }
.carte-svg .carte-groupe.u1 .anneau, .carte-svg .carte-groupe.u2 .anneau, .carte-svg .carte-groupe.u3 .anneau { stroke-width: 3px; }
.carte-svg .carte-groupe.u1 .anneau { stroke: var(--crit); }
.carte-svg .carte-groupe.u2 .anneau { stroke: var(--warn); }
.carte-svg .carte-groupe.u3 .anneau { stroke: var(--muted); }
.carte-svg .carte-groupe.perdue .anneau { stroke: var(--comm); stroke-width: 2.5px; stroke-dasharray: 3 2; }
.carte-svg .carte-groupe.perdue .marque { fill: var(--accent); stroke: var(--panel); stroke-dasharray: none; }
.carte-svg .carte-nombre { fill: var(--accent-ink); font: 700 14px var(--f-ui); text-anchor: middle; pointer-events: none; }
.carte-svg .carte-libelle { fill: var(--ink); font: 600 12px var(--f-ui); paint-order: stroke; stroke: var(--bg); stroke-width: 3px; pointer-events: none; }
.carte-svg .choisi .anneau { stroke: var(--ink); stroke-width: 2px; }
.carte-svg .clignote .marque { animation: clignote 1s steps(1) infinite; }      /* une fois par seconde */
@media (prefers-reduced-motion: reduce) { .carte-svg .clignote .marque { animation: none; } }
.carte-pied { display: flex; align-items: center; gap: var(--space-4); flex-wrap: wrap; margin-top: var(--space-2); }
.carte-pied .espace { flex: 1; }
.carte-cle { display: inline-flex; align-items: center; gap: 6px; }
.carte-cle::before { content: ""; width: 10px; height: 10px; border-radius: var(--radius-pill); background: var(--accent); }
.carte-cle.alarme::before { border-radius: 1px; transform: rotate(45deg); width: 9px; height: 9px; background: var(--crit); }
.carte-cle.perdue::before { background: transparent; border: 2px dashed var(--comm); width: 8px; height: 8px; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-2) var(--space-4); margin: var(--space-3) 0 var(--space-4); }
.fiche dt { color: var(--muted); font-size: 13px; }
.fiche dd { margin: 0; }
.liste-alarmes-courte { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.liste-alarmes-courte li { display: flex; align-items: center; gap: var(--space-2); flex-wrap: wrap; }
button.lien { background: none; border: 0; padding: 0; font: 600 15px var(--f-ui); color: var(--accent); cursor: pointer; text-decoration: underline; }
.page-licences { max-width: 960px; margin: var(--space-8) auto; padding: 0 var(--space-4); }
.page-licences .panneau { display: grid; gap: var(--space-4); }

/* --- Courbes (lot 3) ----------------------------------------------------------------------- */
.courbes-page:not([hidden]) { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--space-4); align-items: start; }
@media (max-width: 1100px) { .courbes-page:not([hidden]) { grid-template-columns: 1fr; } }
.courbes-droite { display: grid; gap: var(--space-4); }
.courbes-choix { display: grid; gap: var(--space-3); }
.courbes-choix select { width: 100%; }
.courbes-mesures { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--space-2); }
.courbes-mesures label { display: flex; gap: var(--space-2); align-items: baseline; cursor: pointer; }
.courbes-mesures label.inactif { color: var(--muted); cursor: not-allowed; }
.courbes-export { display: flex; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.courbes-graphe { height: 520px; }
.serie { display: inline-block; width: 14px; height: 4px; border-radius: 2px; margin-right: var(--space-2); vertical-align: middle; }
.serie[data-serie="1"] { background: var(--s1); }
.serie[data-serie="2"] { background: repeating-linear-gradient(90deg, var(--s2) 0 4px, transparent 4px 6px); }   /* s2 en tirets */
.serie[data-serie="3"] { background: var(--s3); }
.serie[data-serie="4"] { background: var(--s4); }
.serie[data-serie="5"] { background: var(--s5); }

/* --- Bilans (lot 4) ------------------------------------------------------------------------- */
.bilans-page:not([hidden]) { display: grid; gap: var(--space-4); }
.bilans-choix { display: flex; flex-wrap: wrap; align-items: end; gap: var(--space-3) var(--space-4); }
.bilans-choix #bilans-journee { flex: 1 1 260px; margin: 0; }
.bilans-graphe { height: 340px; }
.defile { overflow-x: auto; }
.bilans-table th.n, .bilans-table td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.bilans-table td, .bilans-table th { white-space: nowrap; }
.bilans-table tfoot th { color: var(--ink); border-top: 2px solid var(--line); border-bottom: 0; }
.bilans-table tr.a-venir td { color: var(--muted); }
.bilans-table .partiel { font-weight: 600; }
.badge-heure { display: inline-block; padding: 0 var(--space-2); border: 1px solid var(--muted); border-radius: 999px; font-weight: 600; }

/* Titres en Barlow Semi Condensed (charte CES · SOPEI) */
h1, h2, h3 { font-family: var(--f-head); }
/* Repères de la carte : villes (point et nom) et départements (capitales espacées) */
.carte-svg .carte-reperes { pointer-events: none; }
.carte-svg .carte-ville circle { fill: var(--muted); stroke: var(--land); stroke-width: 1.5px; }
.carte-svg .carte-ville text { fill: var(--ink); font: 500 12px var(--f-ui); paint-order: stroke; stroke: var(--land); stroke-width: 3px; stroke-linejoin: round; }
.carte-svg .carte-ville.rang1 text { font-weight: 600; }
.carte-svg .carte-dep-nom { fill: var(--muted); font: 500 11px var(--f-ui); letter-spacing: .08em; text-transform: uppercase; text-anchor: middle;
  paint-order: stroke; stroke: var(--land); stroke-width: 3px; stroke-linejoin: round; }

/* --- Synoptique agrandi (bouton « Agrandir », touche F) ------------------------------------------ */
.bouton-icone { display: inline-flex; align-items: center; gap: var(--space-2); }
.bouton-icone .icone { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
#agrandir [data-reduire], #agrandir[aria-pressed="true"] [data-agrandir] { display: none; }
#agrandir[aria-pressed="true"] [data-reduire] { display: inline; }
#panneau-synoptique:fullscreen, #panneau-synoptique.plein-ecran {
  display: flex; flex-direction: column; gap: var(--space-3); width: 100vw; height: 100vh; max-width: none; margin: 0;
  border-radius: 0; padding: var(--space-4) var(--space-6); background: var(--bg); overflow: hidden;
}
#panneau-synoptique.plein-ecran { position: fixed; inset: 0; z-index: 1000; }
#panneau-synoptique:fullscreen::backdrop { background: var(--bg); }
#panneau-synoptique:fullscreen .synoptique-cadre, #panneau-synoptique.plein-ecran .synoptique-cadre { flex: 1; min-height: 0; display: flex; }
#panneau-synoptique:fullscreen .synoptique-cadre svg, #panneau-synoptique.plein-ecran .synoptique-cadre svg { width: 100%; height: 100%; }
body.synoptique-agrandi { overflow: hidden; }

/* --- Pilotage manuel : bandeau « Site en manuel », panneau Commandes par équipement --------- */
.bandeau-manuel {
  position: sticky; top: var(--haut-bandeau); z-index: 15;
  display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center;
  padding: var(--space-2) var(--space-6); background: var(--warn-soft); color: var(--warn-txt);
  border-bottom: 2px solid var(--warn); font-weight: 600;
}
.bandeau-manuel a { color: inherit; text-decoration: underline; }
.etat-manu { color: var(--warn-txt); font-weight: 700; }
.groupes-commandes { display: grid; gap: var(--space-3); margin-top: var(--space-3); }
.groupe-commande { border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3) var(--space-4); display: grid; gap: var(--space-2); }
.groupe-commande header { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: baseline; justify-content: space-between; }
.boutons-ordres { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.ordre-simple { display: flex; gap: var(--space-3); align-items: center; justify-content: space-between; width: 100%; }
.consigne { display: flex; flex-wrap: wrap; gap: var(--space-3); align-items: center; }
.consigne input { width: 7em; }
.bouton:disabled { opacity: .55; cursor: not-allowed; }
.recap { display: grid; grid-template-columns: max-content 1fr; gap: var(--space-1) var(--space-4); margin: 0; }
.recap dt { color: var(--muted); }
.recap dd { margin: 0; }
#commandes { width: min(720px, 94vw); }

