/* ==========================================================================
   Mobilis — feuille de styles
   Mobile d'abord. Aucune dépendance externe : ni police distante, ni CDN,
   l'application doit rester fonctionnelle sur un réseau local isolé.
   ========================================================================== */

/* ------------------------------------------------------------------ Jetons */

:root {
    color-scheme: light;

    /* Plans et encre */
    --plan: #f9f9f7;
    --surface: #fcfcfb;
    --surface-creuse: #f2f1ed;
    --encre: #0b0b0b;
    --encre-2: #52514e;
    --encre-3: #898781;
    --bordure: rgba(11, 11, 11, .10);
    --bordure-forte: rgba(11, 11, 11, .18);
    --grille: #e1e0d9;
    --ligne-base: #c3c2b7;

    /* Accent de marque (famille bleue de la palette) */
    --accent: #1c5cab;
    --accent-vif: #2a78d6;
    --accent-doux: #cde2fb;
    --accent-encre: #ffffff;

    /* États */
    --bon: #0ca30c;
    --attention: #fab219;
    --grave: #ec835a;
    --critique: #d03b3b;
    --succes-texte: #006300;

    /* Séries de données — paire divergente bleu ↔ rouge, neutre gris.
       Validée CVD (ΔE protan 21,6 en clair / 19,2 en sombre). */
    --serie-oui: #2a78d6;
    --serie-non: #e34948;
    --serie-attente: #c3c2b7;

    /* Rythme */
    --r1: .25rem;
    --r2: .5rem;
    --r3: .75rem;
    --r4: 1rem;
    --r5: 1.5rem;
    --r6: 2rem;
    --arrondi: 10px;
    --arrondi-s: 6px;
    --ombre: 0 1px 2px rgba(11, 11, 11, .05), 0 4px 12px rgba(11, 11, 11, .05);
    --ombre-forte: 0 8px 32px rgba(11, 11, 11, .18);

    --largeur-nav: 244px;
    --hauteur-barre: 56px;

    --police: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        color-scheme: dark;
        --plan: #0d0d0d;
        --surface: #1a1a19;
        --surface-creuse: #232322;
        --encre: #ffffff;
        --encre-2: #c3c2b7;
        --encre-3: #898781;
        --bordure: rgba(255, 255, 255, .10);
        --bordure-forte: rgba(255, 255, 255, .20);
        --grille: #2c2c2a;
        --ligne-base: #383835;
        --accent: #3987e5;
        --accent-vif: #5598e7;
        --accent-doux: #184f95;
        --accent-encre: #ffffff;
        --succes-texte: #0ca30c;
        --serie-oui: #3987e5;
        --serie-non: #e66767;
        --serie-attente: #52514e;
        --ombre: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 12px rgba(0, 0, 0, .3);
        --ombre-forte: 0 8px 32px rgba(0, 0, 0, .6);
    }
}

/* ------------------------------------------------------------------- Socle */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: var(--police);
    font-size: 15px;
    line-height: 1.55;
    color: var(--encre);
    background: var(--plan);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { margin: 0; line-height: 1.25; font-weight: 650; letter-spacing: -.01em; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--accent-vif);
    outline-offset: 2px;
    border-radius: var(--arrondi-s);
}

code {
    font-family: ui-monospace, "Cascadia Code", Consolas, monospace;
    font-size: .875em;
    background: var(--surface-creuse);
    padding: .1em .35em;
    border-radius: 4px;
}

.icone { width: 1.125em; height: 1.125em; flex: none; vertical-align: -.18em; }

/* --------------------------------------------------------- Ossature admin */

.appli {
    min-height: 100dvh;
    display: grid;
    grid-template-columns: 1fr;
    grid-template-rows: var(--hauteur-barre) 1fr;
    grid-template-areas: "barre" "contenu";
}

.bascule-nav { position: absolute; opacity: 0; pointer-events: none; }

.barre {
    grid-area: barre;
    position: sticky;
    top: 0;
    z-index: 40;
    display: flex;
    align-items: center;
    gap: var(--r3);
    padding: 0 var(--r4);
    padding-left: max(var(--r4), env(safe-area-inset-left));
    background: var(--surface);
    border-bottom: 1px solid var(--bordure);
}

.bouton-menu {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px; height: 40px;
    margin-left: -8px;
    border-radius: var(--arrondi-s);
    cursor: pointer;
}
.bouton-menu:hover { background: var(--surface-creuse); }

.hamburger, .hamburger::before, .hamburger::after {
    display: block;
    width: 18px; height: 2px;
    background: var(--encre);
    border-radius: 2px;
    transition: transform .18s ease;
}
.hamburger { position: relative; }
.hamburger::before, .hamburger::after { content: ""; position: absolute; left: 0; }
.hamburger::before { top: -6px; }
.hamburger::after { top: 6px; }

.marque { display: inline-flex; align-items: center; gap: var(--r2); color: var(--encre); font-weight: 700; }
.marque:hover { text-decoration: none; }
.marque__logo {
    display: grid; place-items: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--accent);
    color: var(--accent-encre);
    font-weight: 800; font-size: 15px;
}
.marque__nom { letter-spacing: -.02em; }

.barre__droite { margin-left: auto; display: flex; align-items: center; gap: var(--r2); }
.barre__utilisateur { color: var(--encre-2); font-size: .875rem; }
.enligne { display: inline; }

.voile {
    display: none;
    position: fixed; inset: 0;
    z-index: 45;
    background: rgba(11, 11, 11, .45);
}

.nav {
    grid-area: nav;
    position: fixed;
    top: var(--hauteur-barre);
    bottom: 0; left: 0;
    z-index: 50;
    width: var(--largeur-nav);
    padding: var(--r3);
    background: var(--surface);
    border-right: 1px solid var(--bordure);
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform .22s ease;
}

.bascule-nav:checked ~ .nav { transform: translateX(0); }
.bascule-nav:checked ~ .voile { display: block; }

.nav__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.nav__separateur { height: 1px; margin: var(--r2) var(--r2); background: var(--bordure); }

.nav__lien {
    display: flex; align-items: center; gap: var(--r3);
    padding: var(--r2) var(--r3);
    border-radius: var(--arrondi-s);
    color: var(--encre-2);
    font-weight: 500;
}
.nav__lien:hover { background: var(--surface-creuse); color: var(--encre); text-decoration: none; }
.nav__lien.active { background: var(--accent-doux); color: var(--accent); font-weight: 600; }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .nav__lien.active { color: #fff; }
}

.contenu {
    grid-area: contenu;
    padding: var(--r4);
    padding-left: max(var(--r4), env(safe-area-inset-left));
    padding-right: max(var(--r4), env(safe-area-inset-right));
    padding-bottom: max(var(--r6), env(safe-area-inset-bottom));
    max-width: 1400px;
    width: 100%;
}

@media (min-width: 900px) {
    .appli {
        grid-template-columns: var(--largeur-nav) 1fr;
        grid-template-areas: "barre barre" "nav contenu";
    }
    .bouton-menu, .voile { display: none; }
    .nav { position: sticky; transform: none; height: calc(100dvh - var(--hauteur-barre)); }
    .contenu { padding: var(--r5) var(--r6); }
}

/* ------------------------------------------------------------- En-têtes */

.entete-page {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--r3);
    margin-bottom: var(--r5);
}
.entete-page__actions { display: flex; flex-wrap: wrap; gap: var(--r2); }

.titre-page { font-size: clamp(1.35rem, 1.1rem + 1vw, 1.75rem); }
.sous-titre { margin: var(--r1) 0 0; color: var(--encre-2); font-size: .9rem; }
.titre-section { font-size: 1.05rem; margin-bottom: var(--r3); }
.entete-section { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--r2); }

.lien-retour { display: inline-flex; align-items: center; gap: .35em; font-size: .875rem; color: var(--encre-2); }
.separateur-point::after { content: "•"; margin: 0 .35em; color: var(--encre-3); }

/* --------------------------------------------------------------- Surfaces */

.carte {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--arrondi);
    padding: var(--r4);
    margin-bottom: var(--r4);
    box-shadow: var(--ombre);
}
.carte--etroite { max-width: 27rem; margin: var(--r5) auto; }

@media (min-width: 700px) { .carte { padding: var(--r5); } }

.vide {
    display: grid; gap: var(--r3); justify-items: center;
    padding: var(--r6) var(--r4);
    background: var(--surface);
    border: 1px dashed var(--bordure-forte);
    border-radius: var(--arrondi);
    color: var(--encre-2);
    text-align: center;
}

.chargement { display: flex; align-items: center; gap: var(--r2); padding: var(--r5); color: var(--encre-2); }

.rotor {
    width: 16px; height: 16px;
    border: 2px solid var(--grille);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: rotation .7s linear infinite;
}
@keyframes rotation { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .rotor { animation-duration: 2s; } }

/* --------------------------------------------------------------- Boutons */

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .45em;
    min-height: 40px;
    padding: 0 var(--r4);
    border: 1px solid transparent;
    border-radius: var(--arrondi-s);
    background: var(--surface-creuse);
    color: var(--encre);
    font: inherit; font-weight: 550;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s ease, border-color .15s ease;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }

.btn--principal { background: var(--accent); color: var(--accent-encre); }
.btn--secondaire { background: var(--accent-doux); color: var(--accent); }
.btn--fantome { background: transparent; border-color: var(--bordure-forte); color: var(--encre-2); }
.btn--fantome:hover { background: var(--surface-creuse); color: var(--encre); }
.btn--danger { background: var(--critique); color: #fff; }
.btn--danger-texte { color: var(--critique); }
.btn--petit { min-height: 32px; padding: 0 var(--r3); font-size: .8125rem; }
.btn--large { width: 100%; min-height: 48px; font-size: 1rem; }

.btn--oui { background: var(--serie-oui); color: #fff; }
.btn--non { background: transparent; border-color: var(--serie-non); color: var(--serie-non); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .btn--secondaire { color: #fff; }
}

/* ------------------------------------------------------------ Formulaires */

.formulaire { display: grid; gap: var(--r4); }
.formulaire--large { max-width: 46rem; }

.champ { display: grid; gap: var(--r1); }
.champ > label { font-size: .875rem; font-weight: 550; color: var(--encre-2); }

input[type=text], input[type=password], input[type=email], input[type=search],
input[type=tel], input[type=number], input[type=date], input[type=datetime-local],
select, textarea {
    width: 100%;
    min-height: 42px;
    padding: .5rem .7rem;
    border: 1px solid var(--bordure-forte);
    border-radius: var(--arrondi-s);
    background: var(--surface);
    color: var(--encre);
    /* 16 px minimum : en dessous, iOS zoome automatiquement à la saisie. */
    font: inherit;
    font-size: 16px;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-vif); }

.champ--recherche { position: relative; }
.champ--recherche .icone {
    position: absolute; left: .65rem; top: 50%; transform: translateY(-50%);
    color: var(--encre-3); pointer-events: none;
}
.champ--recherche input { padding-left: 2.3rem; }

.case { display: flex; align-items: flex-start; gap: var(--r2); font-size: .9rem; cursor: pointer; }
.case input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.case--encadree {
    padding: var(--r3);
    border: 1px solid var(--bordure);
    border-radius: var(--arrondi-s);
    background: var(--surface-creuse);
}

.grille-2 { display: grid; gap: var(--r4); }
@media (min-width: 640px) { .grille-2 { grid-template-columns: 1fr 1fr; } }

.actions-formulaire { display: flex; flex-wrap: wrap; align-items: center; gap: var(--r3); }
.actions-bloc { display: flex; flex-wrap: wrap; gap: var(--r2); margin-top: var(--r4); }
.ligne-ajout { display: flex; flex-wrap: wrap; gap: var(--r2); }
.ligne-ajout select { flex: 1 1 14rem; }

.aide { margin: var(--r1) 0 0; font-size: .8125rem; color: var(--encre-3); }
.validation-message { color: var(--critique); font-size: .8125rem; }
.invalid { border-color: var(--critique) !important; }

.filtres {
    display: flex; flex-wrap: wrap; align-items: center; gap: var(--r3);
    margin-bottom: var(--r4);
}
.filtres .champ--recherche { flex: 1 1 16rem; }
.filtres select { width: auto; min-width: 11rem; }

.zone-import { width: 100%; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }

/* --------------------------------------------------------------- Onglets */

.onglets {
    display: flex;
    gap: var(--r1);
    margin-bottom: var(--r4);
    padding-bottom: 2px;
    border-bottom: 1px solid var(--bordure);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}
.onglet {
    flex: none;
    min-height: 38px;
    padding: 0 var(--r3);
    border: none;
    border-bottom: 2px solid transparent;
    margin-bottom: -3px;
    background: none;
    color: var(--encre-2);
    font: inherit; font-weight: 550;
    cursor: pointer;
    white-space: nowrap;
}
.onglet:hover { color: var(--encre); }
.onglet--actif { color: var(--accent); border-bottom-color: var(--accent); }
.onglet--erreur:not(.onglet--actif) { color: var(--critique); }
.onglet__pastille-erreur {
    display: inline-block;
    width: 6px; height: 6px;
    margin-left: .4em;
    border-radius: 50%;
    background: var(--critique);
    vertical-align: middle;
}

/* Liste d'erreurs générée par <ValidationSummary /> : non stylée par défaut. */
.validation-errors {
    display: grid;
    gap: var(--r1);
    margin: 0 0 var(--r4);
    padding: var(--r3) var(--r3) var(--r3) calc(var(--r3) + 1.1em);
    border: 1px solid var(--bordure-forte);
    border-left: 3px solid var(--critique);
    border-radius: var(--arrondi-s);
    background: color-mix(in srgb, var(--critique) 8%, transparent);
    color: var(--critique);
    font-size: .9rem;
    list-style: disc;
}
.validation-errors:empty { display: none; }

.bloc-test {
    display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--r3);
    padding: var(--r3);
    margin-top: var(--r4);
    background: var(--surface-creuse);
    border-radius: var(--arrondi-s);
}
.bloc-test .champ { flex: 1 1 14rem; }

/* --------------------------------------------------------------- Alertes */

.alerte {
    display: flex; align-items: flex-start; gap: var(--r2);
    padding: var(--r3);
    border: 1px solid var(--bordure-forte);
    border-left-width: 3px;
    border-radius: var(--arrondi-s);
    font-size: .9rem;
}
.alerte--erreur { border-left-color: var(--critique); color: var(--critique); background: color-mix(in srgb, var(--critique) 8%, transparent); }
.alerte--succes { border-left-color: var(--bon); color: var(--succes-texte); background: color-mix(in srgb, var(--bon) 8%, transparent); }
.alerte--info { border-left-color: var(--accent-vif); background: color-mix(in srgb, var(--accent-vif) 8%, transparent); }
.alerte--neutre { border-left-color: var(--encre-3); background: var(--surface-creuse); }

.bandeau-info {
    margin-bottom: var(--r4);
    padding: var(--r3) var(--r4);
    border-radius: var(--arrondi-s);
    background: var(--accent-doux);
    color: var(--accent);
    font-size: .9rem;
}
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .bandeau-info { color: #fff; }
}

.erreur-globale {
    display: none;
    position: fixed; bottom: 0; left: 0; right: 0;
    z-index: 1000;
    padding: var(--r3) var(--r4);
    background: var(--critique);
    color: #fff;
}
#blazor-error-ui .fermer { float: right; cursor: pointer; }
.lien-clair { color: #fff; text-decoration: underline; }

/* -------------------------------------------------------------- Pastilles */

.pastille {
    display: inline-flex; align-items: center; gap: .3em;
    padding: .12em .6em;
    border-radius: 999px;
    border: 1px solid currentColor;
    font-size: .75rem; font-weight: 600;
    white-space: nowrap;
}
.pastille::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.pastille--ok { color: var(--succes-texte); }
.pastille--non { color: var(--critique); }
.pastille--attente { color: #8a6100; }
.pastille--info { color: var(--accent); }
.pastille--neutre { color: var(--encre-3); }

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .pastille--attente { color: var(--attention); }
}

/* --------------------------------------------------------------- Tableaux */

.table-defilante { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th, .table td { padding: var(--r2) var(--r3); text-align: left; vertical-align: middle; }
.table thead th {
    position: sticky; top: 0;
    background: var(--surface);
    border-bottom: 1px solid var(--ligne-base);
    font-size: .75rem; font-weight: 650; text-transform: uppercase; letter-spacing: .03em;
    color: var(--encre-3);
    white-space: nowrap;
}
.table tbody tr { border-bottom: 1px solid var(--grille); }
.table tbody tr:hover { background: var(--surface-creuse); }
.table .nombre { text-align: right; font-variant-numeric: tabular-nums; }
.ligne--inactive { opacity: .55; }
.col-actions { text-align: right; white-space: nowrap; }

/* En dessous de 700 px, chaque ligne devient une fiche empilée. */
@media (max-width: 699px) {
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr {
        margin-bottom: var(--r3);
        padding: var(--r2);
        border: 1px solid var(--bordure);
        border-radius: var(--arrondi-s);
    }
    .table td { display: flex; justify-content: space-between; gap: var(--r3); padding: .3rem var(--r2); }
    .table td::before {
        content: attr(data-libelle);
        font-size: .75rem; font-weight: 650; text-transform: uppercase;
        color: var(--encre-3);
    }
    .table td.col-actions { justify-content: flex-end; }
    .table td.col-actions::before { content: none; }
    .table .nombre { text-align: right; }
}

.journal__extrait { display: inline-block; max-width: 28rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: bottom; color: var(--encre-2); }
.journal__erreur { color: var(--critique); font-size: .8125rem; }

/* --------------------------------------------------- Cartes de prestation */

.cartes { display: grid; gap: var(--r4); }
@media (min-width: 720px) { .cartes { grid-template-columns: repeat(auto-fill, minmax(21rem, 1fr)); } }

.carte-prestation {
    display: flex; flex-direction: column; gap: var(--r3);
    padding: var(--r4);
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--arrondi);
    box-shadow: var(--ombre);
}
.carte-prestation--passee { opacity: .68; }
.carte-prestation header { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--r2); }
.carte-prestation__titre { font-weight: 650; font-size: 1.05rem; color: var(--encre); }
.carte-prestation__meta { list-style: none; margin: 0; padding: 0; display: grid; gap: var(--r1); font-size: .875rem; color: var(--encre-2); }
.carte-prestation__meta li { display: flex; align-items: center; gap: .45em; }
.carte-prestation__actions { display: flex; flex-wrap: wrap; gap: var(--r1); margin-top: auto; padding-top: var(--r2); border-top: 1px solid var(--grille); }

.grille-detail { display: grid; gap: var(--r4); }
@media (min-width: 1000px) { .grille-detail { grid-template-columns: 1fr 1fr; } }
.grille-detail > .carte { margin-bottom: 0; }

.description { white-space: pre-wrap; color: var(--encre-2); }

/* ----------------------------------------------------- Jauges & compteurs */

.jauge { display: flex; align-items: center; gap: var(--r3); }
.jauge__barre {
    flex: 1;
    height: 8px;
    background: var(--surface-creuse);
    border-radius: 999px;
    overflow: hidden;
}
.jauge__remplie {
    display: block; height: 100%;
    background: var(--accent-vif);
    /* Extrémité arrondie de 4 px, ancrée à la ligne de base. */
    border-radius: 0 4px 4px 0;
}
.jauge__remplie--complete { background: var(--bon); }
.jauge__texte { font-size: .8125rem; font-variant-numeric: tabular-nums; color: var(--encre-2); white-space: nowrap; }
.jauge--large .jauge__barre { height: 12px; }

.compteurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(7.5rem, 1fr)); gap: var(--r3); margin-bottom: var(--r4); }
.compteur { display: grid; gap: 2px; padding: var(--r3); background: var(--surface-creuse); border-radius: var(--arrondi-s); }
.compteur--accent { background: var(--accent-doux); }
.compteur__valeur { font-size: 1.5rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; }
.compteur__libelle { font-size: .75rem; color: var(--encre-2); }
@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) .compteur--accent .compteur__libelle { color: #dbe7f7; }
}

/* -------------------------------------------------------- Tuiles d'indice */

.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(10.5rem, 1fr)); gap: var(--r4); margin-bottom: var(--r5); }

.tuile {
    display: grid; gap: var(--r1);
    padding: var(--r4);
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--arrondi);
    box-shadow: var(--ombre);
}
.tuile__libelle { font-size: .8125rem; color: var(--encre-2); }
.tuile__valeur { font-size: clamp(1.6rem, 1.3rem + 1.2vw, 2.1rem); font-weight: 700; line-height: 1.1; letter-spacing: -.025em; }
.tuile__detail { font-size: .8125rem; color: var(--encre-3); }

/* ------------------------------------------------------------ Graphiques */

.viz { display: grid; gap: var(--r3); }
.viz__legende { display: flex; flex-wrap: wrap; gap: var(--r4); font-size: .8125rem; color: var(--encre-2); }
.viz__cle { display: inline-flex; align-items: center; gap: .45em; }
.viz__puce { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.viz__vide { padding: var(--r5); text-align: center; color: var(--encre-3); font-size: .9rem; }

.chart { width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--police); fill: var(--encre-3); }
.chart .axe-libelle { font-size: 10px; }
.chart .valeur-libelle { font-size: 10px; fill: var(--encre-2); font-variant-numeric: tabular-nums; }
.chart .grille-ligne { stroke: var(--grille); stroke-width: 1; }
.chart .ligne-base { stroke: var(--ligne-base); stroke-width: 1; }
/* Écart de 2 px entre segments empilés : la surface transparaît entre deux aplats. */
.chart .segment { stroke: var(--surface); stroke-width: 2; }
.chart .segment:hover, .chart .barre:hover { opacity: .82; }

/* Barre de répartition en ligne de tableau : 2 px de surface entre deux aplats. */
.repartition {
    display: inline-flex;
    width: 7rem; min-width: 5rem; height: 10px;
    border-radius: 3px;
    overflow: hidden;
    background: var(--surface-creuse);
    vertical-align: middle;
    gap: 2px;
}
.repartition--vide { opacity: .5; }
.repartition__part { display: block; height: 100%; }

.barres-h { display: grid; gap: var(--r2); }
.barre-h { display: grid; grid-template-columns: minmax(6rem, 9rem) 1fr auto; align-items: center; gap: var(--r3); font-size: .875rem; }
.barre-h__nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--encre-2); }
.barre-h__piste { height: 14px; background: var(--surface-creuse); border-radius: 4px; overflow: hidden; }
.barre-h__valeur-barre { display: block; height: 100%; background: var(--accent-vif); border-radius: 0 4px 4px 0; }
.barre-h__valeur { font-variant-numeric: tabular-nums; color: var(--encre-2); min-width: 2.5rem; text-align: right; }

/* ---------------------------------------------------------------- Modales */

.modale-fond {
    position: fixed; inset: 0;
    z-index: 200;
    display: grid; place-items: center;
    padding: var(--r4);
    background: rgba(11, 11, 11, .5);
    overflow-y: auto;
}
.modale {
    width: 100%; max-width: 30rem;
    max-height: 90dvh;
    overflow-y: auto;
    padding: var(--r5);
    background: var(--surface);
    border-radius: var(--arrondi);
    box-shadow: var(--ombre-forte);
}
.modale--large { max-width: 42rem; }
.modale__titre { font-size: 1.15rem; margin-bottom: var(--r3); }
.modale__corps { color: var(--encre-2); margin-bottom: var(--r5); }
.modale__actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: var(--r2); margin-top: var(--r4); }

/* ---------------------------------------------------------- Pages publiques */

.public { min-height: 100dvh; display: grid; grid-template-rows: auto 1fr auto; background: var(--plan); }
.public__entete {
    display: flex; align-items: center; justify-content: center; gap: var(--r2);
    padding: var(--r4);
    font-weight: 700;
}
.public__titre { letter-spacing: -.02em; }
.public__corps { padding: 0 var(--r4); }
.public__pied { padding: var(--r4); text-align: center; font-size: .8125rem; color: var(--encre-3); }

.salutation { margin: 0 0 var(--r1); color: var(--encre-2); }

.details { display: grid; gap: var(--r3); margin: var(--r4) 0; }
.details dt { display: flex; align-items: center; gap: .4em; font-size: .75rem; text-transform: uppercase; letter-spacing: .03em; color: var(--encre-3); }
.details dd { margin: 2px 0 0; }

.etat-actuel { margin: var(--r4) 0; padding-top: var(--r3); border-top: 1px solid var(--grille); font-size: .875rem; color: var(--encre-2); }

.choix { display: grid; gap: var(--r3); margin-top: var(--r4); }
.choix form { display: contents; }

/* --------------------------------------------------------------- Impression */

.impression { max-width: 21cm; margin: 0 auto; padding: var(--r4); }
.impression__outils { display: flex; gap: var(--r2); margin-bottom: var(--r4); }
.feuille {
    background: var(--surface);
    border: 1px solid var(--bordure);
    border-radius: var(--arrondi);
    padding: var(--r6);
}

.entete-etat { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--r4); padding-bottom: var(--r3); margin-bottom: var(--r4); border-bottom: 2px solid var(--encre); }
.entete-etat__meta { text-align: right; font-size: .8125rem; color: var(--encre-2); }

.bloc-infos { display: grid; gap: var(--r2); margin-bottom: var(--r5); font-size: .9rem; }
.bloc-infos > div { display: flex; gap: var(--r2); }
.bloc-infos dt { min-width: 8rem; font-weight: 650; }
.bloc-infos dd { margin: 0; }

/* Réservé au papier ; impression.css le révèle. */
.pied-impression { display: none; }

.signatures { display: grid; grid-template-columns: 1fr 1fr; gap: var(--r5); margin-top: var(--r6); }
.signature { padding-top: var(--r5); border-top: 1px solid var(--ligne-base); font-size: .8125rem; color: var(--encre-2); }
