/* Zelaya — feuille de style unique (CLAUDE.md, section 6).
   Un registre de caisse moderne : fond blanc, filets fins, chiffres alignés. Mobile d'abord. */

/* ---------- Police (auto-hébergée, licence OFL) ---------- */
@font-face { font-family: "Archivo"; font-weight: 400; font-style: normal; font-display: swap; src: url("../fonts/archivo-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 500; font-style: normal; font-display: swap; src: url("../fonts/archivo-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Archivo"; font-weight: 700; font-style: normal; font-display: swap; src: url("../fonts/archivo-latin-700-normal.woff2") format("woff2"); }

/* ---------- Variables ---------- */
:root {
  --encre:   #0D005C;  /* texte, titres */
  --action:  #1779FF;  /* cliquable / actif uniquement */
  --fond:    #FFFFFF;
  --fond-2:  #F5F6FB;
  --trait:   #E2E4EE;
  --texte-2: #5B5880;
  --ok:      #137A4B;
  --partiel: #A86400;
  --retard:  #C2341F;

  /* Graphique : 2 séries, paire validée (luminosité, saturation, daltonisme, contraste sur blanc).
     Distinctes des couleurs de statut et du bleu des boutons. */
  --serie-encaisse: #4535C4; /* indigo, famille de l'encre */
  --serie-depenses: #B5528A; /* prune */
  --action-fonce: #0F5FCC;   /* survol des boutons */
  --action-pale:  #EAF2FF;   /* fond d'un élément actif */

  --police: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --rayon: 4px;
  --tactile: 44px;           /* zone tactile minimale */
  --barre-bas: 60px;         /* navigation mobile */
  --largeur: 1120px;
  --transition: 120ms ease-out;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
h1 { font-size: 1.625rem; line-height: 1.2; font-weight: 700; letter-spacing: -0.01em; }
h2 { font-size: 1.125rem; line-height: 1.3; font-weight: 700; }
h3 { font-size: 1rem; line-height: 1.4; font-weight: 500; }
a { color: var(--action); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
img, svg { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }
::selection { background: var(--action-pale); }
hr { border: 0; border-top: 1px solid var(--trait); margin: 24px 0; }

/* Chiffres et codes : même police, chiffres de largeur égale */
.montant, .num, .code, .chiffre { font-variant-numeric: tabular-nums; letter-spacing: 0.01em; }
.code { font-weight: 500; letter-spacing: 0.04em; white-space: nowrap; }
.montant { white-space: nowrap; }
.retard-texte { color: var(--retard); }
.ok-texte { color: var(--ok); }
.secondaire { color: var(--texte-2); }
.petit { font-size: 0.875rem; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- En-tête ---------- */
.entete {
  position: sticky; top: 0; z-index: 20;
  background: var(--fond);
  border-bottom: 1px solid var(--trait);
}
.entete-interieur {
  max-width: var(--largeur); margin: 0 auto; padding: 0 16px;
  height: 56px; display: flex; align-items: center; gap: 24px;
}
.entete-logo { display: flex; align-items: center; height: var(--tactile); padding: 0 4px; margin-left: -4px; }
.entete-logo .logo-complet { display: none; height: 28px; width: auto; }
.entete-logo .logo-icone { height: 28px; width: auto; }
.entete-logo .logo-perso { height: 28px; width: auto; max-width: 160px; object-fit: contain; }
.entete-titre { font-size: 1rem; font-weight: 700; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entete-utilisateur { display: none; align-items: center; gap: 4px; margin-left: auto; }
.entete-utilisateur .nom { font-size: 0.875rem; color: var(--texte-2); }
.entete-utilisateur form { margin: 0; }

/* Navigation ordinateur : soulignement de la page active */
.nav-principale { display: none; }
.nav-principale ul { list-style: none; padding: 0; display: flex; gap: 2px; }
.nav-principale a {
  display: flex; align-items: center; height: 56px; padding: 0 10px;
  color: var(--encre); font-size: 0.9375rem; font-weight: 500;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
  transition: color var(--transition), border-color var(--transition);
}
.nav-principale a:hover { color: var(--action); text-decoration: none; }
.nav-principale a[aria-current="page"] { color: var(--action); border-bottom-color: var(--action); }

/* Navigation mobile : barre du bas, 4 entrées */
.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  background: var(--fond); border-top: 1px solid var(--trait);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav-bas > ul { list-style: none; padding: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); }
.nav-bas > ul > li > a, .nav-bas summary {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  height: var(--barre-bas); color: var(--texte-2); font-size: 0.75rem; font-weight: 500;
  cursor: pointer; list-style: none;
}
.nav-bas summary::-webkit-details-marker { display: none; }
.nav-bas a:hover { text-decoration: none; }
.nav-bas > ul > li > a[aria-current="page"], .nav-bas details[open] > summary, .nav-bas .actif > summary { color: var(--action); }
.nav-bas > ul > li > a svg, .nav-bas summary svg { width: 22px; height: 22px; }

/* Menu « Plus » (details/summary : marche sans JavaScript) */
.nav-plus { position: static; }
.nav-plus-menu {
  position: fixed; left: 0; right: 0; bottom: calc(var(--barre-bas) + env(safe-area-inset-bottom));
  background: var(--fond); border-top: 1px solid var(--trait);
  list-style: none; margin: 0; padding: 8px 0;
}
.nav-plus-menu a, .nav-plus-menu button {
  display: flex; align-items: center; gap: 12px; width: 100%;
  min-height: 48px; padding: 0 20px;
  color: var(--encre); font: inherit; font-size: 1rem; text-align: left;
  background: none; border: 0; cursor: pointer;
}
.nav-plus-menu a[aria-current="page"] { color: var(--action); }
.nav-plus-menu svg { width: 20px; height: 20px; color: var(--texte-2); }
.nav-plus-menu .separateur { border-top: 1px solid var(--trait); margin: 8px 0; }

/* ---------- Page ---------- */
.page {
  max-width: var(--largeur); margin: 0 auto;
  padding: 20px 16px calc(var(--barre-bas) + 32px + env(safe-area-inset-bottom));
}
.page-entete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 20px; }
.page-entete h1 { flex: 1 1 auto; }
.page-entete .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section { margin-top: 32px; }
.section > h2 { padding-bottom: 8px; border-bottom: 1px solid var(--encre); margin-bottom: 0; }

/* Date du registre : comme l'en-tête d'une page de cahier */
.page-date { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; }
.page-date h1 { font-size: 1.75rem; flex: 1; }
.page-date-annee { color: var(--texte-2); font-size: 0.9375rem; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tactile); padding: 0 16px;
  font: inherit; font-size: 0.9375rem; font-weight: 500; line-height: 1;
  border: 1px solid var(--trait); border-radius: var(--rayon);
  background: var(--fond); color: var(--encre);
  cursor: pointer; white-space: nowrap;
  transition: background-color var(--transition), border-color var(--transition), color var(--transition);
}
.btn:hover { border-color: var(--encre); text-decoration: none; }
.btn:active { background: var(--fond-2); }
.btn svg { width: 18px; height: 18px; }
.btn-principal { background: var(--action); border-color: var(--action); color: #fff; }
.btn-principal:hover { background: var(--action-fonce); border-color: var(--action-fonce); }
.btn-principal:active { background: var(--action-fonce); }
.btn-danger { color: var(--retard); }
.btn-danger:hover { border-color: var(--retard); }
.btn-discret { border-color: transparent; color: var(--action); padding: 0 8px; }
.btn-discret:hover { border-color: transparent; background: var(--fond-2); }
.btn-icone { width: var(--tactile); padding: 0; border-color: transparent; color: var(--texte-2); }
.btn-icone:hover { border-color: transparent; background: var(--fond-2); color: var(--encre); }
.btn-montant { font-variant-numeric: tabular-nums; min-width: 88px; }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.btn-large { width: 100%; }

/* ---------- Formulaires ---------- */
.formulaire { max-width: 560px; }
.champ { margin-bottom: 16px; }
.champ label, .champ .etiquette { display: block; font-size: 0.875rem; font-weight: 500; margin-bottom: 6px; }
.champ .aide { font-size: 0.8125rem; color: var(--texte-2); margin-top: 4px; }
.champ .optionnel { font-weight: 400; color: var(--texte-2); }
input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
input[type="date"], input[type="search"], input[type="file"], select, textarea {
  display: block; width: 100%; min-height: var(--tactile);
  padding: 10px 12px;
  font: inherit; font-size: 1rem; color: var(--encre);
  background: var(--fond); border: 1px solid var(--trait); border-radius: var(--rayon);
  transition: border-color var(--transition);
}
input:hover, select:hover, textarea:hover { border-color: #C9CCDC; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--action); box-shadow: 0 0 0 1px var(--action); }
input::placeholder, textarea::placeholder { color: #9A98B5; }
input[type="file"] { padding: 9px 12px; }
textarea { min-height: 96px; resize: vertical; }
select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%235B5880' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.champ-montant { position: relative; }
.champ-montant input { padding-right: 52px; text-align: right; font-variant-numeric: tabular-nums; }
.champ-montant .devise { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--texte-2); font-size: 0.875rem; pointer-events: none; }
.champ--erreur input, .champ--erreur select, .champ--erreur textarea { border-color: var(--retard); }
.champ--erreur input:focus, .champ--erreur select:focus { box-shadow: 0 0 0 1px var(--retard); }
.champ .erreur { font-size: 0.8125rem; color: var(--retard); margin-top: 4px; }
.cases { display: flex; flex-wrap: wrap; gap: 8px; }
.case { display: inline-flex; align-items: center; gap: 8px; min-height: var(--tactile); padding: 0 12px; border: 1px solid var(--trait); border-radius: var(--rayon); cursor: pointer; font-size: 0.9375rem; }
.champ .case { display: inline-flex; margin-bottom: 0; font-size: 0.9375rem; font-weight: 400; }
.case input { width: 18px; height: 18px; margin: 0; accent-color: var(--action); }
.case:has(input:checked) { border-color: var(--action); background: var(--action-pale); }
.formulaire-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; padding-top: 16px; border-top: 1px solid var(--trait); }
.grille-2 { display: grid; gap: 0 16px; }

/* ---------- Messages ---------- */
.flash {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 12px 14px; margin-bottom: 16px;
  background: var(--fond-2); border-left: 3px solid var(--texte-2); border-radius: 0 var(--rayon) var(--rayon) 0;
  font-size: 0.9375rem;
}
.flash svg { width: 18px; height: 18px; flex: none; margin-top: 2px; }
.flash--ok { border-left-color: var(--ok); }
.flash--ok svg { color: var(--ok); }
.flash--erreur { border-left-color: var(--retard); }
.flash--erreur svg { color: var(--retard); }
.flash--info { border-left-color: var(--action); }
.flash--info svg { color: var(--action); }

.bandeau { padding: 10px 14px; margin-bottom: 16px; border: 1px solid var(--trait); border-radius: var(--rayon); color: var(--texte-2); font-size: 0.9375rem; }

/* ---------- Statuts : texte + petite pastille ---------- */
.statut { display: inline-flex; align-items: center; gap: 6px; font-size: 0.875rem; font-weight: 500; white-space: nowrap; }
.statut::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--texte-2); flex: none; }
.statut--paye::before    { background: var(--ok); }
.statut--partiel::before { background: var(--partiel); }
.statut--non_paye::before, .statut--retard::before { background: var(--retard); }
.statut--repos, .statut--hors_contrat { color: var(--texte-2); font-weight: 400; }
.statut--repos::before, .statut--hors_contrat::before { background: transparent; box-shadow: inset 0 0 0 1.5px var(--texte-2); }
.statut--actif::before { background: var(--ok); }
.statut--suspendu::before { background: var(--retard); }
.statut--termine::before, .statut--inactif::before { background: var(--texte-2); }
.statut--en_reparation::before { background: var(--partiel); }

/* ---------- Tableaux ---------- */
.tableau-conteneur { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.tableau { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.tableau th {
  text-align: left; font-size: 0.8125rem; font-weight: 500; color: var(--texte-2);
  padding: 10px 12px; border-bottom: 1px solid var(--encre); white-space: nowrap;
}
.tableau td { padding: 12px; border-bottom: 1px solid var(--trait); vertical-align: middle; }
@media (max-width: 767px) {
  .tableau { font-size: 0.875rem; }
  .tableau th, .tableau td { padding: 10px 6px; }
}
.tableau tbody tr:hover td { background: var(--fond-2); }
.tableau .date { white-space: nowrap; }
.tableau .num, .tableau th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tableau tfoot td { font-weight: 700; border-top: 1px solid var(--encre); border-bottom: 0; }
.tableau--raye tbody tr:nth-child(even) td { background: var(--fond-2); }
.tableau a.ligne-lien { color: var(--encre); font-weight: 500; }
.tableau a.ligne-lien:hover { color: var(--action); }

/* Sur mobile, un tableau peut devenir une liste de lignes compactes */
.lignes-compactes { list-style: none; padding: 0; border-top: 1px solid var(--encre); }
.lignes-compactes > li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--trait); }
.lignes-compactes .principal { flex: 1; min-width: 0; color: var(--encre); }
.lignes-compactes a.principal:hover { text-decoration: none; }
.lignes-compactes a.principal:hover strong { color: var(--action); }
.lignes-compactes .principal strong { display: block; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lignes-compactes .principal span { font-size: 0.875rem; color: var(--texte-2); }
.lignes-compactes .valeur { text-align: right; font-variant-numeric: tabular-nums; }

/* ---------- Chiffres clés (synthèse, tableau de bord) : séparateurs, pas de cartes ---------- */
.chiffres { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border-top: 1px solid var(--trait); border-bottom: 1px solid var(--trait); }
.chiffres--2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
/* 4 chiffres : 2 × 2 sur mobile, une ligne sur ordinateur */
.chiffres--4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chiffres--4 > div:nth-child(3) { padding-left: 0; border-left: 0; }
.chiffres--4 > div:nth-child(n+3) { border-top: 1px solid var(--trait); }
@media (min-width: 768px) {
  .chiffres--4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .chiffres--4 > div:nth-child(3) { padding-left: 12px; border-left: 1px solid var(--trait); }
  .chiffres--4 > div:nth-child(n+3) { border-top: 0; }
}

/* ---------- Graphique (SVG généré côté serveur) ---------- */
.graphique { width: 100%; height: auto; max-width: 560px; margin-top: 8px; overflow: visible; }
.graphique .grille { stroke: var(--trait); stroke-width: 1; }
.graphique .base { stroke: var(--texte-2); stroke-width: 1; }
.graphique .axe { font-size: 14px; fill: var(--texte-2); font-variant-numeric: tabular-nums; }
.graphique .axe--courant { fill: var(--encre); font-weight: 700; }
.graphique .barre-encaisse { fill: var(--serie-encaisse); }
.graphique .barre-depenses { fill: var(--serie-depenses); }
.graphique .survol { fill: transparent; }
.graphique .mois:hover .survol { fill: var(--fond-2); }
.legende { display: flex; gap: 16px; font-size: 0.875rem; color: var(--texte-2); margin-top: 10px; }
.legende > span { display: inline-flex; align-items: center; gap: 6px; }
.pastille-serie { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
.pastille-serie--encaisse { background: var(--serie-encaisse); }
.pastille-serie--depenses { background: var(--serie-depenses); }
.donnees-graphique { margin-top: 8px; }
.donnees-graphique summary { font-size: 0.875rem; color: var(--action); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.chiffres > div { padding: 12px 12px 12px 0; }
.chiffres > div + div { padding-left: 12px; border-left: 1px solid var(--trait); }
.chiffres dt { font-size: 0.8125rem; color: var(--texte-2); }
.chiffres dd { font-size: 1.25rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: 0.01em; white-space: nowrap; }
.chiffres dd .devise { font-size: 0.8125rem; font-weight: 500; color: var(--texte-2); margin-left: 2px; }

/* Barre de progression : la seule reprise de la coupe en biais du logo (bord gauche) */
.progression { margin-top: 12px; }
.progression-piste {
  height: 8px; background: var(--fond-2); overflow: hidden;
  clip-path: polygon(6px 0, 100% 0, 100% 100%, 0 100%);
}
.progression-barre { height: 100%; background: var(--ok); transition: width 150ms ease-out; }
.progression-legende { display: flex; justify-content: space-between; font-size: 0.8125rem; color: var(--texte-2); margin-top: 6px; }

/* ---------- Filtres ---------- */
.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 16px 0; }
.onglets { display: inline-flex; max-width: 100%; overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--rayon); }
.onglets > * { white-space: nowrap; flex: none; }
.onglets { scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }
.onglets a, .onglets button {
  display: flex; align-items: center; min-height: 40px; padding: 0 14px;
  font: inherit; font-size: 0.875rem; font-weight: 500; color: var(--texte-2);
  background: var(--fond); border: 0; cursor: pointer;
}
.onglets > * + * { border-left: 1px solid var(--trait); }
.onglets a:hover { text-decoration: none; color: var(--encre); }
.onglets [aria-current="true"], .onglets [aria-pressed="true"] { background: var(--action-pale); color: var(--action); }
.filtres input[type="search"] { flex: 1 1 200px; min-height: 40px; }
/* Formulaire de filtres : 2 colonnes sur mobile, une ligne sur ordinateur */
.filtres-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0 0 16px; }
.filtres-grille input, .filtres-grille select { min-height: 40px; padding-top: 6px; padding-bottom: 6px; font-size: 0.9375rem; }
.filtres-grille .btn { grid-column: 1 / -1; }
@media (min-width: 768px) {
  .filtres-grille { display: flex; flex-wrap: wrap; }
  .filtres-grille input, .filtres-grille select { width: auto; }
  .filtres-grille .btn { grid-column: auto; }
}

/* ---------- État vide ---------- */
.vide { padding: 32px 0; border-top: 1px solid var(--trait); border-bottom: 1px solid var(--trait); color: var(--texte-2); }
.vide strong { display: block; color: var(--encre); font-weight: 500; margin-bottom: 4px; }
.vide .btn { margin-top: 16px; }

/* ---------- Fiche détail : liste de définitions en lignes ---------- */
.fiche { display: grid; grid-template-columns: minmax(120px, 40%) 1fr; border-top: 1px solid var(--trait); }
.fiche dt, .fiche dd { padding: 10px 0; border-bottom: 1px solid var(--trait); }
.fiche dt { color: var(--texte-2); font-size: 0.875rem; padding-right: 12px; }
.fiche dd { font-variant-numeric: tabular-nums; }

/* ---------- Calendrier 30 jours (fiche chauffeur) ---------- */
.calendrier { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; max-width: 266px; }
.calendrier .jour-entete { font-size: 0.75rem; color: var(--texte-2); text-align: center; }
.calendrier .jour {
  aspect-ratio: 1; display: flex; align-items: center; justify-content: center;
  font-size: 0.75rem; font-variant-numeric: tabular-nums; border-radius: 2px;
  background: var(--fond-2); color: var(--texte-2);
}
.calendrier .jour--paye { background: var(--ok); color: #fff; }
.calendrier .jour--partiel { background: var(--partiel); color: #fff; }
.calendrier .jour--non_paye { background: var(--fond); color: var(--retard); box-shadow: inset 0 0 0 1.5px var(--retard); }
.calendrier .jour--repos { background: var(--fond-2); color: #A9A7C0; }
.calendrier .jour--hors_contrat { background: var(--fond); color: #A9A7C0; box-shadow: inset 0 0 0 1px var(--trait); }
.calendrier .jour--aujourdhui { outline: 2px solid var(--encre); outline-offset: 1px; }

/* ---------- Ligne du registre ---------- */
.registre { list-style: none; padding: 0; border-top: 1px solid var(--encre); }
/* Mobile : nom + statut, puis retard, puis les boutons sur toute la largeur (pouce). */
.registre-ligne {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  grid-template-areas: "qui statut" "retard retard" "gestes gestes" "panneau panneau";
  gap: 2px 12px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--trait);
  scroll-margin-top: 72px; transition: background-color 150ms ease-out;
}
.registre-ligne[hidden] { display: none; }
.registre-ligne.vient-de-changer { background: #EAF6EF; }
.registre-ligne .qui { grid-area: qui; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.registre-ligne .qui strong { font-weight: 500; }
.registre-ligne .qui a { color: var(--encre); }
.registre-ligne .qui .code { color: var(--texte-2); margin-right: 6px; }
.registre-ligne .etat-statut { grid-area: statut; justify-self: end; }
.registre-ligne .etat-retard { grid-area: retard; font-size: 0.875rem; }
.registre-ligne .gestes { grid-area: gestes; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 8px; }
.registre-ligne .gestes form { display: contents; }
.registre-ligne .gestes .btn { flex: 0 0 auto; padding: 0 12px; }
.registre-ligne .gestes .btn-montant { flex: 1 1 auto; min-width: 72px; }
.registre-ligne .gestes .btn-icone { padding: 0; }
.registre-panneau { grid-area: panneau; margin-top: 10px; padding: 12px; background: var(--fond-2); border-radius: var(--rayon); }
.registre-panneau[hidden] { display: none; }
.registre-panneau h3 { font-size: 0.875rem; margin: 12px 0 4px; }
.registre-panneau h3:first-child { margin-top: 0; }
.registre-panneau .champ { margin-bottom: 10px; }
.registre-panneau .formulaire-actions { margin-top: 8px; padding-top: 0; border-top: 0; }
.repartition { list-style: none; padding: 0; margin: 8px 0; border-top: 1px solid var(--trait); font-size: 0.9375rem; }
.repartition li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--trait); }
.recus { list-style: none; padding: 0; font-size: 0.9375rem; }
.recus > li { padding: 6px 0; border-bottom: 1px solid var(--trait); }
.recus .recu-ligne { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.recus .annule { color: var(--texte-2); text-decoration: line-through; }
.recus details summary { font-size: 0.8125rem; color: var(--retard); cursor: pointer; min-height: 32px; display: flex; align-items: center; }
.recus details form { display: flex; gap: 8px; padding: 4px 0 8px; }
.recus details input { min-height: 40px; }
.message-registre:empty { display: none; }
.message-registre { position: sticky; top: 64px; z-index: 10; }

/* ---------- Listes, fiches et formulaires des modules ---------- */
.seulement-ordinateur { display: none; }
.tableau .col-secondaire { display: none; }
.lien-retour { display: inline-flex; align-items: center; gap: 4px; min-height: 32px; font-size: 0.875rem; color: var(--texte-2); margin-bottom: 4px; }
.lien-retour svg { width: 16px; height: 16px; }
.sous-titre { color: var(--texte-2); font-size: 0.9375rem; margin-top: 2px; }
.section-entete { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--encre); }
.section-entete h2 { padding: 0; border: 0; }
.colonnes { display: grid; gap: 0 32px; }
.colonnes > * { min-width: 0; }
.photo { width: 100%; max-width: 320px; aspect-ratio: 4 / 3; object-fit: cover; border: 1px solid var(--trait); border-radius: var(--rayon); margin-top: 16px; }
.photo-vide { display: flex; align-items: center; justify-content: center; max-width: 320px; aspect-ratio: 4 / 3; margin-top: 16px; border: 1px dashed var(--trait); border-radius: var(--rayon); color: var(--texte-2); font-size: 0.875rem; }
fieldset { border: 0; padding: 0; margin: 0 0 8px; min-width: 0; }
legend { font-size: 1rem; font-weight: 700; padding: 16px 0 8px; width: 100%; border-bottom: 1px solid var(--trait); margin-bottom: 16px; }
.calcul { font-size: 0.875rem; color: var(--texte-2); margin: -8px 0 16px; }
/* Champs de reprise : visibles seulement si « Contrat déjà en cours » est coché (sans JavaScript) */
.champs-reprise { display: none; }
.bloc-reprise:has(input[name="deja_en_cours"]:checked) .champs-reprise { display: block; }
/* Taux de change : seulement pour une dépense en USD (sans JavaScript) */
.formulaire:has(input[name="devise"][value="HTG"]:checked) .champ-taux { display: none; }
.liste-retards { list-style: none; padding: 0; columns: 2; column-gap: 24px; font-size: 0.875rem; }
.liste-retards li { display: flex; justify-content: space-between; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--trait); break-inside: avoid; }
.zone-danger { margin-top: 32px; padding-top: 16px; border-top: 1px solid var(--trait); }
.zone-danger details { border-bottom: 1px solid var(--trait); }
.zone-danger summary { display: flex; align-items: center; min-height: var(--tactile); cursor: pointer; font-weight: 500; }
.zone-danger form { padding: 8px 0 16px; }
.annule td { color: var(--texte-2); text-decoration: line-through; }
.annule td:last-child { text-decoration: none; }

/* ---------- Connexion ---------- */
.connexion { min-height: 100vh; display: flex; align-items: flex-start; justify-content: center; padding: 12vh 16px 32px; }
.connexion-boite { width: 100%; max-width: 360px; }
.connexion-boite .logo { width: 220px; height: auto; margin: 0 0 40px; }
.connexion-boite h1 { font-size: 1.25rem; margin-bottom: 20px; }

/* ---------- Styleguide ---------- */
.nuancier { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); border-top: 1px solid var(--trait); }
.nuancier > div { padding: 12px 0; border-bottom: 1px solid var(--trait); display: flex; gap: 10px; align-items: center; font-size: 0.8125rem; }
.nuancier .pastille { width: 28px; height: 28px; border-radius: var(--rayon); border: 1px solid var(--trait); flex: none; }
.exemple { padding: 16px 0; display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }

/* ---------- Écrans moyens et grands ---------- */
@media (min-width: 768px) {
  .seulement-ordinateur { display: block; }
  .tableau th.col-secondaire, .tableau td.col-secondaire { display: table-cell; }
  .tableau span.col-secondaire { display: inline; }
  .seulement-mobile { display: none; }
  .colonnes { grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); }
  .liste-retards { columns: 3; }
}

@media (min-width: 640px) {
  .grille-2 { grid-template-columns: 1fr 1fr; }
  .chiffres dd { font-size: 1.5rem; }
  .page-date h1 { font-size: 2.25rem; }
  .registre-ligne { grid-template-columns: minmax(0, 1fr) 100px 190px 330px; grid-template-areas: "qui statut retard gestes" "panneau panneau panneau panneau"; }
  .registre-ligne .etat-statut { justify-self: start; }
  .registre-ligne .etat-retard { text-align: right; }
  .registre-ligne .gestes { margin-top: 0; flex-wrap: nowrap; justify-content: flex-end; }
  .registre-ligne .gestes .btn { flex: 0 0 auto; }
  .registre-panneau { max-width: 640px; justify-self: end; width: 100%; }
}

@media (min-width: 1024px) {
  .entete-logo .logo-complet { display: block; }
  .entete-logo .logo-icone, .entete-titre { display: none; }
  .nav-principale { display: block; }
  .entete-utilisateur { display: flex; }
  .nav-bas { display: none; }
  .page { padding: 32px 24px 64px; }
  .btn { min-height: 40px; }
  input[type="text"], input[type="email"], input[type="password"], input[type="tel"], input[type="number"],
  input[type="date"], input[type="search"], select { min-height: 40px; padding-top: 8px; padding-bottom: 8px; }
}

/* ---------- Impression : feuille propre, sans menu ---------- */
@media print {
  .entete, .nav-bas, .filtres, .gestes, .btn, .flash, .pas-imprime, .lien-retour { display: none !important; }
  .tableau th.col-secondaire, .tableau td.col-secondaire { display: table-cell; }
  .tableau span.col-secondaire { display: inline; }
  .page { padding: 0; max-width: none; }
  .imprime-logo { display: block !important; width: 180px; margin-bottom: 16px; }
  body { font-size: 11pt; }
  .tableau tbody tr:hover td { background: none; }
}
.imprime-logo { display: none; }

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