/* Apparence des écrans, d'après les maquettes approuvées (docs/dossier-developpeur/MAQUETTES.html, jetons --p-* et
   --f-product). Téléphone d'abord, mode clair seulement (section 10.1, ENF-040) : texte d'au moins 16 px, cibles d'au moins
   44 px. L'organisation est le visage du service : sa couleur (--couleur-principale), son logo et son nom; Inscript Transport
   est nommé en pied de page. Les couleurs de chaque organisation viendront de son apparence (EF-006); en attendant, le vert
   des maquettes (H-121).

   Sommaire : 1. jetons; 2. police; 3. base; 4. coquille (en-tête, menu, pied, bandeau de la démo); 5. texte; 6. formulaires;
   7. boutons; 8. alertes, messages et pastilles; 9. cartes et listes; 10. onglets; 11. grille de réservation (U3);
   12. tableaux et écrans d'Inscript (P1 à P5, A1, A2); 13. chauffeur (C1, C2); 14. rapport du mois (R1); 15. impression;
   16. mouvement réduit.

   Contrastes vérifiés (WCAG 2.1 AA : 4,5:1 pour le texte, 3:1 pour le gros texte, les contours et les graphiques) :
   - encre #1C2420 sur blanc 15,9:1; sur surface #F4F7F5 14,7:1; sur vert pâle #E2F1E8 13,6:1; sur gris #ECF0EE 13,8:1;
     sur le jaune de la démo #FFD84D 11,5:1;
   - discret #55605A sur blanc 6,6:1; sur surface 6,1:1; sur vert pâle 5,6:1; sur gris #ECF0EE 5,7:1;
   - blanc sur vert #147A49 5,4:1 (bouton principal, case réservée); vert #147A49 sur surface 5,0:1;
   - vert foncé #0E5A35 sur blanc 8,3:1; sur vert pâle 7,1:1; sur surface 7,7:1;
   - avertissement #6A4300 sur #FFF3D6 7,9:1; rouge #A3241C sur blanc 7,4:1, sur #FBE8E6 6,3:1, blanc sur rouge 7,4:1;
     blanc sur le rouge foncé (survol) #861D17 9,5:1;
   - bleu #1B5A86 sur #E3EEF6 6,3:1, sur blanc 7,4:1 (aussi l'anneau du focus); sur le jaune de la démo 5,3:1;
   - inactif #5A635E sur #ECF0EE 5,4:1; bordure des champs #848F89 sur blanc 3,4:1;
   - barres du rapport : vert #147A49 sur blanc 5,4:1. Les traits #D6DED9 ne portent aucune information. */

/* ---------- 1. Jetons ---------- */
:root {
  /* La couleur de l'organisation (EF-006) et ses deux compagnes : le texte sur fond pâle, le fond pâle. */
  --couleur-principale: #147a49;
  --couleur-principale-encre: #0e5a35;
  --couleur-principale-pale: #e2f1e8;

  --encre: #1c2420;
  --discret: #55605a;
  --blanc: #ffffff;
  --surface: #f4f7f5;
  --chrome: #e3e9e5;
  --trait: #d6ded9;
  --trait-impression: #b8c2bc;
  --champ: #848f89;

  --avert-fond: #fff3d6;
  --avert-trait: #e2be62;
  --avert-encre: #6a4300;
  --rouge: #a3241c;
  --rouge-fonce: #861d17;
  --rouge-pale: #fbe8e6;
  --rouge-trait: #e3a8a2;
  --bleu: #1b5a86;
  --bleu-pale: #e3eef6;
  --bleu-trait: #a9c6dd;
  --inactif-fond: #ecf0ee;
  --inactif-trait: #dce2df;
  --inactif-encre: #5a635e;
  --ok-trait: #9acbb0;
  --demo: #ffd84d;
  --focus: #1b5a86;

  /* Les barres des graphiques du rapport : la couleur de l'organisation. */
  --couleur-barre: var(--couleur-principale);

  /* Échelle des tailles (base 16 px) : 12, 14, 15, 16, 17, 19, 24, 28, 40. */
  --t-xxs: 0.75rem;
  --t-xs: 0.875rem;
  --t-s: 0.9375rem;
  --t-base: 1rem;
  --t-corps: 1.0625rem;
  --t-m: 1.1875rem;
  --t-l: 1.5rem;
  --t-xl: 1.75rem;
  --t-xxl: 2.5rem;

  --rayon-bouton: 10px;
  --rayon-carte: 12px;
  --rayon-champ: 8px;

  /* La colonne du téléphone (usager, chauffeur), et celle des écrans d'Inscript et du rapport. */
  --largeur: 32rem;
  --largeur-large: 72rem;

  --police: "Montserrat", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

/* ---------- 2. Police : Montserrat, servie par le site (aucune police externe; licence OFL dans wwwroot/fonts) ---------- */
@font-face {
  font-family: "Montserrat";
  font-style: normal;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/montserrat-latin.woff2") format("woff2");
}

@font-face {
  font-family: "Montserrat";
  font-style: italic;
  font-weight: 400 900;
  font-display: swap;
  src: url("/fonts/montserrat-italic-latin.woff2") format("woff2");
}

/* ---------- 3. Base ---------- */
[hidden] {
  display: none !important;
}

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

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

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--police);
  font-size: var(--t-corps);
  line-height: 1.5;
  color: var(--encre);
  background: var(--blanc);
  overflow-wrap: break-word;
}

a {
  color: var(--couleur-principale-encre);
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 2px;
}

a:hover {
  text-decoration-thickness: 2px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.c.libre:has(input:focus-visible),
.segments input:focus-visible + span {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* « Aller au contenu » : le premier arrêt du clavier, caché jusqu'à ce qu'il ait le focus (il saute l'en-tête et le menu). */
.aller-contenu {
  position: absolute;
  top: 0.5rem;
  left: 0.5rem;
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 1rem;
  border-radius: var(--rayon-bouton);
  background: var(--blanc);
  color: var(--couleur-principale-encre);
  transform: translateY(-200%);
}

.aller-contenu:focus {
  transform: none;
}

/* Un champ, une case ou un bouton atteint au clavier n'est jamais caché sous la barre d'onglets fixée au bas de l'écran. */
html:has(.onglets) {
  scroll-padding-bottom: calc(4.5rem + env(safe-area-inset-bottom, 0px));
}

img,
svg {
  max-width: 100%;
}

/* ---------- 4. Coquille : en-tête de l'organisation, menu d'Inscript, contenu, pied ---------- */
.entete {
  background: var(--blanc);
  border-bottom: 1px solid var(--trait);
}

.entete-dedans {
  display: flex;
  align-items: center;
  max-width: calc(var(--largeur) + 2rem);
  margin: 0 auto;
  padding: 0.625rem 1rem;
}

body.large .entete-dedans {
  max-width: calc(var(--largeur-large) + 2rem);
}

body.avec-menu .entete-dedans {
  max-width: none;
}

/* Le logo de l'organisation et son nom; tant que son logo n'est pas déposé (wwwroot/icones/{code}/), ses initiales sur sa
   couleur. */
.marque {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  color: var(--encre);
  text-decoration: none;
}

.logo {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--rayon-champ);
  background: var(--couleur-principale);
  color: var(--blanc);
  font-size: var(--t-xs);
  font-weight: 700;
  letter-spacing: 0.02em;
  object-fit: cover;
}

.nom-service {
  font-size: var(--t-corps);
  font-weight: 700;
  line-height: 1.2;
}

.contenu {
  flex: 1 0 auto;
  width: 100%;
  max-width: calc(var(--largeur) + 2rem);
  margin: 0 auto;
  padding: 1.25rem 1rem 1.5rem;
}

.contenu.large {
  max-width: calc(var(--largeur-large) + 2rem);
}

/* Les écrans d'Inscript : le menu à gauche à l'ordinateur, en haut au téléphone (maquettes P1 à P5, A1, A2). */
.ecran-personnel {
  flex: 1 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.ecran-personnel .contenu.large {
  margin: 0;
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.menu {
  display: flex;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.5rem 1rem;
  background: var(--surface);
  border-bottom: 1px solid var(--trait);
}

.menu a {
  flex: none;
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--rayon-champ);
  color: var(--encre);
  font-size: var(--t-s);
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
}

.menu a:hover {
  background: var(--chrome);
}

.menu a[aria-current="page"] {
  background: var(--couleur-principale-pale);
  color: var(--couleur-principale-encre);
  font-weight: 700;
}

@media (min-width: 75rem) {
  .ecran-personnel {
    grid-template-columns: 13rem minmax(0, 1fr);
  }

  .menu {
    flex-direction: column;
    gap: 0.125rem;
    overflow: visible;
    padding: 1rem 0.75rem;
    border-bottom: 0;
    border-right: 1px solid var(--trait);
  }

  .menu a {
    white-space: normal;
  }

  .ecran-personnel .contenu.large {
    padding: 1.5rem 2rem 2rem;
  }
}

.pied {
  width: 100%;
  margin-top: 1rem;
  padding: 0.875rem 1rem 1.25rem;
  border-top: 1px solid var(--trait);
  color: var(--discret);
  font-size: var(--t-s);
  text-align: center;
}

.pied p {
  margin: 0.25rem auto;
  max-width: 40rem;
}

/* 44 px de haut au toucher : les liens du pied, un lien seul sur sa ligne (« Retour à mon compte », « ‹ Journée »), le jour
   précédent ou suivant (P1), la semaine précédente ou suivante (U3) et le retour du manifeste (C2). */
.pied a,
.contenu > p > a:only-child:not(.bouton),
.contenu > a:not(.bouton),
.jours a,
.semaine a,
.entete-manifeste > a {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
}

/* Mode démonstration (D-134) : l'heure simulée en haut de chaque page, impossible à prendre pour l'heure réelle. */
.bandeau-demo {
  margin: 0;
  padding: 0.5rem 1rem;
  background: var(--demo);
  color: var(--encre);
  font-size: var(--t-s);
  font-weight: 600;
  text-align: center;
  text-wrap: balance;
  font-variant-numeric: tabular-nums;
}

.bandeau-demo a {
  color: var(--encre);
}

/* ---------- 5. Texte : une échelle sobre; les heures et les chiffres sont les plus forts ---------- */
h1,
h2,
h3 {
  margin: 0 0 0.75rem;
  color: var(--encre);
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

h1 {
  font-size: var(--t-l);
}

h2 {
  margin-top: 1.75rem;
  font-size: var(--t-m);
}

h3 {
  font-size: var(--t-corps);
}

p,
ul,
ol,
dl {
  margin: 0 0 1rem;
}

/* Des lignes de moins de 80 caractères sur les écrans larges. */
.contenu.large > p,
.contenu.large > ul,
.contenu.large > ol {
  max-width: 72ch;
}

h1.question {
  line-height: 1.3;
}

.aide {
  margin: 0.25rem 0 0.75rem;
  color: var(--discret);
  font-size: var(--t-base);
  line-height: 1.45;
}

.muet {
  color: var(--discret);
}

.cache {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.texte-legal {
  white-space: pre-line;
  max-width: 68ch;
}

/* Les dates commencent par une minuscule (« mardi 13 janvier ») : la première lettre d'un titre de date est relevée. */
.date-journee::first-letter,
.jour::first-letter {
  text-transform: uppercase;
}

/* Un jour de trajets (U4, C1), une date dans une carte : petit, gras, discret, sans majuscules. */
.jour {
  margin: 1.5rem 0 0.5rem;
  color: var(--discret);
  font-size: var(--t-base);
  font-weight: 700;
  letter-spacing: 0;
}

.carte .jour {
  margin: 0;
}

/* L'heure d'un trajet : l'élément le plus fort de l'écran. */
.grand {
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.nombre,
.nombre-g,
.heure {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* La page d'accueil (U1) : le service, sur le vert pâle de l'organisation. */
.hero {
  margin-bottom: 1.25rem;
  padding: 1rem 1.125rem;
  border-radius: var(--rayon-carte);
  background: var(--couleur-principale-pale);
}

.hero h1 {
  margin-bottom: 0.375rem;
}

.hero p {
  margin: 0;
  color: var(--couleur-principale-encre);
}

/* ---------- 6. Formulaires ---------- */
.champ {
  margin-bottom: 1.25rem;
}

.champ > label:not(.case),
.champ > .etiquette,
legend {
  display: block;
  padding: 0;
  margin-bottom: 0.375rem;
  font-size: var(--t-base);
  font-weight: 600;
}

.champ > .aide,
.champ > p.aide {
  margin: 0.375rem 0 0;
}

input[type="text"],
input[type="email"],
input[type="tel"],
input[type="number"],
input[type="search"],
input[type="date"],
input[type="time"],
textarea,
select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  font: inherit;
  font-size: var(--t-corps);
  color: var(--encre);
  background-color: var(--blanc);
  border: 1px solid var(--champ);
  border-radius: var(--rayon-champ);
}

textarea {
  resize: vertical;
  line-height: 1.45;
}

input[type="number"] {
  width: 6rem;
  font-variant-numeric: tabular-nums;
}

input[aria-invalid="true"],
textarea[aria-invalid="true"],
.input-validation-error {
  border-color: var(--rouge);
}

input::placeholder,
textarea::placeholder {
  color: var(--discret);
  opacity: 1;
}

input.code {
  font-size: var(--t-l);
  font-weight: 700;
  letter-spacing: 0.3em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

fieldset {
  min-width: 0;
  margin: 0 0 1.25rem;
  padding: 0;
  border: 0;
}

/* Une case à cocher (ou un bouton radio) et sa phrase : toute la ligne se touche. */
.case {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  min-height: 2.75rem;
  padding: 0.5rem 0;
  font-size: var(--t-corps);
  line-height: 1.4;
  cursor: pointer;
}

.case input {
  flex: none;
  width: 1.375rem;
  height: 1.375rem;
  margin: 0;
  accent-color: var(--couleur-principale);
}

.erreur,
.field-validation-error {
  color: var(--rouge);
  font-size: var(--t-base);
  font-weight: 600;
}

span.erreur:empty {
  display: none;
}

.deux {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

/* Un choix parmi quelques-uns (le nombre de personnes, le motif, la catégorie) : des boutons qui passent à la ligne au
   téléphone. Le choisi est plein, de la couleur de l'organisation. */
.segments {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.segments label {
  position: relative;
}

/* Le vrai champ d'un bouton de choix ou d'une case libre de la grille (U3) : invisible, il couvre tout le bouton. */
.segments input,
.c.libre input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.segments span {
  display: grid;
  place-items: center;
  min-width: 3rem;
  min-height: 2.75rem;
  padding: 0.375rem 1rem;
  border: 1.5px solid var(--champ);
  border-radius: var(--rayon-bouton);
  background: var(--blanc);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: center;
  cursor: pointer;
}

.segments input:checked + span {
  color: var(--blanc);
  background: var(--couleur-principale);
  border-color: var(--couleur-principale);
}

/* ---------- 7. Boutons : rayon de 10 px, bordure de 1,5 px, gras, au moins 44 px ---------- */
.bouton {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  min-height: 3rem;
  margin: 0 0 0.75rem;
  padding: 0.625rem 1rem;
  font: inherit;
  font-size: var(--t-corps);
  font-weight: 700;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  color: var(--blanc);
  background: var(--couleur-principale);
  border: 1.5px solid var(--couleur-principale);
  border-radius: var(--rayon-bouton);
  cursor: pointer;
  transition: background-color 0.12s, border-color 0.12s;
}

.bouton:hover {
  background: var(--couleur-principale-encre);
  border-color: var(--couleur-principale-encre);
}

.bouton.secondaire {
  color: var(--couleur-principale-encre);
  background: var(--blanc);
  border-color: var(--couleur-principale);
}

.bouton.secondaire:hover {
  background: var(--couleur-principale-pale);
}

.bouton.discret {
  color: var(--encre);
  background: var(--blanc);
  border-color: var(--champ);
}

.bouton.discret:hover {
  background: var(--surface);
}

.bouton.danger {
  color: var(--blanc);
  background: var(--rouge);
  border-color: var(--rouge);
}

.bouton.danger:hover {
  background: var(--rouge-fonce);
  border-color: var(--rouge-fonce);
}

/* « Annuler toute la journée », « Annuler ce départ » (P1, P5) : un geste grave, sans être le premier bouton de la page. */
.bouton.danger-contour {
  color: var(--rouge);
  background: var(--blanc);
  border-color: var(--rouge);
}

.bouton.danger-contour:hover {
  background: var(--rouge-pale);
}

/* Pendant un envoi (js/site.js) : le bouton dit « Envoi en cours… » et un deuxième toucher ne renvoie rien. */
form[aria-busy="true"] .bouton,
form[aria-busy="true"] button {
  cursor: progress;
}

.bouton:disabled,
.bouton:disabled:hover {
  color: var(--inactif-encre);
  background: var(--inactif-fond);
  border-color: var(--inactif-trait);
  cursor: default;
}

/* Sur les écrans larges, un bouton a la largeur de son texte. */
.contenu.large .bouton {
  display: inline-flex;
  width: auto;
  margin-right: 0.5rem;
}

.bouton.petit {
  display: inline-flex;
  width: auto;
  min-height: 2.75rem;
  margin: 0;
  padding: 0.5rem 0.875rem;
  font-size: var(--t-base);
  border-radius: var(--rayon-champ);
}

/* Un bouton qui a l'air d'un lien (les pages de la liste des usagers, « Rétablir l'accès »). */
button.lien {
  min-height: 2.75rem;
  padding: 0.5rem 0;
  font: inherit;
  font-weight: 600;
  color: var(--couleur-principale-encre);
  text-decoration: underline;
  text-underline-offset: 2px;
  background: none;
  border: 0;
  cursor: pointer;
}

/* ---------- 8. Alertes, messages et pastilles ---------- */
.alerte {
  display: flex;
  gap: 0.625rem;
  align-items: flex-start;
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--avert-trait);
  border-radius: var(--rayon-bouton);
  background: var(--avert-fond);
  color: var(--avert-encre);
  font-size: var(--t-base);
  line-height: 1.45;
}

.alerte p {
  margin: 0;
}

.alerte > div,
.alerte > p {
  flex: 1;
  min-width: 0;
}

.alerte div > p + p {
  margin-top: 0.375rem;
}

.alerte .ic {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.375rem;
  height: 1.375rem;
  margin-top: 0.0625rem;
  border-radius: 50%;
  background: var(--avert-encre);
  color: var(--avert-fond);
  font-size: var(--t-xxs);
  font-weight: 800;
  line-height: 1;
}

.alerte.info {
  background: var(--bleu-pale);
  border-color: var(--bleu-trait);
  color: var(--bleu);
}

.alerte.info .ic {
  background: var(--bleu);
  color: var(--bleu-pale);
}

.alerte.ok {
  background: var(--couleur-principale-pale);
  border-color: var(--ok-trait);
  color: var(--couleur-principale-encre);
}

.alerte.ok .ic {
  background: var(--couleur-principale);
  color: var(--couleur-principale-pale);
}

.alerte.mauvais {
  background: var(--rouge-pale);
  border-color: var(--rouge-trait);
  color: var(--rouge);
}

.alerte.mauvais .ic {
  background: var(--rouge);
  color: var(--rouge-pale);
}

/* Une alerte avec son geste (P1 : « Affecter ») : la phrase et le bouton sur une ligne, centrés. */
.alerte:has(> .bouton) {
  flex-wrap: wrap;
  align-items: center;
}

.alerte .bouton.petit {
  flex: none;
  margin: 0;
}

.carte .alerte {
  margin: 0;
}

/* Un message neutre (état vide, explication) : sur la surface; « erreur » : en rouge. */
.message {
  margin: 0 0 1rem;
  padding: 0.75rem 0.875rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-bouton);
  background: var(--surface);
  font-size: var(--t-base);
}

.message p {
  margin: 0 0 0.5rem;
}

.message ul {
  margin: 0.25rem 0 0;
  padding-left: 1.25rem;
}

.message.erreur {
  background: var(--rouge-pale);
  border-color: var(--rouge-trait);
  color: var(--rouge);
  font-weight: 500;
}

.message .bouton {
  margin: 0.75rem 0 0;
}

.pastille {
  display: inline-block;
  padding: 0.125rem 0.625rem;
  border-radius: 999px;
  background: var(--inactif-fond);
  color: var(--inactif-encre);
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 1.5;
  white-space: nowrap;
}

.pastille.ok {
  background: var(--couleur-principale-pale);
  color: var(--couleur-principale-encre);
}

.pastille.avertissement {
  background: var(--avert-fond);
  color: var(--avert-encre);
}

.pastille.mauvais {
  background: var(--rouge-pale);
  color: var(--rouge);
}

.pastille.info {
  background: var(--bleu-pale);
  color: var(--bleu);
}

/* ---------- 9. Cartes, listes et rangées ---------- */
.carte {
  display: grid;
  gap: 0.5rem;
  align-content: start;
  min-width: 0;
  padding: 0.875rem 1rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-carte);
  background: var(--blanc);
}

.carte p,
.carte h2 {
  margin: 0;
}

.carte.douce {
  margin-bottom: 1rem;
  background: var(--surface);
}

/* Le trajet d'un lien de courriel (U6) commence par sa date : « Lundi 1er février, 9 h 00 ». */
.carte.douce > p:first-child::first-letter {
  text-transform: uppercase;
}

.carte .bouton {
  margin: 0;
}

.carte .rangee {
  margin-top: 0.25rem;
}

.trajets {
  display: grid;
  gap: 0.625rem;
  margin: 0 0 1.25rem;
  padding: 0;
  list-style: none;
}

.etale {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.etale h1 {
  margin: 0;
}

.contenu > .etale {
  margin-bottom: 1rem;
}

.rangee {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.rangee form {
  margin: 0;
}

/* La preuve d'un trajet (P3, D-135) : une phrase par fait. */
.preuve {
  margin: 0.25rem 0 0;
  padding-left: 1.125rem;
  color: var(--discret);
  font-size: var(--t-base);
}

.preuve li {
  margin: 0.125rem 0;
}

/* Les étapes du guide d'installation. */
.etapes {
  padding-left: 1.5rem;
}

.etapes li {
  margin: 0.375rem 0;
  padding-left: 0.25rem;
}

.etapes li::marker {
  color: var(--couleur-principale-encre);
  font-weight: 700;
}

/* La carte « Avis » (U5) : les notifications sur ce téléphone et le guide d'installation (EF-183, RA-178). */
.avis-telephone {
  margin: 1.5rem 0 1rem;
}

.avis-telephone h2 {
  font-size: var(--t-corps);
}

.avis-telephone form {
  margin: 0;
}

.avis-telephone .aide {
  margin: 0;
}

.avis-telephone .bouton {
  justify-self: start;
}

/* Une liste de clés et de valeurs (U5, P3, R1). */
.kv {
  display: grid;
  grid-template-columns: minmax(0, auto) minmax(0, 1fr);
  gap: 0.5rem 1rem;
  margin: 0;
  font-size: var(--t-base);
}

.kv dt {
  color: var(--discret);
}

.kv dd {
  margin: 0;
  min-width: 0;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.kv dd .ligne {
  display: block;
}

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

.roles li {
  margin: 0.125rem 0;
}

.petit-lien {
  margin-left: 0.5rem;
  font-size: var(--t-s);
}

.deconnexion {
  margin-top: 1.5rem;
}

/* ---------- 10. Onglets ---------- */
/* La barre de l'usager (U3, U4, U5) : Réserver, Mes trajets, Profil, fixée au bas de l'écran comme dans l'application; la
   page garde la place qu'elle prend. */
.onglets {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 3;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  max-width: calc(var(--largeur) + 2rem);
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
  border-top: 1px solid var(--trait);
  background: var(--blanc);
}

body:has(.onglets) {
  padding-bottom: calc(3.75rem + env(safe-area-inset-bottom, 0px));
}

@media (min-width: 34rem) {
  .onglets {
    border: 1px solid var(--trait);
    border-bottom: 0;
    border-radius: var(--rayon-carte) var(--rayon-carte) 0 0;
  }
}

.onglets a {
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 0.375rem;
  min-height: 3.5rem;
  padding: 0.5rem 0.25rem 0.625rem;
  color: var(--discret);
  font-size: var(--t-s);
  font-weight: 600;
  text-decoration: none;
}

.onglets a::before {
  content: "";
  display: block;
  width: 1.5rem;
  height: 4px;
  border-radius: 2px;
  background: var(--inactif-trait);
}

.onglets a[aria-current="page"] {
  color: var(--couleur-principale-encre);
}

.onglets a[aria-current="page"]::before {
  background: var(--couleur-principale);
}

/* Les sous-onglets (U4 « À venir », « Passés ») : soulignés. */
.sous-onglets {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 1rem;
  border-bottom: 1px solid var(--trait);
}

.sous-onglets a,
.sous-onglets button {
  display: grid;
  place-items: center;
  min-height: 2.75rem;
  margin-bottom: -1px;
  padding: 0 0.875rem;
  font: inherit;
  font-size: var(--t-base);
  font-weight: 600;
  color: var(--discret);
  text-decoration: none;
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  cursor: pointer;
}

.sous-onglets a[aria-current="page"] {
  color: var(--couleur-principale-encre);
  border-bottom-color: var(--couleur-principale);
}

/* Les filtres de la liste des usagers (P3) : des puces; la choisie, pleine. Ce sont de petits formulaires (POST) : le texte
   cherché ne va jamais dans une adresse (H-114). */
.sous-onglets form,
.pages form {
  display: flex;
  margin: 0;
}

.sous-onglets.puces {
  flex-wrap: wrap;
  gap: 0.375rem;
  border-bottom: 0;
}

.sous-onglets.puces button {
  margin: 0;
  border: 1px solid var(--trait);
  border-radius: 999px;
  color: var(--encre);
  font-size: var(--t-s);
}

.sous-onglets.puces button[aria-pressed="true"] {
  color: var(--blanc);
  background: var(--encre);
  border-color: var(--encre);
}

/* ---------- 11. Réserver (U3) : la grille d'une semaine. Une case libre est une case à cocher; « choisi » suit la case
   cochée. ---------- */
.choix .bouton {
  margin-top: 0.25rem;
}

.champ.personnes input {
  display: block;
}

.semaine {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.25rem 1rem;
  margin-top: 0.5rem;
}

.semaine h2 {
  margin: 0;
  font-size: var(--t-corps);
}

.semaine p {
  display: flex;
  flex-wrap: wrap;
  column-gap: 1.25rem;
  margin: 0;
}

.semaine a {
  font-size: var(--t-base);
  white-space: nowrap;
}

@media (min-width: 60rem) {
  .contenu.large .sens {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.5rem;
  }
}

.grille {
  width: 100%;
  margin: 1rem 0 0.5rem;
  border-collapse: separate;
  border-spacing: 3px;
  table-layout: fixed;
}

.grille caption {
  padding: 0 3px 0.375rem;
  text-align: left;
  font-weight: 700;
}

.grille caption small {
  display: block;
  color: var(--discret);
  font-size: var(--t-xs);
  font-weight: 500;
}

.grille thead th {
  padding: 0.125rem 0;
  color: var(--discret);
  font-size: var(--t-xs);
  font-weight: 700;
  text-align: center;
}

.grille th.groupe {
  padding: 0.5rem 3px 0.125rem;
  color: var(--discret);
  font-size: var(--t-xs);
  font-weight: 700;
  text-align: left;
}

.grille td {
  padding: 0;
}

.grille td.vide {
  padding: 0.5rem 3px;
  color: var(--discret);
}

.c {
  position: relative;
  display: grid;
  place-items: center;
  align-content: center;
  width: 100%;
  min-height: 2.875rem;
  padding: 0.25rem 1px;
  border-radius: 7px;
  font: inherit;
  font-size: var(--t-xs);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  text-align: center;
}

.c small {
  display: block;
  font-size: var(--t-xxs);
  font-weight: 600;
}

/* Une case de 66 px au téléphone : « 15 h 30 » en 14 px; plus grand dès qu'il y a la place. */
@media (min-width: 30rem) {
  .c {
    font-size: var(--t-s);
  }
}

/* Un téléphone de 320 px : une case de 55 px; « 15 h 30 » en 13 px, un peu serré, y tient sans toucher la bordure. */
@media (max-width: 22rem) {
  .grille {
    border-spacing: 2px;
  }

  .c {
    padding-inline: 0;
    font-size: 0.8125rem;
    letter-spacing: -0.03em;
  }
}

/* Le jour de la case : caché tant que les jours sont en colonnes (l'en-tête le dit). */
.jour-case {
  display: none;
}

/* Très gros texte (texte du téléphone à 150 % ou 200 %, ou zoom) : cinq colonnes ne tiennent plus, même à 320 px. Les cases
   d'un passage passent l'une sous l'autre, deux ou trois par rangée, chacune avec son jour, sans défilement de côté (H-122).
   Un téléphone de 320 px à taille normale fait 20em : il garde la grille. */
@media (max-width: 19em) {
  .grille,
  .grille tbody,
  .grille tr,
  .grille td,
  .grille th.groupe {
    display: block;
  }

  .grille thead {
    display: none;
  }

  .grille caption {
    display: block;
  }

  .grille tbody tr {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 4px;
  }

  .grille td {
    flex: 1 1 6.5em;
  }

  .grille th.groupe {
    flex-basis: 100%;
  }

  .c {
    padding: 0.375rem 0.25rem;
    font-size: var(--t-s);
    letter-spacing: normal;
    white-space: normal;
  }

  .jour-case {
    display: block;
    font-weight: 600;
  }
}

.c.libre {
  background: var(--blanc);
  border: 1.5px solid var(--couleur-principale);
  color: var(--couleur-principale-encre);
  cursor: pointer;
}

.c.libre:has(input:checked),
.c.choisi {
  background: var(--couleur-principale-pale);
  border: 2px solid var(--couleur-principale);
  color: var(--couleur-principale-encre);
}

.c.libre:has(input:checked)::before {
  content: "✓";
  position: absolute;
  top: 2px;
  left: 4px;
  font-size: var(--t-xxs);
  line-height: 1;
}

.c.reserve {
  background: var(--couleur-principale);
  border: 1.5px solid var(--couleur-principale);
  color: var(--blanc);
}

.c.complet {
  background: repeating-linear-gradient(135deg, var(--inactif-fond) 0 5px, var(--inactif-trait) 5px 10px);
  border: 1px solid var(--inactif-trait);
  color: var(--encre);
  cursor: pointer;
}

.c.ferme {
  background: var(--inactif-fond);
  border: 1px solid var(--inactif-fond);
  color: var(--inactif-encre);
  font-weight: 600;
  cursor: pointer;
}

.legende {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.875rem;
  margin: 0.25rem 0 0.75rem;
  color: var(--discret);
  font-size: var(--t-xs);
}

.legende > span {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.legende .c {
  width: 1rem;
  height: 1rem;
  min-height: 0;
  padding: 0;
  border-radius: 4px;
  cursor: default;
}

/* ---------- 12. Écrans d'Inscript (P1 à P5, A1, A2) : à l'ordinateur d'abord, lisibles au téléphone ---------- */
.entete-journee {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: flex-end;
  gap: 0.75rem 1.5rem;
  margin-bottom: 0.5rem;
}

.entete-journee h1 {
  margin: 0;
}

.entete-journee .aide {
  margin-bottom: 0;
}

.choix-date {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0;
}

.choix-date label {
  font-size: var(--t-base);
  font-weight: 600;
}

.choix-date input[type="date"],
.choix-date select {
  width: auto;
  font-size: var(--t-base);
}

.jours {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
  margin-bottom: 0.75rem;
}

/* Les nombres de la journée (P1) : le chiffre d'abord, gros et gras; sa phrase dessous. */
.kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
  gap: 0.625rem;
  margin: 0.75rem 0 1.25rem;
}

.kpi {
  display: grid;
  gap: 0.125rem;
  margin: 0;
  padding: 0.625rem 0.875rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-bouton);
  background: var(--blanc);
}

.kpi b {
  font-size: var(--t-xl);
  font-weight: 700;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
}

.kpi span {
  color: var(--discret);
  font-size: var(--t-s);
  line-height: 1.3;
}

.carte.alertes {
  margin-bottom: 1.25rem;
}

/* Un tableau trop large défile de côté, seul : la page, jamais (le titre caché d'une colonne, .cache, y reste aussi). */
.defile {
  position: relative;
  overflow-x: auto;
  margin-bottom: 1.25rem;
}

.tableau {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-size: var(--t-base);
}

.tableau th {
  padding: 0.5rem;
  border-bottom: 1px solid var(--trait);
  background: var(--surface);
  color: var(--discret);
  font-size: var(--t-xs);
  font-weight: 600;
  text-align: left;
  vertical-align: bottom;
}

/* Une ligne par rangée; l'état, seul, passe à la ligne (« Ne roule pas : aucune réservation à la fermeture »). */
.tableau td {
  padding: 0.625rem 0.5rem;
  border-bottom: 1px solid var(--trait);
  vertical-align: middle;
  white-space: nowrap;
}

.tableau td.etat,
.tableau td.etat .pastille {
  white-space: normal;
}

/* Une pastille sur deux lignes garde des coins doux, pas une bulle; sa colonne garde de quoi la lire. */
.tableau td.etat {
  min-width: 11rem;
}

.tableau td.etat .pastille {
  border-radius: var(--rayon-champ);
}

.tableau tr.choisi td {
  background: var(--couleur-principale-pale);
}

.tableau .nombre {
  text-align: right;
}

.tableau .nombre-g strong {
  font-size: var(--t-corps);
}

.tableau.etroit {
  min-width: 0;
}

.tableau.etroit td:first-child {
  white-space: normal;
}

/* Les réglages du service (A1) : le nom et la phrase d'aide sur plusieurs lignes, la valeur et son unité côte à côte. */
.tableau.reglages td {
  white-space: normal;
  vertical-align: top;
}

.tableau.reglages td .aide {
  margin: 0.125rem 0 0;
}

.tableau.reglages td.valeur {
  white-space: nowrap;
}

.tableau.reglages input[type="time"] {
  width: auto;
}

.tableau.reglages select {
  width: auto;
  min-width: 8rem;
}

.unite {
  margin-left: 0.5rem;
}

/* Deux colonnes à l'ordinateur : un départ et son affectation; la fiche et ses à-côtés; la liste et l'invitation. */
.colonnes {
  display: grid;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

@media (min-width: 48rem) {
  .colonnes {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }

  .colonnes.personnel {
    grid-template-columns: minmax(0, 1fr) minmax(16rem, 20rem);
  }
}

.colonnes h2:first-child,
.colonnes .carte h2 {
  margin-top: 0;
}

.colonnes .carte h2 + h2,
.colonnes .carte form + h2 {
  margin-top: 1rem;
}

.colonnes.personnel form.carte {
  gap: 1rem;
  padding: 1rem;
}

.colonnes.personnel form.carte > .champ {
  margin: 0;
}

.colonnes.personnel form.carte h2 {
  margin-bottom: 0.25rem;
}

.colonnes.personnel .tableau .muet {
  font-size: var(--t-xs);
}

/* La liste tient à côté de l'invitation : ses cellules passent à la ligne au lieu de défiler. */
.colonnes.personnel .tableau {
  min-width: 0;
}

.colonnes.personnel .tableau td {
  white-space: normal;
  vertical-align: top;
}

/* Un départ arrêt par arrêt (P5, l'impression du chauffeur). */
.arrets {
  margin: 0;
  padding: 0;
  list-style: none;
}

.arrets li {
  display: grid;
  grid-template-columns: 4.5rem minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--trait);
}

.arrets li p {
  margin: 0;
}

.arrets .heure {
  font-weight: 700;
}

.arrets li.calme {
  color: var(--inactif-encre);
}

/* La recherche des usagers (P3). */
.recherche {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.recherche .champ {
  flex: 1 1 16rem;
  margin: 0;
}

/* La recherche du journal (A3) : cinq champs, sur une ligne à l'ordinateur. */
.recherche.journal .champ {
  flex-basis: 10rem;
}

.pages {
  align-items: center;
}

/* ---------- 13. Chauffeur (C1, C2) : au cellulaire, gros boutons, lisibles d'un coup d'œil (RA-143) ---------- */
.entete-chauffeur h1 {
  margin-bottom: 0;
}

.entete-chauffeur .aide {
  margin-top: 0.125rem;
}

.deplist {
  display: grid;
  gap: 0.5rem;
  margin: 0 0 0.75rem;
  padding: 0;
  list-style: none;
}

.dep {
  display: grid;
  grid-template-columns: 5rem minmax(0, 1fr) auto;
  gap: 0.625rem;
  align-items: center;
  min-height: 3.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-bouton);
  color: var(--encre);
  font-weight: 500;
  text-decoration: none;
}

a.dep:hover {
  border-color: var(--champ);
}

.dep b {
  font-size: var(--t-m);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dep small {
  display: block;
  color: var(--discret);
  font-size: var(--t-s);
}

.dep.off {
  background: var(--inactif-fond);
  border-color: var(--inactif-fond);
  color: var(--inactif-encre);
}

.dep.off small {
  color: var(--inactif-encre);
}

.dep.vide {
  display: block;
  min-height: 0;
  margin: 0 0 0.75rem;
  color: var(--discret);
}

/* Le manifeste (C2) : les arrêts dans l'ordre, l'arrêt actuel en vert pâle, les arrêts passés et sautés grisés. */
.entete-manifeste {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin: -0.5rem 0 0.75rem;
}

.entete-manifeste > a {
  flex: none;
  white-space: nowrap;
  text-decoration: none;
}

.entete-manifeste > div {
  text-align: right;
}

.entete-manifeste h1 {
  margin: 0;
  font-size: var(--t-m);
}

.entete-manifeste p {
  margin: 0;
}

.manifeste {
  margin: 0 -1rem;
  padding: 0;
  list-style: none;
  border-top: 1px solid var(--trait);
}

.manifeste > li {
  display: grid;
  grid-template-columns: 4.25rem minmax(0, 1fr);
  gap: 0.625rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--trait);
}

.manifeste .heure {
  padding-top: 0.0625rem;
  font-size: var(--t-corps);
  font-weight: 700;
}

.manifeste .corps {
  display: grid;
  gap: 0.375rem;
  min-width: 0;
}

.manifeste .corps p {
  margin: 0;
}

.nom-arret {
  font-weight: 700;
}

.manifeste > li.actuel {
  background: var(--couleur-principale-pale);
}

.manifeste > li.fait .heure,
.manifeste > li.fait .nom-arret {
  color: var(--discret);
}

.manifeste > li.saute {
  color: var(--inactif-encre);
}

.manifeste > li.saute .nom-arret {
  font-weight: 600;
}

/* Sur l'arrêt actuel, déjà vert pâle, les pastilles vertes gardent un fond blanc pour se voir. */
.manifeste > li.actuel .pastille.ok {
  background: var(--blanc);
}

/* « Montées », « Descentes » : petit, gras, discret, sans majuscules. */
.etiquette-s {
  color: var(--discret);
  font-size: var(--t-xs);
  font-weight: 700;
}

.pax {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0.375rem 0.625rem;
}

.pax .qui {
  font-size: var(--t-m);
  font-weight: 600;
}

.pax form {
  margin: 0;
}

.pax .alerte {
  flex-basis: 100%;
  margin: 0;
}

.places {
  color: var(--discret);
  font-size: var(--t-s);
}

/* « Montée sans réservation » et « Terminer » au bas du manifeste, sur la surface (maquette C2). */
.barre-actions {
  display: grid;
  gap: 0.5rem;
  margin: 0 -1rem 0.75rem;
  padding: 0.75rem 1rem 1rem;
  border-bottom: 1px solid var(--trait);
  background: var(--surface);
}

.barre-actions .bouton {
  margin: 0;
}

/* Manifestes à imprimer (D-124) : seulement les manifestes, sans l'en-tête, le pied ni les boutons. */
.feuille {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

.feuille h2 {
  margin-top: 1rem;
  font-size: var(--t-corps);
  text-wrap: pretty;
}

/* ---------- Démonstration (D-134) : le panneau de l'heure simulée ---------- */
.heure-demo {
  font-size: var(--t-m);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.gestes-demo {
  display: grid;
  gap: 0.5rem;
  max-width: 32rem;
  margin-bottom: 1.5rem;
}

.gestes-demo .bouton {
  margin: 0;
}

/* ---------- 14. Le rapport du mois (R1) : quatre grands chiffres, deux graphiques à barres côte à côte à l'ordinateur, les
   détails repliés, des définitions courtes; une colonne au téléphone. Une seule couleur d'accent, celle de l'organisation
   (le bord des cartes, les barres); le texte reste foncé ou discret. ---------- */
.chiffres-cles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(12rem, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0 1.75rem;
}

.chiffre-cle {
  margin: 0;
  padding: 0.875rem 1rem 1rem;
  border: 1px solid var(--trait);
  border-radius: var(--rayon-carte);
  background: var(--blanc);
}

.chiffre-cle b {
  display: block;
  font-size: var(--t-xxl);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.chiffre-cle span {
  display: block;
  margin-top: 0.375rem;
  color: var(--discret);
  font-size: var(--t-base);
}

/* « moins de 3 » ou « — » : plus petit et discret, à la même hauteur que les autres cartes. */
.chiffre-cle.masque b {
  font-size: var(--t-l);
  font-weight: 600;
  line-height: 1.85;
  color: var(--discret);
}

.graphiques {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.75rem;
}

@media (min-width: 60rem) {
  .graphiques {
    grid-template-columns: minmax(0, 3fr) minmax(0, 2fr);
    align-items: start;
  }
}

/* Une carte (.carte), plus aérée. */
.graphique {
  padding: 1.125rem 1.25rem 1.25rem;
}

.graphique h2,
.definitions h2 {
  margin: 0;
  font-size: var(--t-m);
}

.graphique .aide {
  margin: 0 0 0.75rem;
}

/* Au téléphone, le libellé au-dessus de sa barre; à partir de 40rem et à l'impression, à sa gauche. La valeur suit le bout
   de la barre : la piste laisse 3,5rem à droite pour celle de la plus grande. Une barre est un rectangle SVG dont la largeur
   est l'attribut width (en pour cent de la piste) : la politique de sécurité du contenu interdit le style en ligne. Un
   chiffre masqué n'a pas de barre, seulement son libellé, en discret. */
.barres {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  margin: 0;
  font-size: var(--t-base);
}

.barres dt {
  margin-top: 0.625rem;
}

.barres dd {
  margin: 0;
  min-width: 0;
}

.barres .piste {
  display: flex;
  align-items: center;
  width: calc(100% - 3.5rem);
  min-height: 1.625rem;
}

.barres .barre {
  flex: none;
  height: 0.875rem;
}

.barres rect {
  fill: var(--couleur-barre);
}

.barres .valeur {
  flex: none;
  margin-left: 0.5rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.barres dd.masque {
  color: var(--discret);
  font-style: italic;
}

@media print, (min-width: 40rem) {
  .barres {
    grid-template-columns: fit-content(18rem) minmax(0, 1fr);
    align-items: center;
    gap: 0.375rem 1rem;
  }

  .barres dt {
    margin: 0;
  }
}

.details-rapport {
  margin: 0 0 1.75rem;
  border-top: 1px solid var(--trait);
  border-bottom: 1px solid var(--trait);
}

.details-rapport summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  min-height: 2.75rem;
  padding: 0.875rem 0;
  list-style: none;
  cursor: pointer;
}

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

/* Le triangle du navigateur est retiré : une flèche le remplace, tournée quand les détails sont ouverts. Les lecteurs
   d'écran ne la lisent pas (texte de remplacement vide; la première ligne, pour un navigateur qui ne le connaît pas). */
.details-rapport summary::before {
  content: "›";
  content: "›" / "";
  display: inline-block;
  width: 1rem;
  color: var(--couleur-principale);
  font-size: var(--t-l);
  line-height: 1;
  transition: transform 0.15s;
}

.details-rapport[open] summary::before {
  transform: rotate(90deg);
}

.details-rapport summary h2 {
  margin: 0;
  font-size: var(--t-m);
}

.details-rapport summary .aide {
  margin: 0;
}

.details-contenu {
  display: grid;
  gap: 1.5rem 3rem;
  padding: 0.25rem 0 1.5rem;
}

.details-contenu h3 {
  margin: 0 0 0.5rem;
}

.details-contenu .defile {
  max-width: 40rem;
  margin-bottom: 0;
}

.definitions-liste {
  display: grid;
  gap: 0.5rem 3rem;
  margin-top: 0.5rem;
}

.definitions-liste p {
  margin: 0;
}

@media print, (min-width: 48rem) {
  .details-contenu,
  .definitions-liste {
    grid-template-columns: 1fr 1fr;
  }

  .details-contenu .pleine {
    grid-column: 1 / -1;
  }
}

.imprime-seulement {
  display: none;
}

.actions-rapport {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 1.25rem 0 0.5rem;
}

.actions-rapport form {
  margin: 0;
}

/* ---------- Téléphone : les écrans d'Inscript gardent leur largeur de colonne; les titres un peu plus petits ---------- */
@media (max-width: 30rem) {
  h1 {
    font-size: 1.375rem;
  }

  .grand {
    font-size: 1.625rem;
  }

  .kpi b {
    font-size: var(--t-l);
  }

  .chiffre-cle b {
    font-size: 2.25rem;
  }

  .ecran-personnel .contenu.large {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .alerte.mauvais {
    flex-wrap: wrap;
  }
}

/* ---------- 15. Impression : le rapport (R1) et les manifestes du chauffeur (D-124) ---------- */
@media print {
  .entete,
  .pied,
  .menu,
  .onglets,
  .bandeau-demo,
  .aller-contenu,
  .pas-imprime {
    display: none !important;
  }

  body {
    display: block;
    font-size: 11pt;
  }

  .ecran-personnel {
    display: block;
  }

  .contenu,
  .contenu.large,
  .ecran-personnel .contenu.large {
    max-width: none;
    margin: 0;
    padding: 0;
  }

  /* Le rapport du mois (R1) sur une ou deux pages : le nom du service sous le titre, les cartes et les graphiques côte à
     côte, sans fond, un peu plus serrés; les détails toujours (js/site.js les ouvre), d'un bloc, sur la page suivante
     s'ils ne tiennent pas. Les barres SVG s'impriment sans l'option « graphiques d'arrière-plan ». */
  .imprime-seulement {
    display: block;
  }

  .chiffres-cles {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin: 1rem 0;
  }

  .chiffre-cle {
    padding: 0.6rem 0.9rem;
    background: none;
    border: 1px solid var(--trait-impression);
    border-left: 0.3rem solid var(--couleur-principale);
    break-inside: avoid;
  }

  .chiffre-cle b {
    font-size: 2rem;
  }

  .chiffre-cle.masque b {
    font-size: 1.25rem;
    line-height: 1.75;
  }

  .graphiques {
    grid-template-columns: 3fr 2fr;
    gap: 0.75rem;
    margin-bottom: 1rem;
  }

  .graphique {
    padding: 0.75rem 1rem;
    break-inside: avoid;
  }

  .graphique .aide {
    margin-bottom: 0.5rem;
  }

  .barres {
    grid-template-columns: fit-content(14rem) minmax(0, 1fr);
    gap: 0.1rem 0.75rem;
    font-size: 0.9375rem;
    line-height: 1.3;
  }

  .graphique h2,
  .details-rapport summary h2,
  .definitions h2 {
    font-size: 1.125rem;
  }

  .definitions-liste {
    gap: 0.35rem 2rem;
  }

  .definitions-liste p {
    font-size: 0.875rem;
  }

  .details-rapport {
    border: 0;
    break-inside: avoid;
  }

  .details-rapport summary {
    min-height: 0;
    padding: 0 0 0.5rem;
  }

  .details-contenu {
    gap: 0.75rem 2rem;
    padding-bottom: 0.75rem;
  }

  .details-contenu .kv,
  .details-contenu .tableau {
    font-size: 0.875rem;
  }

  .details-contenu .tableau th,
  .details-contenu .tableau td {
    padding: 0.15rem 0.5rem;
    background: none;
  }

  .details-rapport summary::before {
    content: none;
  }

  .details-rapport summary .aide {
    display: none;
  }

  /* Les manifestes du chauffeur : chaque départ d'un bloc, les heures et les noms lisibles en noir. */
  .feuille h2 {
    margin-top: 0;
  }

  .arrets li {
    padding: 0.3rem 0;
    break-inside: avoid;
  }
}

/* ---------- 16. Mouvement réduit : aucune transition ---------- */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition: none !important;
    animation: none !important;
    scroll-behavior: auto !important;
  }
}
