:root {
    /* Couleurs de la marque : modifiez ces valeurs pour changer toute l'interface. */
    --marine: #06255c;
    --bleu: #1565c0;
    --vert: #79bd0e;
    --vert-vif: #9be03a;
    --degrade: linear-gradient(165deg, var(--marine) 0%, var(--bleu) 100%);
    --degrade-vert: linear-gradient(120deg, var(--vert-vif) 0%, var(--vert) 100%);
    --bleu-fonce: var(--marine);
    --bleu-clair: #e4eefb;
    --ambre: #f2b632;
    --encre: #0b2545;
    --encre-douce: #4f6079;
    --brique: #b3261e;
    --fond: #f3f6fb;
    --papier: #ffffff;
    --trait: #d5dfee;
    --texte: "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--fond);
    color: var(--encre);
    font: 16px/1.55 var(--texte);
}

h1 { font-size: 1.75rem; line-height: 1.2; margin: 0 0 1.25rem; font-weight: 650; }
h2 { font-size: 1.15rem; margin: 2.25rem 0 .75rem; font-weight: 650; }
p { margin: 0 0 1rem; max-width: 72ch; }
a { color: var(--bleu-fonce); }
code { font-size: .92em; background: rgba(21, 101, 192, .1); padding: .05em .3em; border-radius: 3px; }
small { display: block; color: var(--encre-douce); font-weight: 400; font-size: .84rem; }
:focus-visible { outline: 3px solid var(--bleu-fonce); outline-offset: 2px; }
.rail :focus-visible { outline-color: var(--vert); }

/* Espace connecté */
.moi { background: rgba(0, 0, 0, .22); border-radius: 6px; padding: .35rem 0; }
.espace { display: grid; grid-template-columns: 15rem minmax(0, 1fr); min-height: 100vh; }

.rail {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 1.75rem;
    padding: 1.25rem .75rem;
    background: var(--degrade);
    color: #fff;
}
.rail a { color: #fff; text-decoration: none; }
.marque { display: flex; align-items: center; gap: .6rem; padding: 0 .6rem; }
.marque img { width: 2.25rem; height: 2.25rem; object-fit: contain; background: #fff; border-radius: 4px; padding: 2px; }
.marque strong { display: block; font-size: 1.1rem; }
.marque small { color: #ffffff; }
.menu { display: flex; flex-direction: column; gap: 1.75rem; flex: 1; min-height: 0; }
.rail nav { display: grid; gap: .15rem; flex: 1; align-content: start; overflow-y: auto; }
.bouton-menu { display: none; }
.rail nav a, .moi > a { display: block; padding: .5rem .6rem; border-left: 4px solid transparent; }
.rail nav a:hover, .moi > a:hover { background: rgba(255, 255, 255, .09); }
.rail a[aria-current="page"] { border-left-color: var(--vert); background: rgba(255, 255, 255, .12); font-weight: 600; }
.lien-rail { background: none; border: 0; color: #ffffff; font: inherit; font-size: .9rem; padding: .35rem .75rem; cursor: pointer; }
.lien-rail:hover { color: #fff; text-decoration: underline; }

.page { padding: 2.25rem clamp(1rem, 4vw, 3.5rem) 4rem; max-width: 70rem; }
.chapo { font-size: 1.1rem; }

/* Formulaires */
.pile { display: grid; gap: 1rem; }
.etroit { max-width: 34rem; }
.deux { display: grid; grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr)); gap: 1rem; }
label { display: grid; gap: .25rem; font-weight: 600; font-size: .92rem; }
input, select {
    width: 100%;
    font: inherit;
    font-weight: 400;
    padding: .55rem .65rem;
    color: var(--encre);
    background: var(--papier);
    border: 1px solid #a6b6cf;
    border-radius: 4px;
}
input:disabled { background: var(--fond); color: var(--encre-douce); }
.pile h2 { margin: 1rem 0 0; }

.bouton, .bouton-second {
    display: inline-block;
    justify-self: start;
    padding: .6rem 1.1rem;
    font: inherit;
    font-weight: 600;
    text-decoration: none;
    border-radius: 4px;
    cursor: pointer;
}
.bouton { color: #fff; background: var(--bleu-fonce); border: 1px solid var(--bleu-fonce); }
.bouton:hover { background: var(--bleu); }
.bouton:disabled { opacity: .6; cursor: progress; }
.bouton-second { color: var(--bleu-fonce); background: transparent; border: 1px solid var(--bleu-fonce); }
.bouton-second:hover { background: var(--bleu-clair); }
.bouton-discret { background: none; border: 0; padding: 0; font: inherit; color: var(--bleu-fonce); text-decoration: underline; cursor: pointer; }

.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.ligne-fin { display: flex; justify-content: flex-end; gap: 1rem; }
.actions { display: flex; justify-content: flex-end; max-width: none; }
.filtres { display: flex; flex-wrap: wrap; align-items: end; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.filtres label { min-width: 11rem; }
progress { width: 14rem; height: .7rem; accent-color: var(--bleu-fonce); }

/* Messages */
.avis { max-width: none; padding: .65rem .85rem; border-left: 4px solid; background: var(--papier); }
.avis-succes { border-color: var(--bleu-fonce); }
.avis-info { border-color: var(--encre-douce); }
.avis-attention { border-color: var(--ambre); background: #fff8d6; }
.avis-erreur { border-color: var(--brique); background: #fbecea; }
.controles { margin-top: 0; }

/* Données */
.defile { position: relative; overflow-x: auto; background: var(--papier); border: 1px solid var(--trait); border-radius: 4px; margin-bottom: 1.25rem; }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { padding: .6rem .8rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--trait); }
th { font-size: .85rem; font-weight: 600; color: var(--encre-douce); white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
.droite { text-align: right; }
.nowrap { white-space: nowrap; }
.chiffres { font-variant-numeric: tabular-nums; white-space: nowrap; }
.discret { color: var(--encre-douce); font-size: .9em; }
.masque { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.etat { display: inline-block; padding: .05rem .5rem; border-radius: 3px; font-size: .84rem; font-weight: 600; white-space: nowrap; }
.etat-ok { background: var(--bleu-clair); color: var(--bleu-fonce); }
.etat-off { background: #f6e3e0; color: var(--brique); }
.etat-info { background: #fff3b8; color: #6b4e00; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.5rem; margin: 0; }
.fiche dt { color: var(--encre-douce); }
.fiche dd { margin: 0; }

.fil { list-style: none; margin: 0 0 1rem; padding: 0; border-top: 1px solid var(--trait); }
.fil li { display: grid; grid-template-columns: 11rem 1fr auto; gap: 1rem; padding: .5rem 0; border-bottom: 1px solid var(--trait); }
.fil time { color: var(--encre-douce); font-variant-numeric: tabular-nums; font-size: .92rem; }

.pagination { display: flex; gap: 1rem; align-items: center; }
.apercu-logo { max-width: 10rem; max-height: 5rem; object-fit: contain; justify-self: start; background: var(--papier); padding: .4rem; border: 1px solid var(--trait); }

/* Pages d'accueil : un ticket avec son talon détachable */
.accueil {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 1.5rem 1rem;
    background: var(--degrade);
}
.souche {
    display: grid;
    grid-template-columns: 11rem minmax(0, 1fr);
    width: min(40rem, 100%);
    background: var(--papier);
    border-radius: 10px;
}
.souche-large { width: min(46rem, 100%); }
.talon {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 2rem;
    padding: 1.75rem 1.25rem;
    color: var(--encre);
    background: var(--degrade-vert);
    border-radius: 10px 0 0 10px;
    border-right: 3px dashed var(--bleu-fonce);
}
.talon strong { font-size: 1.5rem; line-height: 1.1; }
.talon span { font-size: .9rem; }
.corps { padding: 2rem clamp(1.25rem, 4vw, 2.25rem); min-width: 0; }

@media (prefers-reduced-motion: no-preference) {
    a, button { transition: background-color .12s; }
}

/* Lot 2 : fiches et onglets */
textarea { width: 100%; font: inherit; font-weight: 400; padding: .55rem .65rem; color: var(--encre); background: var(--papier); border: 1px solid #a6b6cf; border-radius: 4px; resize: vertical; }
input[type="checkbox"] { width: auto; }
.case { display: flex; align-items: center; gap: .5rem; }
.petit { padding: .25rem .65rem; font-size: .9rem; white-space: nowrap; }
.pousse { flex: 1; }
.entete-fiche { margin-bottom: 1rem; }
.multiligne { white-space: pre-line; }
.onglets { display: flex; gap: .25rem; overflow-x: auto; overflow-y: hidden; margin: 1.75rem 0 1.25rem; border-bottom: 2px solid var(--trait); }
.onglets a { flex: none; padding: .55rem .85rem; color: var(--encre-douce); text-decoration: none; border-bottom: 3px solid transparent; }
.onglets a:hover { color: var(--bleu-fonce); }
.onglets a[aria-current="page"] { color: var(--bleu-fonce); font-weight: 600; border-bottom-color: var(--vert); }

/* Lot 3 : parc */
fieldset { display: grid; gap: 1rem; margin: 0; padding: 0; border: 0; }
fieldset[hidden] { display: none; }
.ligne-droite { gap: .75rem; }
.cle { font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.bouton-second { justify-self: start; }

/* Téléphone et tablette */
@media (max-width: 52rem) {
    .espace { display: block; }
    .rail {
        position: sticky;
        z-index: 10;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        justify-content: space-between;
        gap: 0;
        padding: .6rem 1rem;
        box-shadow: 0 2px 10px rgba(6, 37, 92, .3);
    }
    .marque { padding: 0; min-width: 0; }
    .marque small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 11rem; }
    .bouton-menu {
        display: block;
        min-height: 2.75rem;
        padding: 0 1rem;
        font: inherit;
        font-weight: 600;
        color: var(--encre);
        background: var(--degrade-vert);
        border: 0;
        border-radius: 8px;
        cursor: pointer;
    }
    .menu { display: none; flex-basis: 100%; gap: .75rem; padding-top: .75rem; max-height: calc(100vh - 4.5rem); overflow-y: auto; }
    .menu.ouvert { display: flex; }
    .rail nav { grid-template-columns: 1fr 1fr; gap: .35rem; overflow: visible; }
    .rail nav a { display: flex; align-items: center; min-height: 3rem; padding: 0 .75rem; background: rgba(255, 255, 255, .1); border-left: 0; border-radius: 8px; }
    .rail a[aria-current="page"] { background: var(--degrade-vert); color: var(--encre); }
    .moi { display: flex; justify-content: space-between; align-items: center; }
    .moi > a { border-left: 0; }

    .page { padding: 1.25rem 1rem 3rem; }
    h1 { font-size: 1.5rem; overflow-wrap: anywhere; }
    .fil li { grid-template-columns: 1fr; gap: 0; }
    .souche { grid-template-columns: 1fr; }
    .talon { flex-direction: row; align-items: baseline; gap: 1rem; padding: 1rem 1.25rem; border-right: 0; border-bottom: 3px dashed var(--bleu-fonce); border-radius: 10px 10px 0 0; }
}

/* Listes en cartes et formulaires pleine largeur sur téléphone */
@media (max-width: 40rem) {
    .bouton, .bouton-second { min-height: 2.75rem; display: inline-flex; align-items: center; justify-content: center; }
    .bouton-discret { min-height: 2.75rem; }
    .pile > .bouton, .pile > .bouton-second, .filtres > .bouton-second { width: 100%; justify-self: stretch; }
    .actions { flex-wrap: wrap; }
    .actions .bouton, .actions .bouton-second { flex: 1 1 100%; }
    .petit { min-height: 2.5rem; }

    .filtres { display: grid; grid-template-columns: 1fr 1fr; }
    .filtres label { min-width: 0; }
    .filtres label:first-child, .filtres > .bouton-second { grid-column: 1 / -1; }

    .fiche { grid-template-columns: 1fr; gap: 0; }
    .fiche dt { margin-top: .6rem; font-size: .85rem; }
    .fiche dd { overflow-wrap: anywhere; }

    .defile { overflow: visible; background: none; border: 0; }
    table, tbody { display: block; }
    thead { display: none; }
    tbody tr {
        display: block;
        margin-bottom: .75rem;
        padding: .35rem .9rem;
        background: var(--papier);
        border: 1px solid var(--trait);
        border-left: 4px solid var(--bleu);
        border-radius: 8px;
    }
    td, tbody tr:last-child td {
        display: grid;
        grid-template-columns: 7.5rem minmax(0, 1fr);
        gap: .75rem;
        align-items: baseline;
        padding: .45rem 0;
        border-bottom: 1px solid var(--trait);
        text-align: left;
        white-space: normal;
        overflow-wrap: anywhere;
    }
    td:last-child, tbody tr:last-child td:last-child { border-bottom: 0; }
    td::before { content: attr(data-label); color: var(--encre-douce); font-size: .85rem; }
    td:empty { display: none; }
    td.sans-titre { display: block; text-align: right; }
    td.sans-titre::before { content: none; }
    td.sans-titre form { display: inline-block; }
    .ligne-fin { justify-content: flex-end; align-items: center; }
    td .bouton-second.petit { width: 100%; }
    .etat { justify-self: start; }
}

/* Lot 4 : tickets */
.etat-neutre { background: #e6ebf3; color: var(--encre-douce); }
.choix { display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: .75rem; }
.choix-carte { display: grid; gap: .1rem; padding: .85rem 1rem; color: var(--encre); text-decoration: none; background: var(--papier); border: 1px solid var(--trait); border-left: 4px solid var(--bleu); border-radius: 8px; }
.choix-carte:hover { border-color: var(--bleu-fonce); background: var(--bleu-clair); }
.choix-carte span { color: var(--encre-douce); font-size: .92rem; }
.choix-autre { border-left-color: var(--vert); }
.encadre { padding: 1rem 1.25rem; margin-bottom: 1.5rem; background: var(--papier); border: 1px solid var(--trait); border-top: 4px solid var(--vert); border-radius: 8px; }
.encadre h2 { margin-top: 0; }
.marge-haut { margin-top: 1.25rem; }
.suivi { display: grid; gap: .25rem; }
.suivi .filtres, .suivi .ligne { margin-bottom: .75rem; }
.messages { display: grid; gap: .75rem; }
.message { padding: .7rem .9rem; background: var(--papier); border: 1px solid var(--trait); border-radius: 8px; }
.message p { margin: .35rem 0 0; }
.message-client { background: var(--bleu-clair); }
.message-interne { background: #fff8d6; }
.piece { display: inline-block; margin-right: .75rem; overflow-wrap: anywhere; }

/* Lot 5 : contrats */
.etat-vip { background: var(--degrade-vert); color: var(--encre); }
.jauge { margin-bottom: 1rem; }
.jauge progress { display: block; width: 100%; height: .8rem; }
.jauge p { margin: .35rem 0 0; }

/* Lot 6 : tableaux de bord */
:root { --serie-1: #1565c0; --serie-2: #79bd0e; }
.periodes { display: flex; gap: .25rem; margin-bottom: 1rem; }
.periodes a { padding: .35rem .8rem; color: var(--bleu-fonce); text-decoration: none; border: 1px solid var(--trait); border-radius: 6px; background: var(--papier); }
.periodes a[aria-current] { color: var(--encre); background: var(--degrade-vert); border-color: var(--vert); font-weight: 600; }
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: 1px; margin-bottom: 1rem; background: var(--trait); border: 1px solid var(--trait); border-radius: 8px; overflow: hidden; }
.indicateurs div { padding: .8rem 1rem; background: var(--papier); }
.indicateurs strong { display: block; font-size: 1.6rem; line-height: 1.2; font-variant-numeric: tabular-nums; }
.indicateurs span { color: var(--encre-douce); font-size: .88rem; }
.carte { padding: 1rem 1.1rem; margin-bottom: 1rem; background: var(--papier); border: 1px solid var(--trait); border-radius: 8px; min-width: 0; }
.carte h2 { margin: 0 0 .6rem; font-size: 1.02rem; }
.grille-cartes { display: grid; grid-template-columns: repeat(auto-fit, minmax(19rem, 1fr)); gap: 1rem; }
.grille-cartes .carte { margin-bottom: 0; }
.legende { display: flex; align-items: center; gap: .4rem; margin-bottom: .4rem; color: var(--encre-douce); font-size: .88rem; }
.pastille { width: .7rem; height: .7rem; border-radius: 2px; }
.pastille + .pastille { margin-left: .5rem; }
.serie-1-fond { background: var(--serie-1); }
.serie-2-fond { background: var(--serie-2); margin-left: .6rem; }
.graphique { display: block; width: 100%; height: auto; margin-bottom: .5rem; }
.graphique .grille { stroke: var(--trait); stroke-width: 1; }
.graphique .axe { fill: var(--encre-douce); font-size: 12px; }
.serie-1 { fill: var(--serie-1); }
.serie-2 { fill: var(--serie-2); }
.barres { display: grid; gap: .5rem; margin: 0; padding: 0; list-style: none; }
.barres li { display: grid; grid-template-columns: minmax(0, 1fr) 2rem; gap: .1rem .5rem; align-items: center; }
.barre-libelle { grid-column: 1 / -1; font-size: .92rem; overflow-wrap: anywhere; }
.barre-piste { display: block; height: .5rem; background: var(--fond); border-radius: 3px; overflow: hidden; }
.barre-piste svg { display: block; width: 100%; height: 100%; }
.barre-valeur { text-align: right; font-variant-numeric: tabular-nums; font-size: .92rem; }
.fil-simple { display: flex !important; justify-content: space-between; gap: 1rem; }
details summary { cursor: pointer; color: var(--bleu-fonce); }
