/* ====================================================================== graphiques et tableaux de bord */
/* Palette catégorielle de référence (ordre fixe, validée daltonismes) ; teintes sombres choisies à part. */
:root {
  --g-s1: #257de0; --g-s2: #f47230; --g-s3: #00b894; --g-s4: #f2a600;
  --g-s5: #ee7fac; --g-s6: #008a17; --g-s7: #6a4ce2; --g-s8: #ec4647; --g-autres: #a4adb8;
}
@media (prefers-color-scheme: dark) {
  :root { --g-s1: #338ced; --g-s2: #e76624; --g-s3: #00a888; --g-s4: #d28e05;
    --g-s5: #e24d8b; --g-s6: #0aac23; --g-s7: #9887ef; --g-s8: #eb6263; --g-autres: #66717d; }
}
.g-zone { position: relative; min-height: 4rem; min-width: 0; }
.g-svg { display: block; max-width: 100%; height: auto; overflow: visible; }
.g-grille { stroke: var(--trait); stroke-width: 1; }
.g-zero { stroke: var(--discret); stroke-width: 1; }
.g-axe { fill: var(--discret); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-libelle { fill: var(--encre); font-size: 12px; }
.g-valeur { fill: var(--discret); font-size: 11px; font-variant-numeric: tabular-nums; }
.g-centre { fill: var(--encre); font-size: 20px; font-weight: 700; }
.g-point { stroke: var(--carte); stroke-width: 2; }
.g-repere { stroke: var(--discret); stroke-width: 1; stroke-dasharray: 3 3; }
.g-marque { stroke: var(--carte); stroke-width: 1; }
.g-legende { list-style: none; display: flex; flex-wrap: wrap; gap: .25rem .9rem; padding: 0; margin: 0 0 .5rem; font-size: .82rem; color: var(--encre); }
.g-legende li { display: inline-flex; align-items: center; gap: .35rem; }
.g-pastille { width: .7rem; height: .7rem; border-radius: 3px; flex: none; }
.g-anneau { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.5rem; }
.g-legende-anneau { flex-direction: column; flex-wrap: nowrap; flex: 1 1 10rem; min-width: 0; gap: .35rem; }
.g-legende-anneau li { display: grid; grid-template-columns: auto 1fr auto; gap: .5rem; }
.g-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.g-part { color: var(--discret); font-variant-numeric: tabular-nums; }
.g-chiffre { display: flex; flex-direction: column; gap: .15rem; padding: .6rem 0; }
.g-chiffre strong { font-size: clamp(2rem, 5vw, 2.8rem); line-height: 1.1; color: var(--titre); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.g-chiffre span { color: var(--discret); font-size: .9rem; }
.g-table { overflow: auto; max-height: 22rem; }
.g-table .tableau { width: 100%; border-collapse: collapse; font-size: .86rem; }
.g-table th, .g-table td { padding: .35rem .5rem; border-bottom: 1px solid var(--trait); text-align: left; white-space: nowrap; }
.g-table th { color: var(--discret); font-size: .78rem; position: sticky; top: 0; background: var(--carte); }
.g-erreur { color: var(--alerte, #c0392b); font-size: .9rem; }
.g-vide { color: var(--discret); font-size: .9rem; font-style: italic; }
.g-bulle { position: absolute; z-index: 5; pointer-events: none; background: var(--carte); color: var(--encre);
  border: 1px solid var(--trait); border-radius: 8px; padding: .35rem .55rem; font-size: .82rem; line-height: 1.35;
  box-shadow: 0 4px 14px rgb(24 36 51 / 14%); max-width: 16rem; font-variant-numeric: tabular-nums; }
.g-bulle-titre { font-weight: 700; }

/* grille de tableau de bord */
.tdb-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.tdb-carte { border: 1px solid var(--trait); border-radius: 12px; padding: .9rem 1rem 1rem; background: var(--carte);
  display: flex; flex-direction: column; gap: .5rem; min-width: 0; }
.tdb-carte.plein { grid-column: 1 / -1; }
.tdb-carte-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: .5rem; }
.tdb-carte-tete h3 { margin: 0; font-size: 1rem; line-height: 1.3; overflow-wrap: anywhere; }
.tdb-carte-tete .tdb-source { font-size: .78rem; color: var(--discret); }
.tdb-note { margin: 0; font-size: .85rem; color: var(--discret); }
.tdb-actions { display: flex; gap: .2rem; flex-wrap: wrap; justify-content: flex-end; }
.tdb-actions button, .tdb-actions select { font-size: .78rem; padding: .15rem .45rem; }
.tdb-carte [hidden], .g-zone [hidden] { display: none !important; }
.tdb-carte:not(.plein) .tdb-carte-tete { flex-direction: column; }
.tdb-carte:not(.plein) .tdb-actions { justify-content: flex-start; }
@media (max-width: 760px) { .tdb-grille { grid-template-columns: 1fr; } }
@media print {
  .tdb-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tdb-carte { break-inside: avoid; box-shadow: none; }
  .tdb-actions, .g-bulle, .tdb-carte-tete button { display: none !important; }
  .g-pastille, .g-svg, .g-marque { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
.g-aire { opacity: .1; stroke: none; }

/* Les axes et les barres se lisent de gauche à droite dans toutes les langues (arabe compris). */
.g-trace, .g-trace svg { direction: ltr; unicode-bidi: isolate; }
