/* Rompad Balance (balance.js) : écran du bilan des stocks de la Géologie. Jetons et classes de app.css seulement ;
   aucune couleur en dur. L'écran occupe l'hôte : en-tête (indicateurs), graphique de taille standard, tableau qui
   défile seul. Fenêtre basse (1366 x 768) : le graphique cède sa hauteur jusqu'à son minimum avant le tableau (au moins
   160 px) ; en dessous des deux minimums seulement, c'est la zone de l'écran qui défile, jamais la page. */

.bl-ecran { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: var(--e2); padding: var(--e2); overflow: auto; scrollbar-width: thin; }
/* En-tête de l'écran : « bl-haut » (« bl-tete » est l'en-tête du panneau des bulles d'information, bulles.css ; le même
   nom lui imposait flex-direction: column dans tout le logiciel). Zone des messages : pastilles compactes des bulles
   (« ⚠ Chiffres provisoires ») sur une ligne, messages d'erreur sur toute la largeur. */
.bl-haut { flex: none; display: flex; flex-direction: column; gap: var(--e2); }
.bl-m { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); }
.bl-m > .bl { margin-left: 0; }
.bl-m > .message, .bl-m > .chargement { flex: 1 1 100%; }
.bl-m:empty { display: none; }
/* Graphique de taille standard (spécification des tableaux de bord, 1.2) : 280 px sous la tête du panneau quand la
   place le permet ; il rétrécit (jusqu'à 140 px de tracé) avant le tableau, qui ne rétrécit pas sous 160 px. */
.bl-p-graphe { flex: 0 1 calc(var(--h-tete) + 280px); min-height: calc(var(--h-tete) + 140px); }
.bl-p-graphe[hidden] { display: none; }
.bl-graphe { flex: 1; min-height: 0; position: relative; }
.bl-p-tableau { flex: 1 0 160px; min-height: 160px; }
.bl-p-tableau .panneau-tete .note { overflow: hidden; text-overflow: ellipsis; }
.bl-defile { flex: 1; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: var(--line-fort) transparent; }
.bl-defile:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }

/* Tableau dense, colonnes groupées comme la feuille : largeur au contenu, défilement horizontal dans le panneau. */
.bl-tab { width: max-content; min-width: 100%; table-layout: auto; }
.bl-tab th, .bl-tab td { padding: 0 var(--e2); }
.bl-tab td.n { min-width: 58px; }
.bl-tab thead th { text-align: center; }
.bl-tab thead th.n { text-align: right; }
.bl-tab thead tr.bl-h2 th { top: var(--h-tete); }
.bl-tab thead tr.bl-h3 th { top: calc(var(--h-tete) * 2); font-weight: 400; color: var(--ink-2); }
.bl-tab thead th small { display: inline; }
.bl-tab .bl-deb { border-left: 1px solid var(--line-fort); }
.bl-tab thead th.bl-site { box-shadow: inset 0 2px 0 var(--accent); }
.bl-tab thead th.bl-mine { box-shadow: inset 0 2px 0 var(--line-fort); }

/* Colonne Période figée à gauche. */
.bl-tab .bl-per { position: sticky; left: 0; z-index: 1; min-width: 150px; max-width: 220px; text-align: left; border-right: 1px solid var(--line-fort); }
.bl-tab thead .bl-per { z-index: 3; }
.bl-tab tfoot .bl-per { z-index: 3; }

/* Années et mois repliables (lignes de sous-total), jours en retrait. */
.bl-tab tbody tr.bl-g > * { background: var(--bg-2); font-weight: 600; }
.bl-tab tbody tr.bl-g.bl-n1 > * { background: var(--bg-1); }
.bl-tab tbody tr.bl-n1 > .bl-per { padding-left: 16px; }
.bl-tab tbody tr.bl-n2 > .bl-per { padding-left: 30px; }
.bl-tab tbody tr.bl-g small { margin-left: var(--e2); color: var(--ink-2); font-size: var(--fs-xs); font-weight: 400; }
.bl-pli { width: 16px; height: 16px; margin-right: var(--e1); padding: 0; display: inline-flex; align-items: center; justify-content: center; vertical-align: middle;
  border: 1px solid transparent; border-radius: var(--r1); background: transparent; color: var(--ink); cursor: pointer; }
.bl-pli:hover { background: var(--bg-3); }
.bl-pli:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; }
.bl-pli svg { width: 12px; height: 12px; }
.bl-tab tbody tr:focus-visible > * { background: var(--survol); }

/* Valeurs : clôture appuyée, négatif en couleur ET signe moins, absence « n.d. ». */
.bl-tab td.bl-clo { font-weight: 600; }
.bl-neg { color: var(--bad); font-weight: 600; }
.bl-nd { color: var(--ink-2); }
.bl-tab tbody tr.bl-alerte > .bl-per { box-shadow: inset 3px 0 0 var(--warn); }
.bl-marque { display: inline-flex; align-items: center; justify-content: center; min-width: 14px; height: 14px; margin-left: var(--e2); padding: 0 2px;
  border: 1px solid var(--warn); border-radius: 7px; background: var(--warn-bg); color: var(--ink); font-size: var(--fs-xxs); font-weight: 700; line-height: 12px; }

/* Panneau Détail : tableaux du jour. */
.bl-mini { width: 100%; table-layout: auto; margin-bottom: var(--e4); font-size: var(--fs-s); }
.bl-mini th, .bl-mini td { padding: 0 var(--e2); height: 20px; }
.bl-mini tr.bl-hors > * { color: var(--ink-2); }

/* Panneau Contrôles du bilan. */
.bl-alertes { margin: 0; padding: var(--e2); list-style: none; display: flex; flex-direction: column; gap: var(--e2); }
.bl-alertes li { display: flex; gap: var(--e3); align-items: flex-start; }
.bl-alertes p { margin: 0 0 var(--e1); font-size: var(--fs-s); white-space: normal; }
.bl-niv { flex: none; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; border: 1px solid currentColor; border-radius: 50%; font-size: var(--fs-xxs); font-weight: 700; }
.bl-corr { color: var(--ink-2); }

/* Panneau Diagnostic des stocks négatifs : liste des stocks, détail, pistes (le corps du panneau défile seul). */
.bl-diag { display: flex; flex-direction: column; gap: var(--e2); padding-bottom: var(--e4); }
.bl-diag .message { margin: var(--e2) var(--e3) 0; }
.bl-diag-barre { display: flex; align-items: center; justify-content: space-between; gap: var(--e3); padding: 0 var(--e3); font-size: var(--fs-s); color: var(--ink-2); }
.bl-diag .bl-mini { margin-bottom: 0; }
.bl-diag-lien { padding: 0; border: 0; background: transparent; color: var(--accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.bl-diag-lien[aria-pressed="true"] { color: var(--ink); text-decoration: none; }
.bl-diag-lien:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.bl-diag-choisi > * { background: var(--survol); }
.bl-diag .bl-mini th small { color: var(--ink-2); font-weight: 400; }
/* Analyse depuis la date historique d'un stock déjà négatif avant la période (même route, autres dates). */
.bl-diag-hist { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e2); padding: 0 var(--e3); }
.bl-pistes { margin: 0; padding: 0 var(--e3); list-style: none; display: flex; flex-direction: column; gap: var(--e2); }
.bl-pistes li { padding: var(--e2) 0; border-bottom: 1px solid var(--line); }
.bl-pistes p { margin: 0 0 var(--e1); font-size: var(--fs-s); white-space: normal; }
.bl-pistes-f { display: flex; flex-wrap: wrap; gap: var(--e2); }

/* Panneau Stocks d'ouverture. */
.bl-form { display: flex; flex-direction: column; gap: var(--e2); padding: var(--e2) var(--e3); border-bottom: 1px solid var(--line); }
.bl-ouv li { padding: var(--e2) var(--e3); border-bottom: 1px solid var(--line); font-size: var(--fs-s); }
.bl-ouv li.bl-annule > div:first-child { text-decoration: line-through; color: var(--ink-2); }
/* Stock imposé négatif (accepté avec alerte, décision du PDG) : filet d'attention à gauche de l'entrée. */
.bl-ouv li.bl-ouv-neg { box-shadow: inset 3px 0 0 var(--warn); }

/* Sous-titre d'un panneau et sa bulle (i) sur une ligne (bulles.js : jamais de bulle dans un titre h1-h4). */
.bl-pn-tete { display: flex; align-items: flex-end; gap: var(--e1); }
.bl-pn-tete > .bl { margin-left: 0; }

@media (max-width: 900px) {
  .bl-p-graphe { flex-basis: calc(var(--h-tete) + 240px); }
  .bl-tab .bl-per { min-width: 110px; }
}
