/*
 * L'habillage des écrans : Bootstrap porte la mise en page et les composants,
 * la charte European Sourcing porte les couleurs, les fontes et les formes.
 *
 * Le principe : on ne réécrit pas Bootstrap, on lui parle par ses variables
 * (`--bs-*`), alimentées par les jetons de la charte (`tokens/`). Un composant
 * n'est redessiné à la main que là où Bootstrap n'a pas de variable pour ce que
 * la charte demande. Ce fichier est chargé après `vendor/bootstrap.min.css`, et
 * c'est ce qui lui donne le dernier mot à spécificité égale.
 *
 * Ce que la charte ne dit pas, et qu'il a fallu décider : elle décrit un site
 * vitrine, avec ses bandes colorées et ses sections aérées. Un écran
 * d'exploitation qu'on lit d'un coup d'œil pour savoir si un site s'est tu se
 * dessine autrement : dense, sur fond neutre, avec une seule chose qui ressorte,
 * le statut. Les jetons sont donc respectés, et le rythme vertical resserré.
 *
 * Aucun JavaScript, et une politique de sécurité du contenu qui n'autorise que
 * l'origine du service (voir `base.html.twig`) : tout ce qui bouge ici est en
 * CSS pur, y compris l'infobulle.
 */

@import url("tokens/colors-GD9Lhnn.css");
@import url("tokens/fonts-D4JZo1l.css");
@import url("tokens/shape-u4RCbja.css");

/* ---------------------------------------------------------------------------
 * Bootstrap, reconfiguré par ses variables
 * ------------------------------------------------------------------------- */

:root {
    --bs-body-bg: var(--surface-page);
    --bs-body-color: var(--text-body);
    --bs-body-color-rgb: 82, 90, 114;
    --bs-body-font-family: var(--font-body);
    --bs-body-font-size: 15px;
    --bs-body-line-height: 1.5;
    --bs-heading-color: var(--text-heading);
    --bs-secondary-color: var(--text-muted);
    --bs-font-monospace: var(--font-mono);

    --bs-link-color: var(--text-link);
    --bs-link-color-rgb: 221, 33, 83;
    --bs-link-hover-color: var(--color-primary-hover);
    --bs-link-hover-color-rgb: 185, 26, 67;
    --bs-link-decoration: underline;

    --bs-primary: var(--color-primary);
    --bs-primary-rgb: 221, 33, 83;
    --bs-primary-bg-subtle: var(--color-primary-tint);
    --bs-primary-text-emphasis: var(--color-primary-hover);

    --bs-border-color: var(--border-subtle);
    --bs-border-radius: var(--radius-md);
    --bs-border-radius-sm: var(--radius-sm);
    --bs-border-radius-lg: var(--radius-lg);
    --bs-border-radius-pill: var(--radius-pill);

    --bs-focus-ring-color: rgba(221, 33, 83, .25);
    --bs-box-shadow-sm: var(--shadow-card);
}

/* ---------------------------------------------------------------------------
 * Ossature : la page occupe la fenêtre, le pied se pose en bas
 * ------------------------------------------------------------------------- */

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

main {
    flex: 1 0 auto;
}

h1, h2, h3, .h1, .h2, .h3 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.2;
}

h1, .h1 { font-size: 22px; }
h2, .h2 { font-size: 18px; }

code {
    padding: 1px 5px;
    border-radius: var(--radius-xs);
    background: var(--es-gray-200);
    color: var(--text-heading);
    font-size: .9em;
}

/* Le lien d'évitement : invisible jusqu'au focus clavier, puis posé en haut
   à gauche, par-dessus tout. */
.skip-link {
    position: absolute;
    top: -100%;
    left: var(--space-3);
    z-index: 100;
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-button);
    background: var(--text-heading);
    color: var(--text-on-color);
    font-family: var(--font-ui);
    font-weight: 600;
    text-decoration: none;
}

.skip-link:focus {
    top: var(--space-3);
    color: var(--text-on-color);
}

/* ---------------------------------------------------------------------------
 * Bandeau et navigation
 *
 * Une rangée blanche : le logo, le nom de l'outil, les écrans, le compte.
 * L'écran actif porte un filet rose sous son libellé, et `aria-current="page"`
 * pour qui ne voit pas le filet.
 * ------------------------------------------------------------------------- */

.banner {
    background: var(--surface-card);
    border-bottom: 1px solid var(--border-subtle);
}

.banner__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    gap: 0 var(--space-6);
    min-height: 56px;
    padding: 0 var(--space-6);
}

.banner__brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: var(--text-heading);
    text-decoration: none;
}

.banner__brand img {
    display: block;
    height: 30px;
    width: auto;
}

.banner__product {
    padding-left: var(--space-3);
    border-left: 1px solid var(--border-subtle);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 15px;
    line-height: 1.2;
    white-space: nowrap;
}

.banner__nav {
    display: flex;
    align-items: stretch;
    gap: var(--space-5);
    margin-right: auto;
}

.banner__nav a {
    display: flex;
    align-items: center;
    padding: 0 2px;
    border-bottom: 2px solid transparent;
    color: var(--text-body);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 14px;
    text-decoration: none;
    transition: color var(--transition-fast), border-color var(--transition-fast);
}

.banner__nav a:hover,
.banner__nav a:focus-visible {
    color: var(--color-primary);
}

.banner__nav a[aria-current="page"] {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
}

.banner__account {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 13px;
    color: var(--text-muted);
}

/* Sous 720 px, la navigation passe sous le logo, sur toute la largeur ; sous
   480 px, le nom de l'outil s'efface pour laisser sa place au compte. */
@media (max-width: 719px) {
    .banner__inner {
        padding-top: var(--space-2);
    }

    .banner__brand,
    .banner__account {
        min-height: 40px;
    }

    .banner__account {
        margin-left: auto;
    }

    .banner__nav {
        order: 3;
        flex-basis: 100%;
        min-height: 40px;
    }
}

@media (max-width: 479px) {
    .banner__product {
        display: none;
    }
}

.workspace {
    padding: var(--space-6);
}

.footer {
    padding: var(--space-3) var(--space-6);
    background: var(--surface-footer);
    color: rgba(255, 255, 255, .85);
    font-size: 13px;
}

.footer p {
    margin: 0;
}

/* ---------------------------------------------------------------------------
 * Boutons : Roboto, bordure de 2 px, et le survol passe à la teinte foncée
 * plutôt qu'à une opacité. Un bouton contour se remplit de sa couleur.
 * ------------------------------------------------------------------------- */

.btn {
    --bs-btn-font-family: var(--font-ui);
    --bs-btn-font-weight: 600;
    --bs-btn-font-size: 14px;
    --bs-btn-border-width: 2px;
    --bs-btn-border-radius: var(--radius-button);
    --bs-btn-padding-x: var(--space-4);
    --bs-btn-padding-y: 7px;
    transition: color var(--transition-fast), background-color var(--transition-fast), border-color var(--transition-fast), box-shadow var(--transition-fast);
}

.btn-sm {
    --bs-btn-font-size: 13px;
    --bs-btn-padding-x: var(--space-3);
    --bs-btn-padding-y: 4px;
    --bs-btn-border-radius: var(--radius-button);
}

.btn-primary {
    --bs-btn-bg: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary-hover);
    --bs-btn-hover-border-color: var(--color-primary-hover);
    --bs-btn-active-bg: var(--color-primary-hover);
    --bs-btn-active-border-color: var(--color-primary-hover);
    --bs-btn-disabled-bg: var(--color-primary);
    --bs-btn-disabled-border-color: var(--color-primary);
    --bs-btn-focus-shadow-rgb: 221, 33, 83;
}

.btn-outline-primary {
    --bs-btn-color: var(--color-primary);
    --bs-btn-border-color: var(--color-primary);
    --bs-btn-hover-bg: var(--color-primary);
    --bs-btn-hover-border-color: var(--color-primary);
    --bs-btn-active-bg: var(--color-primary-hover);
    --bs-btn-active-border-color: var(--color-primary-hover);
    --bs-btn-focus-shadow-rgb: 221, 33, 83;
}

.btn-outline-secondary {
    --bs-btn-color: var(--text-body);
    --bs-btn-border-color: var(--es-gray-400);
    --bs-btn-hover-color: var(--text-on-color);
    --bs-btn-hover-bg: var(--text-body);
    --bs-btn-hover-border-color: var(--text-body);
    --bs-btn-active-color: var(--text-on-color);
    --bs-btn-active-bg: var(--text-heading);
    --bs-btn-active-border-color: var(--text-heading);
    --bs-btn-focus-shadow-rgb: 82, 90, 114;
}

.btn-link {
    --bs-btn-font-family: var(--font-body);
    --bs-btn-font-weight: 400;
}

/* ---------------------------------------------------------------------------
 * Formulaires : bordure ardoise de 1 px, rayon de 3 px, et le focus assombrit
 * la bordure au lieu de la colorer.
 * ------------------------------------------------------------------------- */

.form-label {
    margin-bottom: var(--space-1);
    color: var(--text-heading);
    font-weight: 500;
}

.form-control {
    border-color: var(--border-input);
    border-radius: var(--radius-input);
    color: var(--text-heading);
}

.form-control:focus {
    border-color: var(--text-heading);
    box-shadow: 0 0 0 .2rem var(--bs-focus-ring-color);
}

.form-text {
    color: var(--text-muted);
}

/* ---------------------------------------------------------------------------
 * Cartes : blanches, 12 px de rayon, une ombre douce, pas de bordure
 * ------------------------------------------------------------------------- */

.card {
    --bs-card-border-width: 0;
    --bs-card-border-radius: var(--radius-card);
    --bs-card-inner-border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
}

/* ---------------------------------------------------------------------------
 * Tableaux : un en-tête discret, des lignes qui se distinguent au survol
 * ------------------------------------------------------------------------- */

.table {
    --bs-table-color: var(--text-body);
    --bs-table-border-color: var(--border-subtle);
    --bs-table-hover-bg: var(--color-secondary-tint);
    --bs-table-hover-color: var(--text-body);
}

.table > thead th {
    padding-top: var(--space-3);
    padding-bottom: var(--space-3);
    background: var(--es-gray-100);
    color: var(--text-heading);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 13px;
}

.table > :not(caption) > * > * {
    padding-left: var(--space-4);
    padding-right: var(--space-4);
}

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

.alert {
    --bs-alert-border-radius: var(--radius-md);
}

/* ---------------------------------------------------------------------------
 * Le statut d'un site : la seule chose que l'écran des sites existe pour
 * rendre lisible. Aucune notification n'est émise (décision D9) : un site
 * silencieux doit se voir avant d'être lu, sans parcourir la ligne. D'où le
 * filet de couleur en bordure de ligne, qui se repère à distance, et la
 * pastille qui le nomme pour qui ne distingue pas les couleurs.
 *
 * Ces couleurs ne sont pas celles de la marque, et c'est voulu : le rose de
 * la charte est celui des actions, pas celui d'une alerte.
 * ------------------------------------------------------------------------- */

:root {
    --statut-ok: #1a7f37;
    --statut-late: #8a5a00;
    --statut-silent: #b42318;
    --statut-never-seen: #5c6670;
}

.ligne-site > td:first-child {
    border-left: 4px solid transparent;
}

.pastille-statut {
    display: inline-block;
    padding: 3px 10px;
    border-radius: var(--radius-pill);
    background: var(--statut-never-seen);
    color: #fff;
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 12px;
    line-height: 1.4;
    white-space: nowrap;
}

.statut-ok > td:first-child { border-left-color: var(--statut-ok); }
.statut-ok .pastille-statut { background: var(--statut-ok); }

.statut-late > td:first-child { border-left-color: var(--statut-late); }
.statut-late .pastille-statut { background: var(--statut-late); }

.statut-silent > td:first-child { border-left-color: var(--statut-silent); }
.statut-silent .pastille-statut { background: var(--statut-silent); }

.statut-never_seen > td:first-child { border-left-color: var(--statut-never-seen); }

/* ---------------------------------------------------------------------------
 * Écrans
 * ------------------------------------------------------------------------- */

/* L'en-tête d'un écran : le titre, et à droite ce qui l'accompagne. */
.ecran-entete {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-4);
}

.ecran-entete h1 {
    margin: 0;
}

/* L'écran de connexion n'a rien à montrer : il se contente de ne pas être
   large, et de porter le logo. */
.carte-connexion {
    max-width: 24rem;
}

.carte-connexion img {
    display: block;
    height: 36px;
    width: auto;
    margin-bottom: var(--space-5);
}

/* La carte du formulaire d'inscription : une largeur bornée, pas plus. */
.carte-inscription {
    max-width: 32rem;
}

/* L'infobulle de l'écran d'inscription en collecte (PO-4). En CSS pur : ces
   écrans ne servent aucun JavaScript. Affichée au survol ET au focus du
   conteneur ; ce second déclencheur est ce qui la rend atteignable au clavier,
   le bouton `?` étant lui-même focusable. */
.infobulle {
    position: relative;
    display: inline-block;
}

/* Le déclencheur : un « ? » cerclé. Au repos, ardoise sur blanc ; ouvert, il
   prend la couleur du panneau qu'il déplie, pour qu'on lise les deux comme un
   seul objet. */
.infobulle-declencheur {
    --bs-btn-focus-shadow-rgb: 82, 90, 114;
    width: 22px;
    height: 22px;
    padding: 0;
    border: 2px solid var(--es-gray-400);
    border-radius: 50%;
    color: var(--text-body);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 13px;
    line-height: 1;
    text-decoration: none;
}

.infobulle-declencheur:hover,
.infobulle-declencheur:focus-visible,
.infobulle:focus-within .infobulle-declencheur {
    border-color: var(--text-heading);
    background: var(--text-heading);
    color: var(--text-on-color);
}

.infobulle [role="tooltip"] {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 10;
    width: 22rem;
    max-width: 80vw;
    margin-top: var(--space-2);
    padding: var(--space-3) var(--space-4);
    border-radius: var(--radius-md);
    background: var(--text-heading);
    color: var(--es-gray-100);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.infobulle__ligne {
    display: block;
}

.infobulle__ligne + .infobulle__ligne {
    margin-top: var(--space-1);
}

.infobulle [role="tooltip"] code {
    background: rgba(255, 255, 255, .15);
    color: inherit;
}

.infobulle:hover [role="tooltip"],
.infobulle:focus-within [role="tooltip"] {
    display: block;
}

/* Un lien secondaire dans une cellule : « Renommer » à côté d'un nom. Discret
   au repos, il prend la couleur des actions au survol et au focus. */
.lien-discret {
    margin-left: var(--space-2);
    color: var(--text-muted);
    font-size: 13px;
    text-decoration: none;
}

.lien-discret:hover,
.lien-discret:focus-visible {
    color: var(--color-primary);
    text-decoration: underline;
}

/* Le renommage d'un client, en ligne dans le tableau des sites : le champ,
   les deux boutons, et la mention du nombre de sites concernés en dessous. */
.renommage {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-2);
    min-width: 18rem;
}

.renommage .form-control {
    flex: 1 1 10rem;
}

.renommage .form-text {
    flex-basis: 100%;
    margin: 0;
}

/* ---------------------------------------------------------------------------
 * Le guide d'une anomalie : ce qui s'est passé, ce qu'on vérifie, ce qu'on
 * demande au client, quand la marquer traitée. Replié par défaut, en HTML
 * natif (details/summary) : pas de JavaScript, et le clavier l'ouvre seul.
 * ------------------------------------------------------------------------- */

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

.anomalie {
    padding: var(--space-4) var(--space-5);
}

.anomalie + .anomalie {
    border-top: 1px solid var(--border-subtle);
}

.anomalie__entete {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
    justify-content: space-between;
    gap: var(--space-2) var(--space-4);
    margin-bottom: var(--space-2);
}

.anomalie__titre {
    margin: 0;
    color: var(--text-heading);
    font-weight: 500;
}

.anomalie__meta {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-1) var(--space-4);
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

.guide > summary {
    display: inline-block;
    cursor: pointer;
    color: var(--color-primary);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 13px;
    list-style: none;
}

.guide > summary::-webkit-details-marker {
    display: none;
}

.guide > summary::before {
    content: "";
    display: inline-block;
    width: 0;
    height: 0;
    margin-right: 6px;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    border-left: 5px solid currentColor;
    vertical-align: 1px;
    transition: transform var(--transition-fast);
}

.guide[open] > summary::before {
    transform: rotate(90deg);
}

.guide > summary:hover,
.guide > summary:focus-visible {
    color: var(--color-primary-hover);
    text-decoration: underline;
}

.guide__corps {
    max-width: 40rem;
    margin-top: var(--space-3);
    padding: var(--space-4);
    border-left: 3px solid var(--color-secondary);
    border-radius: 0 var(--radius-md) var(--radius-md) 0;
    background: var(--es-gray-100);
    font-size: 14px;
}

.guide__corps h3 {
    margin: var(--space-4) 0 var(--space-1);
    font-family: var(--font-ui);
    font-size: 13px;
    color: var(--text-heading);
}

.guide__corps h3:first-child {
    margin-top: 0;
}

.guide__corps p,
.guide__corps ul {
    margin: 0;
}

.guide__corps ul {
    padding-left: 1.2rem;
}

.guide__corps li + li {
    margin-top: var(--space-1);
}

/* Les questions au client sont faites pour être lues au téléphone ou copiées
   dans un courriel : elles se détachent du reste. */
.guide__questions {
    color: var(--text-heading);
}

/* ---------------------------------------------------------------------------
 * L'écran de restitution
 * ------------------------------------------------------------------------- */

/* Les filtres tiennent sur une rangée sur un écran large, et se replient en
   colonne sur un téléphone. Chaque champ garde sa largeur minimale : un champ
   de date écrasé n'affiche plus son calendrier. */
.filtres {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
    gap: var(--space-3) var(--space-4);
    align-items: end;
}

.filtres .form-label {
    margin-bottom: 2px;
    font-size: 13px;
}

.filtres__action {
    display: flex;
    align-items: flex-end;
}

/* Les nombres s'alignent à droite et se lisent en chiffres tabulaires : sans
   cela, deux colonnes de nombres ne se comparent pas d'un coup d'œil. */
.table-chiffres td:not(:first-child),
.table-chiffres th:not(:first-child) {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* Autant de graphiques par rangée que 22rem en laissent tenir, un seul sur un
   portable. Le `min(22rem, 100%)` est ce qui évite le débordement horizontal :
   sans lui, une piste de 22rem reste large de 22rem sur un écran de 20rem. */
.graphiques {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
    /* Chaque carte garde sa hauteur : le classement grandit avec ses libellés,
       et sans cela il étirerait ses voisines de la même rangée sur du vide. */
    align-items: start;
    gap: var(--space-4);
    margin-bottom: var(--space-4);
}

.graphique__titre {
    margin: 0;
    font-size: 16px;
}

.graphique__note {
    margin: 2px 0 0;
    color: var(--text-muted);
    font-size: 13px;
}

/* L'avertissement est SUR le graphique, pas seulement en haut de l'écran : une
   capture d'écran d'un seul graphique circule sans le reste de la page. */
.graphique__alerte {
    margin: var(--space-2) 0 0;
    padding: var(--space-2) var(--space-3);
    border-left: 3px solid var(--statut-late);
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    background: #fdf6e6;
    color: var(--text-heading);
    font-size: 13px;
}

/* Une hauteur fixe, parce qu'un canvas sans hauteur bornée et un conteneur en
   grille se poursuivent l'un l'autre à chaque redimensionnement. */
.graphique__toile {
    position: relative;
    height: 16rem;
    margin-top: var(--space-3);
}

.graphique__valeurs {
    margin-top: var(--space-3);
}

.graphique__valeurs > summary {
    cursor: pointer;
    color: var(--color-primary);
    font-family: var(--font-ui);
    font-weight: 600;
    font-size: 13px;
}

.graphique__valeurs > summary:hover,
.graphique__valeurs > summary:focus-visible {
    color: var(--color-primary-hover);
}

.graphique__valeurs .table {
    margin-top: var(--space-2);
}

/* ---------------------------------------------------------------------------
 * Qui demande moins de mouvement n'en a aucun
 * ------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        transition: none !important;
    }
}
