/* Interface de logiciel d'exploitation (famille des TMS) : fond gris clair, panneaux blancs à filet, un bleu d'action,
   statuts en pastilles. Police Inter servie avec le site. */
@font-face {
  font-family: "Inter";
  src: url("polices/inter-latin-wght-normal.woff2") format("woff2-variations"), url("polices/inter-latin-wght-normal.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --fond: #f2f3f5;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-3: #eceef2;
  --texte: #131b2b;
  --texte-doux: #586174;
  --bordure: #e0e3e8;
  --bordure-forte: #c8cdd5;
  --bordure-champ: #8a92a0;
  --accent: #2350c4;
  --accent-fort: #1a3f9e;
  --accent-doux: #edf1fc;
  --accent-trait: #c2d0f3;
  --depot: #e2e8f3;
  --flex: #a4530a;
  --flex-doux: #f8ecdc;
  --revoir: #b8340f;
  --revoir-fond: #fdebe4;
  --ok: #17734f;
  --ok-fond: #e6f4ed;
  --alerte-forte: #ad2a1f;
  --alerte-forte-fond: #fcecea;
  --alerte-info: #2350c4;
  --alerte-info-fond: #edf1fc;
  --rayon: 8px;
  --rayon-champ: 6px;
  --champ-h: 38px;
  --police: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
  accent-color: var(--accent);
}
@media (pointer: coarse) { :root { --champ-h: 44px; } }

* { box-sizing: border-box; }
::selection { background: var(--accent-trait); color: var(--texte); }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--texte);
  font: 400 14px/1.5 var(--police);
  font-feature-settings: "cv11", "ss03";
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--accent-fort); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
html { scrollbar-color: var(--bordure-forte) transparent; }

h1, h2, h3 { margin: 0; line-height: 1.3; font-weight: 600; letter-spacing: -.011em; text-wrap: balance; }
h1 { font-size: 1.5rem; letter-spacing: -.02em; }
h2 { font-size: 1rem; }
h3 { font-size: .9375rem; }
strong { font-weight: 600; }

.conteneur { max-width: 1240px; margin: 0 auto; padding: 0 20px; }
@media (max-width: 520px) { .conteneur { padding: 0 16px; } }

.icone { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------------------------------------------------------- */
/* Barre d'application et en-tête de page */

.appbar { background: var(--surface); border-bottom: 1px solid var(--bordure); }
.appbar .conteneur { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 52px; }
.marque { font-weight: 650; font-size: .9375rem; letter-spacing: -.01em; }
.appbar-auteur { color: var(--texte-doux); font-size: .8125rem; }
.appbar-auteur a { color: var(--texte); font-weight: 500; text-decoration: none; padding: 14px 0; }
.appbar-auteur a:hover { color: var(--accent); text-decoration: underline; }

.page-tete { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; padding-top: 28px; padding-bottom: 20px; }
.page-tete h1 { max-width: 30ch; }
.chapo { color: var(--texte-doux); max-width: 68ch; margin: 6px 0 0; font-size: .9375rem; }
.page-actions { display: flex; gap: 8px; flex: none; }
body:has(.resultats.vide) .page-actions { visibility: hidden; }
@media (max-width: 900px) {
  .page-tete { flex-direction: column; align-items: stretch; padding-top: 20px; }
  .page-actions .bouton { flex: 1; }
}
@media (max-width: 520px) {
  h1 { font-size: 1.25rem; }
  .chapo { font-size: .875rem; }
  .page-actions .bouton { padding-inline: 10px; }
}

/* ------------------------------------------------------------------------------------------------------------- */
/* Grille et panneaux */

.grille { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; padding-bottom: 20px; }
@media (max-width: 900px) { .grille { grid-template-columns: minmax(0, 1fr); gap: 16px; } }

.panneau { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); min-width: 0; }
.panneau-tete { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px;
  padding: 14px 20px; border-bottom: 1px solid var(--bordure); }
.panneau-aide { flex-basis: 100%; margin: 0; color: var(--texte-doux); font-size: .8125rem; }
.panneau-corps { padding: 16px 20px 20px; }
.panneau-section { padding: 16px 20px; border-top: 1px solid var(--bordure); }
.panneau-section > h3 { margin-bottom: 8px; }
.panneau-pied { padding: 16px 20px 20px; border-top: 1px solid var(--bordure); background: var(--surface-2);
  border-radius: 0 0 var(--rayon) var(--rayon); }
@media (max-width: 520px) {
  .panneau-tete, .panneau-corps, .panneau-section, .panneau-pied { padding-inline: 14px; }
}

/* Grand écran : le résultat reste visible pendant la saisie, sans défilement propre. --hauteur vient de ui.js : un
   résultat plus haut que l'écran se cale par le bas. */
@media (min-width: 901px) {
  .resultats { position: sticky; top: min(16px, calc(100dvh - var(--hauteur, 0px) - 16px)); }
}

/* Détail du résultat, en pleine largeur sous la saisie */
.analyse { margin-bottom: 40px; }
.analyse > .panneau-corps[hidden] { display: none; }
.analyse.vide .section { display: none; }
.analyse > .panneau-corps + .section { border-top: 1px solid var(--bordure); }

/* Statut du résultat, en pastille dans l'en-tête du panneau */
.statut { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: .75rem;
  font-weight: 550; line-height: 20px; white-space: nowrap; background: var(--surface-3); color: var(--texte-doux); }
.statut::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.statut.ok { background: var(--ok-fond); color: var(--ok); }
.statut.revoir { background: var(--revoir-fond); color: var(--revoir); }
.statut[hidden] { display: none; }

.aide { color: var(--texte-doux); font-size: .8125rem; margin: 6px 0 0; max-width: 62ch; }
.note { font-size: .8125rem; color: var(--texte-doux); margin: 0; }
.drapeau { color: var(--alerte-forte); }

/* ------------------------------------------------------------------------------------------------------------- */
/* Champs */

label { display: block; font-size: .8125rem; font-weight: 500; color: var(--texte); }
input, select {
  font: inherit; font-size: .875rem; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bordure-champ); border-radius: var(--rayon-champ); padding: 0 10px; width: 100%;
  min-height: var(--champ-h); margin-top: 6px; caret-color: var(--accent);
  transition: border-color .12s, box-shadow .12s;
}
@media (pointer: coarse) { input, select { font-size: 1rem; } }
input:hover, select:hover { border-color: var(--texte-doux); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-trait); }
input[type="number"] { font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--texte-doux) 50%), linear-gradient(135deg, var(--texte-doux) 50%, transparent 50%);
  background-position: calc(100% - 17px) 52%, calc(100% - 12px) 52%;
  background-size: 5px 5px; background-repeat: no-repeat;
}

/* Champ avec unité affichée dans la case */
.unite {
  display: flex; align-items: center; margin-top: 6px; min-height: var(--champ-h); background: var(--surface);
  border: 1px solid var(--bordure-champ); border-radius: var(--rayon-champ); color: var(--texte-doux);
  font-weight: 400; transition: border-color .12s, box-shadow .12s;
}
.unite:hover { border-color: var(--texte-doux); }
.unite:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-trait); }
.unite input { flex: 1; min-width: 0; border: none; margin: 0; background: transparent; box-shadow: none; min-height: calc(var(--champ-h) - 2px); }
.unite input:focus { box-shadow: none; }
.unite > span { padding-right: 10px; font-size: .8125rem; white-space: nowrap; }

/* Réglette : libellé et valeur sur une ligne, curseur dessous. La valeur reste une case saisissable. */
.reglettes { display: grid; gap: 4px; }
.reglette { --r: 9px; min-width: 0; }
@media (pointer: coarse) { .reglette { --r: 12px; } }
.reglette-tete { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 36px; }
.reglette-tete label { font-size: .8125rem; font-weight: 500; }
.reglette-valeur { display: inline-flex; align-items: center; gap: 6px; flex: 0 0 auto; color: var(--texte-doux); font-size: .8125rem; }
.reglette-valeur input {
  width: 5em; min-height: 32px; margin: 0; padding: 0 8px; text-align: right; font-weight: 550;
  border-color: var(--bordure-forte);
}
@media (pointer: coarse) { .reglette-valeur input { min-height: 40px; } }
.reglette output { font-size: .875rem; font-weight: 600; color: var(--texte); font-variant-numeric: tabular-nums; white-space: nowrap; }
.reglette-rail { position: relative; }
.piste {
  position: absolute; left: var(--r); right: var(--r); top: 50%; height: 4px; transform: translateY(-50%); border-radius: 2px;
  pointer-events: none; background: linear-gradient(to right, var(--accent) 0 var(--pct, 0%), var(--surface-3) var(--pct, 0%));
}
/* La piste des heures reprend la frise : tournée hachurée, présence au dépôt en bleu-gris. */
.piste.journee {
  height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px var(--bordure-forte);
  background: var(--journee, transparent), repeating-linear-gradient(135deg, var(--surface-3) 0 3px, var(--surface) 3px 6px);
}
.reglette input[type="range"] {
  -webkit-appearance: none; appearance: none; position: relative; display: block; width: 100%; height: 32px;
  min-height: 0; margin: 0; padding: 0; border: none; border-radius: 0; background: transparent; cursor: pointer;
  touch-action: pan-y;
}
@media (pointer: coarse) { .reglette input[type="range"], .reglette-rail[data-double] { height: 40px !important; } }
.reglette input[type="range"]:focus { box-shadow: none; }
.reglette input[type="range"]:focus-visible { outline: none; }
.reglette input[type="range"]::-webkit-slider-runnable-track { height: 100%; background: transparent; }
.reglette input[type="range"]::-moz-range-track { height: 100%; background: transparent; }
.reglette input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: calc(var(--r) * 2); height: calc(var(--r) * 2); margin-top: calc(16px - var(--r));
  border-radius: 50%; background: var(--surface); border: 2px solid var(--accent);
  box-shadow: 0 1px 2px rgb(19 27 43 / .2); transition: box-shadow .12s, background .12s;
}
@media (pointer: coarse) { .reglette input[type="range"]::-webkit-slider-thumb { margin-top: calc(20px - var(--r)); } }
.reglette input[type="range"]::-moz-range-thumb {
  box-sizing: border-box; width: calc(var(--r) * 2); height: calc(var(--r) * 2); border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 1px 2px rgb(19 27 43 / .2);
}
.reglette input[type="range"]:hover::-webkit-slider-thumb { background: var(--accent-doux); }
.reglette input[type="range"]:hover::-moz-range-thumb { background: var(--accent-doux); }
.reglette input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 4px var(--accent-trait); }
.reglette input[type="range"]:focus-visible::-moz-range-thumb { box-shadow: 0 0 0 4px var(--accent-trait); }
.graduation { display: flex; justify-content: space-between; margin-top: -4px; font-size: .75rem; color: var(--texte-doux);
  font-variant-numeric: tabular-nums; }
/* Repères d'heure placés là où passe le centre du curseur. */
.graduation.heures { position: relative; display: block; height: 1.5em; margin-inline: var(--r); }
.graduation.heures span { position: absolute; left: calc(var(--x) * 100%); transform: translateX(-50%); white-space: nowrap; }
.reglette .erreur-champ { margin-top: 2px; }

/* Deux curseurs sur la même piste : les cases laissent passer le pointeur, seules les pastilles le captent. */
.reglette-titre { font-size: .8125rem; font-weight: 500; }
.sorties { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 2px 14px; font-size: .8125rem; color: var(--texte-doux); }
.sortie { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.repere { width: 10px; height: 10px; border-radius: 50%; border: 2px solid var(--accent); background: var(--surface); }
.repere.plein { background: var(--accent); }
.reglette.heure .reglette-tete { flex-wrap: wrap; row-gap: 0; }
.reglette-rail[data-double] { height: 32px; cursor: pointer; }
.reglette-rail[data-double] input[type="range"] { position: absolute; inset: 0; height: 100%; pointer-events: none; }
.reglette-rail[data-double] input[type="range"]::-webkit-slider-thumb { pointer-events: auto; cursor: grab; }
.reglette-rail[data-double] input[type="range"]::-moz-range-thumb { pointer-events: auto; cursor: grab; }
.reglette-rail[data-double] input.rentre::-webkit-slider-thumb { background: var(--accent); }
.reglette-rail[data-double] input.rentre::-moz-range-thumb { background: var(--accent); }
.reglette-rail[data-double] input.rentre:hover::-webkit-slider-thumb { background: var(--accent-fort); }
.reglette-rail[data-double] input.rentre:hover::-moz-range-thumb { background: var(--accent-fort); }
.reglette-rail[data-double] input:focus-visible { z-index: 1; }

/* Choix segmenté (jours par semaine) */
.segments { border: none; margin: 0 0 16px; padding: 0; min-width: 0; }
.segments legend { font-size: .8125rem; font-weight: 500; padding: 0; }
.segments .note { margin-top: 6px; }
.segments .options { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); margin-top: 6px;
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-champ); overflow: hidden; }
.segments label { position: relative; margin: 0; font-weight: 500; }
.segments label + label { border-left: 1px solid var(--bordure); }
.segments input { position: absolute; inset: 0; opacity: 0; margin: 0; min-height: 0; cursor: pointer; }
.segments span { display: flex; align-items: center; justify-content: center; min-height: var(--champ-h); font-variant-numeric: tabular-nums;
  color: var(--texte-doux); transition: background .12s, color .12s; }
.segments label:hover span { background: var(--surface-2); color: var(--texte); }
.segments input:checked + span { background: var(--accent-doux); color: var(--accent); font-weight: 650; box-shadow: inset 0 -2px 0 var(--accent); }
.segments input:focus-visible + span { box-shadow: inset 0 0 0 2px var(--accent); }

.champs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 12px; align-items: end; }
.champs .pleine { grid-column: 1 / -1; }
.hypotheses .champs { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
@media (max-width: 360px) { .champs { grid-template-columns: minmax(0, 1fr); } }
/* Libellé, champ et message d'erreur sur trois rangées partagées : les champs d'une même ligne restent alignés. */
@supports (grid-template-rows: subgrid) {
  .champs { align-items: stretch; }
  .champs > label { display: grid; grid-row: span 3; grid-template-rows: subgrid; row-gap: 6px; align-content: start; }
  .champs > label > input, .champs > label > select, .champs > label > .unite { margin-top: 0; }
  .champs > label > .erreur-champ { margin-top: 0; }
}

/* Interrupteur */
.interrupteur { display: flex; gap: 10px; align-items: center; font-size: .875rem; font-weight: 450; cursor: pointer; min-height: 40px; }
.interrupteur input {
  appearance: none; -webkit-appearance: none; flex: 0 0 auto; width: 34px; height: 20px; min-height: 0; margin: 0; padding: 0;
  border-radius: 10px; border: none; background: var(--bordure-champ); position: relative; cursor: pointer; transition: background .15s;
}
.interrupteur input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff;
  box-shadow: 0 1px 2px rgb(19 27 43 / .25); transition: transform .15s cubic-bezier(.2, .8, .2, 1);
}
.interrupteur input:checked { background: var(--accent); }
.interrupteur input:checked::after { transform: translateX(14px); }
.interrupteur input:focus { box-shadow: none; }
.interrupteur input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ------------------------------------------------------------------------------------------------------------- */
/* Groupes de la flotte : une ligne de flotte par groupe */

.groupe { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 0; margin: 0 0 12px; min-width: 0; background: var(--surface); }
.groupe:focus-within { border-color: var(--bordure-forte); }
.groupe-tete { display: flex; gap: 8px; align-items: center; padding: 6px 6px 6px 8px; background: var(--surface-2);
  border-bottom: 1px solid var(--bordure); border-radius: var(--rayon) var(--rayon) 0 0; }
.groupe-tete input {
  margin: 0; font-weight: 600; font-size: .875rem; min-height: 34px; padding: 0 8px; background: transparent;
  border-color: transparent; flex: 1; min-width: 0;
}
.groupe-tete input:hover { border-color: var(--bordure-forte); background: var(--surface); }
.groupe-tete input:focus { background: var(--surface); }
.groupe-total { font-size: .75rem; font-weight: 550; color: var(--texte-doux); white-space: nowrap; font-variant-numeric: tabular-nums;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: 999px; padding: 1px 8px; }
@media (max-width: 520px) {
  .groupe-tete { flex-wrap: wrap; row-gap: 2px; }
  .groupe-total { order: 3; margin: 0 0 4px 8px; }
}
.retirer {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font: inherit; font-size: .8125rem; font-weight: 500; color: var(--texte-doux); background: none; cursor: pointer;
  border: 1px solid transparent; border-radius: var(--rayon-champ); padding: 0 8px; min-height: 34px;
}
@media (pointer: coarse) { .retirer { min-height: 44px; } }
.retirer:hover { color: var(--alerte-forte); background: var(--alerte-forte-fond); }
.groupe-corps { padding: 14px 16px 12px; display: grid; gap: 12px; }
.groupe-corps > * { margin: 0; }
.groupe-corps > label > select { margin-top: 6px; }

.midi { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: var(--rayon-champ); padding: 10px 12px; display: grid; gap: 10px; }

details.vehicule { border-top: 1px solid var(--bordure); padding-top: 2px; }
details.vehicule .note { margin-top: 10px; }
details.vehicule summary .resume { display: block; font-weight: 400; color: var(--texte-doux); font-size: .8125rem; margin-top: 2px; font-variant-numeric: tabular-nums; }

/* Dépliants : chevron dessiné en CSS */
summary { cursor: pointer; list-style: none; font-weight: 600; position: relative; padding: 10px 0 10px 20px; }
summary::-webkit-details-marker { display: none; }
summary::before {
  content: ""; position: absolute; left: 3px; top: calc(10px + .5em); width: 6px; height: 6px;
  border-right: 1.75px solid var(--texte-doux); border-bottom: 1.75px solid var(--texte-doux);
  transform: translateY(-50%) rotate(-45deg); transition: transform .15s;
}
details[open] > summary::before { transform: translateY(-75%) rotate(45deg); }
summary:hover { color: var(--accent); }
summary:hover::before { border-color: var(--accent); }
details.vehicule summary { font-size: .8125rem; }
.hypotheses summary { padding-block: 4px; font-size: .9375rem; }
.hypotheses[open] summary { margin-bottom: 12px; }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-size: .875rem; font-weight: 550; cursor: pointer; border-radius: var(--rayon-champ); padding: 0 14px;
  min-height: var(--champ-h); background: var(--accent); color: #fff; border: 1px solid var(--accent);
  transition: background .12s, border-color .12s, color .12s;
}
.bouton:hover { background: var(--accent-fort); border-color: var(--accent-fort); }
.bouton.secondaire { background: var(--surface); color: var(--texte); border-color: var(--bordure-forte); }
.bouton.secondaire:hover { background: var(--surface-2); border-color: var(--texte-doux); }
.bouton.secondaire .icone { color: var(--texte-doux); }
.ajout { width: 100%; color: var(--accent) !important; border-style: dashed !important; }
.ajout .icone { color: var(--accent) !important; }

/* ------------------------------------------------------------------------------------------------------------- */
/* Résultats */

/* Verdict : une phrase d'entrée, puis les trois réponses en liste (points, horaires, électricité). */
.verdict { font-size: .875rem; line-height: 1.55; margin: 0 0 10px; }
.verdict p { margin: 0 0 6px; color: var(--texte-doux); }
.verdict ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.verdict li { position: relative; padding-left: 16px; }
.verdict li::before { content: ""; position: absolute; left: 2px; top: .62em; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.verdict .a-revoir { color: var(--alerte-forte); }
.verdict[hidden] { display: none; }

/* Fiche de dimensionnement : une ligne par réponse, libellé et explication à gauche, valeur à droite. */
.fiche { margin: 0; border-top: 1px solid var(--bordure); }
.fiche-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 24px; align-items: baseline;
  padding: 12px 0; border-bottom: 1px solid var(--bordure); }
.fiche dt { font-size: .8125rem; font-weight: 550; color: var(--texte); }
.fiche dt span { display: block; font-weight: 400; color: var(--texte-doux); margin-top: 2px; max-width: 52ch; }
/* Explications d'une ligne de la fiche : une idée par ligne, puce discrète. */
.fiche dt ul { margin: 4px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-weight: 400; color: var(--texte-doux); max-width: 52ch; }
.fiche dt li, .etapes li { position: relative; padding-left: 12px; }
.fiche dt li::before, .etapes li::before { content: ""; position: absolute; left: 1px; top: .6em; width: 4px; height: 4px; border-radius: 50%; background: var(--bordure-champ); }
.fiche dd { margin: 0; text-align: right; font-size: 1.25rem; letter-spacing: -.015em; line-height: 1.25; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.fiche dd small { font-size: .8125rem; font-weight: 500; letter-spacing: 0; color: var(--texte-doux); }
.fiche .repartition { display: flex; flex-direction: column; align-items: flex-end; }
@media (max-width: 420px) {
  .fiche-ligne { gap: 4px 14px; }
  .fiche dd { font-size: 1.125rem; }
}
.etat-vide { margin: 0; padding: 20px 0; color: var(--texte-doux); font-size: .875rem; }

/* Schéma du dépôt : satellites → armoire → raccordement, traits pleins comme sur un schéma unifilaire. */
.schema { --trait: var(--bordure-champ); margin: 0; padding: 0; }
.schema h3 { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; font-size: .9375rem; }
.badge-exemple { padding: 1px 8px; border-radius: 999px; background: var(--surface-3); color: var(--texte-doux); font-size: .6875rem; font-weight: 500; }
/* Votre installation : 3 étages. Colonne de gauche, ce qu'il faut comprendre ; colonne de droite, le dessin. L'écart entre
   les rangées (22 px) porte les fils qui relient places, armoires et poste. */
.installation { display: grid; grid-template-columns: minmax(200px, 300px) minmax(0, 1fr); column-gap: 32px; row-gap: 22px; }
.etage-texte { font-size: .8125rem; color: var(--texte-doux); line-height: 1.45; }
.etage-texte p { margin: 0 0 4px; max-width: 48ch; }
.etage-texte b { color: var(--texte); font-weight: 600; }
/* Note d'évolution sous le raccordement (tarif jaune) : encadré discret, à lire avant de choisir. */
.etage-texte .note-evolution { display: block; margin-top: 6px; padding: 8px 10px; background: var(--accent-doux);
  border: 1px solid var(--accent-trait); border-radius: var(--rayon-champ); color: var(--texte); }
.etage-texte .etage-titre { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: .875rem; font-weight: 600; color: var(--texte); }
.etage-titre .num { flex: none; display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 50%;
  background: var(--accent-doux); color: var(--accent-fort); font-size: .75rem; font-variant-numeric: tabular-nums; }
.etage-dessin { display: flex; flex-direction: column; min-width: 0; }
.etage-dessin.bas { justify-content: flex-end; }
.etage-dessin.pile > .rangee { flex: 1; }
.rangee .colonne { display: flex; flex-direction: column; align-items: center; min-width: 0; container-type: inline-size; }
.etage-dessin.bas .rangee { align-items: end; }
.fil { flex: 1; width: 0; min-height: 0; border-left: 2px solid var(--trait); }
.colonne.passe .fil { margin-top: -22px; }
/* Étage de la prime : séparé du dessin électrique par un filet, avec l'échelle des paliers. */
.installation > .etage-texte:nth-last-child(2):has(+ .prime), .installation > .etage-dessin.prime { padding-top: 18px; border-top: 1px solid var(--bordure); }
/* Une ligne par palier (raccordement, prime, points), pour que les montants tiennent dans la colonne du dessin. */
.paliers { list-style: none; margin: 0; padding: 0; display: grid; gap: 4px; }
.paliers li { display: grid; grid-template-columns: 5.5em 1fr auto; align-items: baseline; column-gap: 10px; padding: 6px 10px;
  border: 1px solid var(--bordure); border-radius: var(--rayon-champ);
  background: var(--surface); font-size: .75rem; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.paliers b { font-size: .875rem; color: var(--texte); font-weight: 600; }
.paliers li.atteint { border-color: var(--accent); background: var(--accent-doux); }
.paliers li.atteint b { color: var(--accent-fort); }
.schema .picto { flex: none; width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.rangee, .schema-bus { display: grid; grid-template-columns: repeat(var(--n), minmax(0, 1fr)); column-gap: 12px; }
.zone-titre { align-self: stretch; margin: 0 0 6px; font-size: .75rem; font-weight: 500; color: var(--texte-doux); text-align: center; }
.sats { list-style: none; margin: 0; padding: 8px; width: 100%; display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  background: var(--surface-2); border-radius: var(--rayon-champ); }
.sat { display: grid; justify-items: center; align-content: start; min-width: 56px; padding: 7px 6px 6px; background: var(--surface);
  border: 1px solid var(--bordure); border-radius: 6px; color: var(--texte); line-height: 1.1; font-variant-numeric: tabular-nums; }
.sat .picto { width: 24px; height: 24px; margin-bottom: 4px; color: var(--accent); }
.sat b { font-size: .8125rem; font-weight: 600; white-space: nowrap; }
.sat .besoin { margin-top: 2px; font-size: .6875rem; color: var(--texte-doux); white-space: nowrap; }
/* Place ajoutée pour la prime : même borne, contour en pointillés. */
.sat.en-plus { border-style: dashed; background: transparent; }
.sat.en-plus .picto { color: var(--texte-doux); }
.schema .boite small { display: block; font-size: .6875rem; color: var(--texte-doux); }
.sat small { font-size: .6875rem; font-weight: 500; color: var(--texte-doux); }
.sat.ac .picto { color: var(--texte-doux); }
/* Place de biberonnage (recharge du midi) : fond et contour accentués, rôle écrit dessous. */
.sat.bib { border-color: var(--accent-trait); background: var(--accent-doux); }
.sat.bib .picto { color: var(--accent); }
.sat .role { margin-top: 3px; font-size: .625rem; font-weight: 600; color: var(--accent-fort); white-space: nowrap; }
/* Rangée avec biberonnage : toutes les places à la largeur du libellé, pour garder une grille régulière. */
.sats:has(.bib) .sat { min-width: 0; width: 96px; }
.schema .boite { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; max-width: 260px; margin: 0 auto;
  padding: 8px 12px 8px 8px; background: var(--surface); border: 1px solid var(--bordure-forte); border-radius: var(--rayon-champ);
  font-size: .75rem; color: var(--texte-doux); line-height: 1.3; text-align: left; }
.schema .boite .picto { width: 30px; height: 30px; color: var(--texte); stroke-width: 1.5; }
.schema .boite strong { display: block; font-size: .9375rem; color: var(--texte); font-variant-numeric: tabular-nums; }
.schema .boite::before { content: ""; position: absolute; left: 50%; top: -23px; height: 22px; border-left: 2px solid var(--trait); }
.schema-bus { height: 20px; }
.schema-bus i { position: relative; }
.schema-bus i::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; border-left: 2px solid var(--trait); }
.schema-bus i::after { content: ""; position: absolute; left: -6px; right: -6px; bottom: 0; border-bottom: 2px solid var(--trait); }
.schema-bus i:first-child::after { left: 50%; }
.schema-bus i:last-child::after { right: 50%; }
.schema-bus i:only-child::after { display: none; }
.schema .boite.poste { border-color: var(--texte-doux); }
.schema .boite.poste .picto { color: var(--accent); }
/* Colonne étroite (3 branches sur téléphone) : pictogramme au-dessus du texte, vignettes resserrées. */
@container (max-width: 150px) {
  .schema .boite { flex-direction: column; gap: 4px; padding: 8px 6px; text-align: center; }
  .sats { padding: 5px; gap: 4px; }
  .sat { min-width: 44px; padding: 5px 2px 4px; }
}
.schema figcaption { margin-top: 16px; font-size: .75rem; color: var(--texte-doux); }
/* Écran étroit : le texte de chaque étage passe au-dessus de son dessin ; les fils n'ont plus de sens. */
@media (max-width: 760px) {
  .installation { grid-template-columns: minmax(0, 1fr); row-gap: 10px; }
  .etage-dessin + .etage-texte { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--bordure); }
  .schema .boite::before, .fil, .schema-bus { display: none; }
}
/* L'armoire porte l'essentiel du coût : c'est la boîte la plus lisible du schéma. */
.schema .boite.armoire { border-color: var(--accent); }
.schema .boite.armoire strong { font-size: 1.0625rem; color: var(--accent-fort); }
@media (max-width: 520px) {
  .rangee, .schema-bus { column-gap: 8px; }
  .sats { padding: 6px; gap: 4px; }
  .sat { min-width: 50px; padding: 6px 4px 5px; }
  .sat .picto { width: 22px; height: 22px; }
  .schema .boite { gap: 8px; padding: 6px 8px 6px 6px; }
  .schema .boite .picto { width: 26px; height: 26px; }
}

/* Alertes */
.alerte { display: flex; gap: 10px; align-items: flex-start; border-radius: var(--rayon-champ); padding: 10px 12px; margin-top: 12px;
  font-size: .8125rem; border: 1px solid transparent; }
.alerte .icone { margin-top: 2px; }
.alerte strong { display: block; }
.alerte.fort { background: var(--alerte-forte-fond); color: var(--alerte-forte); border-color: color-mix(in srgb, var(--alerte-forte) 25%, transparent); }
.alerte.info { background: var(--alerte-info-fond); color: var(--texte); border-color: var(--accent-trait); }
.alerte.info .icone { color: var(--accent); }

/* Sections dépliables du panneau de résultats */
.section { border-top: 1px solid var(--bordure); padding: 4px 20px 8px; }
.section > summary { padding-block: 12px; font-size: .875rem; }
.section[open] > summary { margin-bottom: 4px; }
.section[open] { padding-bottom: 18px; }
@media (max-width: 520px) { .section { padding-inline: 14px; } }

.graphique { position: relative; height: 260px; }

.tableau { overflow-x: auto; border: 1px solid var(--bordure); border-radius: var(--rayon-champ); }
table { border-collapse: collapse; width: 100%; font-size: .8125rem; font-variant-numeric: tabular-nums; }
th, td { text-align: right; padding: 8px 10px; border-bottom: 1px solid var(--bordure); white-space: nowrap; vertical-align: top; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--surface-2); }
th:first-child, td:first-child { text-align: left; }
th { background: var(--surface-2); color: var(--texte-doux); font-weight: 550; font-size: .75rem; white-space: normal; vertical-align: bottom; min-width: 5.5rem; }
td .aide { margin: 0; font-size: .75rem; }
td:first-child { white-space: normal; min-width: 9rem; overflow-wrap: anywhere; font-weight: 550; }
td:first-child .aide { font-weight: 400; }

.contact { margin: 0; font-size: .875rem; }
.contact a { font-weight: 550; padding: 12px 0; }
.avertissement { font-size: .75rem; color: var(--texte-doux); margin: 10px 0 0; max-width: 72ch; }

.pied { color: var(--texte-doux); font-size: .8125rem; padding: 0 0 32px; }
.pied p { margin: .2rem 0; }
.pied a { color: var(--texte); padding: 12px 0; }

/* États : erreurs de saisie, groupe retiré, résultat vide */
input[aria-invalid="true"] { border-color: var(--alerte-forte); }
.unite:has(input[aria-invalid="true"]), .reglette-valeur input[aria-invalid="true"] { border-color: var(--alerte-forte); }
.horaires { font-variant-numeric: tabular-nums; }
.avis { display: block; margin-top: 2px; font-weight: 500; color: var(--alerte-forte); }
.erreur-champ { display: block; margin-top: 4px; font-size: .75rem; font-weight: 500; color: var(--alerte-forte); }
.exclus { display: block; margin: 6px 0 0; color: var(--alerte-forte); }
.retrait[hidden] { display: none; }
.retrait { display: flex; align-items: center; gap: 8px; margin: 0 0 12px; padding: 6px 12px; font-size: .8125rem; color: var(--texte-doux);
  background: var(--surface-2); border-radius: var(--rayon-champ); }
.lien { font: inherit; font-weight: 550; color: var(--accent); background: none; border: none; padding: 10px 4px; cursor: pointer;
  text-decoration: underline; text-underline-offset: 3px; }
.lien:hover { color: var(--accent-fort); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.frise-groupe h3, .groupe-tete input { overflow-wrap: anywhere; }

/* Mobile : barre résumé fixée en bas, tant que les résultats ne sont pas à l'écran. */
.resume-mobile { display: none; }
@media (max-width: 900px) {
  body { padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .resume-mobile {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: var(--surface); border-top: 1px solid var(--bordure);
    box-shadow: 0 -4px 16px rgb(19 27 43 / .08);
    transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s;
  }
  .resume-mobile.cache { transform: translateY(110%); visibility: hidden; transition: transform .25s cubic-bezier(.2, .8, .2, 1), visibility 0s .25s; }
  .resume-mobile p { margin: 0; font-size: .8125rem; line-height: 1.4; color: var(--texte-doux); min-width: 0; font-variant-numeric: tabular-nums; }
  .resume-mobile strong { display: block; font-size: .9375rem; color: var(--texte); font-weight: 650; }
  .resume-mobile .bouton { flex: 0 0 auto; }
  #titre-resultats { scroll-margin-top: 16px; }
  #titre-resultats:focus { outline: none; }
}

/* ------------------------------------------------------------------------------------------------------------- */
/* Frise de la journée : une même échelle 0–24 h pour tous les groupes */

.frise-groupe { padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--bordure); }
.frise-groupe:first-child { padding-top: 0; margin-top: 0; border-top: none; }
.frise-groupe h3 { margin: 0 0 6px; font-size: .8125rem; }
.frise-ligne { margin-bottom: 8px; }
.frise-titre { display: block; font-size: .75rem; color: var(--texte-doux); margin-bottom: 4px; }
.frise { position: relative; height: 24px; border-radius: 4px; background: var(--depot); overflow: hidden; }
.seg { position: absolute; top: 0; bottom: 0; display: flex; align-items: center; justify-content: center;
  font-size: .6875rem; font-weight: 550; white-space: nowrap; overflow: hidden; }
.seg.tournee { background: repeating-linear-gradient(135deg, var(--surface-3) 0 5px, var(--surface) 5px 8px); color: var(--texte-doux);
  box-shadow: inset 0 0 0 1px var(--bordure); }
.seg.charge { background: var(--accent); color: #fff; }
.frise-texte { font-size: .8125rem; margin: 8px 0 0; display: flex; flex-wrap: wrap; gap: 6px 32px; }
.etapes ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 2px; }
.etapes b { font-weight: 550; }
.etapes-titre { margin: 0 0 2px; font-size: .75rem; font-weight: 600; color: var(--texte-doux); }
.axe { position: relative; height: 16px; margin-top: 4px; font-size: .6875rem; color: var(--texte-doux); font-variant-numeric: tabular-nums; }
.axe span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.axe span:first-child { transform: none; }
.axe span:last-child { transform: translateX(-100%); }
@media (max-width: 520px) { .axe span:nth-child(even) { display: none; } }
.legende-frise { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: .75rem; color: var(--texte-doux); margin-top: 12px; }
.legende-frise span { display: inline-flex; align-items: center; gap: 6px; }
.pastille { display: inline-block; width: 14px; height: 10px; border-radius: 2px; }
.pastille.tournee { background: repeating-linear-gradient(135deg, var(--surface-3) 0 3px, var(--surface) 3px 5px); box-shadow: inset 0 0 0 1px var(--bordure-forte); }
.pastille.depot { background: var(--depot); }
.pastille.charge { background: var(--accent); }

/* ------------------------------------------------------------------------------------------------------------- */

.impression-seule { display: none; }
.courbe-impression { display: none; }

/* Tuto guidé : le voile est l'ombre de l'anneau, il assombrit la page sans bloquer les clics. */
.tuto-anneau { position: fixed; z-index: 20; pointer-events: none; border-radius: var(--rayon);
  outline: 2px solid var(--accent); box-shadow: 0 0 0 100vmax rgb(19 27 43 / .5); }
.tuto-anneau.sans-cible { outline: none; }
.tuto-carte { position: fixed; z-index: 21; top: var(--y, 12px); left: var(--x, 12px); width: 340px; padding: 16px;
  background: var(--surface); border-radius: var(--rayon); box-shadow: 0 12px 32px rgb(19 27 43 / .28); }
.tuto-carte h2 { margin: 0 0 6px; font-size: 1rem; font-weight: 600; line-height: 1.3; letter-spacing: -.011em; }
.tuto-compteur { margin: 0 0 8px; font-size: .75rem; font-weight: 550; color: var(--accent-fort); font-variant-numeric: tabular-nums; }
.tuto-texte { margin: 0 0 14px; color: var(--texte-doux); }
.tuto-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tuto-actions > span { display: flex; gap: 6px; }
.tuto-actions .lien { padding-inline: 0; white-space: nowrap; }
.tuto-actions .bouton { padding-inline: 12px; }
.tuto-actions [hidden] { display: none; }
#tuto-lancer { padding: 0 2px; font-size: inherit; }
@media (prefers-reduced-motion: no-preference) {
  .tuto-anneau.glisse { transition: top .24s cubic-bezier(.2, .8, .2, 1), left .24s cubic-bezier(.2, .8, .2, 1),
    width .24s cubic-bezier(.2, .8, .2, 1), height .24s cubic-bezier(.2, .8, .2, 1); }
  .tuto-carte.glisse { transition: top .24s cubic-bezier(.2, .8, .2, 1), left .24s cubic-bezier(.2, .8, .2, 1); }
}
/* Téléphone : carte posée en bas de l'écran, par-dessus la barre résumé ; la cible défile au-dessus. */
@media (max-width: 640px) {
  .tuto-carte { top: auto; left: 0; right: 0; bottom: 0; width: auto; padding: 16px 16px calc(14px + env(safe-area-inset-bottom));
    border-radius: var(--rayon) var(--rayon) 0 0; box-shadow: 0 -8px 24px rgb(19 27 43 / .24); }
}

@media print {
  .tuto-anneau, .tuto-carte, #tuto-lancer { display: none; }
  :root { --fond: #fff; --surface: #fff; --surface-2: #fff; }
  body { font-size: 11px; }
  .appbar, .resume-mobile, .page-actions { display: none; }
  body { padding-bottom: 0; }
  .resultats, .analyse { position: static; border: none; }
  .analyse > .panneau-corps { padding-inline: 0; }
  .page-tete { padding: 0 0 8px; }
  .chapo, .saisie, .pied .conteneur p:first-child { display: none; }
  .grille { display: block; }
  .panneau-tete, .panneau-corps, .section, .panneau-pied { padding-inline: 0; }
  .section, .fiche-ligne, .alerte { break-inside: avoid; }
  /* Les fonds colorés portent l'information (frise, pastilles) : ils doivent s'imprimer. */
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .graphique { height: auto; }
  .graphique canvas { display: none !important; }
  .courbe-impression { display: block; width: 100%; height: auto; }
  .frise-groupe, .graphique { break-inside: avoid; }
  .section { break-inside: auto; }
  .impression-seule { display: block; }
  .synthese { border: 1px solid var(--bordure); border-radius: var(--rayon); padding: 10px 14px; margin-bottom: 14px; break-inside: avoid; }
  .synthese h2 { font-size: 1rem; margin: 0 0 4px; }
  .synthese ul { margin: 0 0 6px; padding-left: 1.1rem; }
  .synthese p { margin: 0; color: var(--texte-doux); }
  summary::before { display: none; }
  summary { padding-left: 0; }
}
