/**
 * Flotexa — système de design (DESIGN_SYSTEM.md, source stricte).
 *
 * Aucune propriété directionnelle physique ici (jamais `margin-left`,
 * `text-align: right`, `left:`) — uniquement des propriétés LOGIQUES
 * (`margin-inline-start`, `text-align: end`, `inset-inline-start`), pour
 * que l'arabe/RTL fonctionne sans seconde feuille (DESIGN_SYSTEM.md §0.2).
 *
 * Tokens et règles repris À L'IDENTIQUE de DESIGN_SYSTEM.md (§7, règle 1 :
 * « copier le bloc :root tel quel ») — aucune valeur inventée hors de ce
 * catalogue.
 */

:root {
  /* Encres */
  --encre-900: #0b1120;
  --encre-800: #131c2e;
  --encre-700: #1e293b;
  --encre-600: #334155;
  --encre-500: #475569;
  --encre-400: #64748b;
  --encre-300: #94a3b8;

  /* Surfaces */
  --papier: #ffffff;
  --toile: #f5f7f9;
  --voile: #fafbfc;
  --trait: #e3e8ef;
  --trait-fort: #cfd6e0;

  /* Accent */
  --vert-700: #0a6353;
  --vert-600: #0e7c66;
  --vert-500: #14957c;
  --vert-100: #d6ede7;
  --vert-050: #eff8f5;

  /* Sémantique */
  --rouge-700: #912018;
  --rouge-600: #b42318;
  --rouge-100: #fee4e2;
  --rouge-050: #fef3f2;
  --ambre-700: #93370d;
  --ambre-600: #b54708;
  --ambre-100: #fef0c7;
  --ambre-050: #fffaeb;
  --bleu-600: #175cd3;
  --bleu-100: #d1e9ff;
  --bleu-050: #eff8ff;

  /* Rythme */
  --r1: 4px;  --r2: 8px;  --r3: 12px; --r4: 16px;
  --r5: 24px; --r6: 32px; --r7: 48px;

  --arrondi: 8px;
  --arrondi-sm: 6px;
  --arrondi-lg: 12px;

  --ombre-1: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --ombre-2: 0 4px 8px -2px rgba(16, 24, 40, .08), 0 2px 4px -2px rgba(16, 24, 40, .04);
  --ombre-3: 0 12px 16px -4px rgba(16, 24, 40, .1), 0 4px 6px -2px rgba(16, 24, 40, .05);
  --ombre-4: 0 24px 48px -12px rgba(16, 24, 40, .22);

  --barre-laterale: 244px;
  --barre-haute: 56px;

  --police: 'Segoe UI', -apple-system, BlinkMacSystemFont, 'Inter', Roboto, Helvetica, Arial, sans-serif;
  --police-chiffres: 'Segoe UI', -apple-system, 'SF Mono', Consolas, monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/*
 * `[hidden]` doit gagner sur TOUTE classe qui pose `display` (`.coquille
 * {display:grid}`, `.chargement-initial{display:flex}`…) : même
 * spécificité qu'un sélecteur de classe, donc c'est l'ORDRE dans la
 * feuille qui déciderait sans cette règle — piège trouvé en vérifiant
 * l'écran de connexion→tableau de bord dans un vrai navigateur (CLAUDE.md,
 * « tester dans un navigateur avant de rapporter terminé ») : la coquille
 * restait invisible malgré `hidden` correctement retiré en JS.
 */
[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  font-family: var(--police);
  font-size: 14px;
  line-height: 1.5;
  color: var(--encre-800);
  background: var(--toile);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.chiffre, td.montant, .stat-valeur, .mono {
  font-variant-numeric: tabular-nums;
  font-feature-settings: 'tnum' 1;
}

::selection { background: var(--vert-100); }

:focus-visible {
  outline: 2px solid var(--vert-500);
  outline-offset: 2px;
  border-radius: var(--r1);
}

/* ── Écran d'amorçage ─────────────────────────────────────── */

.chargement-initial {
  display: flex; align-items: center; justify-content: center;
  height: 100vh; background: var(--encre-900);
}
.marque-chargement {
  display: flex; align-items: center; gap: var(--r3);
  color: #fff; font-size: 20px; font-weight: 600; letter-spacing: .02em;
  animation: pulsation 1.6s ease-in-out infinite;
}
@keyframes pulsation { 0%, 100% { opacity: .5 } 50% { opacity: 1 } }

.sceau {
  display: grid; place-items: center;
  width: 38px; height: 38px; border-radius: 9px;
  background: var(--vert-600); color: #fff;
  font-weight: 700; font-size: 21px;
}

/* ═══════════════════════════════════════════════════════════
   Connexion
   ═══════════════════════════════════════════════════════════ */

.page-connexion {
  min-height: 100vh; display: grid; grid-template-columns: 1fr;
  background: var(--encre-900);
}
@media (min-width: 900px) {
  .page-connexion { grid-template-columns: 1fr 1fr; }
}

.connexion-recit {
  display: none; flex-direction: column; justify-content: space-between;
  padding: var(--r7); color: #fff;
  background:
    radial-gradient(120% 90% at 90% 10%, rgba(20, 149, 124, .28), transparent 60%),
    var(--encre-900);
}
@media (min-width: 900px) { .connexion-recit { display: flex; } }

.connexion-recit h1 {
  font-size: 34px; line-height: 1.2; font-weight: 600; letter-spacing: -.02em;
  max-width: 15ch; margin-top: var(--r6);
}
.connexion-recit p { color: var(--encre-300); max-width: 42ch; margin-top: var(--r4); }
.connexion-recit ul { list-style: none; margin-top: var(--r6); display: grid; gap: var(--r3); }
.connexion-recit li { color: #cbd5e1; font-size: 13.5px; padding-inline-start: var(--r5); position: relative; }
.connexion-recit li::before {
  content: ''; position: absolute; inset-inline-start: 0; top: 8px;
  width: 12px; height: 2px; background: var(--vert-500);
}

.connexion-formulaire {
  display: grid; place-items: center; padding: var(--r5);
  background: var(--papier);
}
.connexion-boite { width: 100%; max-width: 372px; }
.connexion-boite h2 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }
.connexion-boite .sous-titre { color: var(--encre-400); margin: var(--r2) 0 var(--r5); }
/* Liens secondaires sous les formulaires (mot de passe oublié, inscription). */
.liens-connexion { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--r2); margin-block-start: var(--r4); font-size: 13px; }
.liens-connexion a { color: var(--vert-600); text-decoration: none; }
.liens-connexion a:hover { text-decoration: underline; }

/* ═══════════════════════════════════════════════════════════
   Coquille : barre latérale, barre haute, contenu
   ═══════════════════════════════════════════════════════════ */

.coquille {
  display: grid;
  /* `minmax(0, 1fr)`, jamais `1fr` seul — une piste `1fr` sans `minmax`
     respecte le min-content de son contenu (une grille CSS ne réduit pas
     sous cette taille par défaut) : un tableau large dans `<main>` élargit
     alors TOUTE la coquille et fait défiler la page entière plutôt que de
     défiler dans le cadre du tableau (`.tableau-cadre`, prévu pour ça) —
     débordement horizontal constaté sur mobile (Rentabilité/Analytique). */
  grid-template-columns: var(--barre-laterale) minmax(0, 1fr);
  grid-template-rows: var(--barre-haute) 1fr;
  grid-template-areas: 'flanc haut' 'flanc corps';
  height: 100vh;
}

/* ── Barre latérale ── */

.flanc {
  grid-area: flanc;
  background: var(--encre-900);
  display: flex; flex-direction: column;
  overflow: hidden;
}

.flanc-marque {
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--r4); height: var(--barre-haute);
  color: #fff; font-weight: 600; letter-spacing: .01em;
  border-bottom: 1px solid rgba(255, 255, 255, .07);
}
.flanc-marque .sceau { width: 28px; height: 28px; font-size: 16px; border-radius: 7px; }
.flanc-marque small {
  display: block; font-size: 10.5px; font-weight: 400; letter-spacing: .09em;
  color: var(--encre-400); text-transform: uppercase;
}

.flanc-menu { flex: 1; overflow-y: auto; padding: var(--r3) var(--r2); }
.flanc-groupe { margin-bottom: var(--r4); }
.flanc-groupe-titre {
  font-size: 10.5px; font-weight: 600; letter-spacing: .1em; text-transform: uppercase;
  color: #64748b; padding: 0 var(--r3) 6px;
}

.flanc-lien {
  display: flex; align-items: center; gap: 10px;
  padding: 8px var(--r3); border-radius: var(--arrondi-sm);
  color: #cbd5e1; font-size: 13.5px; text-decoration: none;
  cursor: pointer; border: none; background: none; width: 100%; text-align: start;
  transition: background .12s, color .12s;
}
.flanc-lien:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.flanc-lien.actif { background: var(--vert-600); color: #fff; font-weight: 500; }
.flanc-lien .icone { width: 18px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; opacity: .9; font-size: 15px; }
.flanc-lien .icone svg { display: block; }
.flanc-lien .pastille {
  margin-inline-start: auto; background: var(--rouge-600); color: #fff;
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 9px;
}

.flanc-pied {
  padding: var(--r3); border-top: 1px solid rgba(255, 255, 255, .07);
  font-size: 11.5px; color: var(--encre-400);
}

/* ── Barre haute ── */

.haut {
  grid-area: haut;
  background: var(--papier); border-bottom: 1px solid var(--trait);
  display: flex; align-items: center; gap: var(--r4); padding: 0 var(--r5);
}

.fil { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--encre-400); }
.fil strong { color: var(--encre-800); font-weight: 600; font-size: 15px; letter-spacing: -.01em; }

.compte-utilisateur { margin-inline-start: auto; display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--vert-100); color: var(--vert-700);
  display: grid; place-items: center; font-weight: 600; font-size: 12.5px;
}
.identite-bouton {
  display: flex; align-items: center; gap: 10px; background: none; border: none;
  padding: 4px 6px; margin: -4px -6px; border-radius: var(--arrondi-sm);
  cursor: pointer; text-align: start; font: inherit; color: inherit;
  transition: background .12s;
}
.identite-bouton:hover { background: var(--voile); }
.compte-utilisateur .identite { line-height: 1.25; }
.compte-utilisateur .identite strong { display: block; font-size: 13px; font-weight: 600; }
.compte-utilisateur .identite span { font-size: 11.5px; color: var(--encre-400); }
.compte-utilisateur .deconnexion {
  background: none; border: none; cursor: pointer; color: var(--encre-400);
  font-size: 12px; text-decoration: underline; padding: 0;
}
.compte-utilisateur .deconnexion:hover { color: var(--rouge-600); }

.cloche-conteneur { position: relative; }
.cloche-bouton {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; background: none; border: none; border-radius: 50%;
  color: var(--encre-700); cursor: pointer; transition: background .12s;
}
.cloche-bouton:hover { background: var(--voile); }
.cloche-bouton .pastille {
  position: absolute; top: 2px; inset-inline-end: 2px;
  background: var(--rouge-600); color: #fff; font-size: 10px; font-weight: 600;
  line-height: 1; padding: 2px 4px; border-radius: 9px; min-width: 14px; text-align: center;
  border: 2px solid var(--papier);
}
.cloche-panneau {
  position: absolute; inset-inline-end: 0; top: calc(100% + 8px); z-index: 40;
  width: 360px; max-height: 420px; overflow-y: auto;
  background: var(--papier); border: 1px solid var(--trait); border-radius: var(--arrondi);
  box-shadow: var(--ombre-2); padding: var(--r2);
}
.cloche-entete { display: flex; align-items: center; justify-content: space-between; gap: var(--r2); padding: var(--r1) var(--r2) var(--r2); font-size: 12px; font-weight: 600; color: var(--encre-400); text-transform: uppercase; letter-spacing: .04em; }
.cloche-son { background: none; border: 1px solid var(--trait); border-radius: var(--arrondi-sm); padding: 2px var(--r2); font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; color: var(--encre-400); cursor: pointer; }
.cloche-son[aria-pressed="true"] { color: var(--vert-700); border-color: var(--vert-600); }
.cloche-son:hover { background: var(--voile); }
.cloche-vide { padding: var(--r4); text-align: center; color: var(--encre-400); font-size: 13px; }
.cloche-liste { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.cloche-item {
  display: flex; align-items: flex-start; gap: 8px; padding: var(--r2); border-radius: var(--arrondi-sm);
}
.cloche-item:hover { background: var(--voile); }
.cloche-corps { flex: 1; min-width: 0; }
.cloche-corps strong { display: block; font-size: 13px; }
.cloche-corps p { margin: 2px 0 0; font-size: 12.5px; color: var(--encre-400); overflow-wrap: break-word; }
.cloche-date { display: block; margin-top: 4px; font-size: 11px; color: var(--encre-400); }
.cloche-marquer {
  flex-shrink: 0; width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 1px solid var(--trait); border-radius: 50%; color: var(--encre-400); cursor: pointer;
  font-size: 12px; line-height: 1;
}
.cloche-marquer:hover { color: var(--vert-700); border-color: var(--vert-600); }

@media (max-width: 480px) {
  .cloche-panneau { position: fixed; inset-inline: var(--r3); top: 56px; width: auto; }
}

/* ── Corps ── */

.corps { grid-area: corps; overflow-y: auto; padding: var(--r5); }
.corps > .largeur { max-width: 1420px; margin: 0 auto; }

.entete-page {
  display: flex; align-items: flex-start; gap: var(--r4);
  margin-bottom: var(--r5); flex-wrap: wrap;
}
.entete-page h1 { font-size: 22px; font-weight: 600; letter-spacing: -.02em; }
.entete-page p { color: var(--encre-400); font-size: 13.5px; margin-top: 3px; max-width: 78ch; }
.entete-page .actions { margin-inline-start: auto; display: flex; gap: var(--r2); flex-wrap: wrap; }

/* ═══════════════════════════════════════════════════════════
   Composants
   ═══════════════════════════════════════════════════════════ */

.carte {
  background: var(--papier); border: 1px solid var(--trait);
  border-radius: var(--arrondi); box-shadow: var(--ombre-1);
  margin-bottom: var(--r4); overflow: hidden;
}
.carte-entete {
  display: flex; align-items: center; gap: var(--r3);
  padding: var(--r3) var(--r4); border-bottom: 1px solid var(--trait);
}
.carte-entete h2 { font-size: 14.5px; font-weight: 600; letter-spacing: -.005em; }
.carte-entete .note { font-size: 12.5px; color: var(--encre-400); }
.carte-entete .actions { margin-inline-start: auto; display: flex; gap: var(--r2); }
/* Téléphone : les actions de l'en-tête (onglets de rapport, filtres) passent sur leur propre ligne, défilables, au lieu d'écraser le titre. */
@media (max-width: 600px) {
  .carte-entete { flex-wrap: wrap; }
  .carte-entete .actions { margin-inline-start: 0; inline-size: 100%; overflow-x: auto; padding-block-end: 2px; }
  .carte-entete .actions > * { flex: none; }
}
.carte-corps { padding: var(--r4); }
.carte-corps.serre { padding: 0; }

.grille { display: grid; gap: var(--r4); }
.grille.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.grille.g3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grille.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ── Tuiles de chiffres ── */

.stat {
  background: var(--papier); border: 1px solid var(--trait);
  border-radius: var(--arrondi); padding: var(--r4); box-shadow: var(--ombre-1);
}
.stat-titre {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--encre-400);
}
.stat-valeur {
  font-size: 27px; font-weight: 600; letter-spacing: -.025em;
  margin-top: 6px; line-height: 1.1;
}
.stat-note { font-size: 12.5px; color: var(--encre-400); margin-top: 4px; }
.stat-aide { font-size: 11.5px; line-height: 1.4; color: var(--encre-400); margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--trait); }
.stat.alerte .stat-valeur { color: var(--rouge-600); }
.stat.attention .stat-valeur { color: var(--ambre-600); }
.stat.bien .stat-valeur { color: var(--vert-600); }

/* ── Boutons ── */

.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border-radius: var(--arrondi-sm); border: 1px solid transparent;
  padding: 7px 14px; font: inherit; font-size: 13.5px; font-weight: 500;
  cursor: pointer; white-space: nowrap; transition: background .12s, border-color .12s, box-shadow .12s;
  background: var(--vert-600); color: #fff; box-shadow: var(--ombre-1);
}
.bouton:hover { background: var(--vert-700); }
.bouton:disabled { opacity: .45; cursor: not-allowed; }
.bouton.discret { background: var(--papier); color: var(--encre-700); border-color: var(--trait-fort); box-shadow: none; }
.bouton.discret:hover { background: var(--voile); border-color: var(--encre-300); }
.bouton.fantome { background: transparent; color: var(--encre-500); box-shadow: none; }
.bouton.fantome:hover { background: var(--voile); color: var(--encre-800); }
.bouton.danger { background: var(--rouge-600); }
.bouton.danger:hover { background: var(--rouge-700); }
.bouton.petit { padding: 4px 10px; font-size: 12.5px; }
.bouton.large { padding: 10px 18px; font-size: 14.5px; width: 100%; }

.groupe-boutons { display: flex; gap: var(--r2); flex-wrap: wrap; }

/* ── Champs ── */

.champ { margin-bottom: var(--r3); }
.champ > label {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--encre-600); margin-bottom: 5px;
}
.champ .aide { font-size: 12px; color: var(--encre-400); margin-top: 4px; }
.champ.erreur input, .champ.erreur select { border-color: var(--rouge-600); }
/* Refus d'une action (formulaire, modale) : un bandeau rouge qui se voit, pas une ligne de texte perdue.
   Dans un .champ, l'erreur reste la petite ligne sous le champ (règle plus spécifique ci-dessous). */
.message-erreur {
  display: block; margin-block: var(--r3); padding: var(--r3) var(--r4);
  background: var(--rouge-050); border: 1px solid var(--rouge-100); border-inline-start: 4px solid var(--rouge-600);
  border-radius: var(--arrondi); color: var(--rouge-700);
  font-size: 13.5px; font-weight: 500; line-height: 1.5;
}
.message-erreur[hidden] { display: none; }
/* Le pied collant des modales recouvre le bas de la zone : sans cette marge, le bandeau reste caché dessous. */
.message-erreur { scroll-margin-block: var(--r5) 96px; }
.champ .message-erreur {
  padding: 0; margin-block: 4px 0; background: none; border: 0; border-radius: 0;
  font-size: 12px; font-weight: 400; color: var(--rouge-600);
}

input, select, textarea {
  width: 100%; padding: 8px 11px;
  border: 1px solid var(--trait-fort); border-radius: var(--arrondi-sm);
  font: inherit; font-size: 13.5px; color: var(--encre-800); background: var(--papier);
  transition: border-color .12s, box-shadow .12s;
}
input:hover, select:hover, textarea:hover { border-color: var(--encre-300); }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--vert-500);
  box-shadow: 0 0 0 3px var(--vert-050);
}
input[readonly] { background: var(--voile); color: var(--encre-500); }
textarea { min-height: 78px; resize: vertical; }

.rangee { display: grid; gap: var(--r3); grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ── Formulaires : UNE mise en page, quelle que soit la structure du libellé ──
   Deux structures coexistent dans les écrans — `<div class="champ"><label>` et
   `<label class="champ"><span>` : la seconde n'avait aucun style de libellé
   (texte de corps, sans graisse ni couleur). Les deux se présentent désormais
   à l'identique. */

label.champ { display: block; }
label.champ > span:first-child, .champ > .libelle {
  display: block; font-size: 12.5px; font-weight: 500;
  color: var(--encre-600); margin-bottom: 5px;
}
.champ .aide, .champ-aide { display: block; font-size: 12px; line-height: 1.4; color: var(--encre-400); margin-top: 4px; }
.champ .message-erreur { display: block; }
.champ.erreur textarea { border-color: var(--rouge-600); }
.champ.erreur input:focus, .champ.erreur select:focus, .champ.erreur textarea:focus { box-shadow: 0 0 0 3px var(--rouge-050); }

input:disabled, select:disabled, textarea:disabled { background: var(--voile); color: var(--encre-400); cursor: not-allowed; }
input::placeholder, textarea::placeholder { color: var(--encre-300); }
select { cursor: pointer; }

/* Cases à cocher et boutons radio : à leur taille naturelle, alignés sur leur
   texte (la règle générique `input { width:100% }` ne doit pas s'y appliquer). */
input[type="checkbox"], input[type="radio"] {
  inline-size: auto; flex: none; margin: 0; accent-color: var(--vert-600); cursor: pointer;
}
label:has(> input[type="checkbox"]), label:has(> input[type="radio"]) {
  display: inline-flex; align-items: center; gap: var(--r2);
  font-size: 13.5px; color: var(--encre-700); cursor: pointer;
}
label.champ:has(> input[type="checkbox"]), label.champ:has(> input[type="radio"]) { display: flex; }

/* Rangées de cases (documents remis, options…) */
.cases { display: flex; flex-wrap: wrap; gap: var(--r2) var(--r4); }

/* Groupes de champs (« 2ᵉ conducteur », « Documents remis »…) */
fieldset {
  border: 1px solid var(--trait); border-radius: var(--arrondi-sm);
  padding: var(--r3) var(--r4); margin: 0 0 var(--r3); min-inline-size: 0;
}
legend {
  padding-inline: var(--r2); font-size: 11.5px; font-weight: 600;
  letter-spacing: .06em; text-transform: uppercase; color: var(--encre-400);
}

/* Sections d'un long formulaire : sur-titre en capitales (DESIGN_SYSTEM §0, sur-titres),
   un filet au-dessus — sauf pour la première, qui ouvre le formulaire. */
.titre-section {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--encre-400); margin: var(--r5) 0 var(--r3);
  padding-block-start: var(--r3); border-block-start: 1px solid var(--trait);
}
.titre-section:first-child { margin-block-start: 0; padding-block-start: 0; border-block-start: 0; }
.titre-section + .aide { margin-block: calc(-1 * var(--r2)) var(--r3); }
.titre-bloc { font-size: 13px; font-weight: 600; color: var(--encre-700); margin: var(--r4) 0 var(--r2); }

/* Un champ de saisie suivi de son action (« + Nouveau client », « Rechercher »…) :
   même hauteur, alignés sur la ligne de base du champ. */
.champ-action { display: flex; gap: var(--r2); align-items: stretch; }
.champ-action > input, .champ-action > select { flex: 1 1 auto; min-inline-size: 0; }
.champ-action > .bouton { flex: none; }

/* Formulaire d'une page (hors fenêtre modale) : largeur lisible, rythme vertical stable. */
.formulaire { max-inline-size: 720px; }
.formulaire.etroit { max-inline-size: 560px; }

/* Pied de formulaire d'une page : séparé des champs, boutons alignés (principal en premier). */
.actions-formulaire {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--r2);
  margin-top: var(--r4); padding-top: var(--r3); border-top: 1px solid var(--trait);
}
.actions-formulaire .compteur, .actions-formulaire .secondaire { margin-inline-start: auto; }

/* Boutons posés à côté de champs (barres d'outils, filtres) : même hauteur qu'un champ. */
.barre-outils > .bouton:not(.petit), .rangee > .bouton:not(.petit) { min-block-size: 38px; }
.rangee { align-items: start; }
.rangee > .champ { margin-bottom: 0; }
.rangee { margin-bottom: var(--r3); }

/* Sélecteur de couleur du véhicule : les teintes sont des DONNÉES (peinture
   d'une voiture), posées en `style` par le JS — pas des tokens d'interface.
   Seuls l'anneau de sélection (vert) et les traits viennent du catalogue. */
.couleurs { display: flex; flex-wrap: wrap; gap: var(--r2); border: 0; padding: 0; margin: 0; min-inline-size: 0; }
.couleurs label { position: relative; inline-size: 56px; display: inline-flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer; font-size: 11px; color: var(--encre-500); text-align: center; }
.couleurs input { position: absolute; inset-block-start: 0; inset-inline-start: 0; inline-size: 100%; block-size: 100%; opacity: 0; margin: 0; cursor: pointer; }
.pastille-couleur { inline-size: 28px; block-size: 28px; border-radius: 50%; border: 1px solid var(--trait-fort); box-shadow: inset 0 0 0 2px var(--papier); }
.couleurs input:checked + .pastille-couleur, .couleurs input:focus-visible + .pastille-couleur { outline: 2px solid var(--vert-600); outline-offset: 2px; }
.couleurs input:checked ~ .libelle-couleur { color: var(--encre-900); font-weight: 600; }
.pastille-aucune { background: var(--papier); border-style: dashed; }
.pastille-couleur-mini { display: inline-block; inline-size: 10px; block-size: 10px; border-radius: 50%; border: 1px solid var(--trait-fort); margin-inline-end: 6px; }

/* ── Tableaux ── */

.tableau-cadre { overflow: auto; max-height: 62vh; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--voile); text-align: start;
  font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--encre-400); padding: 9px var(--r4);
  border-bottom: 1px solid var(--trait); white-space: nowrap;
}
tbody td {
  padding: 11px var(--r4); border-bottom: 1px solid var(--trait);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--voile); }
tbody tr.cliquable { cursor: pointer; }
tbody tr.retenu { background: var(--vert-050); }
td.montant, th.montant { text-align: end; white-space: nowrap; }
td .principal { font-weight: 600; color: var(--encre-900); }
td .secondaire { font-size: 12px; color: var(--encre-400); }
td .actions { display: flex; gap: 6px; justify-content: flex-end; }

/* ── Étiquettes ── */

.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 11.5px; font-weight: 500; line-height: 1.6;
  padding: 1px 9px; border-radius: 20px;
  background: var(--voile); color: var(--encre-500); border: 1px solid var(--trait);
  white-space: nowrap;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .85; }
.badge.sans-puce::before { display: none; }
.badge.vert { background: var(--vert-050); color: var(--vert-700); border-color: var(--vert-100); }
.badge.rouge { background: var(--rouge-050); color: var(--rouge-700); border-color: var(--rouge-100); }
.badge.ambre { background: var(--ambre-050); color: var(--ambre-700); border-color: var(--ambre-100); }
.badge.bleu { background: var(--bleu-050); color: var(--bleu-600); border-color: var(--bleu-100); }

/* ── Modale (DESIGN_SYSTEM §5.7) — fabriques modale()/confirmer() ── */

#couche-modale {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(11, 17, 32, .45); backdrop-filter: blur(2px);
  display: grid; place-items: start center; padding: 6vh var(--r4) var(--r4);
  overflow-y: auto;
}
.modale {
  background: var(--papier); border-radius: var(--arrondi-lg);
  box-shadow: var(--ombre-4); width: 100%; max-width: 640px;
  animation: montee .18s ease-out;
}
.modale.large { max-width: 880px; }
.modale-entete { display: flex; align-items: flex-start; gap: var(--r3);
  padding: var(--r4) var(--r5); border-bottom: 1px solid var(--trait); }
.modale-entete h2 { font-size: 17px; font-weight: 600; letter-spacing: -.01em; }
.modale-entete .sous-titre { color: var(--encre-400); font-size: 13px; margin-top: 4px; }
.modale-entete .fermer { margin-inline-start: auto; background: none; border: none;
  cursor: pointer; font-size: 20px; color: var(--encre-400); line-height: 1; padding: 2px 6px; }
.modale-corps { padding: var(--r5); }
.modale-pied { display: flex; flex-wrap: wrap; gap: var(--r2); justify-content: flex-end;
  padding: var(--r3) var(--r5) var(--r4); border-top: 1px solid var(--trait); }
@keyframes montee { from { opacity: 0; transform: translateY(10px) } to { opacity: 1; transform: none } }

/* ── États vides et squelettes ── */

.vide { padding: var(--r6) var(--r4); text-align: center; color: var(--encre-400); }
.vide .icone { font-size: 30px; opacity: .35; display: block; margin-bottom: var(--r3); }
.vide h3 { font-size: 15px; color: var(--encre-700); font-weight: 600; margin-bottom: 5px; }
.vide p { font-size: 13px; max-width: 46ch; margin: 0 auto; }

.squelette {
  background: linear-gradient(90deg, var(--voile) 25%, #eef1f5 37%, var(--voile) 63%);
  background-size: 400% 100%; animation: glisse 1.3s ease-in-out infinite;
  border-radius: var(--r1); height: 13px; margin: 9px 0;
}
@keyframes glisse { 0% { background-position: 100% 50% } 100% { background-position: 0 50% } }

/* ── Messages ── */

#couche-messages {
  position: fixed; inset-inline-end: var(--r5); bottom: var(--r5);
  width: 400px; max-width: calc(100vw - 32px); z-index: 90;
  display: flex; flex-direction: column; gap: var(--r2);
}
.message {
  background: var(--papier); border: 1px solid var(--trait);
  border-inline-start: 3px solid var(--encre-400);
  border-radius: var(--arrondi-sm); box-shadow: var(--ombre-3);
  padding: var(--r3) var(--r4); font-size: 13.5px;
  animation: entree .18s ease-out;
}
@keyframes entree { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
.message strong { display: block; font-weight: 600; margin-bottom: 2px; }
.message.ok { border-inline-start-color: var(--vert-600); }
.message.non { border-inline-start-color: var(--rouge-600); }
.message.attention { border-inline-start-color: var(--ambre-600); }
.message ul { margin: 6px 0 0; margin-inline-start: var(--r4); font-size: 12.5px; color: var(--encre-500); }

/* ── Onglets ── */

.onglets { display: flex; gap: 2px; border-bottom: 1px solid var(--trait); margin-bottom: var(--r4); }
.onglets button {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 9px var(--r4); font: inherit; font-size: 13.5px; color: var(--encre-400); cursor: pointer;
}
.onglets button.actif { color: var(--encre-900); border-bottom-color: var(--vert-600); font-weight: 600; }

/* ── Onglets en barre latérale (page Paramètres) ── */

.mise-en-page-laterale {
  display: grid; grid-template-columns: 220px 1fr; gap: var(--r5); align-items: start;
}
.onglets-lateraux {
  display: flex; flex-direction: column; gap: 2px;
  background: var(--papier); border: 1px solid var(--trait);
  border-radius: var(--arrondi-lg); padding: var(--r2); position: sticky; top: var(--r4);
}
.onglets-lateraux button {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: start;
  background: none; border: none; border-radius: var(--arrondi-sm);
  padding: 9px var(--r3); font: inherit; font-size: 13.5px; color: var(--encre-500); cursor: pointer;
  transition: background .12s, color .12s;
}
.onglets-lateraux button:hover { background: var(--toile); color: var(--encre-900); }
.onglets-lateraux button.actif { background: var(--vert-050); color: var(--vert-700); font-weight: 600; }
.onglets-lateraux button .icone { width: 18px; text-align: center; font-size: 14px; opacity: .8; }

@media (max-width: 860px) {
  .mise-en-page-laterale { grid-template-columns: 1fr; }
  .onglets-lateraux { flex-direction: row; overflow-x: auto; position: static; }
}

/* ── Barre d'outils de liste ── */

.barre-outils {
  /* `flex-end`, jamais `center` : un champ `.champ` (span de libellé +
     input empilés, ex. « Du »/« Au ») est plus haut qu'un bouton nu — les
     centrer sur la hauteur de la ligne place le bouton au-dessus du
     niveau réel des champs de saisie (signalé 2026-09-06, Planning et les
     écrans à filtre de dates : « le calendrier et le bouton actualiser ne
     sont pas bien alignés »). `flex-end` aligne tout sur le bas des
     champs, où qu'ils aient ou non un libellé au-dessus. */
  display: flex; align-items: flex-end; gap: var(--r3);
  padding: var(--r3) var(--r4); border-bottom: 1px solid var(--trait);
  background: var(--voile); flex-wrap: wrap;
}
.barre-outils input, .barre-outils select { max-width: 240px; }
.barre-outils .compteur { margin-inline-start: auto; font-size: 12.5px; color: var(--encre-400); }

/* Groupe de boutons solidaires (ex. sélecteur de pas 7/14/30 j du Planning)
   — un `gap` plus serré que `.barre-outils` (`--r3`) marque visuellement
   que ces boutons forment UN seul contrôle, pas plusieurs actions distinctes. */
.segmente { display: flex; gap: 4px; }

/* ── Planning visuel de la flotte (M5) — ruban temporel par véhicule.
   Pas de fabrique SVG (DESIGN_SYSTEM §5.19 couvre les courbes/aires, pas
   un Gantt) : une piste par véhicule, des barres positionnées en % sur
   l'intervalle demandé, colorées par les mêmes tons sémantiques que
   badgeStatut() (vert=contrat actif, ambre=brouillon verrouillé,
   bleu=réservation). ── */

/* Cadre défilable de la grille date/pistes — colonne d'étiquette FIXE
   (200px ci-dessous) : sous ~550px de large la piste devient illisible et
   déborderait de la PAGE sans ce cadre (même doctrine que `.tableau-cadre` :
   le contenu dense défile dans SON cadre, jamais la page entière). */
.planning-defilement { overflow-x: auto; }
.planning-defilement > * { min-width: 560px; }

.planning-ligne {
  display: grid; grid-template-columns: 200px 1fr; align-items: center;
  gap: var(--r3); padding: 6px 0; border-bottom: 1px solid var(--trait);
}
.planning-ligne.zebre { background: var(--voile); }
.planning-etiquette { font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.planning-etiquette .secondaire { display: block; font-size: 11.5px; color: var(--encre-400); }
.planning-piste { position: relative; height: 30px; background: var(--voile); border-radius: var(--arrondi-sm); }
.planning-ligne.zebre .planning-piste { background: var(--papier); }
.planning-barre {
  position: absolute; top: 4px; height: 22px; border-radius: var(--r1);
  background: var(--vert-600); color: #fff; font-size: 11px; font-weight: 500;
  display: flex; align-items: center; padding-inline: 6px; overflow: hidden;
  white-space: nowrap; cursor: default; transition: filter .1s ease;
}
.planning-barre.cliquable { cursor: pointer; }
.planning-barre.cliquable:hover { filter: brightness(1.12); box-shadow: var(--ombre-2); }
.planning-barre.ambre { background: var(--ambre-600); }
.planning-barre.bleu { background: var(--bleu-600); }
.planning-barre.rouge { background: var(--rouge-600); }
.planning-grille-jours {
  display: grid; grid-template-columns: 200px 1fr; gap: var(--r3);
  font-size: 11px; color: var(--encre-400); margin-bottom: 4px;
}
.planning-grille-jours > div:last-child { position: relative; height: 14px; }
.planning-grille-jours .repere { position: absolute; transform: translateX(-50%); }
/* Repère de fin : ancré par `inset-inline-end` (logique, se retourne tout
   seul en RTL) plutôt que centré par `transform: translateX` — un repère
   centré à 100 % déborde de la piste (moitié du texte hors cadre,
   débordement horizontal constaté) ; `translateX` est une transformation
   PHYSIQUE qui ne suit PAS l'inversion RTL de `inset-inline-*`, la
   combinaison des deux avait fait réapparaître le débordement en arabe. Le
   repère de départ (0 %) n'a besoin d'aucun correctif : `inset-inline-start`
   seul l'ancre déjà sans déborder. */
.planning-grille-jours .repere-fin { transform: none; inset-inline-end: 0; }

/* ── Légende de graphique (DESIGN_SYSTEM §5.19) — fabrique legendeGraphe() ── */
.legende-graphe { display: flex; gap: var(--r4); flex-wrap: wrap; margin-top: var(--r3); }
.legende-item { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--encre-500); }
.legende-puce { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

/* Pastille du centre d'alertes */
.pastille-cloche {
  position: absolute; top: -2px; inset-inline-end: -2px;
  min-width: 16px; height: 16px; padding: 0 4px;
  background: var(--rouge-600); color: #fff;
  border-radius: 9px; font-size: 10.5px; font-weight: 600;
  display: grid; place-items: center; line-height: 1;
}

/* ═══════════════════════════════════════════════════════════
   Vues de détail (fiches) — classes spécifiées dans
   DESIGN_SYSTEM.md §5.15–5.18 mais jamais portées ici : les
   fiches client / véhicule / contrat les utilisent depuis les
   lots C2/V3. Blocs repris À L'IDENTIQUE du catalogue.
   ═══════════════════════════════════════════════════════════ */

/* ── Encarts d'information (DESIGN_SYSTEM §5.15) ── */

.encart {
  border-inline-start: 3px solid var(--trait-fort);
  padding-block: 2px; padding-inline: var(--r3) 0;
  color: var(--encre-500); font-size: 12.5px; margin-top: var(--r3);
}
.encart strong { color: var(--encre-700); font-weight: 600; }
.encart.attention {
  border-color: var(--ambre-600); color: var(--ambre-700); background: var(--ambre-050);
  padding: var(--r3); border-radius: 0 var(--arrondi-sm) var(--arrondi-sm) 0;
}
.encart.attention strong { color: var(--ambre-700); }
.encart.refus {
  border-color: var(--rouge-600); color: var(--rouge-700); background: var(--rouge-050);
  padding: var(--r3); border-radius: 0 var(--arrondi-sm) var(--arrondi-sm) 0;
}
.encart.refus strong { color: var(--rouge-700); }

/* ── Liste de contrôle : blocages / avertissements (DESIGN_SYSTEM §5.16) ── */

.liste-controle { list-style: none; display: grid; gap: 2px; }
.liste-controle li {
  display: flex; align-items: center; gap: var(--r3);
  padding: 10px var(--r3); border-radius: var(--arrondi-sm);
}
.liste-controle li.bloquant      { background: var(--rouge-050); }
.liste-controle li.avertissement { background: var(--ambre-050); }
.liste-controle li.ok            { background: var(--vert-050); }

/* ── Paires clé/valeur — détails (DESIGN_SYSTEM §5.17) ── */

.paire {
  display: flex; justify-content: space-between; gap: var(--r4);
  padding: 7px 0; border-bottom: 1px solid var(--trait);
}
.paire dt { color: var(--encre-400); font-size: 13px; flex-shrink: 0; }
.paire dd { font-weight: 500; text-align: end; overflow-wrap: anywhere; }
.paire:last-child { border-bottom: none; }

/* Groupe de paires : titre de section au-dessus d'un `<dl>` de `.paire`. */
.bloc-detail { margin-bottom: var(--r4); }
.bloc-detail > h3 {
  font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase;
  color: var(--encre-400); margin-bottom: 2px;
}

/* ── Panneau d'onglet dans une fiche ── */

.onglet-panneau { margin-top: var(--r4); }

/* ── Galerie de photos véhicule (DESIGN_SYSTEM §5.18) ── */

.galerie { display: grid; gap: var(--r3); grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
.vignette {
  position: relative; border: 1px solid var(--trait); border-radius: var(--arrondi-sm);
  overflow: hidden; background: var(--voile); aspect-ratio: 4 / 3;
}
.vignette img { width: 100%; height: 100%; object-fit: cover; display: block; }
.vignette .etiquette-photo {
  position: absolute; inset-inline-start: 6px; bottom: 6px;
  background: rgba(11, 17, 32, .78); color: #fff; font-size: 10.5px; padding: 2px 7px; border-radius: 10px;
}
.vignette .retirer:hover { background: var(--rouge-600); }

/* ── Utilitaires de texte hors tableau (DESIGN_SYSTEM §2, table « Notes/aides »
   et §5.5 : `.principal`/`.secondaire` n'étaient stylés que sous `td`). ── */

.aide, .note { font-size: 12.5px; color: var(--encre-400); }
.principal { font-weight: 600; color: var(--encre-900); }
.secondaire { font-size: 12px; color: var(--encre-400); }

/* ── Impression ── */

@media print {
  .flanc, .haut, .entete-page .actions, .barre-outils, #couche-messages { display: none !important; }
  .coquille { display: block; height: auto; }
  .corps { padding: 0; overflow: visible; }
  .carte { box-shadow: none; border-color: #999; page-break-inside: avoid; }
  .tableau-cadre { max-height: none; overflow: visible; }
}

/* ── Bascule mobile de la barre latérale (visible sous 1000px seulement) ── */

.bascule-flanc { display: none; background: none; border: none; cursor: pointer; padding: 4px; font-size: 20px; color: var(--encre-700); }
.voile-flanc { display: none; }

/* ── Étroit ── */

@media (max-width: 1000px) {
  .coquille { grid-template-columns: minmax(0, 1fr); grid-template-areas: 'haut' 'corps'; }
  .flanc { position: fixed; inset: 0 auto 0 0; width: var(--barre-laterale); z-index: 70;
           transform: translateX(-100%); transition: transform .2s; }
  .flanc.ouvert { transform: none; box-shadow: var(--ombre-4); }
  .bascule-flanc { display: inline-flex; }
  .voile-flanc.ouvert { display: block; position: fixed; inset: 0; z-index: 60; background: rgba(11, 17, 32, .45); }
  .corps { padding: var(--r4); }
}

/* ── Bandeau du haut sur petit mobile — débordement horizontal constaté
   (~90px, TOUS les écrans, signalé 2026-09-06) : bascule de langue + avatar
   + identité (nom+rôle) + déconnexion tiennent sur une seule ligne sans
   repli. Sous 600px, l'identité textuelle (déjà portée par l'avatar à
   initiales) et le titre de page cèdent la place — geste minimal, rien
   d'essentiel n'est masqué (changer de langue, se déconnecter et savoir
   qui est connecté — via l'avatar — restent possibles). ── */
@media (max-width: 600px) {
  .compte-utilisateur { gap: 6px; }
  .compte-utilisateur .identite { display: none; }
  .fil strong {
    max-width: 90px; overflow: hidden; text-overflow: ellipsis;
    white-space: nowrap; display: inline-block; vertical-align: bottom;
  }
  /* Le libellé de bascule de langue affiche un drapeau + le nom de la
     langue CIBLE (ex. « 🇲🇦 العربية ») — plus long que « Français » seul ;
     à lui seul il dépassait encore le bandeau une fois l'identité masquée
     ci-dessus. Tronqué, jamais le bouton retiré : changer de langue reste
     possible d'un tap, juste sans lire le nom complet avant de l'avoir fait. */
  #bouton-langue {
    max-width: 84px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  }
}

/* Carte « Premiers pas » du tableau de bord */
.premiers-pas { list-style: none; margin: 0; padding: 0; }
.premiers-pas li { display: flex; align-items: center; gap: var(--r3); padding: var(--r3) var(--r4); border-block-end: 1px solid var(--trait); }
.premiers-pas li:last-child { border-block-end: 0; }
.premiers-pas .pas-etat { flex: none; inline-size: 22px; block-size: 22px; border-radius: 50%; border: 2px solid var(--trait-fort); display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: transparent; }
.premiers-pas .fait .pas-etat { background: var(--vert-600); border-color: var(--vert-600); color: #fff; }
.premiers-pas .pas-texte { flex: 1; min-inline-size: 0; }
.premiers-pas .pas-texte strong { display: block; font-weight: 600; }
.premiers-pas .pas-texte span { color: var(--encre-400); font-size: 12.5px; }
.premiers-pas .fait .pas-texte strong { color: var(--encre-400); font-weight: 500; text-decoration: line-through; }
.barre-progres { block-size: 6px; border-radius: 3px; background: var(--trait); overflow: hidden; margin: var(--r3) var(--r4) 0; }
.barre-progres > span { display: block; block-size: 100%; background: var(--vert-600); }

/* Œil afficher/masquer sur les champs mot de passe (js/oeil-mdp.js). */
.champ-mdp { position: relative; display: block; }
.champ-mdp > input { inline-size: 100%; padding-inline-end: 42px; }
.oeil-mdp {
  position: absolute; inset-block: 0; inset-inline-end: 0; inline-size: 40px;
  display: inline-flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--arrondi-sm); color: var(--encre-400); cursor: pointer;
}
.oeil-mdp:hover { color: var(--encre-700); }
.oeil-mdp:focus-visible { outline: 2px solid var(--vert-600); outline-offset: -2px; }

/* Une seule hauteur pour tous les champs d'une ligne (les champs date/heure du navigateur sont
   naturellement plus hauts que les champs texte et les listes). */
input:not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="color"]):not([type="range"]), select { block-size: 38px; }

/* Champs d'une barre d'outils (filtres Du/Au, agence…) : pas de marge basse, la barre porte le rythme. */
.barre-outils .champ { margin-bottom: 0; }

/* Petit formulaire en ligne dans une fiche : pas de filet, juste un peu d'air au-dessus du bouton. */
.actions-formulaire.sans-filet { border-top: 0; padding-top: 0; margin-top: var(--r2); }

/* Champs rangés dans une grille de formulaire : l'écart vient de la grille, pas d'une marge en plus. */
.grille > .champ { margin-bottom: 0; }
form .grille { gap: var(--r3) var(--r4); margin-bottom: var(--r3); }

/* Case à cocher dans un champ à libellé de bloc (`.champ > label`) : texte courant, pas un libellé de champ. */
.champ > label:has(> input[type="checkbox"]), .champ > label:has(> input[type="radio"]) {
  display: flex; font-size: 13.5px; font-weight: 400; color: var(--encre-700); margin-bottom: 0;
}

/* Texte d'attente / d'invite dans un cadre (« Chargement… », « Recherche… ») */
.chargement { padding: var(--r4); color: var(--encre-400); }

/* ── Fiches (contrat, devis, réservation, facture, infraction…) — DESIGN_SYSTEM §5.4 bis ── */

.fiche-entete { display: flex; align-items: flex-start; gap: var(--r4); flex-wrap: wrap; margin-bottom: var(--r3); }
.fiche-identite { min-inline-size: 0; }
.fiche-titre {
  display: flex; align-items: center; flex-wrap: wrap; gap: var(--r3);
  font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--encre-900);
}
.fiche-resume { margin-top: 3px; font-size: 13px; color: var(--encre-400); }
.fiche-docs { margin-inline-start: auto; display: flex; flex-wrap: wrap; gap: var(--r2); }
.fiche-docs:empty, .fiche-actions:empty { display: none; }

/* Actions de gestion : une barre posée sous l'en-tête, jamais mêlée au pied de la fenêtre. */
.fiche-actions {
  display: flex; flex-wrap: wrap; gap: var(--r2); align-items: center;
  padding: var(--r2) var(--r3); margin-bottom: var(--r4);
  background: var(--voile); border: 1px solid var(--trait); border-radius: var(--arrondi-sm);
}

/* Détails : paires clé/valeur sur deux colonnes dès que la place le permet. */
.fiche-details {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  column-gap: var(--r6); margin-bottom: var(--r4);
}

/* Le seul bouton destructif du pied est isolé à l'opposé de « Fermer » et de l'action principale. */
.modale-pied .fiche-danger { margin-inline-end: auto; }

/* Titres de bloc d'une fiche : pas de marge au-dessus du premier. */
#fiche-solde > .titre-bloc:first-child, #fiche-caution > .titre-bloc:first-child { margin-top: 0; }

/* Totaux d'une facture : un bloc compact aligné à la fin, comme sur le document imprimé. */
.fiche-totaux { max-inline-size: 360px; margin-inline-start: auto; margin-top: var(--r4); }

/* Titre de section qui garde son filet même quand il ouvre un bloc (Solde, Caution dans une fiche). */
.titre-section.avec-filet:first-child {
  margin-block-start: var(--r5); padding-block-start: var(--r3); border-block-start: 1px solid var(--trait);
}
.champ-compact { max-inline-size: 280px; }

/* Panneau où s'ouvre le formulaire d'une action de fiche (Encaisser, Prolonger, Annuler…). */
#fiche-zone-action:not(:empty) {
  padding: var(--r4); margin-bottom: var(--r4);
  background: var(--voile); border: 1px solid var(--trait); border-radius: var(--arrondi-sm);
}
#fiche-zone-action > .titre-bloc:first-child, #fiche-zone-action > h3:first-child { margin-top: 0; }

/* Identifiant (numéro de document, matricule, date) : jamais coupé en fin de ligne. */
.insecable { white-space: nowrap; }

/* Barres d'outils : un bouton posé à côté de champs a la hauteur des champs, même s'il est « petit ». */
.barre-outils > .bouton.petit { padding: 8px 14px; font-size: 13.5px; min-block-size: 38px; }

/* Contrôle segmenté (7 / 14 / 30 jours, Précédent / Suivant) : boutons soudés, un seul contrôle. */
.segmente { gap: 0; }
.segmente > .bouton { border-radius: 0; min-block-size: 38px; }
.segmente > .bouton + .bouton { margin-inline-start: -1px; }
.segmente > .bouton:first-child { border-start-start-radius: var(--arrondi-sm); border-end-start-radius: var(--arrondi-sm); }
.segmente > .bouton:last-child { border-start-end-radius: var(--arrondi-sm); border-end-end-radius: var(--arrondi-sm); }
.segmente > .bouton:not(.discret) { position: relative; z-index: 1; }

/* Fenêtre modale longue (fiches, longs formulaires) : le titre et les boutons restent à l'écran pendant le défilement. */
.modale-entete {
  position: sticky; inset-block-start: 0; z-index: 3; background: var(--papier);
  border-start-start-radius: var(--arrondi-lg); border-start-end-radius: var(--arrondi-lg);
}
.modale-pied {
  position: sticky; inset-block-end: 0; z-index: 2; background: var(--papier);
  border-end-start-radius: var(--arrondi-lg); border-end-end-radius: var(--arrondi-lg);
}

/* Les marges haute et basse de la fenêtre portent la marge (et non le conteneur), pour que le titre
   et le pied collants s'arrêtent exactement au bord de l'écran. */
#couche-modale { padding-block: 0; }
.modale { margin-block: 6vh var(--r4); }

/* Textes d'aide sous les soldes : un peu d'air avant et après. */
.grille + .aide, #fiche-solde .aide, #fiche-caution .aide { margin-block: var(--r2) var(--r3); }

/* En-tête de page : le titre et sa description cèdent la place (et passent à la ligne) plutôt que de
   renvoyer les boutons d'action sous eux. */
.entete-page > div:first-child { flex: 1 1 280px; min-inline-size: 0; }
.entete-page .actions { flex: none; }

/* Texte posé directement dans une carte « serrée » (celle dont le corps est un tableau) : sa propre respiration. */
.carte-corps.serre > p, .carte-corps.serre > .aide, .carte-corps.serre > .encart { margin: 0; padding: var(--r3) var(--r4); }
.carte-corps.serre > .encart { margin: var(--r3) var(--r4); padding: var(--r3); }

/* Tuile de chiffre : lien vers la liste qui détaille le chiffre. */
.stat-lien { display: inline-block; margin-top: var(--r3); font-size: 12.5px; font-weight: 500; color: var(--vert-700); text-decoration: none; }
.stat-lien:hover { text-decoration: underline; }

/* ══ Mobile (≤ 600 px) ═══════════════════════════════════════════════════════
   Barre haute allégée (menu · titre · cloche · avatar) : langue, installation et
   déconnexion vivent dans le tiroir de navigation (`relais-compte.js`). Les tableaux
   deviennent des cartes (une ligne = une carte, libellé à gauche / valeur à droite,
   libellés portés par `data-etiquette`). Les fenêtres prennent toute la largeur. */
.flanc-compte { display: none; }

@media (max-width: 860px) {
  .mise-en-page-laterale { grid-template-columns: minmax(0, 1fr); }
  .onglets-lateraux { min-inline-size: 0; max-inline-size: 100%; }
  .onglets-lateraux button { flex: none; white-space: nowrap; inline-size: auto; }
}

@media (max-width: 700px) {
  .tableau-cadre { max-height: none; overflow: visible; }
  .tableau-cadre table, .tableau-cadre tbody, .tableau-cadre tr, .tableau-cadre td { display: block; }
  .tableau-cadre thead { display: none; }
  .tableau-cadre tbody tr { padding: var(--r3) var(--r4); border-block-end: 1px solid var(--trait); }
  .tableau-cadre tbody tr:last-child { border-block-end: 0; }
  .tableau-cadre tbody td {
    display: flex; align-items: baseline; justify-content: space-between; gap: var(--r3);
    padding: 4px 0; border: 0; text-align: end; min-inline-size: 0; overflow-wrap: anywhere;
  }
  .tableau-cadre tbody td::before {
    content: attr(data-etiquette); flex: none; max-inline-size: 42%; text-align: start;
    font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--encre-400);
  }
  .tableau-cadre tbody td[data-etiquette=""]::before { display: none; }
  .tableau-cadre tbody td:first-child { font-weight: 600; color: var(--encre-900); }
  .tableau-cadre td .actions { flex-wrap: wrap; }
}

@media (max-width: 600px) {
  .haut { padding: 0 var(--r3); gap: var(--r2); }
  .fil { flex: 1; min-inline-size: 0; }
  .fil strong { max-inline-size: 100%; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .compte-utilisateur { margin-inline-start: 0; gap: var(--r1); }
  .compte-utilisateur #bouton-langue, .compte-utilisateur #bouton-installer, .compte-utilisateur .deconnexion { display: none; }

  .flanc-compte { display: grid; gap: 2px; padding: var(--r2); border-block-start: 1px solid rgba(255, 255, 255, .07); }
  .flanc-compte .flanc-lien[hidden] { display: none; }
  .flanc-compte .flanc-deconnexion { color: #fca5a5; }
  .flanc-compte .flanc-deconnexion:hover { background: rgba(248, 113, 113, .12); color: #fecaca; }

  .corps { padding: var(--r3); }
  .entete-page { gap: var(--r3); margin-block-end: var(--r4); }
  .entete-page .actions { inline-size: 100%; margin-inline-start: 0; }
  .entete-page .actions > .bouton { flex: 1 1 auto; justify-content: center; }
  .grille.g2, .grille.g3, .grille.g4 { grid-template-columns: minmax(0, 1fr); }
  .barre-outils > *, .barre-outils .champ { flex: 1 1 100%; }
  .barre-outils input, .barre-outils select { max-inline-size: none; inline-size: 100%; }
  .barre-outils .compteur { margin-inline-start: 0; }

  #couche-modale { padding-inline: 0; }
  .modale, .modale.large { max-inline-size: none; margin-block-start: 4vh; border-end-start-radius: 0; border-end-end-radius: 0; }
  .modale-entete { padding: var(--r3) var(--r4); }
  .modale-corps { padding: var(--r4); }
  .modale-pied { padding: var(--r3) var(--r4); border-end-start-radius: 0; border-end-end-radius: 0; }
  .modale-pied > .bouton { flex: 1 1 auto; justify-content: center; }
  .onglets { overflow-x: auto; flex-wrap: nowrap; }
  .onglets button { white-space: nowrap; flex: none; }
}

/* Connexion : la marque reste visible quand le panneau de présentation disparaît (mobile) ; sélecteur de fichier au style des boutons. */
.marque-mobile { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; margin-block-end: var(--r5); color: var(--encre-900); }
@media (min-width: 900px) { .marque-mobile { display: none; } }
input[type="file"] { font-size: 13px; color: var(--encre-500); }
input[type="file"]::file-selector-button { margin-inline-end: var(--r3); padding: 6px 12px; border: 1px solid var(--trait-fort); border-radius: var(--arrondi-sm); background: var(--papier); color: var(--encre-800); font: inherit; font-weight: 500; cursor: pointer; }
input[type="file"]::file-selector-button:hover { background: var(--voile); }

/* Recherche dans une liste : champ en tête de barre d'outils ; lignes non retenues masquées (aussi en cartes mobiles). */
.barre-outils input[type="search"] { flex: 1 1 240px; min-inline-size: 200px; max-inline-size: 360px; }
tr[hidden] { display: none !important; }
.aucun-resultat .vide { padding-block: var(--r5); }

.modale-corps > .aide { margin-block-end: var(--r3); }

/* ══ Menu latéral — groupes repliables (menu.js) ═════════════════════════════
   Tableau de bord en tête, quatre groupes par ce que l'agent FAIT (Location · Flotte · Finances ·
   Analyse), Administration puis Support en pied. Le groupe de la page courante est toujours ouvert. */
.flanc-lien[hidden], .flanc-groupe[hidden], .flanc-groupe-liens[hidden] { display: none; }
.flanc-haut { padding-block-end: var(--r3); }
.flanc-bas { margin-block-start: var(--r3); padding-block-start: var(--r3); border-block-start: 1px solid rgba(255, 255, 255, .07); }
.flanc-groupe { margin-bottom: var(--r2); }
.flanc-groupe-titre {
  display: flex; align-items: center; justify-content: space-between; gap: var(--r2); inline-size: 100%;
  background: none; border: 0; cursor: pointer; font: inherit; text-align: start;
  padding: 7px var(--r3); border-radius: var(--arrondi-sm);
  font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: #94a3b8;
  transition: background .12s, color .12s;
}
.flanc-groupe-titre:hover { background: rgba(255, 255, 255, .05); color: #e2e8f0; }
.flanc-groupe-titre:focus-visible { outline: 2px solid var(--vert-600); outline-offset: -2px; }
.flanc-groupe-titre .chevron { flex: none; transition: transform .15s; }
.flanc-groupe.replie .flanc-groupe-titre .chevron { transform: rotate(-90deg); }
[dir="rtl"] .flanc-groupe.replie .flanc-groupe-titre .chevron { transform: rotate(90deg); }
.flanc-groupe-liens { display: grid; gap: 1px; padding-block-start: 2px; }
.flanc-lien .flanc-badge {
  margin-inline-start: auto; padding: 1px 7px; border-radius: 99px; font-size: 10px; font-weight: 700; letter-spacing: .03em;
  background: rgba(20, 149, 124, .22); color: #6ee7c8;
}
.flanc-bas { position: sticky; inset-block-end: 0; background: var(--encre-900); padding-block-end: var(--r2); }

/* Menu : ouverture animée vers le bas (hauteur 0 → auto via grille), titres à l'abri du style générique des boutons. */
.flanc .flanc-groupe-titre { background: none; border: 0; box-shadow: none; }
.flanc .flanc-groupe-titre:hover { background: rgba(255, 255, 255, .06); }
.flanc-groupe-liens { display: grid; grid-template-rows: 1fr; transition: grid-template-rows .24s cubic-bezier(.4, 0, .2, 1); padding-block-start: 0; }
.flanc-groupe.replie .flanc-groupe-liens { grid-template-rows: 0fr; }
.flanc-groupe-liens-interieur { overflow: hidden; min-block-size: 0; display: grid; gap: 1px; padding-block-start: 2px; transition: opacity .2s, visibility .24s; }
.flanc-groupe.replie .flanc-groupe-liens-interieur { visibility: hidden; opacity: 0; }
@media (prefers-reduced-motion: reduce) { .flanc-groupe-liens, .flanc-groupe-liens-interieur, .flanc-groupe-titre .chevron { transition: none; } }

/* Analytique — évolution : commandes, phrase de lecture, variations, règles de calcul */
.evolution-commandes { background: transparent; border-block-end: 0; padding-inline: 0; align-items: flex-end; }
.evolution-contenu { display: grid; gap: var(--r4); }
.evolution-lecture { font-size: 15px; line-height: 1.6; color: var(--encre-600); background: var(--voile); border: 1px solid var(--trait); border-radius: var(--arrondi); padding: var(--r3) var(--r4); }
.evolution-lecture strong { color: var(--encre-900); font-variant-numeric: tabular-nums; }
.stat-note.variation { font-weight: 600; }
.stat-note.variation.hausse { color: var(--vert-700); }
.stat-note.variation.baisse { color: var(--rouge-700); }
.montant-negatif { color: var(--rouge-700); }
.evolution-regles { font-size: 13px; color: var(--encre-500); }
.evolution-regles summary { cursor: pointer; font-weight: 600; color: var(--encre-700); }
.evolution-regles ul { margin: var(--r2) 0 0; padding-inline-start: var(--r5); display: grid; gap: var(--r1); }

/* Jauge d'usage d'une formule (écran Abonnement) */
.jauge-bloc { display: grid; gap: var(--r2); }
.jauge-tete { display: flex; justify-content: space-between; align-items: baseline; font-size: 13px; color: var(--encre-600); }
.jauge-tete strong { font-size: 14px; color: var(--encre-800); }
.jauge { block-size: 8px; border-radius: 4px; background: var(--trait); overflow: hidden; }
.jauge > i { display: block; block-size: 100%; border-radius: 4px; background: var(--vert-600); }
.jauge > i.attention { background: var(--ambre-600); }
.jauge > i.alerte { background: var(--rouge-600); }

/* Case à cocher accompagnée de son libellé, dans une barre d'outils (ex. « Afficher les supprimés ») : jamais étirée par la règle des champs. */
.champ-inline { display: inline-flex; align-items: center; gap: var(--r2); font-size: 13px; color: var(--encre-400); cursor: pointer; }
.barre-outils .champ-inline input[type="checkbox"], .champ-inline input[type="checkbox"] { inline-size: auto; max-inline-size: none; margin: 0; flex: none; }
