/* Le Grand Livre, thème « Doux » : fond gris-bleu, cartes blanches très arrondies, une couleur par catégorie,
   un accent bleu. Mode clair et mode sombre (réglage de l'appareil, ou choix dans l'en-tête). */

@font-face { font-family: "Rubik"; src: url("/fonts/rubik-latin-wght-normal.woff2") format("woff2"); font-weight: 300 900; font-style: normal; font-display: swap; }
@font-face { font-family: "Rubik"; src: url("/fonts/rubik-latin-wght-italic.woff2") format("woff2"); font-weight: 300 900; font-style: italic; font-display: swap; }

:root {
  color-scheme: light;
  --fond: #EEF1F6;
  --carte: #FFFFFF;
  --carte-2: #F5F7FB;
  --bord: #E1E6EF;
  --texte: #1D2433;
  --texte-2: #3E4759;
  --pale: #5B6478;
  --accent: #3D5BD9;
  --accent-texte: #FFFFFF;
  --accent-doux: #E6EEFF;
  --accent-fonce: #2A43A8;
  --orange: #E08A3C;
  --orange-doux: #FDEBDD;
  --orange-texte: #8F4310;
  --rouge: #B4314F;
  --rouge-doux: #FCEDEF;
  --vert: #2F7D62;
  --vert-doux: #E3F3EE;
  --voile: rgba(29, 36, 51, .38);
  --ombre-flottante: 0 12px 32px rgba(29, 36, 51, .16);
  --cat-1: #5B7FD6; --cat-2: #E08A3C; --cat-3: #3FA37A; --cat-4: #3BA3B8;
  --cat-5: #D9617E; --cat-6: #A46BD1; --cat-7: #C29A1E; --cat-8: #7A879E;
  --rayon: 22px;
  --rayon-petit: 12px;
  --police: "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --fond: #0F1218; --carte: #181C25; --carte-2: #20252F; --bord: #2A303C;
    --texte: #E8EBF2; --texte-2: #C9CFDA; --pale: #A0A8B8;
    --accent: #8098FF; --accent-texte: #0F1218; --accent-doux: #222C4A; --accent-fonce: #A9B8FF;
    --orange: #F0A05A; --orange-doux: #3A2A1C; --orange-texte: #F5B77E;
    --rouge: #FF8FA3; --rouge-doux: #3A1F27; --vert: #6FD3AE; --vert-doux: #1B3329;
    --voile: rgba(0, 0, 0, .55); --ombre-flottante: 0 12px 32px rgba(0, 0, 0, .5);
    --cat-1: #7F9BEA; --cat-2: #F0A05A; --cat-3: #5CC497; --cat-4: #57C0D4;
    --cat-5: #EC7F98; --cat-6: #BE8EE6; --cat-7: #D9B746; --cat-8: #98A4BA;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --fond: #0F1218; --carte: #181C25; --carte-2: #20252F; --bord: #2A303C;
  --texte: #E8EBF2; --texte-2: #C9CFDA; --pale: #A0A8B8;
  --accent: #8098FF; --accent-texte: #0F1218; --accent-doux: #222C4A; --accent-fonce: #A9B8FF;
  --orange: #F0A05A; --orange-doux: #3A2A1C; --orange-texte: #F5B77E;
  --rouge: #FF8FA3; --rouge-doux: #3A1F27; --vert: #6FD3AE; --vert-doux: #1B3329;
  --voile: rgba(0, 0, 0, .55); --ombre-flottante: 0 12px 32px rgba(0, 0, 0, .5);
  --cat-1: #7F9BEA; --cat-2: #F0A05A; --cat-3: #5CC497; --cat-4: #57C0D4;
  --cat-5: #EC7F98; --cat-6: #BE8EE6; --cat-7: #D9B746; --cat-8: #98A4BA;
}

/* ─── Base ─────────────────────────────────────────────────────────────────── */

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--fond);
  color: var(--texte);
  font: 400 15px/1.5 var(--police);
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-fonce); text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.2; }
h2 { font-size: 17px; }
h3 { font-size: 15px; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
::selection { background: var(--accent-doux); }

.etiquette { font-size: 13px; font-weight: 500; color: var(--pale); }
.pale { color: var(--pale); }
.rouge, .crediteur, .negatif { color: var(--rouge); }
.vert { color: var(--vert); }
.m { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.c { text-align: center; }
.nowrap { white-space: nowrap; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.point { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; background: var(--cat-8); margin-right: 7px; vertical-align: 1px; }

/* ─── En-tête et navigation ────────────────────────────────────────────────── */

.barre-haut {
  max-width: 1180px; margin: 0 auto; padding: 20px 24px 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 14px;
}
.marque { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: var(--texte); }
.marque:hover { color: var(--texte); text-decoration: none; }
.marque svg { flex: none; }
.navigation {
  flex: 0 1 auto; min-width: 0; display: flex; gap: 2px; padding: 4px; background: var(--carte); border-radius: 999px;
  overflow-x: auto; scrollbar-width: none;
}
.navigation::-webkit-scrollbar { display: none; }
.navigation a {
  flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 13px; border-radius: 999px;
  color: var(--texte-2); white-space: nowrap;
}
.navigation a:hover { background: var(--carte-2); color: var(--texte); text-decoration: none; }
.navigation a[aria-current="page"] { background: var(--texte); color: var(--fond); font-weight: 500; }
.navigation .compteur { padding: 0 7px; border-radius: 999px; background: var(--orange-doux); color: var(--orange-texte); font-size: 12px; font-weight: 600; }
.navigation a[aria-current="page"] .compteur { background: var(--orange); color: #1D2433; }
.outils-haut { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.rond {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--carte); color: var(--texte-2);
  display: inline-grid; place-items: center; cursor: pointer;
}
.rond:hover { background: var(--carte-2); color: var(--texte); }
.menu-compte { position: relative; }
.menu-compte .menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 220px; padding: 6px;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 16px; box-shadow: var(--ombre-flottante);
  display: flex; flex-direction: column;
}
.menu-compte .menu button, .menu-compte .menu a {
  text-align: left; border: 0; background: none; padding: 10px 12px; border-radius: 10px; cursor: pointer; color: var(--texte);
}
.menu-compte .menu button:hover, .menu-compte .menu a:hover { background: var(--carte-2); text-decoration: none; }
.menu-compte .menu [aria-pressed="true"] { color: var(--accent); font-weight: 500; }
.menu-compte .menu hr { border: 0; border-top: 1px solid var(--bord); margin: 6px 4px; }

/* ─── Page ─────────────────────────────────────────────────────────────────── */

.page { max-width: 1180px; margin: 0 auto; padding: 8px 24px 72px; }
.titre-page { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin: 10px 0 20px; }
.titre-page h1 { font-size: 30px; letter-spacing: -.01em; }
.titre-page h1 em { font-style: normal; font-weight: 400; color: var(--pale); }
.titre-page .sous-titre { color: var(--pale); margin-top: 4px; }
.chapeau { max-width: 70ch; color: var(--pale); margin: 0 0 18px; }

.carte, .page > section, .pile > section, .colonnes > section {
  background: var(--carte); border-radius: var(--rayon); padding: 22px 24px;
}
.page > section + section, .page > section + .carte, .page > .carte + section, .page > .carte + .carte,
.colonnes + section, .colonnes + .colonnes, section + .colonnes, .carte + .colonnes { margin-top: 20px; }
.page > section:empty { display: none; }
.carte section + section, section section + section { margin-top: 28px; }
.pile { display: flex; flex-direction: column; gap: 20px; }
.pile > .colonnes + .colonnes, .pile > section + .colonnes, .pile > .colonnes + section { margin-top: 0; }
.colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 20px; }
.titre-section { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.titre-section h2 small { font-weight: 400; color: var(--pale); font-size: 15px; }

/* ─── Boutons et champs ────────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 18px;
  border: 1px solid var(--bord); border-radius: 999px; background: var(--carte); color: var(--texte);
  font: 500 14px/1 var(--police); white-space: nowrap; cursor: pointer; text-decoration: none;
}
.btn:hover { background: var(--carte-2); color: var(--texte); text-decoration: none; }
.btn.plein { background: var(--accent); border-color: transparent; color: var(--accent-texte); }
.btn.plein:hover { background: var(--accent-fonce); color: var(--accent-texte); }
.btn.discret { border-color: transparent; background: transparent; color: var(--accent); padding: 0 10px; }
.btn.discret:hover { background: var(--accent-doux); }
.btn.danger { border-color: transparent; background: var(--rouge-doux); color: var(--rouge); }
.btn.danger:hover { background: var(--rouge); color: var(--carte); }
.btn:disabled { opacity: .45; cursor: default; pointer-events: none; }
.btn kbd { font: inherit; font-size: 12px; opacity: .75; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions .pousse { margin-left: auto; }

label { display: grid; gap: 5px; }
label > span { font-size: 13px; font-weight: 500; color: var(--pale); }
input[type="text"], input[type="search"], input[type="password"], input[type="date"], input[type="number"], input[type="url"], input:not([type]), select, textarea {
  width: 100%; min-width: 0; min-height: 42px; padding: 9px 12px;
  border: 1px solid transparent; border-radius: var(--rayon-petit); background: var(--carte-2); color: var(--texte);
  font: 400 15px/1.3 var(--police);
}
textarea { min-height: 0; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--pale); opacity: .85; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); background: var(--carte); box-shadow: 0 0 0 3px var(--accent-doux); }
select { cursor: pointer; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 17px; height: 17px; margin: 0; }
.case { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; }
.case > span { font-size: 15px; font-weight: 400; color: var(--texte); }
.formulaire { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 14px 18px; }
.formulaire .large { grid-column: 1 / -1; }
.formulaire .double { grid-column: span 2; }
.aide { font-size: 13px; color: var(--pale); }

/* ─── Tableaux ─────────────────────────────────────────────────────────────── */

.defile { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.registre { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.registre th {
  text-align: left; padding: 8px 10px; font-size: 13px; font-weight: 500; color: var(--pale);
  border-bottom: 1px solid var(--bord); white-space: nowrap; vertical-align: bottom;
}
.registre th.m { text-align: right; }
.registre td { padding: 10px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.registre tbody tr:hover > td { background: var(--carte-2); }
.registre .num, .registre .compte { font-size: 13px; color: var(--pale); white-space: nowrap; }
.registre .sous { display: block; font-size: 12.5px; color: var(--pale); }
.registre tr.titre td { padding-top: 18px; font-size: 13px; font-weight: 600; color: var(--pale); border-bottom: 0; }
.registre tr.sous-total td { font-weight: 600; background: var(--carte-2); border-bottom: 0; }
.registre tr.total td { font-weight: 600; font-size: 15.5px; background: var(--accent-doux); color: var(--texte); border-bottom: 0; }
.registre tr.sous-total td:first-child, .registre tr.total td:first-child, .registre tr.resultat td:first-child { border-radius: 12px 0 0 12px; }
.registre tr.sous-total td:last-child, .registre tr.total td:last-child, .registre tr.resultat td:last-child { border-radius: 0 12px 12px 0; }
.registre tr.detail td { font-size: 13.5px; color: var(--texte-2); }
.registre tr.detail td:first-child { padding-left: 28px; }
.registre tr.resultat td { font-weight: 600; background: var(--carte-2); border-bottom: 0; }
.registre tr.resultat.final td { font-size: 17px; background: var(--accent-doux); }
.registre tr + tr.resultat td, .registre tr.resultat + tr td { border-top: 6px solid var(--carte); }
.registre tr.cliquable { cursor: pointer; }
.registre tr.selection > td { background: var(--accent-doux) !important; }
.registre tfoot td { border-bottom: 0; }
.vide { padding: 30px 10px; color: var(--pale); text-align: center; }

.pastille { display: inline-block; padding: 2px 9px; border-radius: 999px; background: var(--carte-2); color: var(--texte-2); font-size: 12px; font-weight: 500; white-space: nowrap; }
.pastille.rouge { background: var(--rouge-doux); color: var(--rouge); }
.pastille.vert { background: var(--vert-doux); color: var(--vert); }
.pointe { color: var(--vert); font-size: 13px; font-weight: 500; }

/* ─── Chiffres, listes, jauges ─────────────────────────────────────────────── */

.chiffre { font-size: clamp(36px, 5vw, 52px); font-weight: 600; letter-spacing: -.02em; line-height: 1.05; }
.chiffre small { font-size: .5em; font-weight: 500; color: var(--pale); }
.extrait { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
.ligne-extrait { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--bord); }
.ligne-extrait .points { display: none; }
.ligne-extrait.total { border-bottom: 0; font-weight: 600; font-size: 16px; }
.puces-info { display: flex; flex-wrap: wrap; gap: 8px; }
.puce-info { padding: 5px 12px; border-radius: 999px; font-size: 13px; font-weight: 500; background: var(--accent-doux); color: var(--accent-fonce); }
.puce-info.orange { background: var(--orange-doux); color: var(--orange-texte); }
.puce-info.vert { background: var(--vert-doux); color: var(--vert); }

.alertes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.alertes li { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 16px; background: var(--accent-doux); color: var(--texte); }
.alertes li.attention { background: var(--orange-doux); }
.alertes li.urgent { background: var(--rouge-doux); }
.alertes li a { color: var(--texte); }
.alertes li svg { flex: none; margin-top: 1px; }

.jauge { position: relative; height: 8px; border-radius: 999px; background: var(--carte-2); min-width: 80px; }
.jauge > i { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--accent); }
.jauge > b { position: absolute; top: -4px; bottom: -4px; width: 2px; border-radius: 2px; background: var(--texte); }

svg.graphique { width: 100%; height: auto; display: block; overflow: visible; }
svg.graphique text { font: 400 13px var(--police); fill: var(--pale); }
svg.graphique .axe { stroke: var(--bord); stroke-width: 1.5; }
svg.graphique .reglure { stroke: var(--bord); stroke-width: 1; stroke-dasharray: 3 4; }
svg.graphique .produits { fill: var(--accent); }
svg.graphique .charges { fill: var(--orange); }
.legende { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; color: var(--pale); margin-top: 8px; }
.legende i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legende i.plein { background: var(--accent); }
.legende i.hache { background: var(--orange); }

/* ─── Situation ────────────────────────────────────────────────────────────── */

.accroche { display: flex; flex-wrap: wrap; gap: 24px 32px; align-items: center; }
.accroche > div { flex: 1 1 320px; min-width: 0; }
.anneau { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.anneau svg { flex: none; }
.anneau ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 14px; }
.anneau li { display: flex; align-items: center; }
.anneau li span:nth-child(2) { min-width: 120px; }
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tuile { padding: 14px; border-radius: 16px; background: var(--carte-2); display: flex; flex-direction: column; gap: 4px; }
.tuile .montant { font-size: 19px; font-weight: 600; }
.calendrier { display: flex; flex-direction: column; gap: 4px; }
.calendrier .jour { flex: none; width: 46px; height: 46px; border-radius: 14px; background: var(--carte-2); display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; }
.calendrier .jour b { font-weight: 600; }
.calendrier .jour small { font-size: 11px; color: var(--pale); }
.calendrier > div { display: flex; align-items: center; gap: 12px; padding: 4px 0; }
.calendrier .quoi { flex: 1; min-width: 0; }
.calendrier .quoi small { display: block; font-size: 13px; color: var(--pale); }
.lignes-douces { display: flex; flex-direction: column; gap: 8px; }
.lignes-douces > a, .lignes-douces > div { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 12px 16px; border-radius: 16px; background: var(--carte-2); color: var(--texte); }
.lignes-douces > a:hover { text-decoration: none; background: var(--accent-doux); }
.lignes-douces .quand { flex: none; width: 70px; color: var(--pale); font-size: 14px; }
.lignes-douces .quoi { flex: 1 1 200px; min-width: 0; }
.lignes-douces .quoi small { display: block; font-size: 12.5px; color: var(--pale); }
.lignes-douces .cat { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; background: var(--carte); font-size: 13px; }
.lignes-douces .combien { flex: none; min-width: 90px; text-align: right; font-weight: 600; }

/* ─── Grille de saisie (brouillard) ────────────────────────────────────────── */

.barre { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: center; margin-bottom: 14px; }
.barre .filtres { display: flex; gap: 4px; flex-wrap: wrap; }
.barre .filtres button { border: 0; background: var(--carte-2); padding: 7px 13px; border-radius: 999px; font-size: 13px; color: var(--texte-2); cursor: pointer; }
.barre .filtres button[aria-pressed="true"] { background: var(--texte); color: var(--fond); }

table.grille { width: 100%; border-collapse: collapse; table-layout: fixed; min-width: 1200px; }
.grille th { text-align: left; padding: 6px 8px; font-size: 13px; font-weight: 500; color: var(--pale); border-bottom: 1px solid var(--bord); }
.grille th.m { text-align: right; }
.grille td { padding: 3px 2px; border-bottom: 1px solid var(--bord); vertical-align: top; position: relative; }
.grille td.etat { padding: 8px 4px; font-size: 12px; color: var(--pale); text-align: center; white-space: nowrap; }
.grille td.etat select { width: 76px; min-height: 32px; padding: 4px 6px; font-size: 13px; border-radius: 8px; vertical-align: middle; }
.grille input, .grille select { min-height: 36px; padding: 7px 8px; border: 1px solid transparent; border-radius: 9px; background: transparent; font-size: 14.5px; }
.grille input:focus, .grille select:focus { background: var(--accent-doux); border-color: transparent; box-shadow: none; }
.grille input.m { text-align: right; }
.grille input.faux { box-shadow: inset 0 -2px 0 var(--rouge); }
.grille .sous { display: block; padding: 0 9px 5px; font-size: 12px; color: var(--pale); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grille tr.erreur td { background: var(--rouge-doux); }
.grille tr.note td.note { padding: 2px 10px 10px 40px; font-size: 13px; color: var(--rouge); }
.grille tr.info td.note { color: var(--pale); }
.grille tr.ignoree td input, .grille tr.ignoree td select, .grille tr.ignoree .sous { text-decoration: line-through; color: var(--pale); }
.grille tr.ventil td { background: var(--carte-2); }
.grille .lecture { padding: 8px 9px; display: block; color: var(--pale); font-style: italic; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grille .x { border: 0; background: none; color: var(--pale); cursor: pointer; padding: 6px 5px; font-size: 15px; border-radius: 8px; }
.grille .x:hover { color: var(--rouge); background: var(--rouge-doux); }
.pied-bordereau { display: flex; flex-wrap: wrap; gap: 8px 28px; align-items: baseline; justify-content: flex-end; padding: 14px 4px 4px; }
.pied-bordereau .total { font-weight: 600; }
.raccourcis { margin-top: 14px; font-size: 13px; line-height: 1.9; color: var(--pale); }
.raccourcis kbd { font: 500 12px var(--police); padding: 1px 6px; border-radius: 6px; background: var(--carte); border: 1px solid var(--bord); color: var(--texte-2); }

/* Liste déroulante des cases (catégorie, tiers, compte) */
.choix {
  position: fixed; z-index: 60; max-height: 300px; overflow-y: auto; min-width: 240px; margin: 0; padding: 6px; list-style: none;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; box-shadow: var(--ombre-flottante);
}
.choix li { display: flex; justify-content: space-between; gap: 14px; padding: 7px 10px; border-radius: 9px; cursor: pointer; font-size: 14.5px; }
.choix li small { color: var(--pale); font-size: 12.5px; white-space: nowrap; }
.choix li.groupe { cursor: default; padding: 8px 10px 3px; font-size: 12px; font-weight: 600; color: var(--pale); }
.choix li[aria-selected="true"] { background: var(--accent-doux); }
.choix li.nouveau { color: var(--accent); }

/* ─── Fenêtres ─────────────────────────────────────────────────────────────── */

dialog.fiche {
  border: 0; border-radius: var(--rayon); padding: 0; width: min(760px, calc(100vw - 24px)); max-height: calc(100dvh - 40px);
  background: var(--carte); color: var(--texte); box-shadow: var(--ombre-flottante);
}
dialog.fiche::backdrop { background: var(--voile); }
.fiche header { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 20px 24px 6px; }
.fiche header h2 { font-size: 20px; }
.fiche .corps { padding: 12px 24px 18px; overflow-y: auto; max-height: calc(100dvh - 180px); }
.fiche footer { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; padding: 14px 24px 20px; border-top: 1px solid var(--bord); }
.fiche footer .gauche { margin-right: auto; }
.fiche .fermer { width: 36px; height: 36px; border: 0; border-radius: 50%; background: var(--carte-2); color: var(--pale); font-size: 20px; line-height: 1; cursor: pointer; }
.fiche .fermer:hover { color: var(--texte); }

.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 80; transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px; max-width: min(520px, calc(100vw - 32px));
  padding: 12px 20px; border-radius: 999px; background: var(--texte); color: var(--fond);
  font-size: 14.5px; box-shadow: var(--ombre-flottante); animation: monter .2s ease-out;
}
.toast.erreur { background: var(--rouge); color: #FFFFFF; border-radius: 18px; }
.toast button { border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; cursor: pointer; padding: 0; }
@keyframes monter { from { transform: translate(-50%, 12px); opacity: 0; } to { transform: translate(-50%, 0); opacity: 1; } }

/* ─── Onglets ──────────────────────────────────────────────────────────────── */

.onglets { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 4px; margin-bottom: 18px; background: var(--carte); border-radius: 999px; max-width: 100%; }
.onglets button { border: 0; background: none; min-height: 36px; padding: 0 15px; border-radius: 999px; font-size: 14px; color: var(--texte-2); cursor: pointer; }
.onglets button:hover { background: var(--carte-2); }
.onglets button[aria-selected="true"] { background: var(--texte); color: var(--fond); font-weight: 500; }

/* ─── États ────────────────────────────────────────────────────────────────── */

.bilan { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: start; }
.bilan .defile table.registre { min-width: 520px; }
.etat-titre { margin: 0 0 16px; }
.etat-titre h2 { font-size: 20px; }
.etat-titre p { color: var(--pale); }
.controle { font-size: 14px; font-weight: 500; }
.pivot { min-width: 720px; }
.pivot td.m { font-size: 13.5px; }
.pivot td.fort { font-weight: 600; }

.controles { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
.controles li { display: flex; gap: 10px; align-items: center; padding: 9px 14px; border-radius: 12px; background: var(--carte-2); }
.controles li::before { content: ""; flex: none; width: 10px; height: 10px; border-radius: 50%; background: var(--orange); }
.controles li.ok::before { background: var(--vert); }
.controles li.bloquant:not(.ok) { background: var(--rouge-doux); }
.controles li.bloquant:not(.ok)::before { background: var(--rouge); }

/* ─── Connexion et saisie rapide ───────────────────────────────────────────── */

.connexion { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.connexion .carte { width: min(420px, 100%); padding: 32px; }
.connexion h1 { font-size: 28px; margin: 14px 0 4px; }
.connexion form { display: grid; gap: 16px; margin-top: 22px; }

.vite-montant { font-size: 44px !important; font-weight: 600; text-align: right; min-height: 72px !important; }
.vite-sens { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; padding: 4px; margin: 12px 0 16px; background: var(--carte-2); border-radius: 999px; }
.vite-sens button { border: 0; background: none; min-height: 42px; border-radius: 999px; font-size: 14px; color: var(--texte-2); cursor: pointer; }
.vite-sens button[aria-pressed="true"] { background: var(--texte); color: var(--fond); font-weight: 500; }
.puces { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0 16px; }
.puces button { display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border: 1px solid var(--bord); border-radius: 999px; background: var(--carte); color: var(--texte); font-size: 14.5px; cursor: pointer; }
.puces button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-doux); color: var(--accent-fonce); font-weight: 500; }
.attente { font-size: 13px; font-weight: 500; color: var(--orange-texte); background: var(--orange-doux); padding: 3px 10px; border-radius: 999px; }

/* ─── Petits écrans ────────────────────────────────────────────────────────── */

/* Quand la navigation ne tient plus à côté de la marque et des outils, elle passe sur sa propre ligne. */
@media (max-width: 1180px) {
  .navigation { order: 3; flex: 1 1 100%; }
}

@media (max-width: 860px) {
  .barre-haut { padding: 12px 14px 8px; }
  .page { padding: 4px 14px 56px; }
  .carte, .page > section, .colonnes > section { padding: 18px 16px; border-radius: 18px; }
  .titre-page h1 { font-size: 25px; }
  .bilan { grid-template-columns: 1fr; }
  .formulaire .double { grid-column: 1 / -1; }
}

@media (max-width: 440px) {
  .marque span { display: none; }
  .barre-haut { gap: 10px; }
}

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

/* ─── Impression ───────────────────────────────────────────────────────────── */

.imprime-seulement { display: none; }
@media print {
  @page { size: A4; margin: 14mm 12mm; }
  :root { --fond: #FFFFFF; --carte: #FFFFFF; --carte-2: #F3F4F7; }
  body { font-size: 10.5pt; }
  .barre-haut, .actions, .barre, .onglets, .no-print, .toast, dialog { display: none !important; }
  .page { max-width: none; padding: 0; }
  .carte, .page > section { padding: 0; border-radius: 0; }
  .imprime-seulement { display: block; }
  .registre tr { break-inside: avoid; }
  .bilan { grid-template-columns: 1fr 1fr; gap: 8mm; }
}

/* Un bloc titré à l'intérieur d'une carte (à confirmer, sauvegardes…) laisse respirer ce qui suit. */
.carte > section:not(:last-child) { margin-bottom: 26px; }
