/* Le tableau de bord (ADR-0016), repris de la maquette validée le 19/09/2026
   (docs/maquettes/tableau-de-bord.html). Jetons du DS uniquement ; les graphiques sont en SVG
   dessiné ici, le DS n'a pas de barres. */


.tb-contenu { flex: 1; width: 100%; max-width: 1320px; box-sizing: border-box; margin: 0 auto; padding-block: 18px 48px; padding-inline: 22px; display: flex; flex-direction: column; gap: 16px; }
.tb-tete { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.tb-tete h2 { margin: 0; font: var(--weight-bold) var(--text-xl)/var(--leading-snug) var(--font-display); color: var(--text-1); letter-spacing: -0.01em; text-wrap: balance; }
.tb-tete .tb-au { font: 400 var(--text-sm)/1.3 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-tete .tb-fin { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.tb-pages { display: flex; gap: 6px; flex-wrap: wrap; }

/* Le bandeau : une seule surface, six mesures séparées par des filets, pas six cartes. */
.tb-bandeau { display: grid; grid-template-columns: repeat(var(--n, 6), minmax(0, 1fr)); background: var(--surface-1); border: 1px solid var(--border-subtle); border-radius: var(--ds-radius-surface); }
.tb-mesure { display: flex; flex-direction: column; gap: 6px; padding: 16px 18px; border-left: 1px solid var(--border-subtle); min-width: 0; text-align: left; background: none; border-top: 0; border-right: 0; border-bottom: 0; font: inherit; color: inherit; cursor: pointer; border-radius: 0; }
.tb-mesure:first-child { border-left: 0; }
.tb-mesure:hover { background: var(--surface-hover); }
.tb-mesure:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.tb-mesure-libelle { font: var(--weight-medium) var(--text-sm)/1.3 var(--font-sans); color: var(--text-2); }
.tb-mesure-valeur { font: var(--weight-bold) 26px/1.1 var(--font-display); color: var(--text-1); letter-spacing: -0.02em; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tb-mesure-valeur small { font: var(--weight-medium) var(--text-sm)/1 var(--font-sans); color: var(--text-2); letter-spacing: 0; margin-left: 4px; }
.tb-mesure-compare { display: flex; align-items: center; gap: 5px; font: 400 12px/1.35 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-fleche { flex: none; display: inline-flex; }
/* Les faits en ligne de texte, sans boîte : un filet vertical entre deux faits. */
.tb-faits-ligne { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 2px 10px; min-width: 0; max-width: 100%; font: 400 12px/1.4 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-fait { display: inline-flex; align-items: center; gap: 3px; min-width: 0; overflow-wrap: anywhere; }
.tb-fait.est-fort { color: var(--text-1); font-weight: var(--weight-semibold); }
.tb-sep { width: 1px; height: 11px; background: var(--border-strong); flex: none; }
.tb-faits-ligne + .tb-faits-ligne, .tb-lecture + .tb-faits-ligne { margin-top: 8px; }

.tb-fleche--baisse { color: var(--critical); }
.tb-fleche--hausse { color: var(--success); }

.tb-grille { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 16px; align-items: start; }
.tb-c3 { grid-column: span 3; } .tb-c4 { grid-column: span 4; } .tb-c5 { grid-column: span 5; } .tb-c6 { grid-column: span 6; } .tb-c7 { grid-column: span 7; } .tb-c8 { grid-column: span 8; } .tb-c12 { grid-column: span 12; }
.tb-grille > .ds-card { min-width: 0; }

.tb-graphe { display: block; width: 100%; height: auto; overflow: visible; }
.tb-graphe text { font-family: var(--font-sans); fill: var(--text-2); font-size: 11px; font-variant-numeric: tabular-nums; }
.tb-graphe .tb-axe { stroke: var(--border-strong); stroke-width: 1; }
.tb-graphe .tb-grid { stroke: var(--grid-line, var(--border-subtle)); stroke-width: 1; }
.tb-graphe .tb-objectif { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 5 4; fill: none; }
.tb-graphe .tb-n { fill: var(--accent); }
.tb-graphe .tb-n1 { fill: var(--border-strong); }
.tb-graphe .tb-positif { fill: var(--success); }
.tb-graphe .tb-negatif { fill: var(--critical); }
.tb-graphe .tb-courbe { fill: none; stroke: var(--accent-ink); stroke-width: 2; }
.tb-graphe .tb-point { fill: var(--surface-1); stroke: var(--accent-ink); stroke-width: 2; }
.tb-graphe .tb-cible { fill: transparent; cursor: crosshair; }
.tb-graphe .tb-cible:hover, .tb-graphe .tb-cible.est-lue { fill: var(--accent-softer); }
.tb-graphe .tb-valeur-fort { fill: var(--text-1); font-weight: 600; }
.tb-graphe .tb-en-cours { fill: var(--accent-soft); stroke: var(--accent); stroke-dasharray: 3 2; }

/* La lecture : la ligne qui dit la valeur exacte du point survolé, sous le graphique. */
.tb-lecture { margin: 10px 0 0; min-height: 22px; font: 400 var(--text-sm)/1.4 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-lecture b { color: var(--text-1); font-weight: 600; }
.tb-legende { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; font: 400 12px/1.2 var(--font-sans); color: var(--text-2); }
.tb-legende span { display: inline-flex; align-items: center; gap: 6px; }
.tb-legende i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.tb-legende i.tb-trait { width: 14px; height: 0; border-top: 1.5px dashed var(--text-2); border-radius: 0; }
.tb-legende i.tb-cle-n1 { width: 2px; height: 14px; background: var(--text-1); border-radius: 0; }

/* À surveiller : l'exception, avec sa mesure ; ce qui va bien n'y est pas. */
.tb-alertes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.tb-alertes li { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; padding: 11px 0; border-top: 1px solid var(--border-subtle); }
.tb-alertes li:first-child { border-top: 0; padding-top: 0; }
.tb-pastille { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.tb-pastille--critical { background: var(--critical); }
.tb-pastille--warning { background: var(--warning); }
.tb-alertes .tb-alerte-quoi { font: var(--weight-medium) 13px/1.35 var(--font-sans); color: var(--text-1); }
.tb-alertes .tb-alerte-mesure { grid-column: 2; font: 400 12px/1.35 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-alertes .sb-lien { grid-column: 2; font-size: 12px; justify-self: start; }

.tb-carte-chaleur { display: grid; grid-template-columns: 76px repeat(9, minmax(0, 1fr)); gap: 3px; font: 400 11px/1 var(--font-sans); color: var(--text-2); font-variant-numeric: tabular-nums; }
.tb-carte-chaleur .tb-case { aspect-ratio: 1.35; max-width: 100%; border-radius: 3px; background: rgb(var(--accent-rgb) / var(--a)); display: grid; place-items: center; color: var(--text-1); font-size: 10.5px; cursor: crosshair; }
.tb-carte-chaleur .tb-case.est-fort { color: var(--on-accent); }
.tb-carte-chaleur .tb-case.est-ferme { background: var(--surface-3); color: var(--text-3); }
.tb-carte-chaleur .tb-case:hover { outline: 2px solid var(--text-1); outline-offset: -2px; }
.tb-carte-chaleur .tb-jour { align-self: center; color: var(--text-2); }
.tb-carte-chaleur .tb-heure { text-align: center; padding-bottom: 4px; }

/* Le mur de lectures à gauche, la colonne de travail à droite : elle reste là, page ouverte. */
.tb-colonnes { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 16px; align-items: start; }
.tb-mur { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tb-cote { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tb-cote .tb-grand { display: block; font: var(--weight-bold) 26px/1.1 var(--font-display); color: var(--text-1); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.tb-cote .tb-grand small { font: var(--weight-medium) var(--text-sm)/1 var(--font-sans); color: var(--text-2); letter-spacing: 0; margin-left: 4px; }
.tb-cote .ds-progress + .tb-faits-ligne { margin-top: 8px; }

.tb-note { margin: 0; font: 400 12px/1.45 var(--font-sans); color: var(--text-2); }
.tb-table-cadre { overflow-x: auto; }
.tb-num { font-variant-numeric: tabular-nums; text-align: right; display: block; white-space: nowrap; }

@media (max-width: 1100px) {
  .tb-bandeau { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tb-mesure:nth-child(3n + 1) { border-left: 0; }
  .tb-c3, .tb-c4, .tb-c5, .tb-c6, .tb-c7, .tb-c8 { grid-column: span 12; }
  .tb-colonnes { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: no-preference) {
  .tb-graphe rect.tb-n, .tb-graphe rect.tb-n1, .tb-graphe rect.tb-positif, .tb-graphe rect.tb-negatif { transition: opacity var(--dur-fast) var(--ease-out); }
}
.tb-graphe.est-survole rect.tb-n:not(.est-lue), .tb-graphe.est-survole rect.tb-n1:not(.est-lue) { opacity: 0.55; }

/* Les faits : libellé à gauche, valeur à droite, une ligne par mesure. */
.tb-faits { display: grid; grid-template-columns: minmax(0, 1fr) auto; margin: 0; font: 400 13px/1.35 var(--font-sans); }
.tb-faits dt, .tb-faits dd { margin: 0; padding: 8px 0; border-top: 1px solid var(--border-subtle); }
.tb-faits dt:first-of-type, .tb-faits dt:first-of-type + dd { border-top: 0; padding-top: 0; }
.tb-faits dt { color: var(--text-2); }
.tb-faits dd { color: var(--text-1); font-weight: var(--weight-semibold); text-align: right; font-variant-numeric: tabular-nums; padding-left: 16px; }
.tb-sous-titre { margin: 18px 0 8px; font: var(--weight-semibold) 11px/1.2 var(--font-sans); letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-2); }

/* La répartition : une barre à 100 %, une part par segment. */
.tb-repartition { display: flex; gap: 2px; height: 22px; border-radius: var(--ds-radius-control); overflow: hidden; }
.tb-repartition span { background: var(--c); min-width: 3px; cursor: crosshair; }
.tb-repartition span:hover, .tb-repartition span.est-lue, .tb-repartition span:focus-visible { outline: 2px solid var(--text-1); outline-offset: -2px; }
.tb-repartition + .tb-legende { margin: 10px 0 0; }

.tb-graphe .tb-s3 { fill: var(--series-3); }
.tb-graphe .tb-repere { stroke: var(--text-2); stroke-width: 1.5; stroke-dasharray: 4 3; }
.tb-graphe .tb-trait-n1 { stroke: var(--text-1); stroke-width: 2; }
.tb-graphe .tb-lieu { fill: var(--border-strong); stroke: var(--surface-1); stroke-width: 1.5; cursor: crosshair; }
.tb-graphe .tb-lieu.est-boutique { fill: var(--accent); }
.tb-graphe .tb-lieu.est-lue { stroke: var(--text-1); stroke-width: 2; }
.tb-graphe .tb-legende-courbe { fill: var(--text-2); }
.tb-fort { color: var(--text-1); font-weight: var(--weight-semibold); }

/* ── Mise en page soignée (page Atelier et services d'abord, 19/09/2026) ────────────────────
   Validée par Célian le 19/09/2026 et étendue à toutes les pages : chaque page s'enveloppe
   dans .tb-soigne (display: contents, la grille de la page ne change pas). */
.tb-soigne { display: contents; }
/* Les cases du haut : le chiffre suit son libellé ; les faits en dessous, empilés, sans filet. */
.tb-soigne .tb-mesure { display: grid; grid-template-rows: auto auto 1fr; align-content: start; row-gap: 8px; }
.tb-soigne .tb-mesure .tb-faits-ligne { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; overflow: visible; }
.tb-soigne .tb-mesure .tb-sep { display: none; }
.tb-soigne .tb-mesure .tb-fait { display: block; line-height: 1.4; }
.tb-soigne .tb-mesure .tb-fait::before { display: none; }
.tb-soigne .tb-mesure .tb-fleche { display: inline-block; vertical-align: -3px; margin-right: 4px; }
/* Les lignes de faits ailleurs : un filet entre deux faits d'une même ligne, jamais en tête
   d'une ligne renvoyée (le filet de tête sort du cadre et il est coupé). */
.tb-soigne .tb-faits-ligne { display: flex; flex-wrap: wrap; column-gap: 21px; row-gap: 2px; overflow: hidden; }
.tb-soigne .tb-faits-ligne .tb-sep { display: none; }
.tb-soigne .tb-fait { position: relative; }
.tb-soigne .tb-fait:not(:first-child)::before { content: ""; position: absolute; left: -11px; top: 50%; width: 1px; height: 11px; margin-top: -5.5px; background: var(--border-strong); }
/* Les cartes d'une même rangée : même hauteur, en-têtes de même hauteur (le filet sous le
   titre tombe au même niveau), et la ligne de lecture posée en bas de la carte. */
.tb-soigne .tb-grille { align-items: stretch; }
.tb-soigne .tb-grille > .ds-card { display: flex; flex-direction: column; }
.tb-soigne .ds-card__head { min-height: 68px; box-sizing: border-box; align-items: flex-start; }
.tb-soigne .ds-card__body { flex: 1 1 auto; display: flex; flex-direction: column; }
.tb-soigne .ds-card__body > .tb-lecture { margin-top: auto; padding-top: 10px; }
.tb-soigne .ds-card__body > .tb-lecture + .tb-faits-ligne { margin-top: 8px; }
.tb-soigne .tb-legende { min-height: 16px; }
.tb-soigne .tb-phrase { margin: 0 0 12px; font: 400 var(--text-sm)/1.45 var(--font-sans); color: var(--text-1); max-width: 70ch; }
.tb-soigne .tb-pile { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.tb-soigne .tb-pile > .ds-card { display: flex; flex-direction: column; }
.tb-soigne .tb-pile > .ds-card:last-child { flex: 1 1 auto; }
