/*
 * graphiques.css — les tableaux de bord : Réglages du Hub (hub.html) et console de la plateforme
 * (super-admin.html). Les briques sont fabriquées par graphiques.js ; tout est préfixé `tb-`.
 *
 * D'APRÈS l'administration de livres-en-ville : cartes blanches sur un fond à peine teinté, tuiles de
 * chiffres avec halo qui suit le pointeur, grille « bento » de 12 colonnes, graphiques SVG fins. Ses
 * couleurs ne sont pas reprises : le Hub garde son violet (#6750a4) et la couleur de l'organisation
 * (--marque-*, marque.js), la console son registre neutre et son bleu (tokens.css).
 *
 * LES SÉRIES (--tb-s1…s7) sont la palette catégorielle de référence de la méthode « dataviz »,
 * validée pour le daltonisme dans l'ordre où elle est écrite (adjacentes) ; en sombre, les mêmes
 * teintes, éclaircies pour le fond sombre. Une série unique prend --tb-serie-principale. Le texte ne
 * porte jamais la couleur d'une série : une pastille à côté de lui le fait.
 *
 * TROIS RÈGLES DU DÉPÔT :
 *   - aucun style en ligne n'est nécessaire (la console a une CSP style-src 'self') : ce qui varie à
 *     l'exécution passe par des propriétés posées en JavaScript (--tb-x, width, animation-delay) ;
 *   - tout fond qui porte du texte est OPAQUE (SonarCloud juge un rgba() comme s'il était plein) ;
 *     les lueurs translucides ne vivent que sur des pseudo-éléments décoratifs ;
 *   - aucune de ces classes ne pose `display` sur un élément que le Hub masque par `.hidden`.
 */

/* --- Les jetons ----------------------------------------------------------------------------- */
.tb {
    --tb-fond: #f7f5fa;
    --tb-carte: #ffffff;
    --tb-carte-douce: #f5f2f9;
    --tb-trait: #e7e2ee;
    --tb-trait-fort: #cfc7dc;
    --tb-encre-forte: #1c1b1f;
    --tb-encre: #322f37;
    --tb-attenue: #5f5b66;   /* 6,3:1 sur blanc */
    --tb-faible: #6b6675;    /* 5,6:1 */
    --tb-accent: #6750a4;    /* 6,4:1 */
    --tb-accent-fort: #4f378b;
    --tb-accent-voile: #f1ebfb;
    --tb-serie-principale: #6750a4;
    --tb-grille: #eeeaf3;
    --tb-bien: #17603f;
    --tb-bien-voile: #e5f3eb;
    --tb-mal: #96231f;
    --tb-mal-voile: #fbeceb;
    --tb-attention: #7a4b00;
    --tb-attention-voile: #fcf1dc;
    --tb-s1: #2a78d6;
    --tb-s2: #eb6834;
    --tb-s3: #1baf7a;
    --tb-s4: #eda100;
    --tb-s5: #e87ba4;
    --tb-s6: #008300;
    --tb-s7: #4a3aa7;
    --tb-lueur: rgb(103 80 164 / 14%);
    --tb-ombre: 0 1px 0 #ffffff inset, 0 12px 32px -20px rgb(28 27 31 / 28%);
    --tb-rayon: 16px;

    container: tb / inline-size;
    color: var(--tb-encre);
    font-variant-numeric: lining-nums;
}

.dark .tb {
    --tb-fond: #141218;
    --tb-carte: #1d1b22;
    --tb-carte-douce: #25222b;
    --tb-trait: #2f2b36;
    --tb-trait-fort: #463f51;
    --tb-encre-forte: #ede8f1;
    --tb-encre: #d9d3df;
    --tb-attenue: #c3bccb;
    --tb-faible: #a9a2b2;
    --tb-accent: #d0bcff;
    --tb-accent-fort: #eaddff;
    --tb-accent-voile: #2c2540;
    --tb-serie-principale: #b9a3f0;
    --tb-grille: #2a2730;
    --tb-bien: #8fd3ab;
    --tb-bien-voile: #16291f;
    --tb-mal: #f2a7a2;
    --tb-mal-voile: #33191a;
    --tb-attention: #f2c46d;
    --tb-attention-voile: #33270f;
    --tb-s1: #3987e5;
    --tb-s2: #d95926;
    --tb-s3: #199e70;
    --tb-s4: #c98500;
    --tb-s5: #d55181;
    --tb-s6: #008300;
    --tb-s7: #9085e9;
    --tb-lueur: rgb(208 188 255 / 10%);
    --tb-ombre: 0 12px 32px -20px rgb(0 0 0 / 60%);
}

/* La console reprend les jetons de tokens.css (qui suivent eux-mêmes le thème). Deux classes : à
 * spécificité égale avec `.dark .tb`, l'ordre fait gagner la console, en clair comme en sombre. */
.tb.tb--console {
    --tb-fond: var(--voile);
    --tb-carte: var(--papier);
    --tb-carte-douce: var(--papier-enfonce);
    --tb-trait: var(--trait);
    --tb-trait-fort: var(--trait-fort);
    --tb-encre-forte: var(--encre-forte);
    --tb-encre: var(--encre);
    --tb-attenue: var(--encre-attenuee);
    --tb-faible: var(--encre-faible);
    --tb-accent: var(--accent);
    --tb-accent-fort: var(--accent-fort);
    --tb-accent-voile: var(--accent-voile);
    --tb-serie-principale: var(--tb-s1);
    --tb-lueur: rgb(42 120 214 / 12%);
}

/* --- Les séries : une classe pose la couleur, chaque marque la lit -------------------------- */
.tb-accent { --serie: var(--tb-serie-principale); }
.tb-s1 { --serie: var(--tb-s1); }
.tb-s2 { --serie: var(--tb-s2); }
.tb-s3 { --serie: var(--tb-s3); }
.tb-s4 { --serie: var(--tb-s4); }
.tb-s5 { --serie: var(--tb-s5); }
.tb-s6 { --serie: var(--tb-s6); }
.tb-s7 { --serie: var(--tb-s7); }
.tb-autre { --serie: var(--tb-trait-fort); }

.tb-hors-ecran {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
}

/* --- En-tête d'une page ---------------------------------------------------------------------- */
.tb-entete {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 16px 24px;
    margin-bottom: 24px;
}

.tb-surtitre {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--tb-attenue);
    font-size: 13px;
    font-weight: 600;
}

.tb-surtitre::before {
    content: "";
    width: 18px;
    height: 2px;
    border-radius: 2px;
    background: var(--tb-accent);
}

.tb-titre {
    margin: 8px 0 6px;
    color: var(--tb-encre-forte);
    font-size: clamp(24px, 2.4vw, 32px);
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.15;
}

.tb-chapeau {
    max-width: 68ch;
    margin: 0;
    color: var(--tb-attenue);
    font-size: 14px;
    line-height: 1.65;
}

.tb-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

/* Le titre qui apparaît mot à mot (grTitreFlou). */
.tb-mot {
    display: inline-block;
    animation: tb-flou 0.6s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes tb-flou {
    from { opacity: 0; filter: blur(8px); transform: translateY(6px); }
}

/* --- Tuiles de chiffres ---------------------------------------------------------------------- */
.tb-tuiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
    margin-bottom: 16px;
}

.tb-tuile {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 10px;
    min-width: 0;
    padding: 18px 20px 16px;
    border: 1px solid var(--tb-trait);
    border-radius: var(--tb-rayon);
    background: var(--tb-carte);
    box-shadow: var(--tb-ombre);
}

/* Le halo qui suit le pointeur (« Spotlight card ») : décoratif, sous le texte. */
.tb-projecteur::before {
    content: "";
    position: absolute;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background: radial-gradient(260px circle at var(--tb-x, 50%) var(--tb-y, 0%), var(--tb-lueur), transparent 70%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.tb-projecteur:hover::before {
    opacity: 1;
}

.tb-tuile__tete {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

.tb-tuile__libelle {
    color: var(--tb-attenue);
    font-size: 13px;
    font-weight: 600;
}

.tb-tuile__icone {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border: 1px solid var(--tb-trait);
    border-radius: 12px;
    background: var(--tb-carte-douce);
    color: var(--tb-accent);
}

.tb-tuile__icone svg {
    width: 17px;
    height: 17px;
}

.tb-tuile__corps {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
}

.tb-tuile__valeur {
    color: var(--tb-encre-forte);
    font-size: clamp(26px, 2.3vw, 34px);
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1.1;
    white-space: nowrap;
}

.tb-tuile--absente {
    border-style: dashed;
    background: var(--tb-carte-douce);
    box-shadow: none;
}

.tb-tuile--absente .tb-tuile__valeur {
    color: var(--tb-attenue);
    font-size: 18px;
    letter-spacing: 0;
}

.tb-tuile__pied {
    display: flex;
    align-items: center;
    gap: 8px;
    min-height: 24px;
    font-size: 13px;
}

.tb-tuile__note {
    min-width: 0;
    overflow: hidden;
    color: var(--tb-faible);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-etincelle {
    flex-shrink: 1;
    width: 96px;
    min-width: 40px;
    height: 30px;
    margin-bottom: 4px;
    overflow: visible;
}

.tb-etincelle path {
    fill: none;
    stroke: var(--tb-serie-principale);
    stroke-width: 1.6;
    stroke-linejoin: round;
    vector-effect: non-scaling-stroke;
}

.tb-delta {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.tb-delta svg {
    width: 13px;
    height: 13px;
}

.tb-delta--bien { background: var(--tb-bien-voile); color: var(--tb-bien); }
.tb-delta--mal { background: var(--tb-mal-voile); color: var(--tb-mal); }
.tb-delta--plat { background: var(--tb-carte-douce); color: var(--tb-attenue); }

/* --- La grille « bento » --------------------------------------------------------------------- */
.tb-bento {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 16px;
}

.tb-panneau {
    position: relative;
    grid-column: span 12;
    min-width: 0;
    padding: 20px 22px;
    border: 1px solid var(--tb-trait);
    border-radius: var(--tb-rayon);
    background: var(--tb-carte);
    box-shadow: var(--tb-ombre);
}

.tb-l4 { grid-column: span 4; }
.tb-l5 { grid-column: span 5; }
.tb-l6 { grid-column: span 6; }
.tb-l7 { grid-column: span 7; }
.tb-l8 { grid-column: span 8; }

.tb-panneau__entete {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
}

.tb-panneau__titre {
    margin: 0 0 4px;
    color: var(--tb-encre-forte);
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.tb-panneau__texte {
    margin: 0;
    color: var(--tb-attenue);
    font-size: 13px;
    line-height: 1.55;
}

.tb-lien {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
    border: 0;
    background: none;
    color: var(--tb-accent);
    font: inherit;
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
}

.tb-lien svg {
    width: 14px;
    height: 14px;
}

.tb-lien:hover {
    text-decoration: underline;
    text-underline-offset: 3px;
}

.tb-lien:focus-visible,
.tb-segmente button:focus-visible,
.tb-a-traiter:focus-visible,
.tb-graphique__svg:focus-visible {
    outline: 2px solid var(--tb-accent);
    outline-offset: 3px;
    border-radius: 10px;
}

/* Le choix de la mesure affichée (deux ou trois boutons). */
.tb-segmente {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--tb-trait);
    border-radius: 12px;
    background: var(--tb-carte-douce);
}

.tb-segmente button {
    padding: 6px 12px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--tb-attenue);
    font: inherit;
    font-size: 13px;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.tb-segmente button[aria-pressed="true"] {
    background: var(--tb-carte);
    color: var(--tb-encre-forte);
    font-weight: 700;
    box-shadow: 0 1px 3px rgb(28 27 31 / 14%);
}

.tb-vide {
    margin: 0;
    padding: 22px;
    border-radius: 14px;
    background: var(--tb-carte-douce);
    color: var(--tb-attenue);
    font-size: 13px;
    text-align: center;
}

.tb-vide--bien {
    background: var(--tb-bien-voile);
    color: var(--tb-bien);
}

/* L'entrée de la page : le seul mouvement qui ne répond pas à un geste, joué une fois. */
.tb-entree > * {
    animation: tb-monter 0.5s cubic-bezier(.2, .7, .2, 1) both;
}

.tb-entree > :nth-child(2) { animation-delay: 60ms; }
.tb-entree > :nth-child(3) { animation-delay: 120ms; }
.tb-entree > :nth-child(4) { animation-delay: 180ms; }
.tb-entree > :nth-child(5) { animation-delay: 240ms; }
.tb-entree > :nth-child(6) { animation-delay: 300ms; }
.tb-entree > :nth-child(7) { animation-delay: 360ms; }
.tb-entree > :nth-child(n + 8) { animation-delay: 420ms; }

@keyframes tb-monter {
    from { opacity: 0; transform: translateY(10px); }
}

/* --- Graphiques ------------------------------------------------------------------------------ */
.tb-graphique {
    position: relative;
    min-width: 0;
    margin: 0;
}

.tb-graphique__svg {
    display: block;
    max-width: 100%;
    overflow: visible;
}

.tb-grille line {
    stroke: var(--tb-grille);
    stroke-width: 1;
    shape-rendering: crispEdges;
}

.tb-grille text {
    fill: var(--tb-faible);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
}

.tb-trait {
    fill: none;
    stroke: var(--serie);
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.tb-trait--en-cours {
    stroke-dasharray: 3 4;
}

.tb-stop {
    stop-color: var(--serie);
    stop-opacity: 0.22;
}

.tb-stop--fin {
    stop-opacity: 0;
}

.tb-curseur line {
    stroke: var(--tb-trait-fort);
    stroke-width: 1;
}

.tb-point {
    fill: var(--serie);
    stroke: var(--tb-carte);
    stroke-width: 2;
}

.tb-barre {
    fill: var(--serie);
}

.tb-col {
    transform-box: fill-box;
    transform-origin: bottom;
    transition: opacity 0.2s ease;
}

.tb-col--terne,
.tb-terne {
    opacity: 0.35;
}

.tb-cible {
    fill: transparent;
    cursor: crosshair;
}

.tb-bulle {
    position: absolute;
    top: 6px;
    z-index: 5;
    display: grid;
    gap: 5px;
    min-width: 150px;
    padding: 10px 12px;
    border: 1px solid var(--tb-trait);
    border-radius: 14px;
    background: var(--tb-carte);
    box-shadow: 0 14px 34px -10px rgb(28 27 31 / 30%);
    font-size: 13px;
    pointer-events: none;
    transform: translateX(14px);
}

.tb-bulle--gauche {
    transform: translateX(calc(-100% - 14px));
}

.tb-bulle__titre {
    color: var(--tb-attenue);
    font-size: 12px;
}

.tb-bulle__titre::first-letter {
    text-transform: uppercase;
}

.tb-bulle__ligne {
    display: flex;
    align-items: center;
    gap: 7px;
    color: var(--tb-attenue);
    white-space: nowrap;
}

.tb-bulle__ligne strong {
    color: var(--tb-encre-forte);
    font-size: 15px;
    font-variant-numeric: tabular-nums;
}

.tb-pastille {
    display: inline-block;
    flex: none;
    width: 10px;
    height: 10px;
    border-radius: 4px;
    background: var(--serie);
}

.tb-legende {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 16px;
    margin: 0;
    padding: 0;
    list-style: none;
    color: var(--tb-attenue);
    font-size: 13px;
}

.tb-legende li {
    display: flex;
    align-items: center;
    gap: 7px;
    transition: opacity 0.2s ease;
}

.tb-legende--colonne {
    flex-direction: column;
    gap: 6px;
    width: 100%;
}

.tb-legende--colonne li {
    display: grid;
    grid-template-columns: 10px minmax(0, 1fr) auto 44px;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 12px;
    background: var(--tb-carte-douce);
}

.tb-legende--colonne span {
    overflow: hidden;
    color: var(--tb-encre);
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-legende--colonne strong {
    color: var(--tb-encre-forte);
    font-variant-numeric: tabular-nums;
}

.tb-legende--colonne small {
    color: var(--tb-faible);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* L'anneau de répartition */
.tb-anneau {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 18px;
    margin: 0;
}

.tb-anneau__cadre {
    position: relative;
}

.tb-anneau__piste {
    fill: none;
    stroke: var(--tb-carte-douce);
    stroke-width: 18;
}

.tb-arc {
    fill: none;
    stroke: var(--serie);
    stroke-width: 18;
    transition: opacity 0.2s ease;
}

.tb-anneau__centre,
.tb-jauge__centre {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    pointer-events: none;
}

.tb-anneau__centre strong {
    color: var(--tb-encre-forte);
    font-size: 30px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.03em;
    line-height: 1;
}

.tb-anneau__centre span,
.tb-jauge__centre small {
    margin-top: 4px;
    color: var(--tb-attenue);
    font-size: 12px;
}

/* La jauge circulaire */
.tb-jauge {
    position: relative;
    flex: none;
}

.tb-jauge svg {
    display: block;
}

.tb-jauge__piste {
    fill: none;
    stroke: var(--tb-carte-douce);
    stroke-width: 10;
}

.tb-jauge__plein {
    fill: none;
    stroke: var(--serie);
    stroke-width: 10;
    stroke-linecap: round;
}

.tb-jauge__centre strong {
    color: var(--tb-encre-forte);
    font-size: 24px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    line-height: 1;
}

/* Le classement en barres horizontales */
.tb-classement {
    display: grid;
    gap: 6px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tb-classement__ligne {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    min-height: 40px;
}

.tb-classement__rail {
    position: absolute;
    inset: 0;
    overflow: hidden;
    border-radius: 12px;
    background: var(--tb-carte-douce);
}

.tb-classement__plein {
    position: absolute;
    inset: 0 auto 0 0;
    border-radius: 12px;
    background: var(--serie);
    opacity: 0.2;
    transform-origin: left;
    animation: tb-pousser 0.8s cubic-bezier(.2, .7, .2, 1) both;
}

@keyframes tb-pousser {
    from { transform: scaleX(0); }
}

.tb-classement__libelle {
    position: relative;
    min-width: 0;
    padding: 8px 12px;
    overflow: hidden;
    color: var(--tb-encre);
    font-size: 14px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tb-classement__libelle small {
    margin-left: 8px;
    color: var(--tb-faible);
    font-size: 12px;
}

.tb-classement__valeur {
    position: relative;
    padding-right: 12px;
    white-space: nowrap;
}

.tb-classement__valeur strong {
    color: var(--tb-encre-forte);
    font-size: 14px;
    font-variant-numeric: tabular-nums;
}

.tb-classement__valeur small {
    display: inline-block;
    width: 40px;
    color: var(--tb-faible);
    font-size: 12px;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

/* --- Listes : à traiter, activité ------------------------------------------------------------ */
.tb-liste {
    display: grid;
    gap: 8px;
    margin: 0;
    padding: 0;
    list-style: none;
}

.tb-a-traiter {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 11px 12px;
    border: 1px solid var(--tb-trait);
    border-radius: 14px;
    background: var(--tb-carte);
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.tb-a-traiter:hover {
    border-color: var(--tb-trait-fort);
    box-shadow: 0 8px 20px -14px rgb(28 27 31 / 45%);
    transform: translateX(3px);
}

.tb-a-traiter__icone {
    display: grid;
    place-items: center;
    flex: none;
    width: 34px;
    height: 34px;
    border-radius: 12px;
    background: var(--tb-accent-voile);
    color: var(--tb-accent);
}

.tb-a-traiter--urgent .tb-a-traiter__icone {
    background: var(--tb-attention-voile);
    color: var(--tb-attention);
}

.tb-a-traiter__icone svg {
    width: 17px;
    height: 17px;
}

.tb-a-traiter__texte {
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.tb-a-traiter__texte strong {
    color: var(--tb-encre-forte);
    font-size: 14px;
    font-weight: 650;
}

.tb-a-traiter__texte small {
    color: var(--tb-attenue);
    font-size: 12px;
}

.tb-a-traiter__nombre {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    margin-left: auto;
    padding: 0 8px;
    border-radius: 10px;
    background: var(--tb-encre-forte);
    color: var(--tb-carte);
    font-size: 14px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tb-fil {
    margin: 0;
    padding: 0;
    list-style: none;
}

.tb-fil li {
    display: grid;
    grid-template-columns: 30px minmax(0, 1fr) auto;
    align-items: start;
    gap: 12px;
    padding: 10px 0;
    border-top: 1px dashed var(--tb-trait);
}

.tb-fil li:first-child {
    border-top: 0;
}

.tb-fil__icone {
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border: 1px solid var(--tb-trait);
    border-radius: 50%;
    background: var(--tb-carte-douce);
    color: var(--tb-encre);
}

.tb-fil__icone svg {
    width: 15px;
    height: 15px;
}

.tb-fil__texte {
    min-width: 0;
    padding-top: 5px;
    color: var(--tb-encre);
    font-size: 13px;
    line-height: 1.5;
    overflow-wrap: anywhere;
}

.tb-fil__texte strong {
    color: var(--tb-encre-forte);
    font-weight: 650;
}

.tb-fil time {
    padding-top: 6px;
    color: var(--tb-faible);
    font-size: 12px;
    white-space: nowrap;
}

/* Les chiffres d'un panneau, en pavés */
.tb-paves {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
}

.tb-paves > div {
    padding: 11px 12px;
    border-radius: 14px;
    background: var(--tb-carte-douce);
}

.tb-paves dt {
    color: var(--tb-attenue);
    font-size: 12px;
}

.tb-paves dd {
    margin: 4px 0 0;
    color: var(--tb-encre-forte);
    font-size: 20px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.tb-paves dd small {
    margin-left: 4px;
    color: var(--tb-attenue);
    font-size: 12px;
    font-weight: 500;
}

.tb-sous-titre {
    margin: 18px 0 8px;
    color: var(--tb-attenue);
    font-size: 12px;
    font-weight: 700;
}

.tb-puces {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin: 0 0 8px;
    padding: 0;
    list-style: none;
}

/* Une pastille d'état : toujours un texte ; la couleur le double. */
.tb-etat {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 9px;
    border-radius: 999px;
    background: var(--tb-carte-douce);
    color: var(--tb-attenue);
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
}

.tb-etat--bien { background: var(--tb-bien-voile); color: var(--tb-bien); }
.tb-etat--mal { background: var(--tb-mal-voile); color: var(--tb-mal); }
.tb-etat--attention { background: var(--tb-attention-voile); color: var(--tb-attention); }
.tb-etat--accent { background: var(--tb-accent-voile); color: var(--tb-accent); }

/* --- Le bandeau d'ouverture -------------------------------------------------------------------
 * Le seul dégradé vif, comme celui du tableau de bord de livres-en-ville. Dans le Hub, il prend la
 * couleur de l'organisation (marque.js) : le texte blanc reste sur les nuances 900 → 800, assez
 * sombres pour toutes les palettes proposées (≥ 4,5:1). */
.tb-bandeau {
    position: relative;
    isolation: isolate;
    overflow: hidden;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 20px 32px;
    margin-bottom: 16px;
    padding: 26px 28px;
    border-radius: 20px;
    background-color: rgb(var(--marque-800, 154 52 18));
    background-image: linear-gradient(115deg, rgb(var(--marque-900, 124 45 18)) 0%, rgb(var(--marque-800, 154 52 18)) 45%, rgb(var(--marque-600, 234 88 12)) 100%);
    color: #ffffff;
    box-shadow: 0 18px 40px -24px rgb(var(--marque-900, 124 45 18) / 80%);
}

.tb-bandeau::before,
.tb-bandeau::after {
    content: "";
    position: absolute;
    z-index: -1;
    border-radius: 50%;
    filter: blur(40px);
    pointer-events: none;
    animation: tb-derive 18s ease-in-out infinite alternate;
}

.tb-bandeau::before {
    right: -60px;
    top: -90px;
    width: 300px;
    height: 300px;
    background: rgb(var(--marque-300, 253 186 116) / 55%);
}

.tb-bandeau::after {
    right: 22%;
    bottom: -140px;
    width: 260px;
    height: 260px;
    background: rgb(255 255 255 / 18%);
    animation-duration: 23s;
}

@keyframes tb-derive {
    to { transform: translate(-40px, 30px) scale(1.12); }
}

.tb-bandeau__texte {
    flex: 1 1 340px;
    max-width: 60ch;
}

.tb-bandeau__surtitre {
    margin: 0;
    color: #ffffff;
    font-size: 13px;
    font-weight: 600;
}

.tb-bandeau__titre {
    margin: 6px 0 8px;
    color: #ffffff;
    font-size: clamp(24px, 2.6vw, 34px);
    font-weight: 750;
    letter-spacing: -0.025em;
    line-height: 1.12;
}

.tb-bandeau__chapeau {
    margin: 0;
    color: #ffffff;
    font-size: 14px;
    line-height: 1.6;
}

.tb-bandeau__puces {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin: 16px 0 0;
    padding: 0;
    list-style: none;
}

.tb-bandeau__puces li {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border: 1px solid rgb(255 255 255 / 35%);
    border-radius: 999px;
    background: rgb(var(--marque-900, 124 45 18));
    color: #ffffff;
    font-size: 12px;
    font-weight: 600;
}

.tb-bandeau__puces svg {
    width: 14px;
    height: 14px;
}

.tb-bandeau__mesure {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 18px 14px 14px;
    border-radius: 18px;
    background: rgb(var(--marque-900, 124 45 18));
    color: #ffffff;
}

.tb-bandeau__mesure p {
    margin: 0;
    max-width: 18ch;
    font-size: 13px;
    line-height: 1.45;
}

.tb-bandeau__mesure strong {
    display: block;
    font-size: 15px;
}

.tb-bandeau .tb-jauge__piste { stroke: rgb(255 255 255 / 18%); }
.tb-bandeau .tb-jauge__plein { stroke: #ffffff; }
.tb-bandeau .tb-jauge__centre strong,
.tb-bandeau .tb-jauge__centre small { color: #ffffff; }

/* Une carte à bordure dégradée qui tourne lentement : la porte vers un autre outil. */
.tb-passerelle {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    padding: 18px 22px;
    border: 1px solid transparent;
    border-radius: var(--tb-rayon);
    background:
        linear-gradient(var(--tb-carte), var(--tb-carte)) padding-box,
        linear-gradient(120deg, var(--tb-accent), var(--tb-s3), var(--tb-encre-forte), var(--tb-accent)) border-box;
    background-size: auto, 300% 300%;
    animation: tb-bordure 8s ease infinite;
}

@keyframes tb-bordure {
    50% { background-position: 0 0, 100% 50%; }
}

.tb-passerelle__icone {
    display: grid;
    place-items: center;
    flex: none;
    width: 46px;
    height: 46px;
    border-radius: 16px;
    background: var(--tb-encre-forte);
    color: var(--tb-carte);
}

.tb-passerelle__texte {
    display: flex;
    flex: 1 1 260px;
    flex-direction: column;
    gap: 4px;
}

.tb-passerelle__texte strong {
    color: var(--tb-encre-forte);
    font-size: 16px;
}

.tb-passerelle__texte span {
    color: var(--tb-attenue);
    font-size: 13px;
    line-height: 1.55;
}

/* --- Largeur disponible : la grille suit la place laissée par les menus ---------------------- */
@container tb (max-width: 860px) {
    .tb-tuiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .tb-l4 { grid-column: span 6; }
    .tb-l5,
    .tb-l7,
    .tb-l8 { grid-column: span 12; }
}

@container tb (max-width: 720px) {
    .tb-l4,
    .tb-l6 { grid-column: span 12; }
    .tb-panneau { padding: 16px; }
    .tb-bandeau { padding: 22px 20px; }
}

@container tb (max-width: 480px) {
    .tb-tuiles { grid-template-columns: minmax(0, 1fr); }
    .tb-paves { grid-template-columns: minmax(0, 1fr); }
    .tb-bandeau__mesure { width: 100%; }
    .tb-fil li { grid-template-columns: 30px minmax(0, 1fr); }
    .tb-fil time { grid-column: 2; padding-top: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .tb-entree > *,
    .tb-mot,
    .tb-classement__plein,
    .tb-bandeau::before,
    .tb-bandeau::after,
    .tb-passerelle {
        animation: none;
    }

    .tb-a-traiter,
    .tb-col,
    .tb-arc,
    .tb-projecteur::before {
        transition: none;
    }
}
