@charset "UTF-8";

/* ==========================================================================
   RestoConnect — console.css
   Feuille unique de la console de gestion. Remplace intégralement l'ancien
   fichier ; ui.css reste chargé après pour les composants applicatifs.

   Ordre de chargement : bootstrap 5.3 → console.css → ui.css.
   Bootstrap est nourri par ses propres variables (--bs-*) plutôt que combattu :
   c'est ce qui permet de ne pas écrire un seul !important sur les boutons,
   dont les règles d'état (:active, :disabled) pèsent plus lourd que les nôtres.

   Trois règles gouvernent tout le fichier :
     1. on choisit un RÔLE, jamais une valeur ;
     2. la densité se prend sur le vide, jamais sur le corps du texte ;
     3. un état se dit par un seul signal et ne déplace aucun pixel.
   ========================================================================== */


/* ═══════════════════════════════════════════════════════ ① LES JETONS ═══ */

:root {

  /* ---- Les deux familles, et leur frontière ---------------------------
     Inter porte toute l'information. Plus Jakarta Sans ne sert que
     l'identité — titre de page et monogramme — et ne rend jamais un chiffre :
     son 1, son 4 et son 7 ne ressemblent pas à ceux d'Inter, et le même
     montant lu dans une tuile puis dans un tableau cesserait d'être reconnu
     comme le même. */
  --police-donnee:   "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --police-identite: "Plus Jakarta Sans", "Inter", system-ui, sans-serif;
  --police-mono:     "SFMono-Regular", "Cascadia Mono", Consolas, "Liberation Mono", monospace;

  /* ---- L'échelle : neuf crans, tous entiers ---------------------------
     Le demi-pixel est banni : il rend flou sur les 1366×768 qui équipent la
     moitié des salles, et l'écart entre 12,5 et 13 px n'est perçu par
     personne. Quatre crans serrés en bas — c'est là que vit un outil de
     gestion — des sauts francs en haut, où se lit la hiérarchie. */
  --t-micro:   11px;   /* capitales, horodatages, micro-libellés            */
  --t-second:  12px;   /* méta, aides courtes, seconde ligne de cellule     */
  --t-corps:   13px;   /* LE DÉFAUT : cellules, listes, navigation, boutons */
  --t-accent:  14px;   /* champs de saisie, valeur forte, texte de lecture  */
  --t-carte:   16px;   /* titre de carte, de modale, de tiroir ; total      */
  --t-section: 20px;   /* titre de section                                  */
  --t-page:    26px;   /* titre de page — un seul par écran                 */
  --t-chiffre: 32px;   /* chiffre d'indicateur                              */
  --t-heros:   40px;   /* chiffre héros — un seul par écran                 */

  /* Alias de compatibilité : les vues et ui.css emploient les deux jeux de
     noms. Une seule valeur derrière chaque paire. */
  --t-secondaire: var(--t-second);
  --t-corps-fort: var(--t-accent);
  --t-titre-carte: var(--t-carte);
  --t-titre-section: var(--t-section);
  --t-titre-page: var(--t-page);
  --t-chiffre-hero: var(--t-heros);

  /* ---- Quatre graisses, une règle chacune -----------------------------
     Le 800 est supprimé du projet : sous 20 px, Inter ExtraBold ferme ses
     contreformes et le mot grossit sans se hiérarchiser. Le 700 est interdit
     sous 16 px. */
  --g-normal: 400;
  --g-donnee: 500;
  --g-fort:   600;
  --g-titre:  700;

  /* ---- L'interlignage décroît quand la taille monte ------------------- */
  --lh-texte:   1.5;    /* paragraphes de lecture, bornés à --mesure        */
  --lh-donnee:  1.35;   /* cellules, listes, libellés                       */
  --lh-titre:   1.25;   /* de 16 à 26 px                                    */
  --lh-chiffre: 1.1;    /* au-delà de 26 px                                 */

  /* ---- Le resserrement optique est fonction de la taille, et de rien
     d'autre : nul sous 20 px, où il ne ferait que coller les lettres. */
  --ls-caps:     .06em;
  --ls-titre:   -.015em;
  --ls-chiffre: -.025em;

  --mesure: 68ch;          /* au-delà, l'œil rate le retour à la ligne      */
  --devise-echelle: .72em; /* le symbole monétaire est une unité, pas une donnée */

  /* ---- Les neutres : treize crans, une frontière ----------------------
     La marche entre --n-300 et --n-400 est volontairement large : c'est la
     limite entre ce qui décore (bordures, séparateurs) et ce qui porte de
     l'information (texte, contour de contrôle). Rien n'atterrit entre les deux. */
  --n-0:   #ffffff;
  --n-25:  #fbfcfd;
  --n-50:  #f5f7fa;
  --n-100: #edf0f4;
  --n-200: #e2e6ec;
  --n-300: #cfd5de;
  --n-400: #838da0;   /* 3,34:1 sur blanc — plancher WCAG 1.4.11           */
  --n-500: #667085;   /* 4,97:1 — gris le plus clair autorisé pour du texte */
  --n-600: #4d5766;   /* 7,32:1                                            */
  --n-700: #344054;   /* 10,5:1                                            */
  --n-800: #1a2233;   /* 15,9:1 — porte l'anneau de focus                  */
  --n-900: #101828;   /* 18,2:1                                            */
  --n-950: #0a0e18;   /* teinte des ombres et du voile, en rgba uniquement */

  /* ---- Alias de rôle : c'est eux que les règles emploient ------------- */
  --surface:       var(--n-0);
  --surface-2:     var(--n-25);
  --fond:          var(--n-50);
  --bordure:       var(--n-200);
  --bordure-forte: var(--n-300);
  --champ-bordure: var(--n-400);
  --encre:         var(--n-900);
  --encre-2:       var(--n-700);
  --encre-3:       var(--n-500);
  --encre-etiquette: var(--n-500);
  /* Pont de reprise. --encre-4 valait #98a2b3 (2,58:1) et habillait tous les
     en-têtes de tableau : chaque mot qui dit ce qu'un chiffre signifie était
     le moins lisible de l'écran. Il remonte au plancher du texte, et disparaît
     du dépôt à mesure que les vues migrent. */
  --encre-4:       var(--n-500);

  /* ---- Trois familles sémantiques, un ton porteur chacune -------------
     Chaque ton est lisible sur le blanc ET sur sa propre teinte : pas de
     second ton « pour le texte sur fond coloré », qu'on finirait par employer
     au hasard. L'information neutre, elle, n'a pas de couleur — elle a une
     icône et une place. */
  --succes:        #0d7d56;
  --succes-teinte: #e8f6ef;
  --succes-bord:   #b6e2cd;
  --alerte-ton:    #b45309;
  --alerte-teinte: #fdf4e6;
  --alerte-bord:   #f2d8ab;
  --danger:        #c02418;
  --danger-teinte: #fdecea;
  --danger-bord:   #f5c2bd;
  --info:          #33415c;   /* ardoise fixe : jamais dérivée de la marque */
  --info-teinte:   var(--n-50);
  --info-bord:     var(--n-300);

  /* Anciens noms, conservés pour les vues non migrées. */
  --vert: var(--succes);        --vert-clair: var(--succes-teinte);
  --ambre: var(--alerte-ton);   --ambre-clair: var(--alerte-teinte);
  --rouge: var(--danger);       --rouge-clair: var(--danger-teinte);
  --violet: var(--n-600);       --violet-clair: var(--n-100);
  --nuit: var(--n-900);         --nuit-2: var(--n-700);

  /* ---- La marque, dérivée avant tout usage ---------------------------
     Elle arrive brute par --marque (et, pour les navigateurs anciens,
     --marque-fonce / --marque-clair). Elle n'est JAMAIS posée telle quelle :
     un jaune d'enseigne donne 1,5:1 sous du blanc, un bordeaux disparaît sur
     la barre sombre. Trois dérivations bornées en clarté, et rien d'autre. */
  --marque: #2563eb;
  --marque-fond:   var(--marque);
  --marque-texte:  var(--marque-fonce, #1e40af);
  --marque-teinte: var(--marque-clair, #eff4ff);
  --marque-bord:   #c7d9fd;
  --sur-marque:    #ffffff;

  /* ---- Le chrome sombre ---------------------------------------------- */
  --chrome-fond:       var(--n-900);
  --chrome-fond-creux: #0b1220;
  --chrome-encre:      #c8cfdb;   /* 11,6:1 sur --chrome-fond              */
  --chrome-encre-2:    #8f9bad;   /*  6,5:1 — intertitres, numéros         */
  --chrome-filet:      rgba(255, 255, 255, .10);
  --chrome-survol:     rgba(255, 255, 255, .06);
  --chrome-compteur:   rgba(255, 255, 255, .09);
  --chrome-compteur-encre: #e6eaf1;
  /* La marque remontée en luminosité pour tenir sur fond sombre. */
  --marque-chrome: var(--marque);

  /* ---- Quatre élévations, pas une de plus -----------------------------
     0 le fond, 1 ce qui est posé, 2 ce qui flotte, 3 ce qui bloque. Deux
     composants qui interrompent de la même façon portent exactement la même
     ombre. Ombres teintées du neutre le plus sombre, jamais du noir pur. */
  --elev-1: 0 1px 2px rgba(10, 14, 24, .06);
  --elev-2: 0 4px 12px rgba(10, 14, 24, .10), 0 1px 2px rgba(10, 14, 24, .06);
  --elev-3: 0 16px 40px rgba(10, 14, 24, .18);
  --voile-fond: rgba(10, 14, 24, .55);
  --ombre-s: var(--elev-1);  --ombre-m: var(--elev-2);  --ombre-l: var(--elev-3);

  /* ---- L'anneau de focus : deux couches, fixe, indépendant de la marque
     Un anneau dérivé de l'enseigne disparaît chez le premier client dont la
     couleur ressemble au fond. Posé en box-shadow, il n'occupe aucune place
     et ne déplace rien. */
  --anneau: 0 0 0 2px var(--surface), 0 0 0 4px var(--n-800);
  --anneau-sombre: 0 0 0 2px var(--chrome-fond), 0 0 0 4px #ffffff;
  --anneau-danger: 0 0 0 2px var(--surface), 0 0 0 4px var(--danger);

  /* ---- Rayons courts : 4 / 6 / 8 ------------------------------------- */
  --r-s: 4px;  --r-m: 6px;  --r-l: 8px;  --r-pilule: 999px;

  /* ---- Espacement, base de 4 ----------------------------------------- */
  --e-1: 4px;  --e-2: 8px;  --e-3: 12px; --e-4: 16px;
  --e-5: 24px; --e-6: 32px; --e-7: 40px;

  /* ---- Les hauteurs sont imposées, jamais déduites d'un padding -------
     Une hauteur déduite du contenu désaligne toute une barre d'outils au
     premier libellé long. Le padding vertical n'est plus qu'un résultat. */
  --h-controle:   40px;
  --h-controle-s: 32px;
  --h-controle-l: 48px;
  --h-tactile:    44px;
  --h-entete:     56px;   /* identique au bloc de marque : les deux filets
                             horizontaux se rejoignent au pixel */
  --h-basse:      60px;

  /* ---- Densité : un seul endroit ------------------------------------- */
  --p-cellule-y: 8px;
  --p-cellule-x: 14px;
  --p-carte:     16px;
  --p-carte-y:   12px;
  --p-section:   20px;
  --gouttiere:   20px;
  --gouttiere-s: 16px;
  --form-y:      16px;
  --form-x:      16px;
  --form-repli:  440px;

  /* ---- Le tableau ----------------------------------------------------- */
  --tab-ligne:        44px;
  --tab-ligne-double: 56px;
  --tab-tete-h:       38px;
  --tab-unite:        40px;   /* gouttière des unités, hors du flux du nombre */
  --tab-actions:      52px;
  --tab-min:          760px;
  --tab-reserve:      268px;
  --tab-survol:    var(--n-100);
  --tab-selection: color-mix(in srgb, var(--marque) 8%, var(--surface));
  --tab-zebre:     var(--n-25);
  --tab-filet:      var(--bordure);
  --tab-filet-fort: var(--bordure-forte);

  /* ---- La barre latérale ---------------------------------------------- */
  --barre:           264px;
  --barre-ligne:     30px;
  --barre-gouttiere: 30px;
  --barre-rayon:     var(--r-m);

  /* ---- Séries et repères de graphique --------------------------------- */
  --serie-reel:    var(--marque-fond);
  --serie-passe:   var(--n-400);
  --serie-prevu:   var(--n-600);
  --serie-appoint: var(--succes);
  --serie-alerte:  var(--danger);
  --aire-opacite:  .16;
  --trait-serie:   2.2px;
  --grille-trait:  var(--n-100);
  --grille-base:   var(--n-300);
  --repere-trait:  var(--n-500);
  --repere-tirets: 5 4;
  --viseur:        rgba(10, 14, 24, .28);
  --infobulle-fond: var(--n-900);
  --graphe-h:       236px;
  --graphe-h-court: 156px;
  --etincelle-h:    36px;
  --piste-h:        10px;

  /* ---- Seuils métier, partagés avec le PHP ---------------------------- */
  --marge-saine: 55;
  --marge-critique: 35;

  /* ---- Empilement : plus un seul 1030 écrit à la main ------------------ */
  --z-colle:  3;
  --z-entete: 1030;
  --z-basse:  1032;
  --z-menu:   1035;
  --z-voile:  1040;
  --z-tiroir: 1045;
  --z-modale: 1050;
  --z-notif:  1060;

  --duree: .14s;

  /* ---- Le pont Bootstrap ---------------------------------------------- */
  --bs-body-font-family: var(--police-donnee);
  --bs-body-color: var(--encre);
  --bs-body-bg: var(--fond);
  --bs-border-color: var(--bordure);
  --bs-border-radius: var(--r-m);
  --bs-link-color: var(--marque-texte);
  --bs-primary: var(--marque-fond);
}

/* Dérivation réelle de la marque là où les couleurs relatives existent.
   Les bornes de clarté garantissent le contraste quelle que soit la teinte
   injectée : L ≤ .55 pour porter du blanc, L ≤ .46 pour être lue sur blanc.
   Le chroma est plafonné — une marque néon ne doit pas faire vibrer une
   interface qu'on regarde huit heures par jour. */
@supports (color: oklch(from red l c h)) {
  :root {
    --marque-fond:   oklch(from var(--marque) clamp(.35, l, .55) min(c, .19) h);
    --marque-texte:  oklch(from var(--marque) clamp(.28, l, .46) min(c, .17) h);
    --marque-teinte: oklch(from var(--marque) .96 min(c, .045) h);
    --marque-bord:   oklch(from var(--marque) .86 min(c, .09) h);
    --marque-chrome: oklch(from var(--marque) clamp(.68, l, .82) min(c, .15) h);
  }
}

/* La préférence de densité de l'exploitant, posée sur <html>. Elle ne touche
   QUE les rembourrages et les hauteurs : l'échelle typographique ne bouge
   jamais. Un service du soir se pilote plus serré qu'une revue mensuelle. */
:root[data-densite="compacte"] {
  --tab-ligne: 36px; --tab-ligne-double: 46px; --tab-tete-h: 32px;
  --p-cellule-y: 5px; --p-cellule-x: 10px;
  --p-carte: 12px; --p-carte-y: 9px; --p-section: 14px;
  --gouttiere: 16px; --gouttiere-s: 12px; --form-y: 12px;
  --h-controle: 34px; --h-controle-s: 28px;
  --barre-ligne: 26px;
}
:root[data-densite="confortable"] {
  --tab-ligne: 54px; --tab-ligne-double: 66px;
  --p-cellule-y: 12px; --p-cellule-x: 18px;
  --p-carte: 20px; --p-carte-y: 16px; --p-section: 26px;
  --gouttiere: 24px; --form-y: 20px;
}

/* Au doigt, la cible grossit sans que le dessin change. */
@media (pointer: coarse) {
  :root { --h-controle: 44px; --h-controle-s: 40px; --tab-ligne: 48px; }
}

/* ---- Thème sombre : on ne redéfinit que des jetons ---------------------
   La rampe neutre s'inverse (les rôles restent), les ombres s'appuient, les
   teintes sémantiques descendent. Aucune règle de composant n'est dupliquée. */
@media (prefers-color-scheme: dark) {
  :root {
    --n-0:   #151d2b;
    --n-25:  #19222f;
    --n-50:  #0d131d;
    --n-100: #1f2937;
    --n-200: #2b3648;
    --n-300: #3b475c;
    --n-400: #707e94;
    --n-500: #9aa5b8;
    --n-600: #b7c1d0;
    --n-700: #d3dae4;
    --n-800: #e9eef5;
    --n-900: #f6f8fc;
    --n-950: #000208;

    --succes-teinte: #0e2a20;  --succes-bord: #1c5741;  --succes: #4cc394;
    --alerte-teinte: #2c1e0a;  --alerte-bord: #6a4413;  --alerte-ton: #e0912f;
    --danger-teinte: #2d1512;  --danger-bord: #6d2a22;  --danger: #f2867a;
    --info: #b9c4d8;           --info-bord: var(--n-300);

    --chrome-fond: #0a0f1a;
    --chrome-fond-creux: #070b14;
    --chrome-encre: #c2cbd9;
    --chrome-encre-2: #8792a5;

    --elev-1: 0 1px 2px rgba(0, 0, 0, .40);
    --elev-2: 0 4px 12px rgba(0, 0, 0, .48), 0 1px 2px rgba(0, 0, 0, .32);
    --elev-3: 0 16px 40px rgba(0, 0, 0, .60);
    --voile-fond: rgba(0, 2, 8, .68);
    --viseur: rgba(255, 255, 255, .32);
    --infobulle-fond: #0a0f1a;
    --sur-marque: #ffffff;
  }
  /* Sur fond sombre, la marque doit être éclaircie avant d'être lue. */
  @supports (color: oklch(from red l c h)) {
    :root {
      --marque-texte:  oklch(from var(--marque) clamp(.70, l, .84) min(c, .15) h);
      --marque-teinte: oklch(from var(--marque) .28 min(c, .06) h);
      --marque-bord:   oklch(from var(--marque) .40 min(c, .10) h);
    }
  }
}


/* ═════════════════════════════════════════════════ ② LES FONDATIONS ═══ */

body {
  background: var(--fond);
  color: var(--encre);
  font-family: var(--police-donnee);
  font-size: var(--t-corps);
  font-weight: var(--g-normal);
  line-height: var(--lh-donnee);
  letter-spacing: 0;
  /* La chasse tabulaire est posée ici et désactivée nulle part. En FCFA, où
     un chiffre d'affaires courant fait sept chiffres et trois séparateurs,
     une colonne de montants qui ondule est lue comme peu fiable quel que
     soit le soin apporté au calcul. */
  font-variant-numeric: tabular-nums lining-nums;
  /* cv05 distingue le l du 1 et du I sur les références alphanumériques.
     Les variantes cv02/03/04/11 sont retirées : elles changeaient le dessin
     de la police sans que personne l'ait décidé. */
  font-feature-settings: "cv05" 1;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

input, select, textarea, button { font-family: inherit; }

h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-family: var(--police-donnee);
  font-weight: var(--g-titre);
  line-height: var(--lh-titre);
  letter-spacing: 0;
  color: var(--encre);
  text-wrap: balance;
}
h1 { font-family: var(--police-identite); font-size: var(--t-page);    letter-spacing: var(--ls-titre); }
h2 { font-size: var(--t-section); letter-spacing: var(--ls-titre); }
h3 { font-size: var(--t-carte);   font-weight: var(--g-fort); }
h4 { font-size: var(--t-accent);  font-weight: var(--g-fort); }

a { color: var(--marque-texte); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Un seul anneau, sur tout ce qui s'atteint au clavier. Aucun outline: none
   n'existe dans ce fichier sans remplacement immédiat. */
:where(a, button, [tabindex], input, select, textarea, summary):focus-visible {
  outline: none;
  box-shadow: var(--anneau);
  border-radius: var(--r-s);
  position: relative;
  z-index: 1;
}

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

/* Tout paragraphe de lecture est borné. Le seul texte qui explique la méthode
   de prévision est celui qu'on ne lit pas quand il court sur 200 caractères. */
.texte-lecture, p.aide, .explication, .vide-etat p, .etat-vide p,
.modale-corps > p, .carte-tete p, .page-tete p {
  max-width: var(--mesure);
  line-height: var(--lh-texte);
}
.mini, .aide, .meta, .legende span {
  font-size: var(--t-second);
  line-height: var(--lh-donnee);
  color: var(--encre-3);
}
.texte-lecture { font-size: var(--t-accent); color: var(--encre-2); }
.mono, .code {
  font-family: var(--police-mono);
  font-size: var(--t-second);
  font-weight: var(--g-donnee);
  letter-spacing: .01em;
}

/* Les capitales ont une définition unique. Il y en avait seize, avec neuf
   interlettrages et une couleur à 2,5:1 : les en-têtes des tableaux étaient
   les mots les moins lisibles de l'écran. */
.etiquette-capitales, .tuile-libelle, .pouls-etiquette, .tableau th,
.dropdown-header, .detail-titre, .groupe-tete, .modale-section > h3,
.kds-compteur span, .carte-qr .invite, .ticket-source, .barre-groupe,
.moyen-tete .etiquette {
  font-size: var(--t-micro);
  font-weight: var(--g-fort);
  line-height: var(--lh-donnee);
  letter-spacing: var(--ls-caps);
  text-transform: uppercase;
  color: var(--encre-etiquette);
}


/* ═══════════════════════════════════════════════════════ ③ L'OSSATURE ═══ */

.appli { display: flex; min-height: 100vh; min-height: 100dvh; }

.principal { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.contenu { flex: 1; padding: var(--p-section) var(--p-section) var(--e-7); }
/* La mesure borne le texte, pas la grille : un tableau large est utile. */
.contenu-large { max-width: 1560px; margin: 0 auto; width: 100%; }

.pile   { display: flex; flex-direction: column; gap: var(--e-3); }
.ligne  { display: flex; align-items: center; gap: var(--e-2); flex-wrap: wrap; }
.pousse { margin-left: auto; }
.centre { text-align: center; }
.droite { text-align: right; }
.haut   { align-items: flex-start; }

.grille-2, .grille-3, .grille-egale, .grille-cartes, .reglages-grille, .compte-grille {
  display: grid; gap: var(--e-4);
}
.grille-2 { grid-template-columns: 2fr 1fr; }
.grille-3 { grid-template-columns: repeat(3, 1fr); }
.grille-egale { grid-template-columns: 1fr 1fr; }
.grille-cartes, .reglages-grille { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
/* Deux courbes côte à côte partagent la même largeur : deux échelles
   verticales différentes présentées ensemble sont un mensonge visuel. */
.grille-graphes { display: grid; grid-template-columns: 1fr 1fr; gap: var(--e-4); align-items: stretch; }


/* ═════════════════════════════════════════════════ ④ BARRE LATÉRALE ═══ */

.barre-laterale {
  width: var(--barre); flex: none;
  position: sticky; top: 0;
  height: 100vh; height: 100dvh;   /* dvh : sinon « Déconnexion » passe sous
                                      la barre du navigateur mobile */
  display: flex; flex-direction: column;
  /* Fond UNI. Le dégradé n'encodait rien et interdisait les intertitres
     collants, seul mécanisme qui rende parcourable une liste de quarante
     entrées. */
  background: var(--chrome-fond);
  color: var(--chrome-encre);
  border-right: 1px solid var(--chrome-filet);
}

.barre-marque {
  display: flex; align-items: center; gap: var(--e-2);
  height: var(--h-entete); flex: none; padding: 0 14px;
  background: var(--chrome-fond-creux);
  border-bottom: 1px solid var(--chrome-filet);
  font-family: var(--police-identite);
  font-size: var(--t-accent); font-weight: var(--g-titre);
  letter-spacing: var(--ls-titre); color: #fff;
}
.barre-jeton {
  width: 28px; height: 28px; flex: none; border-radius: var(--r-m);
  background: var(--marque-fond); color: var(--sur-marque);
  display: grid; place-items: center; overflow: hidden;
}
.barre-jeton:has(img) { background: #fff; }
.barre-jeton img { width: 100%; height: 100%; object-fit: contain; padding: 3px; }

.barre-nav {
  flex: 1; padding: var(--e-2) 10px var(--e-4);
  overflow-y: auto;
  overscroll-behavior: contain;   /* le tiroir mobile ne fait plus défiler la
                                     page derrière lui */
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, .16) transparent;
}
.barre-nav::-webkit-scrollbar { width: 6px; }
.barre-nav::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

/* L'intertitre colle : le nom du groupe qu'on traverse reste sous les yeux au
   lieu de disparaître à la troisième entrée. Les marges négatives font
   saigner son fond jusqu'aux bords, sinon les entrées défilent visiblement
   dans le rembourrage de chaque côté du titre. */
.barre-groupe {
  position: sticky; top: -1px; z-index: 2;
  margin: 14px -10px 3px; padding: 7px 20px 6px;
  background: var(--chrome-fond);
  color: var(--chrome-encre-2);
  box-shadow: 0 1px 0 var(--chrome-filet);
}
.barre-groupe:first-child { margin-top: 2px; }
.barre-groupe-numero {
  display: inline-block; min-width: 12px; margin-right: 6px;
  color: var(--marque-chrome);
}

.barre-nav a, .barre-quitter {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  width: 100%; min-height: var(--barre-ligne);
  padding: 5px 10px; margin-bottom: 1px;
  border: 0; background: none; border-radius: var(--barre-rayon);
  font-size: var(--t-corps); font-weight: var(--g-donnee);
  line-height: var(--lh-donnee); text-align: left;
  color: var(--chrome-encre);
  white-space: nowrap; overflow: hidden;
  transition: background var(--duree), color var(--duree);
}
.barre-nav a:hover { text-decoration: none; }
.barre-nom { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }

/* UNE gouttière : le numéro OU l'icône, jamais les deux. Tous les libellés
   commencent à la même abscisse — c'est ce qui sépare une liste d'un
   empilement. Le numéro l'emporte : c'est lui qui dit que 1.3 et 1.4 se
   lisent ensemble, pas une icône « liste » qui sert cinq fois. */
.barre-nav a > .bi, .barre-nav a > .barre-numero, .barre-quitter > .bi {
  flex: 0 0 var(--barre-gouttiere); width: var(--barre-gouttiere);
}
.barre-nav a > .bi, .barre-quitter > .bi { font-size: 15px; text-align: center; opacity: .62; }
.barre-nav a:has(.barre-numero) > .bi { display: none; }
.barre-numero, .arbo-numero {
  font-size: var(--t-micro); font-weight: var(--g-fort);
  text-align: left; color: var(--chrome-encre-2);
}

@media (hover: hover) {
  .barre-nav a:hover { background: var(--chrome-survol); color: #fff; }
  .barre-nav a:hover > .bi { opacity: .9; }
}
/* Actif : une TEINTE et un filet intérieur de 3 px. La différence avec le
   survol se joue sur la couleur, pas sur quatre points d'opacité. Le filet
   est en box-shadow inset : il respecte le rayon et ne décale rien. */
.barre-nav a.actif, .barre-nav a[aria-current="page"] {
  background: color-mix(in oklab, var(--marque) 26%, transparent);
  color: #fff; font-weight: var(--g-fort);
  box-shadow: inset 3px 0 0 var(--marque-chrome);
  scroll-margin: 72px 0;
}
.barre-nav a.actif > .bi { opacity: 1; }
.barre-nav a.actif .barre-numero { color: var(--marque-chrome); }
.barre-nav a:focus-visible, .barre-quitter:focus-visible,
.barre-laterale summary:focus-visible { box-shadow: var(--anneau-sombre); }

/* Les compteurs sont neutres par principe : la couleur de marque signifie
   « vous êtes ici » et rien d'autre. Le rouge reste aux alertes véritables. */
.barre-nav a .compteur {
  flex: none; margin-left: auto;
  min-width: 21px; height: 18px; padding: 0 6px; border-radius: var(--r-s);
  background: var(--chrome-compteur); color: var(--chrome-compteur-encre);
  font-size: var(--t-micro); font-weight: var(--g-fort);
  display: grid; place-items: center;
}
.barre-nav a.actif .compteur { background: rgba(255, 255, 255, .2); color: #fff; }
.barre-nav a .compteur.alerte { background: var(--danger); color: #fff; }

/* Sept sections ouvertes en permanence font un mur de 2 400 px. En <details>,
   la barre se présente d'abord comme sept titres. */
.barre-section > summary {
  display: flex; align-items: center; gap: var(--e-2);
  cursor: pointer; list-style: none; user-select: none;
}
.barre-section > summary::-webkit-details-marker { display: none; }
.barre-section > summary::after {
  content: ''; margin-left: auto; width: 7px; height: 7px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(45deg) translate(-2px, -2px);
  transition: transform var(--duree); opacity: .7;
}
.barre-section[open] > summary::after { transform: rotate(-135deg) translate(-2px, -2px); }

.barre-pied {
  flex: none; padding: var(--e-2) 10px;
  background: var(--chrome-fond-creux);
  border-top: 1px solid var(--chrome-filet);
}
.barre-pied form { margin: 0; }
/* Se déconnecter n'est pas destructeur : c'est ce qu'on fait chaque soir.
   Sobre au repos, rouge au survol seulement. */
.barre-quitter { cursor: pointer; margin-bottom: 0; color: var(--chrome-encre-2); }
@media (hover: hover) {
  .barre-quitter:hover { background: color-mix(in oklab, var(--danger) 22%, transparent); color: #ffb4ad; }
}


/* ═════════════════════════════════════════════════════ ⑤ BARRE HAUTE ═══ */

.barre-haute {
  position: sticky; top: 0; z-index: var(--z-entete);
  height: var(--h-entete); flex: none;
  display: flex; align-items: center; gap: 10px;
  padding: 0 var(--p-section) 0 var(--e-3);
  /* Fond opaque : un fond translucide laisse fantômer les montants qui
     défilent dessous — inacceptable quand on lit des chiffres. */
  background: var(--surface);
  border-bottom: 1px solid var(--bordure);
}

.burger {
  display: none; flex: none;
  width: var(--h-tactile); height: var(--h-tactile); padding: 0;
  border: 0; background: none; border-radius: var(--r-s);
  color: var(--encre-2); cursor: pointer; place-items: center;
}
.burger:hover { background: var(--n-100); color: var(--encre); }

/* C'est le fil d'Ariane qui pousse le groupe de droite, et non la recherche :
   celle-ci disparaît sous 992 px, et tout l'en-tête se tassait alors à gauche. */
.fil {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 7px;
  font-size: var(--t-corps); color: var(--encre-3);
  white-space: nowrap; overflow: hidden;
}
.fil > * { flex: none; }
.fil strong { min-width: 0; flex: 0 1 auto; overflow: hidden; text-overflow: ellipsis;
  color: var(--encre); font-weight: var(--g-fort); }
.fil-sep {
  width: 5px; height: 5px; flex: none;
  border-right: 1.4px solid var(--n-400); border-top: 1.4px solid var(--n-400);
  transform: rotate(45deg);
}

.recherche-haute { position: relative; flex: none; }
.recherche-haute input {
  width: 240px; height: var(--h-controle); padding: 0 var(--e-3) 0 34px;
  border: 1px solid var(--champ-bordure); border-radius: var(--r-m);
  background: var(--surface); font-size: var(--t-corps); color: var(--encre);
  transition: border-color var(--duree), box-shadow var(--duree);
}
.recherche-haute .bi {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  color: var(--n-400); pointer-events: none;
}

/* Le sélecteur d'établissement décide QUEL restaurant on administre : il ne
   disparaît jamais, et son focus est visible — au clavier, une flèche du bas
   changeait d'établissement sans le moindre retour. */
.selecteur-lieu {
  display: inline-flex; align-items: center; gap: 7px; flex: none;
  height: var(--h-controle); padding: 0 10px;
  border: 1px solid var(--champ-bordure); border-radius: var(--r-m);
  background: var(--surface);
  font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre-2);
}
.selecteur-lieu:focus-within { box-shadow: var(--anneau); }
.selecteur-lieu .bi { color: var(--n-400); flex: none; }
.selecteur-lieu select {
  border: 0; background: none; font: inherit; color: inherit; cursor: pointer;
  max-width: 160px; text-overflow: ellipsis;
}
.selecteur-lieu select:focus-visible { box-shadow: none; }

.cloche, .avatar, .icone-bouton {
  flex: none; width: var(--h-controle); height: var(--h-controle); padding: 0;
  display: grid; place-items: center; cursor: pointer;
  border: 1px solid var(--bordure); border-radius: var(--r-m);
  background: var(--surface); color: var(--encre-2);
  transition: background var(--duree), border-color var(--duree), color var(--duree);
}
.cloche { position: relative; border-radius: 50%; }
.cloche:hover, .icone-bouton:hover { border-color: var(--bordure-forte); background: var(--n-50); color: var(--encre); }
.avatar {
  border: 0; border-radius: 50%;
  background: var(--marque-fond); color: var(--sur-marque);
  font-size: var(--t-second); font-weight: var(--g-fort);
}
/* La pastille rouge est plafonnée à 99+ : un compteur qui s'élargit pousse
   tout ce qui l'entoure. */
.cloche .pastille {
  position: absolute; top: -3px; right: -3px;
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: var(--r-pilule);
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: var(--g-fort);
  display: grid; place-items: center; border: 2px solid var(--surface);
}


/* ════════════════════════════════════════════════ ⑥ BARRE DU BAS ═══════ */

.barre-navigation, .onglets { display: none; }

.nav-touche, .onglet {
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; flex: 1;
  min-height: var(--h-basse); min-width: var(--h-tactile); padding: 6px 2px;
  border: 0; background: none; color: var(--encre-3);
  font-size: var(--t-micro); font-weight: var(--g-fort);
  text-align: center; cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.nav-touche:hover, .onglet:hover { text-decoration: none; }
.nav-nom, .onglet span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Sur téléphone, le retour au TOUCHER remplace le survol : c'est le seul
   accusé de réception qu'on obtienne du doigt, et son absence produit les
   doubles validations en caisse. */
.nav-touche:active, .onglet:active { transform: scale(.96); }
.nav-touche.actif, .nav-touche[aria-current="page"], .onglet.actif { color: var(--marque-texte); }
.nav-touche.actif::after, .nav-touche[aria-current="page"]::after, .onglet.actif::after {
  content: ''; position: absolute; top: 0; left: 22%; right: 22%; height: 2px;
  border-radius: 0 0 2px 2px; background: var(--marque-fond);
}
.nav-vente { color: var(--sur-marque); overflow: visible; }
.nav-vente::before {
  content: ''; position: absolute; top: 4px; width: 46px; height: 46px;
  border-radius: 50%; background: var(--marque-fond);
  box-shadow: var(--elev-2), 0 0 0 4px var(--surface);
}
.nav-vente .bi, .nav-vente .nav-nom { position: relative; }
.nav-vente .nav-nom { margin-top: 30px; color: var(--encre-3); }
.nav-compteur, .onglet-pastille {
  display: grid; place-items: center; min-width: 28px; height: 22px; padding: 0 7px;
  border: 1px solid var(--bordure-forte); border-radius: var(--r-s);
  font-size: var(--t-second); font-weight: var(--g-fort); color: var(--encre-2);
}


/* ══════════════════════════════════════ ⑦ PAGE, SECTIONS ET CARTES ═════ */

.page-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-4); flex-wrap: wrap; margin-bottom: var(--p-section);
}
.page-tete h1 { font-size: var(--t-page); }
/* La plage datée se pose juste sous le titre : un état de gestion sans bornes
   n'est ni imprimable ni opposable, et deux lectures à trois jours d'écart
   portent sur deux périodes différentes sans que rien ne le signale. */
.page-tete p, .graphe-periode {
  margin: var(--e-1) 0 0; font-size: var(--t-second);
  color: var(--encre-3);
}
.page-tete p strong, .graphe-periode b { color: var(--encre-2); font-weight: var(--g-fort); }
.page-actions { display: flex; align-items: center; gap: var(--e-2); flex-wrap: wrap; }

.section { margin-bottom: var(--p-section); }
.section-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-3); flex-wrap: wrap; margin-bottom: var(--e-3);
}
.section-tete h2 { font-size: var(--t-section); }

/* Niveau 1 : posé sur le fond. La bordure fait le travail, l'ombre ne fait
   que décoller — blanc sur blanc sans bordure ne se voit pas. */
.carte, .carte-blanche, .tuile, .stat-tuile, .filtres, .barre-outils,
.reglage-carte, .moyen-paiement, .alerte-carte, .kds-compteur, .ticket,
.pos-produit, .bloc-bord, .raccourci, .diapo-reglage, .table-jeton, .carte-qr {
  background: var(--surface);
  border: 1px solid var(--bordure);
  border-radius: var(--r-l);
  box-shadow: var(--elev-1);
}
.carte { display: flex; flex-direction: column; }
.carte-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-3); padding: var(--p-carte-y) var(--p-carte);
  border-bottom: 1px solid var(--bordure);
}
.carte-tete h3 { font-size: var(--t-carte); font-weight: var(--g-fort); }
.carte-tete p { margin: 2px 0 0; font-size: var(--t-second); color: var(--encre-3); }
.carte-corps { padding: var(--p-carte); flex: 1; }
.carte-corps-plat { padding: 0; }
.carte-pied {
  padding: 10px var(--p-carte); border-top: 1px solid var(--bordure);
  background: var(--surface-2); font-size: var(--t-second); color: var(--encre-3);
  border-radius: 0 0 var(--r-l) var(--r-l);
}
/* Filtres et résultats habitent le même cadre : deux cartes de même poids
   pour un filtre et sa réponse se lisent comme deux modules indépendants, et
   on oublie qu'un filtre est posé. */
.filtres, .barre-outils, .carte > .tableau-outils {
  display: flex; align-items: center; gap: var(--e-3); flex-wrap: wrap;
  padding: 10px var(--p-cellule-x);
}
.carte > .tableau-outils {
  border: 0; border-bottom: 1px solid var(--bordure); box-shadow: none;
  border-radius: var(--r-l) var(--r-l) 0 0;
}
.filtres .champ, .barre-outils .champ, .tableau-outils .champ { margin-bottom: 0; }


/* ═══════════════════════════════════════════════════════ ⑧ BOUTONS ═════ */

/* Bootstrap est chargé avant et ses règles d'état pèsent plus lourd que nos
   variantes ; elles appliquent --bs-btn-active-bg / --bs-btn-disabled-bg, que
   Bootstrap ne déclare pas sur .btn de base. Une variable non résolue rend la
   déclaration invalide : le fond retombe à transparent, et le bouton primaire
   « disparaît » pendant qu'on maintient le clic — au moment précis où l'on
   valide. On ne lutte pas : on lui donne nos couleurs. */
.btn {
  --btn-fond: var(--surface);
  --btn-encre: var(--encre-2);
  --btn-bordure: var(--bordure-forte);
  --btn-fond-survol: var(--n-50);
  --btn-encre-survol: var(--encre);
  --btn-bordure-survol: var(--n-400);
  --btn-fond-actif: var(--n-100);

  --bs-btn-color: var(--btn-encre);
  --bs-btn-bg: var(--btn-fond);
  --bs-btn-border-color: var(--btn-bordure);
  --bs-btn-hover-color: var(--btn-encre-survol);
  --bs-btn-hover-bg: var(--btn-fond-survol);
  --bs-btn-hover-border-color: var(--btn-bordure-survol);
  --bs-btn-active-color: var(--btn-encre-survol);
  --bs-btn-active-bg: var(--btn-fond-actif);
  --bs-btn-active-border-color: var(--btn-bordure-survol);
  --bs-btn-active-shadow: none;
  --bs-btn-disabled-color: var(--btn-encre);
  --bs-btn-disabled-bg: var(--btn-fond);
  --bs-btn-disabled-border-color: var(--btn-bordure);
  --bs-btn-disabled-opacity: 1;
  --bs-btn-box-shadow: none;

  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: var(--h-controle); padding: 0 var(--p-carte);
  border: 1px solid var(--btn-bordure); border-radius: var(--r-m);
  background: var(--btn-fond); color: var(--btn-encre);
  font-size: var(--t-corps); font-weight: var(--g-fort); line-height: 1.25;
  letter-spacing: 0; white-space: nowrap; cursor: pointer;
  transition: background var(--duree), border-color var(--duree), color var(--duree);
}
.btn:hover { background: var(--btn-fond-survol); color: var(--btn-encre-survol);
  border-color: var(--btn-bordure-survol); text-decoration: none; }
.btn:active { background: var(--btn-fond-actif); }

.btn-primaire {
  --btn-fond: var(--marque-fond); --btn-encre: var(--sur-marque); --btn-bordure: transparent;
  --btn-fond-survol: color-mix(in oklab, var(--marque-fond) 88%, var(--n-900));
  --btn-encre-survol: var(--sur-marque); --btn-bordure-survol: transparent;
  --btn-fond-actif: color-mix(in oklab, var(--marque-fond) 78%, var(--n-900));
}
.btn-clair { box-shadow: var(--elev-1); }
.btn-sombre, .btn-nuit {
  --btn-fond: var(--n-900); --btn-encre: var(--n-0); --btn-bordure: transparent;
  --btn-fond-survol: var(--n-800); --btn-encre-survol: var(--n-0);
  --btn-bordure-survol: transparent; --btn-fond-actif: var(--n-700);
}
.btn-vert {
  --btn-fond: var(--succes); --btn-encre: #fff; --btn-bordure: transparent;
  --btn-fond-survol: color-mix(in oklab, var(--succes) 88%, var(--n-900));
  --btn-encre-survol: #fff; --btn-bordure-survol: transparent;
  --btn-fond-actif: color-mix(in oklab, var(--succes) 78%, var(--n-900));
}
.btn-danger {
  --btn-fond: var(--surface); --btn-encre: var(--danger); --btn-bordure: var(--danger-bord);
  --btn-fond-survol: var(--danger-teinte); --btn-encre-survol: var(--danger);
  --btn-bordure-survol: var(--danger); --btn-fond-actif: var(--danger-teinte);
}
.btn-danger:focus-visible { box-shadow: var(--anneau-danger); }
.btn-fantome {
  --btn-fond: transparent; --btn-encre: var(--encre-3); --btn-bordure: transparent;
  --btn-fond-survol: var(--n-100); --btn-encre-survol: var(--encre);
  --btn-bordure-survol: transparent; --btn-fond-actif: var(--n-200);
}
.btn-sm { min-height: var(--h-controle-s); padding: 0 11px; font-size: var(--t-second); }
.btn-lg { min-height: var(--h-controle-l); padding: 0 22px; font-size: var(--t-accent); }
.btn-bloc { width: 100%; }

/* Un contrôle désactivé baisse son contraste, il ne s'efface pas : à
   opacity .45 on ne lit plus ce qu'on ne peut pas faire, et pointer-events:
   none supprimait l'infobulle qui expliquerait pourquoi. */
.btn[disabled]:not(.occupe), .btn.desactive, .btn[aria-disabled="true"] {
  --btn-fond: var(--n-100); --btn-encre: var(--n-500); --btn-bordure: var(--bordure);
  --btn-fond-survol: var(--n-100); --btn-encre-survol: var(--n-500);
  --btn-bordure-survol: var(--bordure); --btn-fond-actif: var(--n-100);
  opacity: 1; box-shadow: none; cursor: not-allowed; pointer-events: auto;
}
/* Occupé n'est pas inactif : le bouton garde son fond, sa largeur et sa place.
   Remplacer le libellé le fait rétrécir et entraîne tout le pied de modale
   sous le curseur, exactement au moment où l'on s'apprête à recliquer. */
.btn.occupe { color: transparent; pointer-events: none; }
.btn.occupe > * { visibility: hidden; }
.btn.occupe::after {
  content: ''; position: absolute; inset: 0; margin: auto;
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--btn-encre); border-right-color: transparent;
  animation: tourne .7s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* Les petites croix gardent leur dessin, mais leur zone atteint 44 px au
   doigt : la croix d'une notification d'erreur — la seule qui ne part jamais
   seule — faisait 20 px de côté. */
.modale-fermer, .bouton-menu, .notification button, .raccourci-retirer {
  position: relative; border: 0; background: none; color: var(--n-400);
  display: inline-grid; place-items: center;
  width: var(--h-controle-s); height: var(--h-controle-s);
  border-radius: var(--r-s); cursor: pointer;
}
.modale-fermer:hover, .bouton-menu:hover, .notification button:hover { background: var(--n-100); color: var(--encre); }
@media (pointer: coarse) {
  .modale-fermer::before, .bouton-menu::before,
  .notification button::before, .raccourci-retirer::before {
    content: ''; position: absolute; inset: 50% auto auto 50%;
    width: var(--h-tactile); height: var(--h-tactile); transform: translate(-50%, -50%);
  }
}


/* ═══════════════════════════════════════════════════ ⑨ FORMULAIRES ═════ */

.champ { margin-bottom: var(--form-y); }
.champ > label, .etiquette {
  display: block; margin-bottom: 5px;
  font-size: var(--t-second); font-weight: var(--g-fort); color: var(--encre-2);
}
/* Un champ obligatoire le dit dans son libellé : un astérisque seul ne se lit
   ni au lecteur d'écran ni sans légende. */
.champ.requis > label::after {
  content: ' obligatoire'; margin-left: 6px;
  font-size: var(--t-micro); font-weight: var(--g-fort);
  letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--encre-3);
}
.champ > .aide { margin-top: 6px; }
.champ > label + .aide { margin: -2px 0 6px; }

/* La hauteur est imposée, le padding vertical n'est qu'un résultat : c'est ce
   qui rend le champ exactement aussi haut que le bouton posé à côté. Et le
   contour monte à --n-400, seuil de 3:1 exigé par WCAG 1.4.11 — à
   --bordure-forte les champs n'avaient pratiquement pas de limite visible. */
.saisie, select.saisie, .recherche-champ, .barre-outils .recherche input {
  width: 100%; height: var(--h-controle); padding: 0 12px;
  border: 1px solid var(--champ-bordure); border-radius: var(--r-m);
  background: var(--surface); color: var(--encre);
  font-size: var(--t-accent); font-weight: var(--g-normal); line-height: var(--lh-donnee);
  transition: border-color var(--duree), box-shadow var(--duree);
}
select.saisie { padding-right: 34px; }
textarea.saisie { height: auto; min-height: 96px; padding: 10px 12px; line-height: var(--lh-texte); }
.saisie::placeholder { color: var(--n-400); }
.saisie:focus, .recherche-haute input:focus, .recherche-champ:focus,
.barre-outils .recherche input:focus { outline: none; box-shadow: var(--anneau); }
.saisie[disabled], .saisie[readonly] {
  background: var(--n-100); border-color: var(--bordure-forte);
  color: var(--n-500); cursor: not-allowed;
}
/* L'erreur passe par la couleur du contour, jamais par son épaisseur : une
   bordure qui s'épaissit fait sauter la ligne entière. */
.saisie.en-erreur, .saisie[aria-invalid="true"] { border-color: var(--danger); }
.saisie.en-erreur:focus, .saisie[aria-invalid="true"]:focus { box-shadow: var(--anneau-danger); }
.erreur-champ {
  display: flex; align-items: flex-start; gap: 5px; margin-top: 6px;
  font-size: var(--t-second); font-weight: var(--g-donnee); color: var(--danger);
}
.erreur-champ::before { content: '⚠'; flex: none; }

.grille-champs, .grille-champs-3 { display: grid; gap: var(--form-y) var(--form-x); }
.grille-champs { grid-template-columns: 1fr 1fr; }
.grille-champs-3 { grid-template-columns: repeat(3, 1fr); }
/* Le rythme appartient au conteneur : sans cela le dernier champ garde sa
   marge et le formulaire est visiblement décentré dans son panneau. */
.grille-champs > .champ, .grille-champs-3 > .champ,
.champ:last-child, form > .champ:last-of-type { margin-bottom: 0; }

/* Le repli se décide sur le PANNEAU, pas sur la fenêtre : une modale de
   920 px garde deux colonnes quelle que soit la largeur du navigateur. */
.modale-corps, .tiroir-corps, .carte-corps, .filtres { container-type: inline-size; }
@container (max-width: 440px) { .grille-champs, .grille-champs-3 { grid-template-columns: 1fr; } }
@container (max-width: 680px) { .grille-champs-3 { grid-template-columns: 1fr 1fr; } }
@supports not (container-type: inline-size) {
  @media (max-width: 640px) { .grille-champs, .grille-champs-3 { grid-template-columns: 1fr; } }
}

/* Une seule case à cocher : il y en avait deux, à 1 px et 1 px de texte
   d'écart, dont aucune n'avait de focus visible — parcourir les quarante
   droits d'un rôle se faisait à l'aveugle. */
.case, .case-droit {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 8px 10px; margin: 0; border-radius: var(--r-s);
  font-size: var(--t-corps); line-height: var(--lh-texte);
  color: var(--encre-2); cursor: pointer;
}
.case:hover, .case-droit:hover { background: var(--n-50); }
.case:focus-within, .case-droit:focus-within { background: var(--marque-teinte); box-shadow: var(--anneau); }
.case input, .case-droit input { flex: none; width: 17px; height: 17px; margin: 1px 0 0; accent-color: var(--marque-fond); }
.case strong, .case-droit strong { display: block; color: var(--encre); font-weight: var(--g-fort); }
.groupe-options { display: grid; gap: 2px; }
.groupe-tete { margin: var(--e-3) 0 var(--e-1); }

.jetons { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.jeton, .jeton-filtre, .reglage-jeton, .marque-jeton, .catalogue-jeton, .raccourci-jeton {
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--h-controle-s); padding: 0 10px;
  border: 1px solid var(--bordure); border-radius: var(--r-pilule);
  background: var(--n-50); color: var(--encre-2);
  font-size: var(--t-second); font-weight: var(--g-donnee);
}
.jeton-filtre { background: var(--marque-teinte); color: var(--marque-texte); border-color: var(--marque-bord); }


/* ═══════════════════════════════════════════════════════ ⑩ TABLEAUX ════ */

/* Le conteneur défile, et il défile visiblement. Sans min-width sur la table,
   neuf colonnes se compriment à 40 px au lieu de déclencher le défilement. */
.tableau-conteneur {
  overflow: auto;
  overscroll-behavior-x: contain;
  border-radius: 0 0 var(--r-l) var(--r-l);
}
.tableau-conteneur > .tableau { min-width: var(--tab-min); }
.tableau-conteneur > .tableau-compact, .tableau:has(.vide-etat) { min-width: 0; }
/* Un sticky n'a rien à quoi se coller tant que le conteneur grandit avec son
   contenu : c'est la hauteur bornée qui rend l'en-tête collant possible. */
.tableau-fige { max-height: max(320px, calc(100dvh - var(--tab-reserve))); }

/* border-collapse: separate n'est pas un détail de style. Fusionnées, les
   bordures appartiennent à la grille du tableau et non à la cellule : elles
   restent en place pendant que l'en-tête défile, qui se retrouve à flotter
   sans filet. Les filets sont donc dessinés cellule par cellule. */
.tableau {
  width: 100%; border-collapse: separate; border-spacing: 0;
  font-size: var(--t-corps);
}
.tableau thead th {
  height: var(--tab-tete-h); padding: 0 var(--p-cellule-x);
  text-align: left; vertical-align: middle; white-space: nowrap;
  background: var(--surface-2);   /* opaque : le contenu ne fantôme pas dessous */
  border: 0; box-shadow: inset 0 -1px 0 var(--tab-filet-fort);
}
/* La devise se déclare une fois, ici : « Total (FCFA) ». Répétée quarante fois
   par écran, elle vole 35 % de la colonne aux noms d'ingrédients. */
.tableau thead th .unite-colonne {
  font-weight: var(--g-donnee); letter-spacing: .02em;
  text-transform: none; color: var(--encre-3);
}
.tableau-fige thead th { position: sticky; top: 0; z-index: var(--z-colle); }

.tableau th.triable { padding: 0; }
.tableau th.triable > :is(a, button) {
  display: flex; align-items: center; gap: 6px;
  width: 100%; height: var(--tab-tete-h); padding: 0 var(--p-cellule-x);
  border: 0; background: none; cursor: pointer;
  font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit;
}
.tableau th.triable > :is(a, button):hover { background: var(--n-100); color: var(--encre); text-decoration: none; }
.tableau th.triable.num > :is(a, button) { justify-content: flex-end; }
/* La flèche est permanente, grisée quand la colonne ne porte pas le tri : une
   flèche qui n'apparaît qu'au survol ne s'apprend jamais, et n'existe pas au
   doigt. L'ordre courant se lit dans le tableau, jamais dans une phrase. */
.tableau th.triable > :is(a, button)::after {
  content: ''; width: 9px; height: 9px; flex: none;
  background: currentColor; opacity: .22;
  clip-path: polygon(50% 0, 100% 44%, 72% 44%, 72% 100%, 28% 100%, 28% 44%, 0 44%);
}
.tableau th[aria-sort="ascending"]  > :is(a, button)::after { opacity: 1; }
.tableau th[aria-sort="descending"] > :is(a, button)::after { opacity: 1; transform: rotate(180deg); }

/* La hauteur est portée par td : un tableau se scanne à cadence fixe, l'œil
   apprend le pas en trois lignes puis descend sans relire. Un contenu long
   fait grandir la ligne, il ne la déforme pas. Le fond est sur les td, pour
   que les colonnes figées masquent ce qui passe dessous. */
.tableau tbody td {
  height: var(--tab-ligne); padding: var(--p-cellule-y) var(--p-cellule-x);
  vertical-align: middle;
  background: var(--surface); color: var(--encre-2);
  font-weight: var(--g-donnee); line-height: var(--lh-donnee);
  border: 0; box-shadow: inset 0 -1px 0 var(--tab-filet);
}
.tableau tbody tr:last-child > td { box-shadow: none; }
.tableau:has(.cellule-2) tbody td, .tableau-double tbody td { height: var(--tab-ligne-double); }
/* Le survol est neutre par obligation : la marque est réservée à la sélection,
   sans quoi rien ne dit plus « c'est cette ligne-là ». */
.tableau tbody tr:hover > td { background: var(--tab-survol); }
.tableau tbody tr:is(.selectionnee, [aria-selected="true"]) > td { background: var(--tab-selection); }
.tableau tbody tr:is(.selectionnee, [aria-selected="true"]) > td:first-child {
  box-shadow: inset 3px 0 0 var(--marque-fond), inset 0 -1px 0 var(--tab-filet);
}
.tableau tbody tr.ligne-alerte > td:first-child {
  box-shadow: inset 3px 0 0 var(--danger), inset 0 -1px 0 var(--tab-filet);
}
/* Zébrage : au-delà de sept colonnes seulement, et alors sans filets — jamais
   les deux, qui doublent le bruit de fond. */
.tableau-zebre tbody td { box-shadow: none; }
.tableau-zebre tbody tr:nth-child(even) > td { background: var(--tab-zebre); }

.tableau .tronque { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cellule-2 { display: grid; align-content: center; gap: 1px; min-width: 0; }
.cellule-2 > .titre, .tableau .cellule-nom, .tableau tbody td > strong {
  display: block; font-size: var(--t-corps); font-weight: var(--g-fort);
  line-height: var(--lh-donnee); color: var(--encre);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cellule-2 > .sous, .tableau .cellule-note, .tableau tbody td > .mini {
  display: block; margin-top: 1px;
  font-size: var(--t-second); font-weight: var(--g-normal); color: var(--encre-3);
}

/* Les chiffres finissent au même pixel. Rien ne s'intercale entre le dernier
   chiffre et le bord ; l'unité vit dans sa gouttière, hors du flux du nombre,
   sans quoi le bord droit se cale sur « sachet » ou sur « L » selon la ligne. */
.tableau :is(td, th).num, .num {
  text-align: right; white-space: nowrap;
  font-variant-numeric: tabular-nums lining-nums;
  font-weight: var(--g-donnee);
}
/* Un seul chiffre gras par ligne : celui qu'on est venu chercher. Le gras
   appliqué à cinq colonnes sur six n'est plus un signal, c'est un fond. */
.tableau td.num-fort, .tableau td.valeur-forte, .valeur-forte {
  font-weight: var(--g-fort); color: var(--encre);
}
.tableau td.num-faible { font-weight: var(--g-donnee); color: var(--encre-3); }
.tableau td.num-alerte { font-weight: var(--g-fort); color: var(--danger); }
.tableau td.num:has(> :is(.unite, .mini)) {
  position: relative; padding-right: calc(var(--p-cellule-x) + var(--tab-unite));
}
.tableau td.num > :is(.unite, .mini) {
  position: absolute; right: var(--p-cellule-x); top: 50%; transform: translateY(-50%);
  width: var(--tab-unite); text-align: left;
  font-size: var(--t-second); font-weight: var(--g-donnee); color: var(--encre-3);
}
/* Le symbole monétaire est une unité, pas une donnée : quatre capitales de
   32 px pesaient un tiers de la masse visuelle d'une tuile. */
.devise {
  font-size: var(--devise-echelle); font-weight: var(--g-donnee);
  letter-spacing: .01em; color: var(--encre-3); margin-left: .22em; white-space: nowrap;
}
.montant { white-space: nowrap; }

.tableau :is(td, th):is(.actions, .cellule-menu) {
  width: var(--tab-actions); white-space: nowrap; text-align: right; padding-left: 6px;
}
.tableau :is(td, th).actions-bouton { width: 1%; }
.tableau td.actions-bouton .btn { min-height: var(--h-controle-s); }

/* Une ligne cliquable annonce son action par un chevron permanent : un tactile
   n'a pas de survol, et ce que seul le survol révèle n'existe pas sur un
   téléphone. Le balisage porte tabindex="0" et role="button". */
.tableau tbody tr[data-tiroir] { cursor: pointer; }
.tableau tbody tr[data-tiroir] > td:last-child { position: relative; padding-right: 26px; }
.tableau tbody tr[data-tiroir] > td:last-child::after {
  content: ''; position: absolute; right: 10px; top: 50%;
  width: 6px; height: 6px; margin-top: -3px;
  border-right: 1.5px solid var(--n-400); border-bottom: 1.5px solid var(--n-400);
  transform: rotate(-45deg); opacity: .55;
}
.tableau tbody tr[data-tiroir] > td:is(.cellule-menu, .actions, .actions-bouton)::after { content: none; }
.tableau tbody tr[data-tiroir]:focus-visible { outline: none; box-shadow: none; }
.tableau tbody tr[data-tiroir]:focus-visible > td {
  background: var(--tab-survol);
  box-shadow: inset 0 2px 0 var(--n-800), inset 0 -2px 0 var(--n-800);
}

/* Le total appartient au bas de sa colonne, aligné sur elle : déporté dans une
   tuile, il ne se vérifie contre aucune des lignes qui le composent — et un
   état de gestion qu'on ne peut pas recomputer n'est pas opposable. */
.tableau tfoot td {
  height: var(--tab-ligne); padding: var(--p-cellule-y) var(--p-cellule-x);
  vertical-align: middle; background: var(--surface-2);
  border: 0; box-shadow: inset 0 1px 0 var(--tab-filet-fort);
  font-size: var(--t-carte); font-weight: var(--g-titre); color: var(--encre);
}
.tableau tfoot .libelle-total {
  font-size: var(--t-micro); font-weight: var(--g-fort);
  letter-spacing: var(--ls-caps); text-transform: uppercase; color: var(--encre-3);
}
.tableau-fige tfoot td { position: sticky; bottom: 0; z-index: var(--z-colle); }

.tableau-compact { --tab-ligne: 36px; --tab-ligne-double: 46px; --p-cellule-x: 10px; --tab-tete-h: 30px; }
.tableau-confort { --tab-ligne: 54px; --p-cellule-x: 18px; }

/* Le pied vit dans la carte : « 21–40 sur 137 » dit où l'on en est, « page 3 »
   ne le dit pas. Un pavé de numéros centré sous une carte alignée à gauche
   flotte comme s'il appartenait à la page plutôt qu'à la liste. */
.tableau-pied {
  display: flex; align-items: center; justify-content: space-between;
  gap: var(--e-3); flex-wrap: wrap;
  padding: 10px var(--p-cellule-x); border-top: 1px solid var(--tab-filet);
  background: var(--surface-2); border-radius: 0 0 var(--r-l) var(--r-l);
  font-size: var(--t-second); color: var(--encre-3);
}
.tableau-pied .compte strong { color: var(--encre); font-weight: var(--g-fort); }
.pagination { display: flex; align-items: center; gap: var(--e-1); margin: 0; list-style: none; padding: 0; }
.pagination :is(a, span) {
  display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 8px;
  border-radius: var(--r-s); font-size: var(--t-second); font-weight: var(--g-donnee);
  color: var(--encre-2);
}
.pagination a:hover { background: var(--n-100); text-decoration: none; }
.pagination .actif { background: var(--marque-fond); color: var(--sur-marque); }
@media (pointer: coarse) { .pagination :is(a, span) { min-width: 40px; height: 40px; } }

/* Sous 1 100 px les colonnes tertiaires disparaissent, sous 860 px les
   secondaires : on ne perd jamais de vue de quelle ligne il s'agit. */
@media (max-width: 1100px) { .tableau .tertiaire { display: none; } }
@media (max-width: 860px)  { .tableau .secondaire { display: none; } }


/* ══════════════════════════════════════════ ⑪ TUILES ET VARIATIONS ═════ */

.tuiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(232px, 1fr));
  gap: var(--e-3); margin-bottom: var(--p-section); }
.tuile, .stat-tuile {
  position: relative; display: flex; flex-direction: column;
  padding: 14px var(--p-carte); overflow: hidden;
}
/* Une tuile inerte ne réagit pas : ça bouge, donc on clique, donc rien ne se
   passe. Seule .tuile-lien, qui mène quelque part, garde le comportement. */
a.tuile, .tuile-lien { cursor: pointer; transition: box-shadow var(--duree), border-color var(--duree); }
a.tuile:hover, .tuile-lien:hover { box-shadow: var(--elev-2); border-color: var(--bordure-forte); text-decoration: none; }

/* L'ordre de lecture suit l'ordre d'importance : libellé, valeur, comparaison,
   note, étincelle. Le delta descend dans l'axe du chiffre — on lit la valeur
   et sa variation d'un seul mouvement d'œil. */
.tuile-haut { display: flex; align-items: center; gap: var(--e-2); margin-bottom: var(--e-2); }
.tuile-haut .delta { margin-left: auto; }
.tuile-libelle { display: flex; align-items: center; gap: var(--e-2); margin: 0; }
.tuile-icone {
  flex: none; width: 24px; height: 24px; border-radius: var(--r-m);
  background: var(--n-100); color: var(--encre-2); display: grid; place-items: center;
}
.tuile-icone.bleu   { background: var(--marque-teinte); color: var(--marque-texte); }
.tuile-icone.vert   { background: var(--succes-teinte); color: var(--succes); }
.tuile-icone.ambre  { background: var(--alerte-teinte); color: var(--alerte-ton); }
.tuile-icone.rouge  { background: var(--danger-teinte); color: var(--danger); }
.tuile-icone.violet { background: var(--n-100); color: var(--n-600); }

.tuile-valeur, .chiffre, .bloc-chiffre, .kds-compteur strong, .carte-qr .numero {
  font-family: var(--police-donnee);
  font-size: var(--t-chiffre); font-weight: var(--g-titre);
  line-height: var(--lh-chiffre); letter-spacing: var(--ls-chiffre);
  color: var(--encre); margin: var(--e-2) 0 0;
}
/* Un chiffre sans référence n'est pas une information mais une décoration :
   il ne permet aucune décision et donne l'illusion d'en avoir permis une. */
.tuile-compare {
  display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px var(--e-2);
  margin-top: 7px; font-size: var(--t-corps);
}
.tuile-reference { color: var(--encre-3); font-weight: var(--g-donnee); }
.tuile-reference b { font-weight: var(--g-fort); color: var(--encre-2); }
.tuile-note { margin-top: var(--e-1); font-size: var(--t-second); color: var(--encre-3); }

/* Le sens passe par trois canaux — glyphe, signe, teinte — jamais par la
   couleur seule : pour un deutéranope, +12 % et −12 % sont deux taches
   identiques. Le glyphe vient du CSS, donc il ne peut plus contredire la
   donnée : une baisse ne montre plus une flèche montante. */
.delta, .pouls-compare {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px 2px 7px; border-radius: var(--r-pilule);
  font-size: var(--t-second); font-weight: var(--g-fort);
  line-height: 1.5; white-space: nowrap;
}
.delta > svg, .delta > .bi, .pouls-compare > svg, .pouls-compare > .bi { display: none; }
.delta::before, .pouls-compare::before { font-size: 9px; line-height: 1; }
.delta-hausse, .pouls-compare.hausse { color: var(--succes); background: var(--succes-teinte); }
.delta-hausse::before, .pouls-compare.hausse::before { content: "\25B2"; }
.delta-baisse, .pouls-compare.baisse { color: var(--danger); background: var(--danger-teinte); }
.delta-baisse::before, .pouls-compare.baisse::before { content: "\25BC"; }
.delta-neutre, .pouls-compare.neutre { color: var(--encre-3); background: var(--n-100); }
.delta-neutre::before, .pouls-compare.neutre::before { content: "\2013"; }
/* Certaines hausses sont mauvaises — le coût matière, la démarque. On inverse
   la teinte, jamais le glyphe : la flèche décrit le mouvement, la couleur
   porte le jugement. */
.delta-inverse.delta-hausse { color: var(--danger); background: var(--danger-teinte); }
.delta-inverse.delta-baisse { color: var(--succes); background: var(--succes-teinte); }
.delta-sans { color: var(--encre-3); background: transparent; padding-left: 0; font-style: italic; }
.delta-sans::before { content: none; }

/* L'étincelle : quatorze points minimum, en pied de tuile, bord à bord. Assez
   pour lire une pente, trop peu pour prétendre donner une valeur. */
.tuile-etincelle {
  margin: auto calc(var(--p-carte) * -1) -14px;
  padding-top: var(--e-3); height: var(--etincelle-h);
  border-top: 1px solid var(--bordure);
}
.etincelle { display: block; width: 100%; height: 100%; overflow: visible; }
.etincelle .trait {
  fill: none; stroke: var(--serie-reel); stroke-width: 1.8;
  stroke-linejoin: round; stroke-linecap: round;
  vector-effect: non-scaling-stroke;   /* survit à l'étirement du viewBox */
}
.etincelle .zone { fill: var(--serie-reel); opacity: .1; }
.etincelle .repere { stroke: var(--repere-trait); stroke-width: 1; stroke-dasharray: 3 3; opacity: .55; }
.etincelle .fin { fill: var(--serie-reel); }


/* ═══════════════════════════════════════════════════ ⑫ GRAPHIQUES ══════ */

.graphe-tete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-3); flex-wrap: wrap; margin-bottom: var(--e-3);
}
.graphique { display: block; width: 100%; height: var(--graphe-h); overflow: visible; }
.graphique.court { height: var(--graphe-h-court); }

/* Quatre niveaux d'encre, du plus discret au plus fort : grille muette, ligne
   de base, série fantôme, série réelle. La grille donne l'échelle ; c'est le
   repère qui donne le jugement — sans lui, la courbe est un dessin. */
.graphique .grille { stroke: var(--grille-trait); stroke-width: 1; shape-rendering: crispEdges; }
.graphique .grille-base { stroke: var(--grille-base); stroke-width: 1.25; }
.graphique .repere, .graphique .coupure {
  stroke: var(--repere-trait); stroke-width: 1.25;
  stroke-dasharray: var(--repere-tirets); vector-effect: non-scaling-stroke;
}
.graphique .repere-objectif { stroke: var(--serie-appoint); }
.graphique .repere-seuil { stroke: var(--serie-alerte); }
.graphique .repere-etiquette {
  fill: var(--repere-trait); font-size: var(--t-micro); font-weight: var(--g-fort);
  paint-order: stroke; stroke: var(--surface); stroke-width: 3px; stroke-linejoin: round;
}
.graphique .serie-trait {
  fill: none; stroke: var(--serie-reel); stroke-width: var(--trait-serie);
  stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke;
}
.graphique .serie-aire { fill: var(--serie-reel); opacity: var(--aire-opacite); }
.graphique .serie-passe { fill: none; stroke: var(--serie-passe); stroke-width: 1.6; vector-effect: non-scaling-stroke; }
/* Ce qui n'est pas encore arrivé ne se trace jamais en trait plein : la forme
   dit l'incertitude. */
.graphique .serie-prevu {
  fill: none; stroke: var(--serie-prevu); stroke-width: var(--trait-serie);
  stroke-dasharray: 6 4; vector-effect: non-scaling-stroke;
}
.graphique .axe {
  fill: var(--encre-etiquette); font-family: var(--police-donnee);
  font-size: var(--t-micro); font-variant-numeric: tabular-nums;
}
.graphique .axe-borne { fill: var(--encre-3); font-weight: var(--g-fort); }

/* Lire une valeur exacte, sans JavaScript : chaque point porte une colonne
   cible, un viseur et une infobulle, révélés par :hover et :focus-within. Un
   rapport financier dans lequel aucune valeur n'est lisible au franc près
   n'est pas un rapport. */
.graphique .colonne-cible { fill: transparent; cursor: crosshair; }
.graphique :is(.viseur, .point, .infobulle) { opacity: 0; pointer-events: none; transition: opacity .12s; }
.graphique .colonne:hover :is(.viseur, .point, .infobulle),
.graphique .colonne:focus-within :is(.viseur, .point, .infobulle) { opacity: 1; }
.graphique .viseur { stroke: var(--viseur); stroke-width: 1; stroke-dasharray: 3 3; }
.graphique .point { fill: var(--surface); stroke: var(--serie-reel); stroke-width: 2.5; r: 4.5; }
.graphique .point-actuel { fill: var(--serie-reel); stroke: var(--surface); stroke-width: 2.5; r: 4.5; opacity: 1; }
.graphique .infobulle-fond { fill: var(--infobulle-fond); rx: 6; }
.graphique .infobulle-jour { fill: #98a2b3; font-size: var(--t-micro); font-weight: var(--g-fort); }
.graphique .infobulle-valeur { fill: #fff; font-size: var(--t-corps); font-weight: var(--g-titre); }

.legende, .graphe-legende {
  display: flex; gap: var(--e-4); flex-wrap: wrap;
  margin-top: var(--e-3); padding-top: var(--e-3); border-top: 1px solid var(--bordure);
}
.graphe-legende span { display: inline-flex; align-items: center; gap: 7px;
  font-size: var(--t-second); color: var(--encre-3); font-weight: var(--g-donnee); }
/* Le témoin reprend la FORME de la série, pas seulement sa couleur. */
.graphe-legende i { width: 16px; height: 0; border-top: 2.5px solid currentColor; display: inline-block; }
.graphe-legende .t-reel { color: var(--serie-reel); }
.graphe-legende .t-passe { color: var(--serie-passe); }
.graphe-legende .t-prevu { color: var(--serie-prevu); }
.graphe-legende :is(.t-prevu, .t-repere) i { border-top-style: dashed; }

/* Les barres disent une seule grandeur : la longueur et le nombre portent tous
   deux la part du total. Le montant passe en valeur principale — c'est lui que
   le gérant vient chercher. */
.barres { display: grid; gap: var(--e-2); }
.barre-ligne {
  display: grid; grid-template-columns: minmax(96px, 1fr) minmax(90px, 2fr) auto;
  gap: var(--e-3); align-items: center;
}
.barre-libelle { font-size: var(--t-corps); color: var(--encre-2); font-weight: var(--g-donnee);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-piste, .jauge {
  position: relative; height: var(--piste-h); background: var(--n-100);
  border-radius: var(--r-pilule); overflow: hidden;
}
.barre-remplissage, .jauge span { display: block; height: 100%; border-radius: var(--r-pilule); background: var(--serie-reel); }
.jauge { margin-top: var(--e-2); }
.jauge.vert span  { background: var(--succes); }
.jauge.ambre span { background: var(--alerte-ton); }
.jauge.rouge span { background: var(--danger); }
.barre-valeurs { text-align: right; white-space: nowrap; }
.barre-valeur, .barre-montant { font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre); }
.barre-part { display: block; font-size: var(--t-second); font-weight: var(--g-donnee); color: var(--encre-3); }
.barre-ligne.total :is(.barre-libelle, .barre-valeur) {
  font-size: var(--t-accent); font-weight: var(--g-fort); color: var(--encre);
}

/* Un seul état vide pour toute la dimension, à la hauteur exacte du graphique
   qu'il remplace : sinon la page saute d'un jour à l'autre. Et il dit toujours
   ce qu'il faut faire pour qu'il se remplisse. */
.vide-graphe {
  position: relative; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px;
  height: var(--graphe-h); padding: var(--p-section); text-align: center;
  border-radius: var(--r-m);
}
.vide-graphe::after {
  content: ''; position: absolute; left: 8%; right: 8%; bottom: 26px;
  border-top: 1.5px dashed var(--bordure-forte);
}
.vide-graphe strong { position: relative; font-size: var(--t-accent); color: var(--encre-2); }
.vide-graphe p { position: relative; max-width: 34ch; margin: 0; font-size: var(--t-second); color: var(--encre-3); }


/* ═════════════════════════════ ⑬ SIGNALEMENT, ALERTES ET ÉTATS ═════════ */

/* Une puce est une pastille et un libellé en casse normale : à 10,5 px en
   capitales, « REMBOURSÉ » perd sa silhouette et ses accents — on épelle au
   lieu de lire. Cinq variantes, ni violet ni or : deux couleurs sans
   signification obligent chacun à inventer sa convention. */
.puce {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pilule);
  border: 1px solid transparent;
  background: var(--n-100); color: var(--encre-2);
  font-size: var(--t-second); font-weight: var(--g-fort);
  letter-spacing: 0; text-transform: none; white-space: nowrap;
}
.puce-point::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.puce-grise, .puce-neutre  { background: var(--n-100); color: var(--encre-2); }
.puce-verte, .puce-succes  { background: var(--n-100); color: var(--succes); }
.puce-ambre, .puce-alerte  { background: var(--n-100); color: var(--alerte-ton); }
.puce-bleue, .puce-marque  { background: var(--marque-teinte); color: var(--marque-texte); }
.puce-violette, .puce-or   { background: var(--n-100); color: var(--encre-2); }
/* Le fond plein reste au seul état qui doit interrompre la lecture. */
.puce-rouge, .puce-danger { background: var(--danger-teinte); color: var(--danger); border-color: var(--danger-bord); }
.tableau .puce { font-size: var(--t-micro); padding: 2px 8px; }

.alerte, .notification, .etat-erreur {
  display: flex; gap: 11px; align-items: flex-start;
  padding: 13px 15px; border-radius: var(--r-m);
  border: 1px solid var(--bordure);
  background: var(--surface); color: var(--encre-2);
  font-size: var(--t-accent); line-height: var(--lh-texte);
}
.alerte { margin-bottom: var(--form-y); }
.alerte:last-child { margin-bottom: 0; }
.alerte strong { display: block; font-weight: var(--g-fort); }
.alerte-icone { flex: none; width: 22px; height: 22px; border-radius: var(--r-s);
  display: grid; place-items: center; }
/* Une alerte et sa notification sont le même objet : sur 380 px de large, deux
   rectangles blancs à 3 px de liseré près ne disent pas leur genre. */
.alerte-succes, .notification-succes { background: var(--succes-teinte); border-color: var(--succes-bord); color: var(--succes); }
.alerte-attention              { background: var(--alerte-teinte); border-color: var(--alerte-bord); color: var(--alerte-ton); }
.alerte-erreur, .notification-erreur, .etat-erreur { background: var(--danger-teinte); border-color: var(--danger-bord); color: var(--danger); }
.alerte-info, .notification-info { background: var(--info-teinte); border-color: var(--info-bord); color: var(--info); }
.notification {
  position: fixed; right: var(--e-4); bottom: var(--e-4); z-index: var(--z-notif);
  max-width: 380px; box-shadow: var(--elev-2);
}

/* Un état se dit par un seul signal. Le fond teinté plein est réservé à ce qui
   bloque le service — un bloc au maximum par écran ; tout le reste se contente
   d'un filet de 3 px sur surface blanche. Trois fonds pleins empilés font un
   mur rouge où plus rien ne ressort. */
.alerte-carte, .alerte-ligne, .carte-info {
  display: flex; gap: var(--e-3); align-items: flex-start;
  padding: var(--p-carte-y) var(--p-carte);
  border-left: 3px solid var(--n-400);
}
.alerte-carte.critique, .alerte-ligne.critique, .carte-info.critique { border-left-color: var(--danger); }
.alerte-carte.attention, .carte-info.attention { border-left-color: var(--alerte-ton); }
.carte-info.calme { border-left-color: var(--succes); }
.alerte-carte.critique .alerte-icone { background: var(--danger-teinte); color: var(--danger); }
.alerte-carte.attention .alerte-icone, .alerte-ligne .icone { background: var(--alerte-teinte); color: var(--alerte-ton); }
.alerte-bloquante { background: var(--danger-teinte); border-color: var(--danger-bord); border-left-width: 3px; }
.alerte-texte { flex: 1; min-width: 0; }
.marque-rupture { background: var(--danger-teinte); color: var(--danger); }
.marque-urgent  { background: var(--danger); color: #fff; }

/* Un changement d'état ne change jamais la géométrie : la bordure reste à
   1 px et le contour appuyé passe en inset, qui n'occupe pas de place. La
   grille du KDS tressautait à chaque commande en retard. */
.kds-compteur.alerte-rouge { border-color: var(--danger); box-shadow: inset 0 0 0 1px var(--danger), var(--elev-1); }
.kds-compteur.alerte-verte { border-color: var(--succes); box-shadow: inset 0 0 0 1px var(--succes), var(--elev-1); }

.vide-etat, .etat-vide {
  display: flex; flex-direction: column; align-items: center;
  padding: var(--e-7) var(--gouttiere); text-align: center;
  color: var(--encre-3);
  border: 1px dashed var(--bordure-forte); border-radius: var(--r-m);
  background: var(--surface-2);
}
.vide-etat h3 { font-size: var(--t-carte); color: var(--encre); margin-bottom: var(--e-1); }
.vide-etat p { max-width: 42ch; margin: 0; font-size: var(--t-corps); }
.vide-etat .btn { margin-top: var(--form-y); }
.vide-icone { margin: 0 auto var(--e-3); color: var(--n-400); }
/* Dans une cellule, le même composant empilait trois cadres autour d'une
   phrase et mangeait 130 px de hauteur. L'en-tête, lui, n'étiquette plus rien. */
.tableau td > :is(.vide-etat, .etat-vide) {
  display: block; padding: var(--p-section) 0; border: 0; background: none;
}
.tableau td:has(> .vide-etat) { height: auto; box-shadow: none; }
.tableau:has(.vide-etat) thead { display: none; }

.chargement, .etat-chargement {
  display: flex; align-items: center; justify-content: center; gap: var(--e-3);
  min-height: 160px; padding: var(--e-6) var(--e-4);
  color: var(--encre-3); font-size: var(--t-corps);
}
.chargement-rond {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--n-300); border-right-color: transparent;
  animation: tourne .7s linear infinite;
}
.squelette {
  border-radius: var(--r-s);
  background: linear-gradient(90deg, var(--n-100) 25%, var(--n-50) 37%, var(--n-100) 63%);
  background-size: 400% 100%; animation: squelette 1.3s ease infinite;
}
@keyframes squelette { 0% { background-position: 100% 0; } 100% { background-position: -100% 0; } }
.squelette-ligne { height: 13px; margin-bottom: var(--e-2); }
.squelette-ligne:last-child { width: 62%; }


/* ═════════════════════ ⑭ MODALES, TIROIRS, MENUS ET DÉTAILS ════════════ */

/* Niveau 3 : ce qui bloque. Modale et confirmation sont le même objet et
   partagent voile, ombre et rayon — le fond ne change ni de teinte ni de flou
   quand on passe de l'une à l'autre. */
.modale, .confirmation, .tiroir {
  border: 0; border-radius: var(--r-l);
  background: var(--surface); color: var(--encre);
  box-shadow: var(--elev-3); padding: 0;
}
.modale::backdrop, .confirmation::backdrop { background: var(--voile-fond); }
.voile, .voile-barre {
  position: fixed; inset: 0; z-index: var(--z-voile);
  background: var(--voile-fond);
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.voile.visible, .voile-barre.visible { opacity: 1; pointer-events: auto; }

/* Une seule gouttière : un formulaire déplacé d'une carte vers une modale ne
   bouge plus d'un pixel. L'alignement est flex-start, pour qu'un sous-titre
   sur deux lignes ne décentre pas la croix de fermeture. */
.modale-tete, .tiroir-tete, .detail-entete {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-3); padding: var(--gouttiere-s) var(--gouttiere);
  border-bottom: 1px solid var(--bordure);
}
.modale-tete h2, .tiroir-tete h2, .detail-entete h2 { font-size: var(--t-carte); font-weight: var(--g-titre); letter-spacing: 0; }
.modale-tete p, .tiroir-tete p { margin: var(--e-1) 0 0; max-width: var(--mesure);
  font-size: var(--t-second); color: var(--encre-3); }
.modale-corps, .tiroir-corps, .detail-tiroir { padding: var(--gouttiere); }
.modale-section { margin-bottom: var(--e-5); }
.modale-section > h3 { margin-bottom: var(--e-2); }
.modale-section > *:last-child { margin-bottom: 0; }
.modale-pied, .confirmation-actions {
  display: flex; align-items: center; gap: var(--e-3); flex-wrap: wrap;
  padding: var(--gouttiere-s) var(--gouttiere);
  border-top: 1px solid var(--bordure); background: var(--fond);
  border-radius: 0 0 var(--r-l) var(--r-l);
}
/* Le conteneur d'actions déclare son propre flex : posé nu par le JS, il ne
   transmettait ni le gap du pied ni la marge auto de l'action secondaire —
   « Annuler » et « Enregistrer » se touchaient sur les douze modales. */
[data-modale-actions] { display: flex; align-items: center; gap: var(--e-3); flex-wrap: wrap; flex: 1; justify-content: flex-end; }
[data-modale-actions] > :is(.btn-clair, .btn-fantome, .btn-danger):first-child { margin-right: auto; }

.dropdown-menu, .menu-contextuel, .recherche-resultats {
  z-index: var(--z-menu);
  border: 1px solid var(--bordure); border-radius: var(--r-l);
  background: var(--surface); box-shadow: var(--elev-2); padding: var(--e-1);
}
.dropdown-item, .menu-contextuel :is(a, button) {
  display: flex; align-items: center; gap: var(--e-2); width: 100%;
  min-height: var(--h-controle-s); padding: 0 10px;
  border: 0; border-radius: var(--r-s); background: none; text-align: left;
  font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre-2); cursor: pointer;
}
.dropdown-item:hover, .menu-contextuel :is(a, button):hover { background: var(--n-100); color: var(--encre); text-decoration: none; }
.menu-contextuel .danger { color: var(--danger); }
.menu-contextuel .danger:hover { background: var(--danger-teinte); }
.dropdown-header, .menu-contextuel .entete { padding: var(--e-2) 10px var(--e-1); }
.dropdown-divider { height: 1px; margin: var(--e-1) 0; background: var(--bordure); border: 0; }

.detail-titre { margin-bottom: var(--e-2); }
.detail-liste { display: grid; grid-template-columns: auto 1fr; gap: 6px var(--e-3); margin: 0; }
.detail-liste dt { font-size: var(--t-second); color: var(--encre-3); font-weight: var(--g-normal); }
.detail-liste dd { margin: 0; font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre-2); text-align: right; }
.detail-actions { display: flex; gap: var(--e-2); flex-wrap: wrap; margin-top: var(--e-4); }


/* ══════════════════════════════════════════════ ⑮ ÉCRANS MÉTIER ════════ */

/* Le pouls du matin : le seul chiffre héros de l'application. Un deuxième
   40 px sur la même page annule le premier. */
.pouls {
  padding: var(--p-carte) var(--p-section); margin-bottom: var(--p-section);
  background: var(--n-900); color: #fff; border-radius: var(--r-l);
}
.pouls-etiquette { display: block; margin-bottom: 5px; color: var(--chrome-encre-2); }
.pouls-chiffre, .identite-chiffre {
  display: block; font-family: var(--police-donnee);
  font-size: var(--t-heros); font-weight: var(--g-titre);
  line-height: var(--lh-chiffre); letter-spacing: var(--ls-chiffre); color: #fff;
}
.pouls-compare { margin-top: var(--e-2); font-size: var(--t-corps); }
.pouls-reference { color: var(--chrome-encre); font-weight: var(--g-normal); }
.pouls-note { font-size: var(--t-micro); color: var(--chrome-encre-2); }
.pouls-chiffres { display: flex; gap: var(--e-5); flex-wrap: wrap; margin-top: var(--e-4); }
.pouls-case strong {
  display: block; font-size: var(--t-section); font-weight: var(--g-fort);
  line-height: var(--lh-titre); color: #fff;
}
.pouls-case strong.vert  { color: #4cc394; }
.pouls-case strong.rouge { color: #f2867a; }

.flux { display: grid; }
.flux-ligne {
  display: flex; align-items: center; gap: var(--e-3);
  padding: var(--p-cellule-y) 0; border-bottom: 1px solid var(--bordure);
}
.flux-ligne:last-child { border-bottom: 0; }
.flux-ligne strong { font-size: var(--t-corps); font-weight: var(--g-fort); color: var(--encre); }
.flux-ligne p { margin: 1px 0 0; font-size: var(--t-second); color: var(--encre-3); }
.flux-heure { margin-left: auto; font-size: var(--t-second); font-weight: var(--g-donnee); color: var(--encre-3); }

.raccourcis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--e-3); }
.raccourci {
  display: flex; flex-direction: column; align-items: flex-start; gap: 6px;
  min-height: 76px; padding: var(--p-carte);
  font-size: var(--t-corps); font-weight: var(--g-fort); color: var(--encre-2);
}
.raccourci:hover { border-color: var(--bordure-forte); text-decoration: none; }
/* La marque ne mesure rien et ne signale rien : l'icône d'un raccourci est un
   repère, pas une identité. */
.raccourci .bi { color: var(--n-500); }
.bloc-bord { display: block; padding: var(--p-carte); color: inherit; }
.bloc-bord:hover { border-color: var(--bordure-forte); text-decoration: none; }

/* Caisse et cuisine : écrans lus debout, à un mètre. C'est le seul endroit du
   produit où l'on monte volontairement d'un cran — la règle n'est pas
   suspendue, elle est appliquée à une autre distance de lecture. */
.kds-compteurs, .kds-grille { display: grid; gap: var(--e-3); }
.kds-compteurs { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.kds-grille { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.kds-compteur { padding: var(--p-carte); text-align: center; }
.kds-barre { position: sticky; top: 0; z-index: var(--z-colle);
  display: flex; gap: var(--e-2); padding: var(--e-2) var(--e-3);
  background: var(--n-900); box-shadow: var(--elev-2); }
.ticket { display: flex; flex-direction: column; }
.ticket-tete { display: flex; align-items: flex-start; justify-content: space-between;
  gap: var(--e-2); padding: var(--p-carte-y) var(--p-carte); border-bottom: 1px solid var(--bordure); }
.ticket-tete h3 { font-size: var(--t-section); font-weight: var(--g-titre); letter-spacing: var(--ls-titre); }
.ticket-lignes { padding: var(--p-carte); display: grid; gap: var(--e-2); }
.ticket-ligne { display: flex; gap: var(--e-2); align-items: baseline; }
/* La quantité d'un ticket et le prix en caisse sont les deux chiffres les plus
   critiques de l'application : ils repassent à l'encre. En jaune d'enseigne,
   ils donnaient 1,6:1. */
.ticket-qte { flex: none; min-width: 26px; font-size: var(--t-accent); font-weight: var(--g-titre); color: var(--encre); }
.ticket-nom { font-size: var(--t-accent); font-weight: var(--g-donnee); }
.ticket-options { font-size: var(--t-second); color: var(--encre-3); }
.ticket-minuteur { margin-left: auto; }
.ticket-actions, .ticket-coche { display: flex; gap: var(--e-2); padding: var(--p-carte); border-top: 1px solid var(--bordure); }
.ticket-progression { height: 4px; background: var(--n-100); }
.ticket-progression span { display: block; height: 100%; background: var(--n-600); }
.ticket.prete  .ticket-progression span { background: var(--succes); }
.ticket.retard .ticket-progression span { background: var(--danger); }

.pos { display: grid; grid-template-columns: 1fr 360px; gap: var(--e-4); }
.pos-produits { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: var(--e-2); }
.pos-produit { display: flex; flex-direction: column; gap: var(--e-1);
  min-height: 84px; padding: var(--e-3); text-align: left; cursor: pointer; }
.pos-produit strong { font-size: var(--t-corps); font-weight: var(--g-fort); }
.pos-produit span { margin-top: auto; font-size: var(--t-accent); font-weight: var(--g-titre); color: var(--encre); }
.pos-produit small { font-size: var(--t-micro); color: var(--encre-3); }
.pos-produit:active { transform: translateY(1px); }
.pos-ticket { display: flex; flex-direction: column; }
.pos-ticket-lignes { flex: 1; overflow-y: auto; }
.pos-ligne, .recap-ligne { display: flex; align-items: center; gap: var(--e-2);
  padding: 5px 0; font-size: var(--t-corps); }
.recap-total { display: flex; justify-content: space-between;
  padding-top: var(--e-2); border-top: 1px solid var(--bordure-forte);
  font-size: var(--t-carte); font-weight: var(--g-titre); }

/* Plan de salle : l'état d'une table se lit au contour, pas au fond — quatre
   fonds teintés côte à côte dans une grille produisent un damier. */
.plan-salle { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: var(--e-3); }
.table-jeton { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; min-height: 84px; padding: var(--e-2); }
.table-jeton strong { font-size: var(--t-section); font-weight: var(--g-fort); }
.table-jeton.libre     { border-color: var(--succes); }
.table-jeton.occupee   { border-color: var(--marque-fond); background: var(--marque-teinte); }
.table-jeton.reservee  { border-color: var(--alerte-ton); }
.table-jeton.nettoyage { background: var(--n-50); color: var(--encre-3); }

.reglage-page { display: grid; grid-template-columns: 240px 1fr; gap: var(--e-5); align-items: start; }
.reglage-menu, .sommaire-reglages {
  position: sticky; top: calc(var(--h-entete) + var(--e-3));
  display: grid; gap: 2px;
}
.reglage-menu a, .sommaire-reglages a {
  display: flex; align-items: center; gap: var(--e-2);
  min-height: var(--h-controle-s); padding: 0 10px; border-radius: var(--r-s);
  font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre-2);
}
.reglage-menu a:hover { background: var(--n-100); text-decoration: none; }
.reglage-menu a.actif, .reglage-menu a[aria-current="page"] {
  background: var(--marque-teinte); color: var(--marque-texte); font-weight: var(--g-fort);
}
.reglage-corps { display: grid; gap: var(--p-section); min-width: 0; }
.reglage-carte { display: block; padding: var(--p-carte); color: inherit; }
.reglage-texte { font-size: var(--t-corps); color: var(--encre-2); }

.installation { display: grid; gap: var(--e-4); }
.installation-suivante { padding: var(--p-carte); border-radius: var(--r-l);
  background: var(--marque-teinte); color: var(--marque-texte); }
.installation-reste { display: grid; gap: var(--e-2); margin: 0; padding: 0; list-style: none; }
.installation-reste li { display: flex; gap: var(--e-2); font-size: var(--t-corps); }
.installation-reste li.faite { color: var(--encre-3); text-decoration: line-through; }

.connexion { display: grid; place-items: center; min-height: 100dvh; padding: var(--e-4); background: var(--fond); }
.connexion-boite { width: min(400px, 100%); padding: var(--e-5);
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-l); box-shadow: var(--elev-2); }
.connexion-marque { display: flex; align-items: center; gap: var(--e-2); margin-bottom: var(--e-5); }
.connexion-marque strong { font-family: var(--police-identite); font-size: var(--t-section);
  font-weight: var(--g-titre); letter-spacing: var(--ls-titre); }

.choix-profils { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--e-3); }
.choix-profil { display: block; cursor: pointer; }
.choix-profil-icone { display: grid; place-items: center; width: 44px; height: 44px;
  margin: 0 auto var(--e-2); border-radius: 50%; background: var(--n-100); color: var(--encre-2); }
.choix-profil:has(input:checked) .choix-profil-icone { background: var(--marque-fond); color: var(--sur-marque); }
.choix-profil:has(input:focus-visible) { box-shadow: var(--anneau); border-radius: var(--r-m); }
.suggestion-profil { padding: var(--p-carte); border-radius: var(--r-l); background: var(--marque-teinte); }
.suggestion-profil p { max-width: var(--mesure); font-size: var(--t-corps); }

.cartes-qr { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: var(--e-3); }
.carte-qr { padding: var(--p-carte); text-align: center; }
.carte-qr .numero { margin: var(--e-2) 0 0; }
.catalogue-paiements, .galerie-reglage { display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--e-3); }
.moyen-paiement { display: flex; flex-direction: column; }
.moyen-tete { display: flex; align-items: center; gap: var(--e-2); padding: var(--p-carte-y) var(--p-carte); }
.moyen-corps { padding: 0 var(--p-carte) var(--p-carte); font-size: var(--t-second); color: var(--encre-3); }
.moyen-pied { padding: 10px var(--p-carte); border-top: 1px solid var(--bordure); background: var(--surface-2); }
.moyen-pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--n-400); }
.moyen-pastille.actif { background: var(--succes); }
.apercu-logo, .apercu-image, .apercu-couverture {
  border: 1px solid var(--bordure); border-radius: var(--r-m); background: var(--n-50); object-fit: cover;
}
.etat-caisse dt { font-weight: var(--g-normal); color: var(--encre-3); }
.etat-caisse dd { font-weight: var(--g-donnee); }
.etat-caisse .etat-total dt { font-weight: var(--g-fort); color: var(--encre); }
.etat-caisse .etat-total dd { font-size: var(--t-section); font-weight: var(--g-fort); }
.onglets-pilules { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--r-m); background: var(--n-100); }
.onglets-pilules a {
  display: inline-flex; align-items: center; min-height: var(--h-controle-s); padding: 0 var(--e-3);
  border-radius: var(--r-s); font-size: var(--t-corps); font-weight: var(--g-donnee); color: var(--encre-2);
}
.onglets-pilules a.actif, .onglets-pilules a[aria-current="page"] {
  background: var(--surface); color: var(--encre); font-weight: var(--g-fort); box-shadow: var(--elev-1);
}
.onglets-pilules a:hover { text-decoration: none; }


/* ══════════════════════════════════════════════════════ ⑯ RÉACTIF ══════ */

@media (max-width: 1200px) {
  .grille-2, .grille-3, .grille-graphes, .pos { grid-template-columns: 1fr; }
  .reglage-page { grid-template-columns: 1fr; }
  .reglage-menu, .sommaire-reglages { position: static; }
}

@media (max-width: 992px) {
  /* On s'aère, on ne rapetisse pas : sur téléphone c'est le vide qui se
     reprend, jamais le corps du texte. */
  :root { --p-section: 14px; --t-page: 22px; --t-heros: 34px; --t-chiffre: 28px;
          --tab-min: 620px; --graphe-h: 200px; }

  .barre-laterale {
    position: fixed; left: 0; top: 0; z-index: var(--z-tiroir);
    width: min(300px, 86vw); transform: translateX(-100%);
    transition: transform .2s ease;
  }
  .barre-laterale.ouverte { transform: none; box-shadow: var(--elev-3); }
  /* Au doigt, une ligne de 30 px est trop fine : on remonte dans le tiroir
     sans toucher à la densité du poste fixe. */
  .barre-nav a, .barre-quitter { min-height: 38px; }
  .burger { display: grid; }
  .recherche-haute { display: none; }
  .contenu { padding: var(--e-4) var(--e-3) var(--e-6); }
  .barre-haute { padding: 0 var(--e-3); }

  .barre-navigation, .onglets {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: var(--z-basse);
    display: flex; align-items: stretch;
    background: var(--surface); border-top: 1px solid var(--bordure);
    box-shadow: 0 -2px 12px rgba(10, 14, 24, .06);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  /* La réserve suit la barre, pas une classe posée par une autre condition :
     un caissier limité à une seule section recevait la barre par-dessus le
     dernier bouton de chaque page — celui qui valide. */
  body:has(.barre-navigation) .contenu, body.avec-onglets .contenu {
    padding-bottom: calc(var(--h-basse) + var(--e-2) + env(safe-area-inset-bottom, 0));
  }

  /* Sur téléphone le document défile : un tableau à hauteur bornée y crée un
     second défilement qu'on attrape par accident. */
  .tableau-fige { max-height: none; }
  .tableau-fige thead th, .tableau-fige tfoot td { position: static; }
}

@media (max-width: 640px) {
  /* Règle structurelle, pas cosmétique : sous 16 px, iOS zoome au focus d'un
     champ et casse la mise en page. */
  .saisie, select.saisie, textarea.saisie, .recherche-champ,
  input[type="text"], input[type="number"], input[type="tel"], input[type="email"],
  input[type="password"], input[type="search"], input[type="date"], input[type="time"],
  select, textarea { font-size: 16px; }

  .page-tete, .section-tete { flex-direction: column; align-items: stretch; }
  .page-actions .btn { flex: 1; }
  .modale-pied [data-modale-actions] { flex-direction: column-reverse; align-items: stretch; }
  .modale-pied [data-modale-actions] > .btn { width: 100%; margin-right: 0; }
}


/* ═════════════════════════════════ ⑰ MOUVEMENT ET IMPRESSION ═══════════ */

/* Trois animations tournaient en boucle sur un poste de caisse ouvert toute la
   journée. Qui a activé la réduction du mouvement — souvent pour une raison
   vestibulaire — la voit ici respectée partout, avec une alternative statique
   lisible plutôt qu'un écran figé sans indication. */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .squelette { background: var(--n-100); }
  .chargement-rond, .btn.occupe::after { border-right-color: currentColor; opacity: .45; }
}

/* Contraste renforcé : la hiérarchie d'encre tient toujours, en plus lisible. */
@media (prefers-contrast: more) {
  :root {
    --grille-trait: var(--n-200); --grille-base: var(--n-400);
    --repere-trait: var(--n-600); --serie-passe: var(--n-500);
    --aire-opacite: .1; --bordure: var(--n-300); --champ-bordure: var(--n-500);
  }
  .delta, .puce { box-shadow: inset 0 0 0 1px currentColor; }
}

@media print {
  .barre-laterale, .barre-haute, .barre-navigation, .onglets,
  .voile, .voile-barre, .page-actions, .btn, .cellule-menu, .actions { display: none !important; }
  .contenu { padding: 0; }
  body { background: #fff; }
  .carte, .tuile { box-shadow: none; border-color: var(--n-300); break-inside: avoid; }
  .tableau-conteneur { overflow: visible; max-height: none; }
  .tableau { min-width: 0; }
  .tableau thead { display: table-header-group; }   /* l'en-tête se répète à chaque page */
  .tableau tbody tr { break-inside: avoid; }
  .tableau :is(td, th) { box-shadow: none; border-bottom: 1px solid var(--n-300); }
  .graphique :is(.viseur, .infobulle, .colonne-cible) { display: none; }
  .graphe-periode { font-weight: var(--g-titre); color: #000; }
}

/* ==========================================================================
   Report — les modificateurs que la refonte n'avait pas repris
   ==========================================================================

   Dix classes utilisées par des vues existantes ne figuraient pas dans la
   nouvelle feuille. Elles sont recopiées telles quelles plutôt que réécrites :
   ce sont des modificateurs mineurs, et les refaire de mémoire aurait introduit
   des différences qu'aucun test ne rattrape — un décalage de deux pixels sur
   un écran qu'on ouvre une fois par mois ne se voit qu'au moment où il gêne.

   Elles seront absorbées par le système au fur et à mesure que les écrans
   concernés seront repris. */

.carte-qr .absent { margin-top: 8px; }

.ecart { justify-content: space-between; }

.ticket.retard .ticket-minuteur .ecoule { color: var(--rouge); }

.enrobe { flex-wrap: wrap; }

.pouls-case.forte { padding: 10px 12px; margin: -10px -12px; background: var(--fond); border-radius: var(--r-m); }

.pagination .inactif { opacity: .45; }

.carte-qr .lien { font-size: 10.5px; color: var(--encre-4); word-break: break-all; }

.onglet-bloc { position: relative; flex: 1; min-width: 0; }

.onglet-tiroir {
  position: absolute; bottom: 100%; left: 4px; right: 4px; margin-bottom: 8px;
  background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--r-m); box-shadow: var(--ombre-l);
  padding: 6px; overflow: hidden;
}

.onglet-tiroir a {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; border-radius: var(--r-s);
  color: var(--encre-2); font-size: 13.5px; font-weight: 600; text-decoration: none;
}

.onglet-tiroir a.actif { background: var(--marque-clair); color: var(--marque); }

.onglet-tiroir a .compteur { margin-left: auto; }

.pouls-principal { min-width: 0; }


/* ==========================================================================
   Ce qui fait parler un chiffre
   ==========================================================================

   Un montant sans point de comparaison n'est pas une information : il ne
   permet aucune décision et donne l'illusion d'en avoir permis une. Chaque
   tuile porte donc, sous sa valeur, ce à quoi elle se compare — et une perte
   s'écrit en rouge, jamais du même ton qu'un chiffre d'affaires. */

.tuile-reference {
  margin: 2px 0 0;
  font-size: 12px; line-height: 1.45; color: var(--encre-4);
  font-variant-numeric: tabular-nums;
}

.tuile-negative { color: var(--rouge); }

/* L'étincelle répond à « est-ce que ça monte » avant même qu'on ait lu le
   pourcentage. Elle n'a ni axe ni étiquette : c'est une forme, pas un
   graphique, et lui ajouter une graduation la ferait lire comme une mesure. */
.etincelle {
  display: block; width: 100%; height: 28px; margin-top: 10px;
  color: var(--marque); opacity: .55;
}
.tuile:hover .etincelle { opacity: .85; }


/* ==========================================================================
   Le choix d'un template de vitrine
   ==========================================================================

   Un exploitant choisit sur une phrase, pas sur une vignette : « pour qui »
   est donc au même rang que le nom. L'échantillon de couleurs ne sert qu'à
   distinguer les quatre d'un coup d'œil — il ne prétend pas montrer le
   résultat, et le bouton « Voir ma vitrine » est là pour ça. */

.templates { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }

.template {
  display: flex; gap: 14px; padding: 16px;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--r-m);
  cursor: pointer; transition: border-color .15s, box-shadow .15s;
}
.template:hover { border-color: var(--bordure-forte); }
.template.choisi { border-color: var(--marque); box-shadow: inset 0 0 0 1px var(--marque); }
.template input { position: absolute; opacity: 0; pointer-events: none; }

/* L'échantillon : trois bandes, la dominante en premier. */
.template-echantillon {
  display: flex; flex-direction: column; flex: 0 0 auto;
  width: 40px; border-radius: var(--r-s); overflow: hidden;
}
.template-echantillon span { flex: 1; min-height: 22px; }

.template-corps { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.template-nom {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px; font-weight: 700; color: var(--encre);
}
.template-phrase { font-size: 13px; line-height: 1.5; color: var(--encre-2); }
.template-pour { font-size: 12px; line-height: 1.5; color: var(--encre-3); }

/* --- Bandeau des données de démonstration --------------------------------
   Visible sur chaque écran tant que la démonstration est chargée : des
   chiffres fictifs ressemblent trait pour trait aux vrais. */
.bandeau-demo {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 9px 24px; font-size: 13px;
  background: #fff4d6; color: #6b4a00; border-bottom: 1px solid #f1d58a;
}
