/*
 * Frais km : feuille de style.
 * Polices locales, rien n'est chargé depuis internet.
 * Trois thèmes (réglage « Apparence ») : Carnet (par défaut), Route, Classique.
 * Palettes tirées de ui-ux-pro-max (colors.csv n° 100, 16 et 162), contrastes mesurés :
 *   - --texte-doux ne se pose jamais sur --discret ni sur --primaire-clair (moins de 4,5) ;
 *   - l'accent ne sert qu'au décor et au grand texte, --accent-texte quand il est du texte.
 * Pensée d'abord pour son PC (1280 px), puis pour le téléphone.
 */

/* ---------- Polices ---------- */

@font-face { font-family: 'Crimson Pro'; src: url('polices/crimson-pro-latin-wght.woff2') format('woff2'); font-weight: 200 900; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url('polices/atkinson-hyperlegible-latin-400.woff2') format('woff2'); font-weight: 300 500; font-display: swap; }
@font-face { font-family: 'Atkinson Hyperlegible'; src: url('polices/atkinson-hyperlegible-latin-700.woff2') format('woff2'); font-weight: 600 900; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('polices/barlow-latin-400.woff2') format('woff2'); font-weight: 300 449; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('polices/barlow-latin-500.woff2') format('woff2'); font-weight: 450 549; font-display: swap; }
@font-face { font-family: 'Barlow'; src: url('polices/barlow-latin-600.woff2') format('woff2'); font-weight: 550 900; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('polices/barlow-condensed-latin-600.woff2') format('woff2'); font-weight: 500 649; font-display: swap; }
@font-face { font-family: 'Barlow Condensed'; src: url('polices/barlow-condensed-latin-700.woff2') format('woff2'); font-weight: 650 900; font-display: swap; }
@font-face { font-family: 'Lexend'; src: url('polices/lexend-latin-wght.woff2') format('woff2'); font-weight: 300 700; font-display: swap; }
@font-face { font-family: 'Source Sans 3'; src: url('polices/source-sans-3-latin-wght.woff2') format('woff2'); font-weight: 300 800; font-display: swap; }

/* ---------- Thèmes ---------- */

/* Carnet : brun cuir, papier crème, titres à empattement (palette n° 100). */
:root,
[data-theme='carnet'] {
  --primaire: #92400E;
  --primaire-fonce: #78350F;
  --primaire-clair: #FBF1E6;
  --primaire-bord: #E7CDB4;
  --sur-primaire: #FFFFFF;
  --secondaire: #A16207;
  --accent: #6366F1;
  --accent-texte: #4F46E5;
  --fond: #FFFBEB;
  --texte: #0F172A;
  --surface: #FFFFFF;
  --discret: #F8F3F0;
  --texte-doux: #64748B;
  --bord: #F1E8E2;
  --bord-champ: #B37956;
  --anneau: #92400E;
  --teinte-ombre: 120, 53, 15;
  --police-titres: 'Crimson Pro', Georgia, 'Times New Roman', serif;
  --police-texte: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --police-chiffres: 'Atkinson Hyperlegible', 'Segoe UI', system-ui, sans-serif;
  --police-compteur: 'Crimson Pro', Georgia, serif;
  --graisse-titres: 650;
  --taille-titre: 1.55rem;
  --motif-fond: repeating-linear-gradient(to bottom, transparent 0 31px, rgba(146, 64, 14, 0.07) 31px 32px);
}

/* Route : vert d'eau et orange, lettres étroites (palette n° 16, primaire foncée pour le texte). */
[data-theme='route'] {
  --primaire: #0F766E;
  --primaire-fonce: #115E59;
  --primaire-clair: #E6F6F3;
  --primaire-bord: #99F6E4;
  --sur-primaire: #FFFFFF;
  --secondaire: #14B8A6;
  --accent: #EA580C;
  --accent-texte: #C2410C;
  --fond: #F0FDFA;
  --texte: #134E4A;
  --surface: #FFFFFF;
  --discret: #E8F1F4;
  --texte-doux: #64748B;
  --bord: #CDEFE8;
  --bord-champ: #4B9892;
  --anneau: #0D9488;
  --teinte-ombre: 19, 78, 74;
  --police-titres: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --police-texte: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --police-chiffres: 'Barlow', 'Segoe UI', system-ui, sans-serif;
  --police-compteur: 'Barlow Condensed', 'Arial Narrow', sans-serif;
  --graisse-titres: 700;
  --taille-titre: 1.6rem;
  --motif-fond: radial-gradient(rgba(15, 118, 110, 0.09) 1px, transparent 1.5px) 0 0 / 22px 22px;
}

/* Classique : bleu marine, sobre (palette n° 162). Lexend n'a pas de chiffres de même largeur :
   les nombres passent en Source Sans 3. */
[data-theme='classique'] {
  --primaire: #1E3A5F;
  --primaire-fonce: #142A47;
  --primaire-clair: #E9EEF5;
  --primaire-bord: #CBD5E1;
  --sur-primaire: #FFFFFF;
  --secondaire: #334155;
  --accent: #B45309;
  --accent-texte: #B45309;
  --fond: #F8FAFC;
  --texte: #0F172A;
  --surface: #FFFFFF;
  --discret: #E9EEF5;
  --texte-doux: #64748B;
  --bord: #DCE3EC;
  --bord-champ: #62758F;
  --anneau: #1E3A5F;
  --teinte-ombre: 15, 23, 42;
  --police-titres: 'Lexend', 'Segoe UI', system-ui, sans-serif;
  --police-texte: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --police-chiffres: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --police-compteur: 'Source Sans 3', 'Segoe UI', system-ui, sans-serif;
  --graisse-titres: 600;
  --taille-titre: 1.3rem;
  --motif-fond: none;
}

/* Communs aux trois thèmes. Le jaune est celui de sa ligne de fin de mois. */
:root {
  --surligneur: #FFF3A3;
  --surligneur-fort: #FDE047;
  --surligneur-texte: #713F12;
  --succes: #15803D;
  --succes-clair: #DCFCE7;
  --attention: #9A3412;
  --attention-clair: #FFEDD5;
  --attention-bord: #FDBA74;
  --danger: #B91C1C;
  --danger-clair: #FEE2E2;
  --danger-bord: #FCA5A5;
  --rayon: 14px;
  --rayon-petit: 10px;
  --largeur: 1120px;
  --hauteur-nav: 68px;
  --ombre: 0 1px 1px rgba(var(--teinte-ombre), 0.04), 0 2px 4px rgba(var(--teinte-ombre), 0.04), 0 8px 24px rgba(var(--teinte-ombre), 0.07);
  --ombre-haute: 0 2px 4px rgba(var(--teinte-ombre), 0.06), 0 12px 32px rgba(var(--teinte-ombre), 0.14);
  color-scheme: light;
}

/* ---------- Base ---------- */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; font-synthesis: none; }

body {
  margin: 0;
  background-color: var(--fond);
  background-image: var(--motif-fond);
  color: var(--texte);
  font-family: var(--police-texte);
  font-size: 17px;
  line-height: 1.5;
  padding-bottom: calc(var(--hauteur-nav) + 24px + env(safe-area-inset-bottom));
}

h1, h2, h3 {
  font-family: var(--police-titres);
  font-weight: var(--graisse-titres);
  line-height: 1.2;
  margin: 0 0 12px;
  color: var(--texte);
}
h2 { font-size: var(--taille-titre); }
h3 { font-size: 1.1rem; font-family: var(--police-texte); font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--primaire); }
small, .doux { color: var(--texte-doux); }
.doux { font-size: 0.95rem; }
strong { font-weight: 700; }

.nombre, .chiffres { font-family: var(--police-chiffres); font-variant-numeric: tabular-nums; }

.visuellement-cache {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.evitement {
  position: absolute;
  left: -9999px;
}
.evitement:focus {
  left: 16px;
  top: 8px;
  z-index: 60;
  background: var(--surface);
  color: var(--primaire);
  padding: 8px 12px;
  border-radius: 8px;
}

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

.sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}
.icone {
  width: 20px;
  height: 20px;
  flex: none;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ---------- En-tête ---------- */

.entete {
  position: relative;
  z-index: 20;
  color: var(--sur-primaire);
  background: linear-gradient(120deg, var(--primaire-fonce) 0%, var(--primaire) 70%);
  box-shadow: 0 2px 12px rgba(var(--teinte-ombre), 0.18);
}
/* Les tirets de la route, en jaune surligneur. */
.entete::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 4px;
  background: repeating-linear-gradient(90deg, var(--surligneur-fort) 0 28px, transparent 28px 52px);
  opacity: 0.9;
}
.entete :focus-visible { outline-color: var(--surligneur-fort); }

.entete-haut {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 14px 24px 12px;
  display: flex;
  align-items: center;
  gap: 12px 24px;
  flex-wrap: wrap;
}
/* Le h1 de la page. color: inherit, sinon la règle h1 commune le passe en texte foncé sur l'en-tête foncé. */
.marque {
  margin: 0;
  color: inherit;
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--police-titres);
  font-weight: var(--graisse-titres);
  font-size: 1.5rem;
  line-height: 1;
  white-space: nowrap;
}
.marque .icone { width: 28px; height: 28px; stroke-width: 2.25; }

.resume {
  margin: 0 0 0 auto;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.puce {
  display: inline-flex;
  flex-direction: column;
  gap: 1px;
  padding: 6px 14px;
  border-radius: var(--rayon-petit);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.24);
  line-height: 1.2;
}
.puce-nom { font-size: 0.8rem; letter-spacing: 0.02em; }
.puce-valeur {
  font-family: var(--police-chiffres);
  font-variant-numeric: tabular-nums;
  font-size: 1.1rem;
  font-weight: 700;
}
.puce-budget { background: rgba(255, 255, 255, 0.2); }
.puce-alerte {
  background: var(--surligneur);
  border-color: var(--surligneur-fort);
  color: var(--surligneur-texte);
}

/* ---------- Onglets : en bas sur téléphone, pilules dans l'en-tête sur ordinateur ---------- */

.onglets {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  background: var(--surface);
  border-top: 1px solid var(--bord);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -2px 14px rgba(var(--teinte-ombre), 0.1);
}
.onglet {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--texte-doux);
  min-height: var(--hauteur-nav);
  padding: 6px 2px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-top: 3px solid transparent;
}
.onglet .icone { width: 24px; height: 24px; }
.onglet[aria-current='page'] {
  color: var(--primaire);
  border-top-color: var(--primaire);
  background: var(--primaire-clair);
}
.onglet:focus-visible { outline-offset: -3px; }

@media (min-width: 760px) {
  body { padding-bottom: 40px; }
  .entete { position: sticky; top: 0; }
  .entete-haut { padding-bottom: 6px; }
  .onglets {
    position: static;
    display: flex;
    gap: 6px;
    max-width: var(--largeur);
    margin: 0 auto;
    padding: 6px 20px 16px;
    background: none;
    border: 0;
    box-shadow: none;
  }
  .onglet {
    flex-direction: row;
    gap: 8px;
    min-height: 44px;
    padding: 0 18px;
    font-size: 0.98rem;
    color: rgba(255, 255, 255, 0.94);
    border: 1px solid transparent;
    border-radius: 999px;
    transition: background-color 0.15s ease, color 0.15s ease;
  }
  .onglet .icone { width: 20px; height: 20px; }
  .onglet:hover { background: rgba(255, 255, 255, 0.14); }
  .onglet[aria-current='page'] {
    color: var(--primaire);
    background: var(--surface);
    border-color: var(--surface);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  }
  .onglet:focus-visible { outline-offset: 2px; }
}

/* ---------- Contenu ---------- */

main {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 24px;
}
main:focus { outline: none; }

#alertes {
  max-width: var(--largeur);
  margin: 0 auto;
  padding: 0 24px;
}
#alertes:empty { display: none; }

.carte {
  background: var(--surface);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  box-shadow: var(--ombre);
  padding: 20px 22px;
  margin-bottom: 20px;
  min-width: 0;
}
.carte > :last-child { margin-bottom: 0; }
.carte h2 {
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px dashed var(--primaire-bord);
}
.carte-tete {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 8px 16px;
  flex-wrap: wrap;
  padding-bottom: 10px;
  margin-bottom: 16px;
  border-bottom: 2px dashed var(--primaire-bord);
}
.carte-tete h2 { border: 0; padding: 0; margin: 0; }
.carte-tete .doux { margin: 0; }

.grille-2 {
  display: grid;
  gap: 0 20px;
}
.grille-2 > * { min-width: 0; }
@media (min-width: 900px) {
  .grille-2 { grid-template-columns: 1fr 1fr; align-items: start; }
}

.rangee-entre {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px 16px;
  flex-wrap: wrap;
}

/* ---------- Saisir ---------- */

/* Ordinateur : trajets habituels à gauche, la journée à droite ; le reste dessous. */
.page-saisir {
  display: grid;
  gap: 0 20px;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: 'jour' 'favoris' 'feuille' 'ajouts';
}
.zone-jour { grid-area: jour; }
.zone-favoris { grid-area: favoris; }
.zone-feuille { grid-area: feuille; }
.zone-ajouts { grid-area: ajouts; }
@media (min-width: 980px) {
  .page-saisir {
    grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr);
    grid-template-areas: 'jour jour' 'favoris feuille' 'ajouts ajouts';
    align-items: start;
  }
  .zone-feuille { position: sticky; top: 176px; }
  /* Même partage que la rangée du dessus, pour que les bords des cartes tombent juste. */
  .zone-ajouts .grille-2 { grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); column-gap: 20px; }
}

.barre-jour {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px 28px;
  padding: 14px 20px;
}
.jour-quand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.jour-titre {
  margin: 0 8px 0 0;
  font-family: var(--police-titres);
  font-weight: var(--graisse-titres);
  font-size: calc(var(--taille-titre) * 1.05);
  line-height: 1.15;
  min-width: 12ch;
}
.jour-titre small { display: block; font-family: var(--police-texte); font-size: 0.8rem; font-weight: 600; letter-spacing: 0.03em; }
.jour-quand input[type='date'] { width: auto; min-width: 11rem; }
.jour-vehicule { margin-left: auto; }
.vehicule-seul {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border-radius: var(--rayon-petit);
  background: var(--primaire-clair);
  color: var(--primaire);
  font-weight: 700;
}

/* Véhicule en boutons segmentés (des radios : flèches du clavier comprises). */
.segments {
  border: 0;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.segments legend {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 4px;
  padding: 0;
}
.segments-liste {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: var(--discret);
  border: 1px solid var(--bord);
}
.segment { position: relative; display: block; margin: 0; cursor: pointer; font-weight: 400; }
.segment input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.segment span {
  display: flex;
  flex-direction: column;
  min-height: 48px;
  justify-content: center;
  padding: 6px 16px;
  border-radius: 9px;
  line-height: 1.2;
  color: var(--texte);
  transition: background-color 0.15s ease, box-shadow 0.15s ease;
}
.segment small { color: inherit; font-size: 0.82rem; }
.segment input:checked + span {
  background: var(--primaire);
  color: var(--sur-primaire);
  box-shadow: 0 2px 6px rgba(var(--teinte-ombre), 0.25);
}
.segment input:focus-visible + span { outline: 3px solid var(--anneau); outline-offset: 2px; }
@media (hover: hover) {
  .segment input:not(:checked):hover + span { background: var(--surface); }
}

/* La journée, comme les lignes de son fichier. */
.feuille {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  font-size: 0.98rem;
}
.feuille th, .feuille td {
  border: 1px solid var(--bord);
  padding: 8px 10px;
  text-align: left;
  vertical-align: middle;
}
.feuille th {
  background: var(--discret);
  color: var(--texte);
  font-size: 0.82rem;
  font-weight: 700;
}
.feuille td.nombre, .feuille th.nombre { text-align: right; }
.feuille .cellule-actions { border-left: 0; text-align: right; width: 1%; }
.feuille tfoot td { font-weight: 700; background: var(--surligneur); color: var(--texte); border-color: var(--surligneur-fort); }
.feuille-vide {
  border: 2px dashed var(--primaire-bord);
  border-radius: var(--rayon-petit);
  padding: 18px;
  text-align: center;
  color: var(--texte);
  background: var(--fond);
}
.feuille-vide p { margin: 0; }
.apres-jour {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 14px;
}
.apres-jour div {
  border-radius: var(--rayon-petit);
  background: var(--fond);
  border: 1px solid var(--bord);
  padding: 8px 12px;
}
.apres-jour span { display: block; font-size: 0.8rem; font-weight: 700; color: var(--texte); }
.apres-jour strong { font-family: var(--police-chiffres); font-variant-numeric: tabular-nums; font-size: 1.15rem; }

/* ---------- Bandeaux ---------- */

.bandeau {
  border-radius: var(--rayon);
  padding: 12px 16px;
  margin: 20px 0 0;
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  border: 1px solid;
}
.bandeau p { margin: 0; flex: 1 1 240px; }
.carte .bandeau { margin: 12px 0; }
.bandeau-info { background: var(--primaire-clair); border-color: var(--primaire-bord); color: var(--texte); }
.bandeau-attention { background: var(--attention-clair); border-color: var(--attention-bord); color: var(--attention); }
.bandeau-erreur { background: var(--danger-clair); border-color: var(--danger-bord); color: var(--danger); }

.surligne {
  background: linear-gradient(transparent 10%, var(--surligneur) 10%, var(--surligneur) 90%, transparent 90%);
  padding: 0 4px;
  border-radius: 3px;
  font-weight: 700;
  color: var(--texte);
  font-variant-numeric: tabular-nums;
}

/* ---------- Champs et boutons ---------- */

label { display: block; font-weight: 700; margin-bottom: 4px; }
.champ { margin-bottom: 14px; min-width: 0; }
.champ small { display: block; margin-top: 4px; }

input[type='text'],
input[type='search'],
input[type='date'],
input[type='number'],
input[inputmode],
select,
textarea {
  width: 100%;
  font: inherit;
  font-size: 1rem;
  color: var(--texte);
  background: var(--surface);
  border: 1.5px solid var(--bord-champ);
  border-radius: var(--rayon-petit);
  min-height: 48px;
  padding: 10px 12px;
}
textarea { min-height: 96px; resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus {
  border-color: var(--primaire);
  outline: 3px solid var(--primaire-clair);
  outline-offset: 0;
}
input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid var(--anneau);
  outline-offset: 1px;
}
input[type='file'] { font: inherit; max-width: 100%; }
input[type='file']::file-selector-button {
  font: inherit;
  font-weight: 700;
  min-height: 44px;
  margin-right: 12px;
  padding: 8px 16px;
  border-radius: var(--rayon-petit);
  border: 1.5px solid var(--primaire);
  background: var(--surface);
  color: var(--primaire);
  cursor: pointer;
}
input[type='checkbox'], input[type='radio'] {
  width: 22px;
  height: 22px;
  accent-color: var(--primaire);
  flex: none;
  margin: 2px 0 0;
}
.case {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-weight: 400;
  margin-bottom: 10px;
  cursor: pointer;
}

.fieldset-nu { border: 0; padding: 0; margin: 0 0 14px; min-width: 0; }
.legende { font-weight: 700; margin-bottom: 6px; padding: 0; }
.liste-choix { display: grid; gap: 6px; }
.liste-choix .btn { white-space: normal; justify-content: flex-start; text-align: left; }

.rangee {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: flex-end;
}
.rangee > .champ { flex: 1 1 160px; }
.rangee > .champ-court { flex: 0 1 130px; }
.rangee > .btn { margin-bottom: 14px; }

.btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  padding: 10px 20px;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--rayon-petit);
  border: 1.5px solid var(--primaire);
  background: var(--primaire);
  color: var(--sur-primaire);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
}
.btn:hover { background: var(--primaire-fonce); border-color: var(--primaire-fonce); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-second { background: var(--surface); color: var(--primaire); }
.btn-second:hover { background: var(--primaire-clair); color: var(--primaire-fonce); }
.btn-petit { min-height: 40px; padding: 6px 12px; font-size: 0.92rem; }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger-bord); }
.btn-danger:hover { background: var(--danger-clair); color: var(--danger); border-color: var(--danger); }
.btn-icone { min-width: 48px; padding: 0 10px; }
.btn-icone.btn-petit { min-width: 40px; }
.btn-lien {
  appearance: none;
  border: 0;
  background: none;
  font: inherit;
  font-weight: 700;
  color: var(--primaire);
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
  padding: 8px 4px;
  min-height: 40px;
}
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; align-items: center; }

/* ---------- Trajets habituels ---------- */

.favoris {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
  margin-top: 14px;
}
.favori {
  appearance: none;
  position: relative;
  text-align: left;
  font: inherit;
  color: var(--texte);
  background: var(--surface);
  border: 1.5px solid var(--bord);
  border-radius: var(--rayon-petit);
  padding: 10px 12px 10px 12px;
  min-height: 84px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 2px;
  box-shadow: 0 1px 2px rgba(var(--teinte-ombre), 0.06);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.favori-client { font-weight: 700; line-height: 1.2; overflow-wrap: anywhere; padding-right: 24px; }
.favori-commune { font-size: 0.92rem; color: var(--texte-doux); overflow-wrap: anywhere; }
.favori-km { margin-top: auto; padding-top: 4px; font-family: var(--police-chiffres); font-weight: 700; color: var(--primaire); }
.favori-plus {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primaire-clair);
  color: var(--primaire);
  font-weight: 700;
  line-height: 1;
}
.favori:active { transform: scale(0.98); }
@media (hover: hover) {
  .favori:hover {
    transform: translateY(-2px);
    border-color: var(--primaire-bord);
    box-shadow: var(--ombre-haute);
  }
  .favori:hover .favori-plus { background: var(--primaire); color: var(--sur-primaire); }
}
.vide {
  border: 2px dashed var(--primaire-bord);
  border-radius: var(--rayon-petit);
  padding: 16px;
  background: var(--fond);
  color: var(--texte);
}
.vide p:last-child { margin-bottom: 0; }

.pastille {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 10px;
  white-space: nowrap;
}
.pastille-ok { background: var(--succes-clair); color: var(--succes); }
.pastille-choix { background: var(--surligneur); color: var(--surligneur-texte); }
.pastille-nouveau { background: var(--discret); color: var(--texte); }

/* ---------- La journée en une phrase ---------- */

.lignes-phrase { display: grid; gap: 10px; margin-top: 12px; }
.ligne-phrase {
  border: 1.5px solid var(--bord);
  border-radius: var(--rayon-petit);
  padding: 12px;
  background: var(--surface);
}
.ligne-phrase.exclue { opacity: 0.55; }
.ligne-phrase-tete {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.ligne-phrase-tete .case { margin: 0; }
.texte-lu { font-size: 0.92rem; color: var(--texte-doux); }

.resultat-km {
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: var(--rayon-petit);
  padding: 14px;
  margin: 8px 0 14px;
}
.resultat-km p { margin-bottom: 8px; }
.resultat-km > :last-child { margin-bottom: 0; }

/* ---------- Tableaux ---------- */

/* Défilement de côté sur téléphone, avec une ombre qui montre qu'il reste des colonnes. */
.defile {
  /* position: relative garde dans le cadre défilant le texte caché des en-têtes (.visuellement-cache,
     en position absolue) : sans elle, il sortait à droite et élargissait la page à 837 px sur téléphone. */
  position: relative;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
  background:
    linear-gradient(to right, var(--surface) 30%, rgba(255, 255, 255, 0)) left / 32px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 30%, rgba(255, 255, 255, 0)) right / 32px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, rgba(var(--teinte-ombre), 0.18), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, rgba(var(--teinte-ombre), 0.18), transparent) right / 12px 100% no-repeat scroll;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.97rem;
  font-variant-numeric: tabular-nums;
}
th, td {
  text-align: left;
  padding: 9px 10px;
  border-bottom: 1px solid var(--bord);
  vertical-align: middle;
}
th {
  font-weight: 700;
  font-size: 0.84rem;
  color: var(--texte);
  background: var(--discret);
  white-space: nowrap;
}
td.nombre, th.nombre { text-align: right; white-space: nowrap; font-family: var(--police-chiffres); }
th.nombre { font-family: inherit; }
tr.debut-jour td { border-top: 2px solid var(--primaire-bord); }
td.date-jour { white-space: nowrap; font-weight: 700; }
tr.mois-courant td { background: var(--surligneur); color: var(--texte); }
/* Sa ligne de fin de mois, surlignée en jaune vif comme dans son fichier. */
tr.fin-de-mois td { background: var(--surligneur); border-bottom: 2px solid var(--surligneur-fort); }
tr.fin-de-mois td.paiement { font-weight: 700; }
tr.total td { font-weight: 700; border-top: 2px solid var(--primaire-bord); border-bottom: 0; }
/* En-têtes de ligne (le mois, « Année ») : lus comme des en-têtes, dessinés comme des cellules. */
tbody th[scope="row"], tfoot th[scope="row"] { background: transparent; font-size: inherit; }
tr.mois-courant th[scope="row"] { background: var(--surligneur); }
tr.total th[scope="row"] { border-top: 2px solid var(--primaire-bord); border-bottom: 0; }
td input, td select { min-height: 40px; padding: 6px 8px; min-width: 90px; }
.cellule-actions { white-space: nowrap; text-align: right; }
.cellule-actions .btn + .btn { margin-left: 4px; }
.journal-tete { display: flex; flex-wrap: wrap; gap: 0 12px; align-items: flex-end; }
.journal-tete .champ { flex: 1 1 140px; }
.journal-tete .champ-recherche { flex: 2 1 220px; }

/* ---------- Mois ---------- */

.etiquette {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--primaire);
  margin: 0 0 4px;
}
.chiffre-cle {
  font-family: var(--police-titres);
  font-weight: var(--graisse-titres);
  font-size: 2.2rem;
  line-height: 1.1;
  margin: 4px 0 10px;
  font-variant-numeric: tabular-nums;
}

/* Compteur kilométrique : un tambour par chiffre. Le texte entier est lu dans .lecteur. */
.compteur {
  display: inline-flex;
  align-items: stretch;
  gap: 3px;
  padding: 7px;
  margin: 6px 0 14px;
  border-radius: 12px;
  background: linear-gradient(180deg, #2B2118, #0F0B07);
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 255, 255, 0.6), var(--ombre);
}
[data-theme='route'] .compteur { background: linear-gradient(180deg, #17322F, #08201D); }
[data-theme='classique'] .compteur { background: linear-gradient(180deg, #1F2A3A, #0B1220); }
.tambour {
  position: relative;
  display: grid;
  place-items: center;
  width: 0.78em;
  height: 1.3em;
  font-family: var(--police-compteur);
  font-weight: 700;
  font-size: clamp(2.2rem, 6vw, 3.4rem);
  line-height: 1;
  color: #FFFBEB;
  border-radius: 6px;
  background: linear-gradient(180deg, #3A3026 0%, #1C1610 48%, #0E0A06 52%, #2A221A 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.5);
  overflow: hidden;
  font-variant-numeric: tabular-nums;
}
[data-theme='route'] .tambour { background: linear-gradient(180deg, #23423E 0%, #12302C 48%, #0A2420 52%, #1E3B37 100%); color: #F0FDFA; }
[data-theme='classique'] .tambour { background: linear-gradient(180deg, #2C3A4F 0%, #172235 48%, #0E1626 52%, #26344A 100%); color: #F8FAFC; }
.tambour::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0.35), transparent 30%, transparent 70%, rgba(0, 0, 0, 0.35));
  pointer-events: none;
}
.tambour span { display: block; animation: rouler 0.45s cubic-bezier(0.2, 0.8, 0.2, 1) both; }
.tambour:nth-child(2) span { animation-delay: 0.04s; }
.tambour:nth-child(3) span { animation-delay: 0.08s; }
.tambour:nth-child(4) span { animation-delay: 0.12s; }
.tambour:nth-child(5) span { animation-delay: 0.16s; }
.tambour:nth-child(6) span { animation-delay: 0.2s; }
.tambour:nth-child(7) span { animation-delay: 0.24s; }
.tambour-dixieme { background: var(--accent); color: #FFFFFF; }
[data-theme] .tambour-dixieme { background: var(--accent); color: #FFFFFF; }
.compteur-sep {
  align-self: end;
  color: #FFFBEB;
  font-size: 2rem;
  line-height: 1;
  padding: 0 1px 4px;
}
.compteur-unite {
  align-self: center;
  margin-left: 8px;
  padding-right: 6px;
  color: #FFFBEB;
  font-family: var(--police-texte);
  font-weight: 700;
  font-size: 1.05rem;
}
@keyframes rouler {
  from { transform: translateY(-70%); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.lecteur { margin: 0 0 12px; }

/* Sa ligne jaune : Total Kilomètre, PAIEMENT, BUDGET RESTANT. */
.ligne-jaune {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  border: 2px solid var(--surligneur-fort);
  border-radius: var(--rayon-petit);
  background: var(--surligneur);
  overflow: hidden;
  margin: 4px 0 14px;
}
.ligne-jaune div { padding: 10px 14px; border-left: 1px solid var(--surligneur-fort); }
.ligne-jaune div:first-child { border-left: 0; }
.ligne-jaune span { display: block; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.04em; color: var(--surligneur-texte); }
.ligne-jaune strong { font-family: var(--police-chiffres); font-variant-numeric: tabular-nums; font-size: 1.25rem; color: var(--texte); }

.jauge {
  --seuil: 90%;
  position: relative;
  height: 14px;
  background: var(--discret);
  border: 1px solid var(--bord);
  border-radius: 999px;
  margin: 10px 0 6px;
}
.jauge > span {
  display: block;
  height: 100%;
  max-width: 100%;
  background: linear-gradient(90deg, var(--secondaire), var(--primaire));
  border-radius: 999px;
}
/* Le repère du seuil d'alerte choisi dans les Réglages. */
.jauge::after {
  content: '';
  position: absolute;
  top: -5px;
  bottom: -5px;
  left: var(--seuil);
  width: 2px;
  margin-left: -1px;
  background: var(--texte);
  border-radius: 1px;
}
.jauge.alerte > span { background: #C2410C; }
.jauge-legende { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; font-size: 0.9rem; }
.budget-reste { font-family: var(--police-titres); font-weight: var(--graisse-titres); font-size: 2rem; line-height: 1.1; margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.budget-reste.alerte { color: var(--danger); }

.liste-simple { margin: 0; padding-left: 20px; }
.liste-simple li { margin-bottom: 4px; }

/* ---------- Réglages ---------- */

.bloc-vehicule {
  border: 1px solid var(--bord);
  border-radius: var(--rayon-petit);
  padding: 12px 14px 2px;
  margin-bottom: 12px;
  background: var(--fond);
}
.bloc-vehicule .rangee { margin-bottom: 0; }
.champ-bareme { min-width: 5.5rem; max-width: 7rem; }

/* Les trois apparences en liste : aperçu à gauche, nom et description à droite. */
.themes { display: grid; gap: 10px; }
.theme-choix { position: relative; display: block; margin: 0; cursor: pointer; font-weight: 400; }
.theme-choix input { position: absolute; top: 14px; right: 14px; }
.theme-carte {
  display: grid;
  grid-template-columns: 104px 1fr;
  grid-template-rows: auto 1fr;
  column-gap: 14px;
  align-items: start;
  border: 2px solid var(--bord);
  border-radius: var(--rayon);
  padding: 12px;
  background: var(--surface);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.theme-choix input:checked + .theme-carte { border-color: var(--primaire); box-shadow: 0 0 0 3px var(--primaire-clair); }
.theme-choix input:focus-visible + .theme-carte { outline: 3px solid var(--anneau); outline-offset: 2px; }
.theme-apercu {
  grid-row: 1 / span 2;
  display: grid;
  grid-template-rows: 20px 1fr;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid rgba(0, 0, 0, 0.08);
}
.theme-apercu i { display: block; }
.theme-apercu .ta-tete { position: relative; }
.theme-apercu .ta-tete::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: repeating-linear-gradient(90deg, #FDE047 0 12px, transparent 12px 22px);
}
.theme-apercu .ta-corps { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 8px; }
.theme-apercu .ta-corps i { border-radius: 4px; background: #FFFFFF; border: 1px solid; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08); }
.theme-apercu .ta-corps i:last-child { background: #FFF3A3; border-color: #FDE047; }
.ta-carnet .ta-tete { background: linear-gradient(120deg, #78350F, #92400E); }
.ta-carnet .ta-corps { background: #FFFBEB; }
.ta-carnet .ta-corps i { border-color: #D6B48A; }
.ta-route .ta-tete { background: linear-gradient(120deg, #115E59, #0F766E); }
.ta-route .ta-corps { background: #F0FDFA; }
.ta-route .ta-corps i { border-color: #99D5CC; }
.ta-classique .ta-tete { background: linear-gradient(120deg, #142A47, #1E3A5F); }
.ta-classique .ta-corps { background: #F8FAFC; }
.ta-classique .ta-corps i { border-color: #B8C4D4; }
.theme-nom { display: block; font-weight: 700; font-size: 1.05rem; padding-right: 28px; }
.theme-nom-carnet { font-family: 'Crimson Pro', Georgia, serif; font-size: 1.25rem; }
.theme-nom-route { font-family: 'Barlow Condensed', 'Arial Narrow', sans-serif; font-size: 1.25rem; }
.theme-nom-classique { font-family: 'Lexend', 'Segoe UI', sans-serif; }
.theme-texte { display: block; font-size: 0.92rem; color: var(--texte-doux); }

/* ---------- Bienvenue ---------- */

.etapes { list-style: none; margin: 0 0 20px; padding: 0; display: grid; gap: 10px; counter-reset: etape; }
.etapes li {
  counter-increment: etape;
  display: grid;
  grid-template-columns: 40px 1fr;
  gap: 12px;
  align-items: start;
}
.etapes li::before {
  content: counter(etape);
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--primaire);
  color: var(--sur-primaire);
  font-weight: 700;
  font-family: var(--police-chiffres);
}

/* ---------- Message en bas ---------- */

.message {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: calc(var(--hauteur-nav) + 16px + env(safe-area-inset-bottom));
  z-index: 40;
  width: min(580px, calc(100% - 32px));
  background: var(--texte);
  color: #FFFFFF;
  border-radius: var(--rayon);
  padding: 12px 16px;
  display: flex;
  gap: 12px;
  align-items: center;
  box-shadow: 0 10px 30px rgba(var(--teinte-ombre), 0.35);
  animation: monter 0.2s ease-out both;
}
.message[hidden] { display: none; }
.message p { margin: 0; flex: 1; }
.message.erreur { background: var(--danger); }
.message .btn-lien { color: var(--surligneur-fort); }
.message :focus-visible { outline-color: var(--surligneur-fort); }
@keyframes monter {
  from { transform: translate(-50%, 12px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
@media (min-width: 760px) {
  .message { bottom: 24px; }
}

details { margin-top: 10px; }
summary { cursor: pointer; font-weight: 700; padding: 8px 0; color: var(--primaire); }
summary:hover { text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Téléphone ---------- */

@media (max-width: 759px) {
  body { font-size: 16px; }
  .entete-haut { padding: 12px 16px 14px; }
  .marque { font-size: 1.3rem; }
  .resume { margin: 0; width: 100%; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .puce { padding: 5px 8px; min-width: 0; }
  .puce-nom { font-size: 0.72rem; }
  .puce-valeur { font-size: 0.98rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  main { padding: 16px; }
  #alertes { padding: 0 16px; }
  .carte { padding: 16px; margin-bottom: 16px; }
  .barre-jour { padding: 14px 16px; }
  .jour-vehicule { margin-left: 0; width: 100%; }
  .segments-liste { display: flex; width: 100%; }
  .segment { flex: 1 1 0; min-width: 0; }
  .segment span { padding: 6px 10px; }
  .favoris { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .favori { min-height: 80px; }
  .defile { margin: 0 -16px; padding: 0 16px; }
  .tambour { font-size: 2.2rem; }
  .chiffre-cle { font-size: 1.8rem; }
}

/* ---------- Tableaux empilés sur téléphone ----------
   Le Journal, les mois, le barème et l'aperçu d'import ont trop de colonnes pour 390 px : chaque
   ligne devient une fiche, chaque valeur garde son nom (data-etiquette). Les en-têtes restent lus
   par les lecteurs d'écran. Les marges horizontales seules sont remises à zéro, pour garder .mt-*. */
@media (max-width: 759px) {
  .defile.defile-pile { margin-left: 0; margin-right: 0; padding: 0; overflow: visible; background: none; }
  table.pile, table.pile tbody, table.pile tfoot, table.pile tr { display: block; }
  table.pile thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  table.pile td, table.pile th[scope="row"] {
    display: block; border: 0; padding: 0; background: transparent; text-align: left; white-space: normal;
  }
  table.pile td:empty { display: none; }
  table.pile td[data-etiquette]::before {
    content: attr(data-etiquette);
    display: block;
    font-family: var(--police-texte, inherit);
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--texte-doux);
    white-space: normal;
  }
  table.pile tr.mois-courant, table.pile tr.fin-de-mois { background: var(--surligneur); }
  /* --texte-doux sur le jaune passe sous 4,5 de contraste : les étiquettes y prennent la teinte du surligneur. */
  table.pile tr.mois-courant td[data-etiquette]::before,
  table.pile tr.fin-de-mois td[data-etiquette]::before { color: var(--surligneur-texte); }
  table.pile td input, table.pile td select { min-width: 0; }

  /* Journal : une fiche par trajet, la date en tête de chaque journée, les km en grand à droite. */
  .pile-journal tbody tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas:
      "date date date"
      "client client km"
      "commune commune km"
      "vehicule vehicule vehicule"
      "total paiement budget"
      "actions actions actions";
    column-gap: 12px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--bord);
  }
  .pile-journal tbody tr.debut-jour { border-top: 2px solid var(--primaire-bord); }
  .pile-journal tbody tr.fin-de-mois { border-bottom: 2px solid var(--surligneur-fort); }
  .pile-journal .c-date { grid-area: date; font-size: 1.02rem; margin-bottom: 4px; }
  .pile-journal .c-client { grid-area: client; font-weight: 700; overflow-wrap: anywhere; }
  .pile-journal .c-commune { grid-area: commune; overflow-wrap: anywhere; }
  .pile-journal .c-km { grid-area: km; align-self: center; text-align: right; font-size: 1.3rem; font-weight: 700; }
  .pile-journal .c-vehicule { grid-area: vehicule; margin-top: 2px; }
  /* Même spécificité que la règle générale des étiquettes, écrite après elle : « Véhicule Clio » sur une ligne. */
  table.pile-journal td.c-vehicule::before { display: inline; margin-right: 6px; }
  .pile-journal .c-total { grid-area: total; margin-top: 8px; }
  .pile-journal .c-paiement { grid-area: paiement; margin-top: 8px; }
  .pile-journal .c-budget { grid-area: budget; margin-top: 8px; }
  /* Le total cumulé ne s'affiche qu'avec le paiement, sur la dernière ligne du mois, comme dans son fichier. */
  .pile-journal tr:not(.fin-de-mois) .c-total { display: none; }
  .pile-journal .c-actions { grid-area: actions; text-align: left; margin-top: 4px; }
  .pile-journal tbody tr.edition { display: block; padding: 12px; background: var(--discret); }
  .pile-journal tr.edition td { margin-bottom: 10px; }
  .pile-journal tr.edition td input, .pile-journal tr.edition td select { width: 100%; }
  .pile-journal tr.edition td[data-etiquette]::before { color: var(--texte); margin-bottom: 4px; }
  .pile-journal tr.edition .cellule-actions { text-align: left; margin-bottom: 0; }
  .pile-journal tfoot tr { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: 12px; border-top: 2px solid var(--primaire-bord); }
  .pile-journal tfoot td.nombre { text-align: right; font-size: 1.2rem; }

  /* Mois par mois : le mois et son paiement en tête, le détail dessous. */
  .pile-mois tbody tr, .pile-mois tfoot tr {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px;
    border-bottom: 1px solid var(--bord);
  }
  .pile-mois tfoot tr { border-top: 2px solid var(--primaire-bord); border-bottom: 0; }
  /* Valeurs alignées en bas : une étiquette sur deux lignes (« km Véhicule 2 ») ne décale plus le chiffre. */
  .pile-mois tbody tr, .pile-mois tfoot tr, .pile-cases tbody tr { align-items: end; }
  .pile-mois .c-mois { grid-column: 1 / span 2; grid-row: 1; font-size: 1.1rem; }
  /* Un mois sans trajet tient sur une ligne : son nom et « — ». Le détail reste dans le tableau sur ordinateur. */
  .pile-mois tr.mois-vide td:not(.c-paiement) { display: none; }
  .pile-mois tr.mois-vide .c-paiement::before { display: none; }
  .pile-mois tr.mois-vide .c-mois { font-weight: 400; color: var(--texte-doux); }
  .pile-mois tr.mois-courant.mois-vide .c-mois { color: var(--surligneur-texte); }
  .pile-mois .c-paiement { grid-column: 3; grid-row: 1; text-align: right; font-size: 1.1rem; font-weight: 700; }

  /* Barème : une puissance par bloc, chaque tranche avec ses deux nombres sur une ligne. */
  .pile-bareme tbody tr { padding: 12px 0; border-bottom: 1px solid var(--bord); }
  .pile-bareme .c-titre { font-weight: 700; font-size: 1.02rem; }
  .pile-bareme td[data-etiquette] { margin-top: 8px; }
  .pile-bareme td[data-etiquette]::before { margin-bottom: 4px; }
  .pile-bareme .champ-bareme { width: 6.5rem; min-width: 0; max-width: none; }

  /* Aperçu d'import : un onglet par bloc, ses chiffres sur deux colonnes. */
  .pile-cases tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--bord);
  }
  .pile-cases .c-titre { grid-column: 1 / -1; font-weight: 700; font-size: 1.02rem; }
  .pile-cases td.nombre { text-align: left; }
}

/* ---------- Mouvement réduit ---------- */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-delay: 0s !important;
    transition-duration: 0.01ms !important;
  }
  .favori:hover, .favori:active, .btn:active { transform: none; }
}

/* ---------- Marges utilitaires ----------
   En fin de fichier exprès : une règle de composant écrite plus haut (.etiquette { margin: 0 … })
   ne doit pas effacer la marge demandée par la classe. Ne pas remonter ce bloc. */
.mt-0 { margin-top: 0; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 16px; }
.mt-4 { margin-top: 24px; }
