/* Synthèse HoD (synthese_hod.js) : récapitulatif de la direction (Usine, Mine, Géologie), réalisé contre plan
   hebdomadaire et budget. Jetons et classes de app.css seulement ; aucune couleur en dur. La page ne défile jamais :
   l'écran occupe l'hôte (messages en tête, puis la zone des sections qui défile seule ; chaque section défile dans son
   corps quand la disposition personnelle lui donne une hauteur fixe).
   Réorganisation 2.12.0 : une section du HoD par élément (disposition.js, écran synthese_hod), commentaires du jour,
   présentation réglable (filtres, titres et lignes masqués, sections repliées ou réduites, panneau Présentation).
   Un écart porte une flèche et un texte en plus de sa couleur (jamais la couleur seule) ; la référence du HoD porte « H ». */

.sh-ecran { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--e2); padding: var(--e2); }
.sh-m { flex: none; display: flex; flex-direction: column; gap: var(--e2); max-height: 96px; overflow: auto; scrollbar-width: thin; }
.sh-m:empty { display: none; }

/* Zone des sections : défilement interne seulement ; sans moteur de disposition, les sections s'empilent. */
.sh-elements { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-fort) transparent; }
.sh-elements:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.sh-elements > .vide { padding: var(--e4); color: var(--ink-2); }
.sh-el { min-width: 0; min-height: 0; margin-bottom: var(--e2); }
.sh-el:last-child { margin-bottom: 0; }

/* En-tête d'une section (poignée de la disposition) : titre, note, commandes (replier, réduire, agrandir, masquer). */
.sh-el-tete { gap: var(--e2); }
.sh-el-tete h2 { flex: 0 1 auto; }
/* Bulle (i) de la section, juste après son titre (notes, renvois n.d., formule de GRADE VARIANCE). */
.sh-bl { flex: none; display: inline-flex; align-items: center; }
.sh-bl:empty { display: none; }
.sh-bl > .bl { margin-left: 0; }
.sh-tab tr.sh-titre .bl { margin-left: var(--e2); }
/* Pastilles de l'en-tête : sections refusées (bulle avec étiquette) et chiffres provisoires (« ⚠ »), sur une ligne. */
.sh-pastilles { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); padding: 0 var(--e2); }
.sh-pastilles > .bl { margin-left: 0; }
.sh-el-tete .note { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sh-ctl { flex: none; display: inline-flex; align-items: center; gap: 1px; }
.sh-ctl .btn svg { width: 12px; height: 12px; }
.sh-el-corps { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; }
.sh-el-corps:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.sh-el-corps > .vide { padding: var(--e3) var(--e4); color: var(--ink-2); font-size: var(--fs-s); }
.sh-el-msg { padding: var(--e2) var(--e4); color: var(--ink-2); font-size: var(--fs-s); }

/* Commentaires du jour J de la section (colonne P du HoD) ; provisoire signalé par un texte, pas par la couleur seule. */
.sh-com { flex: none; display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--e1) var(--e3); padding: var(--e1) var(--e4); background: var(--bg-1); border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
.sh-com[hidden] { display: none; }
.sh-com-t { display: inline-flex; align-items: center; gap: var(--e1); color: var(--ink-2); font-weight: 600; }
.sh-com-t svg { width: 12px; height: 12px; }
.sh-com-x { overflow-wrap: anywhere; }
.sh-com-x small { color: var(--ink-2); }
.sh-com-prov { font-style: italic; }
.sh-com-p { padding: 0 3px; border: 1px solid var(--line-fort); border-radius: var(--r1); }

/* Indicateurs (mois à date) et graphes (graphe de la période, GRADE VARIANCE). */
.sh-inds { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); border: 0; border-radius: 0; }
.sh-inds .indicateur { position: relative; }
.sh-ind-fav { box-shadow: inset 0 2px 0 var(--ok); }
.sh-ind-def { box-shadow: inset 0 2px 0 var(--bad); }
.sh-el[data-type="graphe"] .sh-el-corps, .sh-el[data-type="grade"] .sh-el-corps { display: flex; flex-direction: column; overflow: hidden; }
.sh-graphe { flex: 1; min-height: 180px; position: relative; overflow: hidden; }
.sh-el[data-type="graphe"] .sh-graphe { min-height: clamp(200px, 30vh, 320px); }
.sh-graphe .gg-trace { min-height: 0; }
.sh-graphe > .vide { padding: var(--e4); color: var(--ink-2); font-size: var(--fs-s); }

/* Tableau dense (densité Studio) : colonnes groupées par période, largeur au contenu, défilement dans la section. */
.sh-tab { width: max-content; min-width: 100%; table-layout: auto; }
.sh-tab th, .sh-tab td { padding: 0 var(--e2); font-size: var(--fs-s); }
.sh-tab tbody th, .sh-tab tbody td { height: 20px; }
.sh-tab td.n { min-width: 56px; }
.sh-tab thead th { text-align: center; }
.sh-tab thead th.n { text-align: right; }
.sh-tab thead tr.sh-h2 th { top: 32px; font-weight: 400; color: var(--ink-2); }
.sh-tab thead th small { display: inline; color: var(--ink-2); font-weight: 400; }
.sh-tab .sh-deb { border-left: 1px solid var(--line-fort); }
.sh-tab thead th.sh-c-jour { box-shadow: inset 0 2px 0 var(--serie-1); }
.sh-tab thead th.sh-c-semaine { box-shadow: inset 0 2px 0 var(--serie-2); }
.sh-tab thead th.sh-c-mois { box-shadow: inset 0 2px 0 var(--accent); }
.sh-tab thead th.sh-c-periode { box-shadow: inset 0 2px 0 var(--line-fort); }
.sh-tab thead th.sh-c-trimestre { box-shadow: inset 0 2px 0 var(--info); }
.sh-tab thead th.sh-c-annee { box-shadow: inset 0 2px 0 var(--ink-2); }
.sh-tab .sh-mes { position: sticky; left: 0; z-index: 1; min-width: 220px; max-width: 320px; text-align: left; border-right: 1px solid var(--line-fort); }
.sh-tab thead .sh-mes { z-index: 3; }
.sh-tab .sh-u { min-width: 40px; color: var(--ink-2); text-align: left; }
.sh-tab .sh-reel { font-weight: 600; }
.sh-tab.sh-reduit td.n { min-width: 48px; }

/* Titres de section : niveau 1 (section sans données, flotte, sécurité), niveau 2 (sous-section de mesures). */
.sh-tab tr.sh-titre th { position: static; height: 20px; text-align: left; white-space: nowrap; font-weight: 600; }
.sh-tab tr.sh-n1 th { background: var(--bg-2); color: var(--ink); border-top: 1px solid var(--line-fort); }
.sh-tab tr.sh-n2 th { background: var(--bg-1); color: var(--ink-2); padding-left: var(--e5); }
.sh-tab tr.sh-titre small { margin-left: var(--e3); color: var(--ink-2); font-weight: 400; }
.sh-tab tr.sh-titre .btn { margin-left: var(--e3); height: 16px; }
.sh-tab tbody tr[data-cle] { cursor: pointer; }
.sh-tab tbody tr[data-cle]:hover > * { background: var(--survol); }
.sh-tab tbody tr[data-cle]:focus-visible > * { background: var(--survol); }
.sh-tab tbody tr[aria-selected="true"] > * { background: var(--choisi); }

/* Bouton « masquer » d'un titre ou d'une ligne : visible au survol ou au focus seulement (présentation sans bruit). */
.sh-tab .sh-masq { margin-left: var(--e2); width: 16px; height: 16px; vertical-align: middle; opacity: 0; }
.sh-tab .sh-masq svg { width: 11px; height: 11px; }
.sh-tab tr:hover .sh-masq, .sh-tab tr:focus-within .sh-masq, .sh-tab .sh-masq:focus-visible { opacity: 1; }

/* Écarts : couleurs communes .ecart-fav, .ecart-defav et .ecart-neutre (app.css) ; absence « n.d. ». La classe .sh-def
   est réservée au bouton (i) « Définition » (plus bas). */
.sh-ec { white-space: nowrap; }
.sh-nd { color: var(--ink-2); }

/* Référence utilisée par le récapitulatif HoD (plan ou budget selon la période). */
.sh-hod { box-shadow: inset 0 -2px 0 var(--accent); }
.sh-hodm { display: inline-flex; align-items: center; justify-content: center; min-width: 10px; height: 10px; margin-left: var(--e1); padding: 0 1px;
  border: 1px solid var(--accent); border-radius: var(--r1); color: var(--accent-texte); font-size: var(--fs-xxs); font-weight: 700; line-height: 8px; vertical-align: 1px; }

/* Rappel des réglages de présentation actifs (au-dessus des sections). */
.sh-reglages-info { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); padding: var(--e1) var(--e3); border: 1px dashed var(--line-fort); border-radius: var(--r1); background: var(--bg-1); color: var(--ink-2); font-size: var(--fs-s); }
.sh-reglages-info > span { display: inline-flex; align-items: center; gap: var(--e1); }
.sh-reglages-info svg { width: 12px; height: 12px; }
/* Toutes les fenêtres : tout déplier, tout replier (barre permanente en tête de la synthèse). */
.sh-barre-plier { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--e2); padding: 2px var(--e2); font-size: var(--fs-s); }
.sh-barre-plier > .note { margin-right: auto; color: var(--ink-2); }
.sh-barre-plier .btn { display: inline-flex; align-items: center; gap: var(--e1); }
.sh-barre-plier svg { width: 12px; height: 12px; }

/* Panneau du dock « Présentation » : départements, sous-traitants, sections, titres et lignes. */
.sh-pan { display: flex; flex-direction: column; gap: var(--e3); padding: var(--e3); font-size: var(--fs-s); }
.sh-pan-g { min-width: 0; display: flex; flex-direction: column; gap: var(--e1); padding: var(--e2) var(--e3); border: 1px solid var(--line); border-radius: var(--r1); }
.sh-pan-g legend { padding: 0 var(--e1); color: var(--ink-2); font-weight: 600; }
.sh-pan-g:disabled { opacity: .55; }
.sh-pan-c { display: inline-flex; align-items: center; gap: var(--e2); min-height: 18px; }
.sh-pan-el { display: flex; flex-direction: column; gap: 1px; padding: var(--e1) 0; border-bottom: 1px solid var(--grid-line); }
.sh-pan-el:last-child { border-bottom: 0; }
.sh-pan-ligne { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e1) var(--e4); }
.sh-pan-ligne > .sh-pan-c:first-child { font-weight: 600; }
.sh-pan-cache .sh-pan-ligne > .sh-pan-c:first-child { color: var(--ink-2); font-weight: 400; }
.sh-pan details summary { cursor: pointer; color: var(--ink-2); }
.sh-pan-arbre, .sh-pan-arbre ul { margin: 0; padding-left: var(--e5); list-style: none; }
.sh-pan-actions { display: flex; flex-wrap: wrap; gap: var(--e2); }
.sh-pan-actions .btn svg { width: 12px; height: 12px; }
/* Combinaison libre du graphe (panneau Présentation). */
.sh-pan-liste { margin: 0; padding-left: var(--e5); display: flex; flex-direction: column; gap: var(--e1); }
.sh-pan-liste li { display: flex; align-items: center; justify-content: space-between; gap: var(--e2); }
.sh-pan-liste li > span:first-child { min-width: 0; overflow-wrap: anywhere; }
.sh-pan-boutons { display: inline-flex; gap: var(--e1); flex: none; }
.sh-pan-form { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e2); }
.sh-pan-form label { display: flex; flex-direction: column; gap: 2px; min-width: 0; color: var(--ink-2); }
.sh-pan-form label:nth-child(2) { grid-column: 1 / -1; }
.sh-pan-form .champ { width: 100%; min-width: 0; }
.sh-graphe .vide .btn { margin-left: var(--e2); }

/* Mode présentation : sections telles que réglées, sans les commandes d'édition de la présentation. */
.cadre[data-presentation="oui"] .sh-ctl, .cadre[data-presentation="oui"] .sh-masq, .cadre[data-presentation="oui"] .sh-reglages-info, .cadre[data-presentation="oui"] .sh-barre-plier { display: none; }
.cadre[data-presentation="oui"] .sh-tab th, .cadre[data-presentation="oui"] .sh-tab td { font-size: var(--fs-m); }

/* ------------------------------------------------------------------ Tableaux de bord standard (02/11/2026, 1.12, 1.13, 1.17) */
/* Cartes : libellé en petites capitales, valeur réalisée, ligne de la référence principale (valeur, écart en valeur et en %),
   ligne du budget ; elles prennent la place de deux rangées d'écart de l'ancienne carte. */
.sh-inds .indicateur.kpi dt { height: 14px; font-size: var(--fs-xs); line-height: 14px; }
.sh-inds .indicateur.kpi dd.kpi-v { height: auto; min-height: 22px; line-height: 22px; text-overflow: clip; }
.sh-inds .indicateur.kpi dd.kpi-ref { height: 14px; color: var(--ink-2); font-size: var(--fs-xs); font-weight: 400; line-height: 14px; font-variant-numeric: tabular-nums; }
/* Panneau Indicateurs bas (12 x 5 d'origine, 1366 x 768) : une seule rangée de cartes, resserrées jusqu'à 112 px (lignes de
   référence coupées, complètes en infobulle de la carte), défilement horizontal au-delà ; plusieurs rangées dès que le
   panneau est agrandi. La seconde rangée n'est plus coupée par le bas du panneau. */
.sh-el[data-type="indicateurs"] > .sh-el-corps { container: shinds / size; }
@container shinds (max-height: 150px) {
  .sh-inds { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: minmax(112px, 1fr); overflow-x: auto; overflow-y: hidden; scrollbar-width: thin; }
}
/* Note des n.d. de la section : chaque raison une fois, numérotée, dans la bulle (i) du titre de la section (04/11/2026) ;
   marge de la liste dans la bulle : bulles.css. */
.sh-tab .nd { white-space: nowrap; }
/* Largeur du tableau ramenée à son cadre (spécification 1.2 et 1.13) : libellé de mesure sur deux lignes au besoin
   (largeur fixe au lieu de la plus longue mesure), dates de chaque fenêtre sous son nom (en-tête sur deux lignes). */
.sh-tab tbody th.sh-mes { width: 240px; min-width: 180px; white-space: normal; overflow-wrap: anywhere; line-height: 1.25; }
.sh-tab thead th.sh-mes { width: 240px; min-width: 180px; }
.sh-tab thead tr.sh-h1 th { height: 32px; line-height: 14px; white-space: normal; }
.sh-tab thead tr.sh-h1 th small { display: block; margin-left: 0; white-space: nowrap; }
/* État vide court d'une sous-section (« Non renseignée ») ; l'explication est dans la bulle (i) du titre (04/11/2026). */
.sh-tab tr.sh-titre small.sh-note { display: inline-block; max-width: 420px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; }
/* Graphe sans aucune valeur : message centré (le titre reste dans l'en-tête de la section, pas répété dans le graphe). */
.sh-graphe > .vide-centre { height: 100%; }
.sh-graphe .gg-titre { display: none; }

@media (max-width: 900px) {
  .sh-el[data-type="graphe"] .sh-graphe { min-height: clamp(170px, 28vh, 260px); }
  .sh-tab .sh-mes { min-width: 150px; }
}

/* ------------------------------------------------------------------ Bulle (i) « Définition » (lot 5) */
/* Définition rendue par le serveur (catalogue de GET /api/objectifs/comparaison) : infobulle au survol, panneau Détail au
   clic. Même allure que les bulles (i) des rapports de réconciliation (rr-bulle). Dans une ligne de tableau : après le nom
   de la mesure ; sur une carte : dans son coin, le libellé (coupé par des points de suspension) lui laisse sa place. */
.sh-def { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px; margin-left: var(--e2); padding: 0; vertical-align: middle;
  border: 1px solid var(--line-fort); border-radius: 50%; background: var(--bg-1); color: var(--ink-2); font: italic 600 var(--fs-xxs)/1 var(--font);
  font-variant-caps: normal; letter-spacing: 0; cursor: help; }
.sh-def:hover { color: var(--ink); border-color: var(--accent); }
.sh-def:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.sh-inds .indicateur > dt.sh-avec-def { padding-right: 18px; }
.sh-inds .sh-def { position: absolute; top: 3px; right: 3px; margin-left: 0; }
@media print { .sh-def { display: none !important; } }

/* Sécurité et approvisionnement (lot 7, D-INTERFACE-5) : une valeur par période, sans plan ni budget ; « Jours depuis le
   dernier LTI » en une cellule fusionnée au jour J (comme Pitinfo) ; notes du serveur dans la bulle (i) de la section
   (04/11/2026). */
.sh-secu td.sh-fusion { text-align: center; }
.sh-secu td.sh-fusion small { margin-left: var(--e1); color: var(--ink-2); font-weight: 400; }
