/* =====================================================================
   DrinkStock — Système de design (version 0.7)
   ---------------------------------------------------------------------
   Principes :
   • Hiérarchie claire : menu sombre / contenu clair, cartes en relief léger.
   • Couleur = sens : vert sarcelle (action), ambre (à commander, attention),
     rouge (rupture, dû), bleu (information), violet (consignes).
   • Lisible au dépôt : zones tactiles ≥ 44 px, chiffres alignés, contrastes AA.
   • Sobre et rapide : aucune police ni image externe (fonctionne hors ligne).
   ===================================================================== */
:root {
  /* Marque */
  --primaire: #0d9488;
  --primaire-fonce: #0f766e;
  --primaire-tres-fonce: #134e4a;
  --primaire-clair: #ccfbf1;
  --primaire-pale: #f0fdfa;
  --accent: #f59e0b;
  --accent-fonce: #b45309;
  --accent-pale: #fffbeb;

  /* Sémantique */
  --succes: #15803d;     --succes-pale: #dcfce7;
  --alerte: #b45309;     --alerte-pale: #fef3c7;
  --danger: #dc2626;     --danger-pale: #fee2e2;
  --info: #2563eb;       --info-pale: #dbeafe;
  --violet: #7c3aed;     --violet-pale: #ede9fe;

  /* Neutres */
  --fond: #f3f5f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --texte: #0f172a;
  --texte-2: #334155;
  --texte-discret: #64748b;
  --bordure: #e5e9f0;
  --bordure-forte: #cfd6e1;

  /* Menu */
  --menu-fond: #0f2a2e;
  --menu-fond-2: #0b1f22;
  --menu-texte: #b6c7c9;
  --menu-titre: #6f8a8d;
  --menu-degrade-1: #0f2a2e;
  --menu-degrade-mid: #134e4a;
  --menu-degrade-2: #0f766e;

  /* Formes */
  --rayon: 14px;
  --rayon-sm: 10px;
  --ombre-1: 0 1px 2px rgba(16, 24, 40, .05);
  --ombre-2: 0 1px 2px rgba(16, 24, 40, .04), 0 6px 18px rgba(16, 24, 40, .06);
  --ombre-3: 0 12px 32px rgba(16, 24, 40, .14);
  --anneau: 0 0 0 4px rgba(13, 148, 136, .16);
  --largeur-menu: 264px;
  --hauteur-barre: 64px;
  --transition: .18s cubic-bezier(.4, 0, .2, 1);
}

/* ------------------------------------------------------------------ */
/* Base                                                                */
/* ------------------------------------------------------------------ */
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh;
  font: 15px/1.55 "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--fond); color: var(--texte);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3 { line-height: 1.25; margin: 0 0 .75rem; color: var(--texte); letter-spacing: -.015em; }
h1 { font-size: 1.6rem; font-weight: 750; }
h2 { font-size: 1.08rem; font-weight: 700; }
h3 { font-size: .95rem; font-weight: 700; }
p { margin: 0 0 .75rem; }
a { color: var(--primaire-fonce); }
code { background: var(--surface-2); border: 1px solid var(--bordure); padding: 0 .35rem; border-radius: 6px; font-size: .82em; color: var(--texte-2); word-break: break-all; }
small { font-size: .8rem; }
strong { font-weight: 650; }
.discret { color: var(--texte-discret); }
.centre { text-align: center; }
.sans-retour { white-space: nowrap; }
.ico { width: 20px; height: 20px; flex: none; }
::selection { background: var(--primaire-clair); }

/* ------------------------------------------------------------------ */
/* Cadre : menu latéral + zone principale                              */
/* ------------------------------------------------------------------ */
.bascule-menu { display: none !important; }
.cadre { display: flex; min-height: 100vh; }
.zone-principale { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.menu-lateral {
  width: var(--largeur-menu); flex: none; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; color: var(--menu-texte);
  background: linear-gradient(180deg, var(--menu-fond) 0%, var(--menu-fond-2) 100%);
  z-index: 30;
}
.marque {
  display: flex; align-items: center; gap: .7rem; padding: 1.15rem 1.2rem 1rem; text-decoration: none; color: #fff;
  border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.marque img { border-radius: 10px; box-shadow: 0 4px 12px rgba(0, 0, 0, .3); }
.marque span { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.marque strong { font-size: 1.12rem; letter-spacing: -.01em; }
.marque small { color: var(--menu-titre); font-size: .76rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-defilant { flex: 1; overflow-y: auto; padding: .75rem .7rem 1rem; scrollbar-width: thin; scrollbar-color: rgba(255,255,255,.15) transparent; }
.menu-groupe { margin-top: 1rem; }
.menu-titre {
  padding: 0 .75rem .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--menu-titre);
}
.menu-entree {
  position: relative; display: flex; align-items: center; gap: .7rem; min-height: 40px; margin: 1px 0;
  padding: .45rem .75rem; border-radius: 10px; color: var(--menu-texte); text-decoration: none;
  font-size: .9rem; font-weight: 500; transition: background var(--transition), color var(--transition);
}
.menu-entree .ico { width: 18px; height: 18px; opacity: .85; }
.menu-entree:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.menu-entree.actif { background: rgba(45, 212, 191, .14); color: #fff; font-weight: 600; }
.menu-entree.actif .ico { color: #5eead4; opacity: 1; }
.menu-entree.actif::before {
  content: ""; position: absolute; left: -.7rem; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: #2dd4bf;
}
.menu-direct { font-weight: 600; }
.menu-pied {
  display: flex; align-items: center; gap: .5rem; padding: .8rem .9rem; border-top: 1px solid rgba(255, 255, 255, .07);
  background: rgba(0, 0, 0, .15);
}
.carte-utilisateur { flex: 1; min-width: 0; display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; padding: .25rem; border-radius: 10px; }
.carte-utilisateur:hover { background: rgba(255, 255, 255, .06); }
.avatar {
  width: 36px; height: 36px; flex: none; border-radius: 50%; display: grid; place-items: center;
  background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #422006; font-weight: 800; font-size: .82rem; text-transform: uppercase;
}
.puce-texte { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.puce-texte strong { font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.puce-texte small { color: var(--menu-titre); font-size: .74rem; }
.bouton-deconnexion {
  width: 38px; height: 38px; display: grid; place-items: center; border: 0; border-radius: 10px; cursor: pointer;
  background: rgba(255, 255, 255, .06); color: var(--menu-texte);
}
.bouton-deconnexion:hover { background: rgba(239, 68, 68, .2); color: #fecaca; }
.voile { display: none; }

/* Barre supérieure */
.barre {
  position: sticky; top: 0; z-index: 20; height: var(--hauteur-barre); display: flex; align-items: center; gap: 1rem;
  padding: 0 1.75rem; background: rgba(255, 255, 255, .86); backdrop-filter: saturate(160%) blur(10px);
  border-bottom: 1px solid var(--bordure);
}
.bouton-menu { display: none; cursor: pointer; padding: .45rem; border-radius: 10px; color: var(--texte-2); }
.bouton-menu:hover { background: var(--surface-2); }
.bouton-menu .ico { width: 24px; height: 24px; }
.fil-ariane { display: flex; align-items: center; gap: .5rem; min-width: 0; font-size: .92rem; }
.fil-groupe { display: inline-flex; align-items: center; gap: .4rem; color: var(--texte-discret); white-space: nowrap; }
.fil-groupe .ico { width: 17px; height: 17px; }
.fil-sep { color: var(--bordure-forte); }
.fil-page { font-weight: 650; color: var(--texte); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-date { margin-left: auto; color: var(--texte-discret); font-size: .85rem; white-space: nowrap; }
.barre-date::first-letter { text-transform: uppercase; }
.barre .puce-utilisateur { display: none; text-decoration: none; }

.contenu { flex: 1; width: 100%; max-width: 1320px; padding: 1.75rem; }
.pied { text-align: center; color: var(--texte-discret); font-size: .78rem; padding: 1.2rem; }

/* ------------------------------------------------------------------ */
/* Écrans sans connexion : installation, connexion                     */
/* ------------------------------------------------------------------ */
.ecran-partage { display: grid; grid-template-columns: minmax(340px, 44%) 1fr; min-height: 100vh; }
.panneau-marque {
  position: relative; overflow: hidden; color: #e6fffb; padding: 3rem;
  background:
    radial-gradient(circle at 15% 15%, rgba(45, 212, 191, .35), transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(245, 158, 11, .30), transparent 45%),
    linear-gradient(160deg, var(--menu-degrade-1) 0%, var(--menu-degrade-mid) 55%, var(--menu-degrade-2) 100%);
  display: flex; align-items: center;
}
.panneau-marque::after {
  /* motif discret de bouteilles */
  content: ""; position: absolute; inset: 0; opacity: .045; pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='1.2'%3E%3Cpath d='M10 2h4v3l1.5 3.5V20a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2V8.5L10 5z'/%3E%3C/svg%3E");
  background-size: 64px 64px;
}
.panneau-marque-contenu { position: relative; z-index: 1; max-width: 460px; }
.marque-grande { display: flex; align-items: center; gap: .8rem; font-size: 1.7rem; font-weight: 800; color: #fff; margin-bottom: 2.5rem; }
.marque-grande img { border-radius: 14px; box-shadow: 0 8px 24px rgba(0, 0, 0, .3); }
.panneau-marque h2 { color: #fff; font-size: 2rem; line-height: 1.2; font-weight: 750; margin-bottom: 1.5rem; }
.arguments { list-style: none; padding: 0; margin: 0 0 2rem; display: grid; gap: .8rem; }
.arguments li { display: flex; align-items: center; gap: .75rem; font-size: 1rem; }
.arguments .ico { width: 34px; height: 34px; padding: 7px; border-radius: 10px; background: rgba(255, 255, 255, .12); color: #5eead4; }
.panneau-depot { color: #99f6e4; font-weight: 600; }
.sans-menu .zone-principale { justify-content: center; }
.sans-menu .contenu { display: flex; flex-direction: column; justify-content: center; }
.contenu-etroit { max-width: 520px; margin: 0 auto; padding: 2.5rem 1.5rem; }
.carte-connexion { width: 100%; max-width: 420px; margin: 0 auto; padding: 2rem; }
/* Photo du dépôt en fond du volet de connexion */
.sans-menu .ecran-partage > .zone-principale {
  background:
    linear-gradient(160deg, rgba(15, 42, 46, .50) 0%, rgba(15, 42, 46, .35) 45%, rgba(15, 42, 46, .70) 100%),
    url("/static/img/fond-connexion.jpg") center / cover no-repeat, #0f2a2e;
}
.sans-menu .carte-connexion {
  background: rgba(255, 255, 255, .94); border: 1px solid rgba(255, 255, 255, .6);
  box-shadow: 0 24px 60px rgba(0, 0, 0, .45); backdrop-filter: blur(6px);
}
.sans-menu .ecran-partage .pied { color: rgba(255, 255, 255, .85); text-shadow: 0 1px 3px rgba(0, 0, 0, .6); }
.entete-connexion { margin-bottom: 1.5rem; }
.entete-connexion img { display: none; }
.entete-connexion h1 { margin: 0; }
.entete-connexion p { color: var(--texte-discret); margin: .3rem 0 0; }

/* ------------------------------------------------------------------ */
/* En-têtes de page, cartes, grilles                                   */
/* ------------------------------------------------------------------ */
.entete-page { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.entete-page h1 { margin: 0; }
.entete-page > div { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions-entete, .actions-fiche { display: flex; gap: .5rem; flex-wrap: wrap; }
.actions-fiche { margin-top: 1rem; }

.carte {
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  box-shadow: var(--ombre-2); padding: 1.4rem; margin-bottom: 1.25rem;
}
.carte > h2:first-child { display: flex; align-items: center; gap: .5rem; }
.carte-info { background: linear-gradient(135deg, var(--primaire-pale), #fff 60%); border-color: #b2f0e6; }
.carte-moyenne { max-width: 680px; }
.zone-danger { border-color: #fecaca; background: linear-gradient(135deg, #fff5f5, #fff 55%); }
.zone-danger h2 { color: var(--danger); }
.grille-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.grille-role { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 1.25rem; align-items: start; }
.grille-champs { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 0 1rem; }
.grille-champs .champ-large { grid-column: span 2; }

/* Indicateurs (KPI) : carte avec pastille de couleur */
.indicateurs { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; margin: 0 0 1.25rem; }
.indicateur {
  --c: var(--primaire); --c-pale: var(--primaire-pale);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .25rem;
  padding: 1.1rem 1.2rem 1.1rem 1.35rem; background: var(--surface); border: 1px solid var(--bordure);
  border-radius: var(--rayon); box-shadow: var(--ombre-2);
}
.indicateur::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.indicateur::after {
  content: ""; position: absolute; right: -24px; top: -24px; width: 88px; height: 88px; border-radius: 50%; background: var(--c-pale);
}
.indicateur:nth-child(5n+2) { --c: var(--accent); --c-pale: var(--accent-pale); }
.indicateur:nth-child(5n+3) { --c: var(--info); --c-pale: #eff6ff; }
.indicateur:nth-child(5n+4) { --c: var(--violet); --c-pale: #f5f3ff; }
.indicateur:nth-child(5n+5) { --c: #e11d48; --c-pale: #fff1f2; }
.indicateur .libelle { position: relative; z-index: 1; color: var(--texte-discret); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.indicateur strong { position: relative; z-index: 1; font-size: 1.55rem; font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.indicateurs-2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.indicateurs-2 .indicateur strong { font-size: 1.2rem; }

/* Tuiles d'accès rapide */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: .8rem; }
.tuile {
  display: flex; align-items: center; gap: .75rem; min-height: 64px; padding: .9rem 1rem; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--bordure); color: var(--texte); text-decoration: none; font-weight: 600;
  box-shadow: var(--ombre-1); transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tuile .ico { width: 38px; height: 38px; padding: 9px; border-radius: 10px; background: var(--primaire-pale); color: var(--primaire-fonce); }
.tuile:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: #99e6da; }

.fiche { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 1rem 0 0; }
.fiche dt { color: var(--texte-discret); }
.fiche dd { margin: 0; font-weight: 550; }

/* ------------------------------------------------------------------ */
/* Formulaires                                                         */
/* ------------------------------------------------------------------ */
.formulaire label, .vente-panier label { display: block; font-weight: 600; font-size: .86rem; color: var(--texte-2); margin-bottom: .9rem; }
label.case { display: flex; align-items: flex-start; gap: .6rem; font-weight: 450; cursor: pointer; margin-bottom: .55rem; color: var(--texte); }
input, select, textarea {
  display: block; width: 100%; margin-top: .35rem; min-height: 44px; padding: .55rem .8rem;
  font: inherit; font-size: .95rem; color: var(--texte); background: var(--surface);
  border: 1px solid var(--bordure-forte); border-radius: var(--rayon-sm);
  transition: border-color var(--transition), box-shadow var(--transition);
}
input::placeholder { color: #9aa6b6; }
input:hover, select:hover { border-color: #aeb9c8; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primaire); box-shadow: var(--anneau); }
input:disabled, select:disabled { background: var(--surface-2); color: var(--texte-discret); cursor: not-allowed; }
select { appearance: none; padding-right: 2.2rem; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right .7rem center; }
select:disabled { background-color: var(--surface-2); }
input[type=checkbox], input[type=radio] { width: 20px; height: 20px; min-height: 0; margin: .1rem 0 0; flex: none; accent-color: var(--primaire); box-shadow: none; }
input[type=color] { padding: .25rem; height: 44px; cursor: pointer; }
input[type=search] { padding-left: 2.4rem;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") no-repeat .75rem center; }
fieldset { border: 1px solid var(--bordure); border-radius: var(--rayon-sm); padding: 1rem 1.1rem; margin: 0 0 1rem; }
legend { font-weight: 700; font-size: .86rem; padding: 0 .4rem; color: var(--texte-2); }
.erreur-champ { color: var(--danger); font-size: .82rem; font-weight: 500; margin: -.6rem 0 .8rem; }
.aide { color: var(--texte-discret); font-size: .84rem; }
.filtres { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; }
.filtres label { font-size: .8rem; font-weight: 600; color: var(--texte-discret); min-width: 160px; margin: 0; }
.filtres .case-filtre { min-width: 0; min-height: 44px; align-items: center; font-weight: 500; color: var(--texte-2); }
.champ-large-filtre { flex: 1; min-width: 260px !important; }
.barre-actions { display: flex; gap: .6rem; justify-content: flex-end; flex-wrap: wrap; margin-bottom: 1.25rem; }
.case-espace { margin-top: 2rem; }
.ajout-rapide { border-top: 1px dashed var(--bordure-forte); margin-top: 1.1rem; padding-top: 1.1rem; }

/* Sélecteur segmenté (consigne, sens, remboursement) */
.segments { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; padding: .35rem; margin-bottom: 1rem; background: var(--surface-2); border-color: var(--bordure); }
.segments legend { font-size: .76rem; color: var(--texte-discret); text-transform: uppercase; letter-spacing: .05em; }
.segments label { margin: 0 !important; display: block; cursor: pointer; }
.segments input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.segments span {
  display: flex; align-items: center; justify-content: center; text-align: center; min-height: 42px; padding: .3rem .6rem;
  border-radius: 8px; font-size: .86rem; font-weight: 600; color: var(--texte-2); transition: all var(--transition);
}
.segments label:hover span { background: #fff; }
.segments input:checked + span { background: var(--surface); color: var(--primaire-fonce); box-shadow: 0 1px 3px rgba(16,24,40,.12), inset 0 0 0 1.5px var(--primaire); }
.segments input:focus-visible + span { box-shadow: var(--anneau); }
.segments input:disabled + span { opacity: .45; cursor: not-allowed; }

/* Matrice des droits */
.matrice { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: .9rem; }
.module-droits { margin: 0; background: var(--surface-2); }
.module-droits legend { display: flex; gap: .5rem; align-items: center; background: var(--surface); border-radius: 6px; }
.module-droits .lien-bouton { width: auto; color: var(--primaire-fonce); font-weight: 600; font-size: .78rem; }
.module-droits code { display: block; font-size: .7rem; background: none; border: 0; padding: 0; color: var(--texte-discret); word-break: normal; }
.apercu-menu { position: sticky; top: calc(var(--hauteur-barre) + 1rem); }
.apercu-groupe { margin-bottom: .7rem; }
.apercu-groupe ul { margin: .2rem 0 0; padding-left: 1.2rem; color: var(--texte-discret); }

/* ------------------------------------------------------------------ */
/* Boutons                                                             */
/* ------------------------------------------------------------------ */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  min-height: 44px; padding: 0 1.15rem; border: 1px solid transparent; border-radius: var(--rayon-sm); cursor: pointer;
  font: inherit; font-size: .92rem; font-weight: 650; text-decoration: none; white-space: nowrap;
  color: #fff; background: linear-gradient(180deg, #14b8a6 0%, var(--primaire) 45%, var(--primaire-fonce) 100%);
  box-shadow: 0 1px 2px rgba(16, 24, 40, .1), inset 0 1px 0 rgba(255, 255, 255, .18);
  transition: transform var(--transition), box-shadow var(--transition), filter var(--transition);
}
.bouton:hover { filter: brightness(1.05); box-shadow: 0 6px 16px rgba(13, 148, 136, .3); transform: translateY(-1px); }
.bouton:active { transform: translateY(0); }
.bouton:focus-visible { outline: none; box-shadow: var(--anneau); }
.bouton:disabled { opacity: .5; cursor: not-allowed; transform: none; box-shadow: none; }
.bouton .ico { width: 18px; height: 18px; }
.bouton.secondaire { background: var(--surface); color: var(--texte-2); border-color: var(--bordure-forte); box-shadow: var(--ombre-1); }
.bouton.secondaire:hover { background: var(--surface-2); border-color: #aeb9c8; box-shadow: var(--ombre-1); filter: none; }
.bouton.danger { background: linear-gradient(180deg, #ef4444, #dc2626); }
.bouton.danger:hover { box-shadow: 0 6px 16px rgba(220, 38, 38, .3); }
.bouton.commander { background: linear-gradient(180deg, #fbbf24 0%, #f59e0b 50%, #d97706 100%); color: #3b1d02; }
.bouton.commander:hover { box-shadow: 0 6px 16px rgba(245, 158, 11, .35); }
.bouton.petit { min-height: 34px; padding: 0 .75rem; font-size: .82rem; border-radius: 8px; }
.bouton.petit .ico { width: 15px; height: 15px; }
.bouton-large { width: 100%; min-height: 52px; font-size: 1.02rem; }
.lien-bouton { background: none; border: 0; font: inherit; cursor: pointer; padding: .25rem 0; color: var(--primaire-fonce); font-weight: 600; text-align: left; }
.lien-bouton:hover { text-decoration: underline; }
.lien-bouton.petit { font-size: .84rem; }

/* ------------------------------------------------------------------ */
/* Tableaux                                                            */
/* ------------------------------------------------------------------ */
.tableau-defilant { overflow-x: auto; margin: 0 -1.4rem; padding: 0 1.4rem; }
.tableau { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .92rem; }
.tableau th, .tableau td { padding: .75rem .8rem; border-bottom: 1px solid var(--bordure); text-align: left; vertical-align: middle; }
.tableau th {
  font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-discret);
  background: var(--surface-2); border-bottom-color: var(--bordure); white-space: nowrap;
}
.tableau thead th:first-child { border-top-left-radius: 10px; }
.tableau thead th:last-child { border-top-right-radius: 10px; }
.tableau tbody tr { transition: background var(--transition); }
.tableau tbody tr:hover { background: #f8fbfb; }
.tableau tbody tr:last-child td { border-bottom: 0; }
.tableau tr.inactif td { color: var(--texte-discret); background: repeating-linear-gradient(135deg, transparent 0 8px, rgba(148,163,184,.05) 8px 16px); }
.tableau .actions { text-align: right; white-space: nowrap; }
.tableau .actions > * + * { margin-left: .35rem; }
.tableau-compact th, .tableau-compact td { padding: .5rem .55rem; }
.tableau-saisie tr.ligne-active td { background: var(--primaire-pale); }
.tableau-saisie tr.ligne-erreur td { background: #fef2f2; }
.tableau-saisie td .champ-quantite { display: inline-block; vertical-align: middle; }
.tableau-saisie [data-tout] { width: auto; display: inline-block; margin-left: .4rem; }
.nombre { text-align: right !important; font-variant-numeric: tabular-nums; white-space: nowrap; }
.lien-ligne { color: inherit; text-decoration: none; }
.lien-ligne:hover strong { color: var(--primaire-fonce); text-decoration: underline; text-underline-offset: 3px; }
.pastille { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .5rem; vertical-align: middle; box-shadow: 0 0 0 3px rgba(0,0,0,.04); }
.champ-quantite { width: 92px; margin: 0 0 0 auto; text-align: right; min-height: 40px; font-weight: 650; }
.champ-montant { text-align: right; min-height: 40px; margin: 0; font-variant-numeric: tabular-nums; }
.champ-recherche { max-width: 300px; margin: 0; }
.montant-du { color: var(--danger); }
.quantite-plus { color: var(--succes); }
.pagination { display: flex; gap: .75rem; align-items: center; justify-content: center; margin-top: 1.1rem; color: var(--texte-discret); font-size: .88rem; }

/* ------------------------------------------------------------------ */
/* Badges, messages                                                    */
/* ------------------------------------------------------------------ */
.badge {
  display: inline-flex; align-items: center; gap: .35rem; padding: .18rem .6rem; border-radius: 999px;
  font-size: .72rem; font-weight: 700; white-space: nowrap; background: #eef2f6; color: var(--texte-2);
}
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.badge.rupture { background: var(--danger-pale); color: #b91c1c; }
.badge.alerte { background: var(--alerte-pale); color: var(--alerte); }
.badge.ok { background: var(--succes-pale); color: var(--succes); }
.badge.info { background: var(--info-pale); color: var(--info); }
.badge.violet { background: var(--violet-pale); color: var(--violet); }
.badge.action { background: var(--info-pale); color: #1e40af; font-family: ui-monospace, Consolas, monospace; font-size: .68rem; }
.badge.action::before { display: none; }

.flash {
  display: flex; gap: .65rem; align-items: flex-start; padding: .85rem 1rem .85rem 1.1rem; border-radius: var(--rayon-sm);
  margin-bottom: 1.25rem; border: 1px solid; border-left-width: 4px; font-weight: 500; box-shadow: var(--ombre-1);
  animation: apparition .25s ease-out;
}
.flash-succes { background: #f0fdf4; border-color: #bbf7d0; border-left-color: var(--succes); color: #14532d; }
.flash-erreur { background: #fef2f2; border-color: #fecaca; border-left-color: var(--danger); color: #7f1d1d; flex-direction: column; gap: .2rem; }
.flash-info   { background: #eff6ff; border-color: #bfdbfe; border-left-color: var(--info); color: #1e3a8a; }
@keyframes apparition { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }

.carte-mdp { border: 2px solid var(--accent); background: var(--accent-pale); }
.mdp-temporaire {
  font: 700 1.6rem/1.2 ui-monospace, "Cascadia Mono", Consolas, monospace; letter-spacing: .12em;
  background: #fff; border: 1px dashed var(--accent); border-radius: 10px; padding: .6rem 1rem; display: inline-block;
}

/* ------------------------------------------------------------------ */
/* Catalogue                                                           */
/* ------------------------------------------------------------------ */
.recap-prix { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; margin-top: 1rem; }
.recap-prix div { background: var(--surface-2); border: 1px solid var(--bordure); border-radius: 10px; padding: .7rem .9rem; display: flex; flex-direction: column; }
.recap-prix div:last-child { background: var(--primaire-pale); border-color: #b2f0e6; }
.recap-prix span { font-size: .78rem; color: var(--texte-discret); }
.recap-prix strong { font-size: 1.2rem; font-variant-numeric: tabular-nums; }
.etoile { color: var(--accent); margin-right: .2rem; }

/* ------------------------------------------------------------------ */
/* Vente rapide                                                        */
/* ------------------------------------------------------------------ */
.vente-grille { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 1.25rem; align-items: start; }
.vente-grille > * { min-width: 0; }
.vente-outils { display: flex; flex-direction: column; gap: .7rem; margin-bottom: 1rem; }
.vente-outils input[type=search] { margin: 0; min-height: 48px; font-size: 1rem; box-shadow: var(--ombre-1); }
.puces { display: flex; gap: .45rem; overflow-x: auto; padding-bottom: .2rem; scrollbar-width: none; }
.puce {
  flex: none; display: inline-flex; align-items: center; min-height: 38px; padding: 0 .95rem; border-radius: 999px;
  border: 1px solid var(--bordure-forte); background: var(--surface); font: inherit; font-size: .86rem; font-weight: 600;
  color: var(--texte-2); cursor: pointer; white-space: nowrap; transition: all var(--transition);
}
.puce:hover { border-color: var(--primaire); color: var(--primaire-fonce); }
.puce.active { background: var(--texte); border-color: var(--texte); color: #fff; }
.tuiles-produits { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(178px, 100%), 1fr)); gap: .8rem; }
.tuile-produit {
  position: relative; min-width: 0; background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon);
  overflow: hidden; display: flex; flex-direction: column; box-shadow: var(--ombre-1);
  transition: border-color var(--transition), box-shadow var(--transition), transform var(--transition);
}
.tuile-produit:hover { box-shadow: var(--ombre-2); transform: translateY(-1px); }
.tuile-produit.choisie { border-color: var(--primaire); box-shadow: 0 0 0 3px rgba(13, 148, 136, .22), var(--ombre-2); }
.tuile-produit.depasse { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(220, 38, 38, .18); }
.tuile-produit.epuisee .tuile-ajouter { opacity: .5; }
.tuile-ajouter {
  position: relative; flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: .2rem; text-align: left;
  padding: .85rem .9rem .7rem; border: 0; border-top: 5px solid var(--bordure); background: none; font: inherit; cursor: pointer;
  min-height: 118px; color: var(--texte); -webkit-tap-highlight-color: transparent;
}
.tuile-ajouter::after {
  /* filigrane bouteille */
  content: ""; position: absolute; right: 8px; bottom: 8px; width: 34px; height: 34px; opacity: .07;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.6'%3E%3Cpath d='M10 2h4v3l1.5 3.5V20a2 2 0 0 1-2 2h-3a2 2 0 0 1-2-2V8.5L10 5z'/%3E%3C/svg%3E") no-repeat center / contain;
}
.tuile-ajouter:active { background: var(--primaire-pale); }
.tuile-nom { font-weight: 700; line-height: 1.25; font-size: .95rem; }
.tuile-format { font-size: .76rem; color: var(--texte-discret); }
.tuile-prix {
  margin-top: auto; font-weight: 750; font-size: 1rem; color: var(--primaire-tres-fonce); font-variant-numeric: tabular-nums;
}
.tuile-stock { font-size: .74rem; font-weight: 600; color: var(--texte-discret); }
.tuile-produit.epuisee .tuile-stock { color: var(--danger); }
.tuile-qte { display: grid; grid-template-columns: 46px minmax(0, 1fr) 46px; border-top: 1px solid var(--bordure); background: var(--surface-2); }
.tuile-qte button { border: 0; background: transparent; font-size: 1.35rem; line-height: 1; cursor: pointer; min-height: 44px; color: var(--texte-2); }
.tuile-qte button:hover { background: var(--primaire-pale); color: var(--primaire-fonce); }
.tuile-qte input { min-width: 0; width: 100%; margin: 0; border: 0; border-radius: 0; text-align: center; font-weight: 800; font-size: 1.05rem; min-height: 44px; padding: 0; background: transparent; box-shadow: none; }
.tuile-produit.choisie .tuile-qte { background: var(--primaire-pale); }
.tuile-produit.choisie .tuile-qte input { color: var(--primaire-fonce); }

.vente-panier {
  position: sticky; top: calc(var(--hauteur-barre) + 1rem); margin: 0; padding: 0; overflow: hidden;
  max-height: calc(100vh - var(--hauteur-barre) - 2rem); overflow-y: auto; box-shadow: var(--ombre-3); border: 0;
}
.vente-panier > * { margin-left: 1.25rem; margin-right: 1.25rem; }
.vente-panier > label:first-child { margin: 0; padding: 1.1rem 1.25rem 1rem; background: linear-gradient(135deg, var(--menu-fond), var(--primaire-tres-fonce)); color: #ccfbf1; }
.vente-panier > label:first-child select { background-color: rgba(255,255,255,.96); }
.vente-panier [data-info-client] { margin-top: .6rem; }
.panier-lignes { list-style: none; margin-top: 0; margin-bottom: .9rem; padding: 0; border-top: 1px solid var(--bordure); }
.panier-lignes li { display: grid; grid-template-columns: 1fr auto auto; gap: .5rem; align-items: center; padding: .55rem 0; border-bottom: 1px dashed var(--bordure); font-size: .9rem; }
.panier-lignes li.discret { display: block; border: 0; text-align: center; padding: 1.2rem 0; }
.panier-lignes .ligne-montant { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.panier-lignes .retirer { border: 0; background: var(--danger-pale); color: var(--danger); width: 26px; height: 26px; border-radius: 50%; cursor: pointer; font-size: .8rem; }
.panier-totaux { display: grid; grid-template-columns: 1fr auto; gap: .35rem 0; margin-top: 0; margin-bottom: .9rem; align-items: center; }
.panier-totaux dt { color: var(--texte-discret); font-size: .9rem; }
.panier-totaux dd { margin: 0; padding-left: .75rem; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 600; }
.panier-totaux .total { font-size: 1.45rem; font-weight: 800; color: var(--texte); padding-top: .55rem; border-top: 2px solid var(--texte); margin-top: .3rem; }
.panier-totaux .champ-montant { width: 140px; margin-left: auto; }
.grille-paiement { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; }
.panier-resultat { font-size: 1rem; margin-bottom: .9rem; display: grid; gap: .4rem; }
.panier-resultat > div { padding: .55rem .8rem; border-radius: 10px; background: var(--accent-pale); color: var(--accent-fonce); font-weight: 600; }
.panier-resultat > .montant-du { background: var(--danger-pale); color: #991b1b; }
.panier-resultat strong { font-size: 1.15rem; }
.bouton-valider { font-size: 1.12rem; min-height: 58px; margin-bottom: .4rem; border-radius: 12px; }
.vente-panier > .bouton-valider { width: calc(100% - 2.5rem); }
.vente-panier > .lien-bouton { display: block; width: auto; margin-bottom: 1rem; text-align: center; color: var(--texte-discret); font-weight: 500; }
.barre-vente-mobile { display: none; }
.totaux-achat { max-width: 380px; margin-left: auto; }

/* ------------------------------------------------------------------ */
/* Tickets, reçus, bons (impression 80 mm ou A4)                        */
/* ------------------------------------------------------------------ */
.vente-ok { display: flex; align-items: center; gap: 1.25rem; flex-wrap: wrap; border: 0; background: linear-gradient(120deg, #ecfdf5, #fff 60%); box-shadow: var(--ombre-2), inset 4px 0 0 var(--succes); }
.vente-ok > div:first-child { flex: 1; }
.vente-ok h1 { color: var(--succes); margin: 0; }
.vente-ok .rendu { background: var(--accent-pale); border: 1px solid #fde68a; border-radius: 12px; padding: .7rem 1.1rem; display: flex; flex-direction: column; font-size: .82rem; color: var(--accent-fonce); font-weight: 600; }
.vente-ok .rendu strong { font-size: 1.7rem; color: var(--accent-fonce); }
.vente-ok .bouton { width: auto; min-width: 230px; }
.grille-ticket { display: grid; grid-template-columns: minmax(280px, 400px) minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.ticket { position: relative; font-size: .9rem; overflow: hidden; }
.ticket::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: linear-gradient(90deg, var(--primaire), var(--accent)); }
.ticket h2 { font-size: .9rem; letter-spacing: .08em; margin: .3rem 0 .8rem; }
.ticket header, .ticket footer { text-align: center; }
.ticket header { border-bottom: 1px dashed var(--bordure-forte); padding: .3rem 0 .7rem; margin-bottom: .7rem; }
.ticket-depot { font-size: 1.15rem; }
.ticket footer { border-top: 1px dashed var(--bordure-forte); padding-top: .7rem; margin-top: .7rem; color: var(--texte-discret); }
.ticket-infos div, .ticket-totaux div { display: flex; justify-content: space-between; gap: .5rem; padding: .05rem 0; }
.ticket-infos span:first-child, .ticket-totaux span:first-child { color: var(--texte-discret); }
.ticket-lignes { width: 100%; border-collapse: collapse; margin: .7rem 0; border-top: 1px dashed var(--bordure-forte); }
.ticket-lignes td { padding: .15rem 0; }
.ticket-detail td { font-size: .85rem; padding-bottom: .35rem; }
.ticket-totaux { border-top: 1px dashed var(--bordure-forte); padding-top: .5rem; }
.ticket-total { font-size: 1.25rem; font-weight: 800; margin: .35rem 0; }
.ticket-total span:first-child { color: var(--texte) !important; }
.ticket-credit { font-weight: 700; color: var(--danger); }
.ticket-emballages { font-size: .82rem; color: var(--texte-discret); margin-top: .6rem; }
.ticket-annulation { color: var(--danger); font-size: .85rem; }
.tampon-annule {
  position: absolute; top: 42%; left: 50%; transform: translate(-50%, -50%) rotate(-18deg); z-index: 2;
  border: 4px solid var(--danger); color: var(--danger); font-size: 2rem; font-weight: 900; padding: .2rem 1rem; opacity: .3; pointer-events: none; border-radius: 8px;
}
.total-retour { font-size: 1.1rem; margin: .5rem 0 1rem; padding: .8rem 1rem; border-radius: 12px; background: var(--violet-pale); color: #4c1d95; }
.total-retour strong { font-size: 1.35rem; }

/* ------------------------------------------------------------------ */
/* Consignes                                                           */
/* ------------------------------------------------------------------ */
.bloc-tiers { border-bottom: 1px solid var(--bordure); padding: .8rem 0; }
.bloc-tiers:last-child { border-bottom: 0; }
.bloc-tiers-entete { display: flex; justify-content: space-between; align-items: center; gap: .5rem; flex-wrap: wrap; }
.liste-emballages { list-style: none; margin: .45rem 0 0; padding: 0; font-size: .88rem; }
.liste-emballages li { display: flex; justify-content: space-between; color: var(--texte-discret); padding: .12rem 0; }
.liste-emballages li span:last-child { font-variant-numeric: tabular-nums; }
.liste-emballages li.avoir { color: var(--succes); font-weight: 650; }

/* ------------------------------------------------------------------ */
/* Commandes fournisseurs                                              */
/* ------------------------------------------------------------------ */
.etapes { display: flex; gap: 0; margin: 0 0 1.25rem; padding: 0; list-style: none; counter-reset: etape; }
.etapes li {
  flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .35rem; text-align: center;
  font-size: .8rem; font-weight: 600; color: var(--texte-discret); counter-increment: etape;
}
.etapes li::before {
  content: counter(etape); width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; z-index: 1;
  background: var(--surface); border: 2px solid var(--bordure-forte); font-weight: 800; color: var(--texte-discret);
}
.etapes li + li::after { content: ""; position: absolute; top: 15px; right: 50%; width: 100%; height: 2px; background: var(--bordure-forte); z-index: 0; }
.etapes li.fait { color: var(--primaire-fonce); }
.etapes li.fait::before { content: "✓"; background: var(--primaire); border-color: var(--primaire); color: #fff; }
.etapes li.fait + li::after, .etapes li.fait::after { background: var(--primaire); }
.etapes li.courant { color: var(--texte); }
.etapes li.courant::before { border-color: var(--primaire); color: var(--primaire-fonce); box-shadow: var(--anneau); }
.etapes li.annule::before { content: "✕"; background: var(--danger); border-color: var(--danger); color: #fff; }
.bon-commande { padding: 2rem 2.2rem; }
.bon-entete { display: flex; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap; padding-bottom: 1.2rem; margin-bottom: 1.2rem; border-bottom: 2px solid var(--texte); }
.bon-entete h2 { font-size: 1.5rem; letter-spacing: .06em; margin: 0 0 .3rem; }
.bon-bloc { font-size: .9rem; color: var(--texte-2); }
.bon-bloc strong { color: var(--texte); font-size: 1rem; }
.bon-signatures { display: grid; grid-template-columns: 1fr 1fr; gap: 2rem; margin-top: 2.5rem; font-size: .85rem; color: var(--texte-discret); }
.bon-signatures div { border-top: 1px solid var(--bordure-forte); padding-top: .5rem; }
.progression { height: 8px; border-radius: 99px; background: var(--bordure); overflow: hidden; min-width: 80px; }
.progression span { display: block; height: 100%; background: linear-gradient(90deg, var(--primaire), #2dd4bf); border-radius: 99px; }
.bandeau-commande {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; padding: 1rem 1.2rem; margin-bottom: 1.25rem; border-radius: var(--rayon);
  background: linear-gradient(120deg, var(--accent-pale), #fff 70%); border: 1px solid #fde68a; box-shadow: var(--ombre-1);
}
.bandeau-commande .ico { width: 40px; height: 40px; padding: 9px; border-radius: 12px; background: #fde68a; color: var(--accent-fonce); }
.bandeau-commande > div { flex: 1; min-width: 200px; }
.bandeau-commande strong { display: block; font-size: 1rem; }
.cellule-commande { display: flex; flex-direction: column; align-items: flex-end; gap: .3rem; }

/* ------------------------------------------------------------------ */
/* Tablette et smartphone                                              */
/* ------------------------------------------------------------------ */
.info-mobile, .seul-mobile { display: none; }
.form-ligne { display: inline; margin: 0; }
@media (max-width: 1100px) {
  .ecran-partage { grid-template-columns: 1fr; }
  .panneau-marque { padding: 1.5rem 1.5rem 1.25rem; min-height: 0; }
  .panneau-marque h2, .arguments, .panneau-depot { display: none; }
  .marque-grande { margin: 0; font-size: 1.35rem; }
  .sans-menu .ecran-partage > .zone-principale { min-height: calc(100vh - 80px); background-position: center, 30% center; }
}
@media (max-width: 960px) {
  .menu-lateral {
    position: fixed; left: 0; top: 0; height: 100vh; transform: translateX(-100%); visibility: hidden;
    transition: transform .22s ease, visibility .22s;
  }
  .bascule-menu:checked ~ .cadre .menu-lateral { transform: none; visibility: visible; box-shadow: 8px 0 30px rgba(0, 0, 0, .25); }
  .bascule-menu:checked ~ .cadre .voile { display: block; position: fixed; inset: 0; background: rgba(15, 23, 42, .45); z-index: 25; }
  .bouton-menu { display: block; }
  .barre { padding: 0 1rem; }
  .barre-date { display: none; }
  .barre .puce-utilisateur { display: block; margin-left: auto; }
  .contenu { padding: 1.1rem; }
  .vente-grille, .grille-role { grid-template-columns: minmax(0, 1fr); }
  .vente-panier { position: static; max-height: none; }
  .apercu-menu { position: static; }
  .grille-ticket { grid-template-columns: 1fr; }
  .barre-vente-mobile {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; gap: .75rem; align-items: center;
    padding: .65rem .9rem calc(.65rem + env(safe-area-inset-bottom)); background: rgba(255,255,255,.96); backdrop-filter: blur(8px);
    border-top: 1px solid var(--bordure); box-shadow: 0 -6px 20px rgba(15, 23, 42, .1);
  }
  .barre-vente-mobile .bouton { min-height: 52px; padding: 0 1.8rem; font-size: 1.05rem; }
  .barre-vente-total { flex: 1; display: flex; flex-direction: column; color: var(--texte); text-decoration: none; line-height: 1.2; }
  .barre-vente-total small { color: var(--texte-discret); }
  .barre-vente-total strong { font-size: 1.3rem; }
  .vente { padding-bottom: 84px; }
}
@media (max-width: 640px) {
  h1 { font-size: 1.35rem; }
  .contenu { padding: .85rem; }
  .carte { padding: 1.05rem; border-radius: 12px; }
  .tableau-defilant { margin: 0 -1.05rem; padding: 0 1.05rem; }
  .fil-groupe { display: none; } .fil-sep { display: none; }
  .grille-2 { grid-template-columns: 1fr; }
  .grille-champs .champ-large { grid-column: auto; }
  .case-espace { margin-top: .5rem; }
  .indicateurs { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .65rem; }
  .indicateur { padding: .85rem .9rem .85rem 1.05rem; }
  .indicateur strong { font-size: 1.15rem; }
  .tableau th, .tableau td { padding: .6rem .5rem; }
  .filtres label { min-width: 100%; }
  .masque-mobile { display: none; }
  .info-mobile { display: inline; }
  .seul-mobile { display: block; margin-top: .5rem; }
  .lien-ligne strong { color: var(--primaire-fonce); text-decoration: underline; text-underline-offset: 3px; text-decoration-color: rgba(13,148,136,.35); }
  .tuiles-produits { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .55rem; }
  .tuile-ajouter { min-height: 104px; padding: .65rem .7rem .55rem; }
  .vente-ok .bouton { width: 100%; }
  .etapes li { font-size: .68rem; }
  .bon-commande { padding: 1.1rem; }
  .bon-signatures { grid-template-columns: 1fr; }
  .cellule-commande { align-items: flex-end; }
}

/* ------------------------------------------------------------------ */
/* Impression : uniquement le contenu utile                            */
/* ------------------------------------------------------------------ */
@media print {
  .menu-lateral, .barre, .pied, .no-print, .flash, .voile, .barre-vente-mobile, .etapes { display: none !important; }
  body { background: #fff; }
  .contenu { padding: 0; max-width: none; }
  .carte, .indicateur { box-shadow: none; border: 0; padding: 0; }
  .indicateur::before, .indicateur::after, .ticket::before { display: none; }
  .grille-ticket { display: block; }
  .ticket { max-width: 80mm; margin: 0 auto; font-size: 11px; }
  .bon-commande { max-width: none; padding: 0; }
  .masque-mobile { display: table-cell !important; }
  .tableau th { background: none; }
  a { color: inherit; text-decoration: none; }
}
.entete-page > .titre-page { display: block; } .titre-page p { margin: .25rem 0 0; }

/* ================================================================== */
/* Tableau de bord (étape 7)                                           */
/* ================================================================== */
.texte-danger { color: var(--danger); }
.texte-alerte { color: var(--alerte); }
.progression i { display: block; height: 100%; background: linear-gradient(90deg, var(--primaire), #2dd4bf); border-radius: 99px; }

.tb-entete { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.tb-entete h1 { margin: 0; }
.tb-entete p { margin: .3rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .6rem; }
.tb-actualise { display: inline-flex; align-items: center; gap: .3rem; font-size: .78rem; padding: .15rem .55rem; border-radius: 99px; background: var(--surface); border: 1px solid var(--bordure); }
.tb-actualise .ico { width: 13px; height: 13px; }
.tb-actions { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.tb-periodes { display: inline-flex; padding: 4px; gap: 2px; background: var(--surface); border: 1px solid var(--bordure); border-radius: 12px; box-shadow: var(--ombre-1); }
.tb-periodes a { white-space: nowrap; padding: .45rem .85rem; border-radius: 9px; font-weight: 650; font-size: .85rem; color: var(--texte-discret); text-decoration: none; transition: background var(--transition), color var(--transition); }
.tb-periodes a:hover { color: var(--texte); background: var(--surface-2); }
.tb-periodes a[aria-current] { background: var(--primaire); color: #fff; box-shadow: 0 2px 6px rgba(13, 148, 136, .35); }

.tb-libelle { display: flex; align-items: center; gap: .4rem; color: var(--texte-discret); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tb-libelle .ico { width: 16px; height: 16px; }
.tb-sous { color: var(--texte-discret); font-size: .84rem; margin: 0; line-height: 1.45; }
.tb-sous b { color: var(--texte-2); }
.tb-delta { display: inline-flex; align-items: center; gap: .25rem; padding: .15rem .55rem; border-radius: 99px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.tb-delta small { font-weight: 500; opacity: .8; }
.tb-delta.hausse { background: var(--succes-pale); color: var(--succes); }
.tb-delta.baisse { background: var(--danger-pale); color: #b91c1c; }

/* KPI : une carte « héros » + cartes secondaires */
.tb-kpis { display: grid; grid-template-columns: minmax(0, 1.6fr) repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.tb-hero, .tb-kpi { isolation: isolate; } /* les décors restent sous la barre supérieure */
.tb-kpis-vendeur { grid-template-columns: minmax(0, 1.6fr) repeat(2, minmax(0, 1fr)); }
.tb-hero {
  position: relative; overflow: hidden; grid-row: span 1; color: #e6fffb; border-radius: var(--rayon); padding: 1.3rem 1.4rem 1.1rem;
  background: radial-gradient(circle at 90% 0%, rgba(45, 212, 191, .35), transparent 50%), linear-gradient(135deg, var(--menu-degrade-1), var(--menu-degrade-mid) 70%, var(--menu-degrade-2));
  box-shadow: 0 10px 30px rgba(15, 42, 46, .25); display: flex; flex-direction: column; gap: .35rem; min-height: 200px; padding-bottom: 84px;
}
.tb-hero-haut { display: flex; justify-content: space-between; align-items: center; gap: .5rem; position: relative; z-index: 1; }
.tb-hero .tb-libelle { color: #99f6e4; }
.tb-hero .tb-delta.hausse { background: rgba(134, 239, 172, .18); color: #bbf7d0; }
.tb-hero .tb-delta.baisse { background: rgba(252, 165, 165, .18); color: #fecaca; }
.tb-hero-valeur { position: relative; z-index: 1; font-size: clamp(1.9rem, 3.2vw, 2.7rem); font-weight: 800; letter-spacing: -.03em; color: #fff; line-height: 1.1; }
.tb-hero-detail { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; font-size: .85rem; color: #b5ece4; }
.tb-hero-detail b { color: #fff; }
.tb-spark { position: absolute; left: 0; right: 0; bottom: 0; width: 100%; height: 72px; }
.tb-spark .ligne { fill: none; stroke: #5eead4; stroke-width: 2; vector-effect: non-scaling-stroke; stroke-linejoin: round; stroke-linecap: round; }
.tb-spark .aire { fill: rgba(94, 234, 212, .12); stroke: none; }
.tb-spark-legende { position: absolute; right: 1rem; bottom: .55rem; font-size: .7rem; color: rgba(204, 251, 241, .7); z-index: 1; }

.tb-kpi {
  --c: var(--primaire); --c-pale: var(--primaire-pale);
  position: relative; overflow: hidden; display: flex; flex-direction: column; gap: .4rem; padding: 1.2rem 1.25rem;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre-2);
  color: var(--texte); text-decoration: none; transition: transform var(--transition), box-shadow var(--transition);
}
.tb-kpi::after { content: ""; position: absolute; right: -28px; top: -28px; width: 96px; height: 96px; border-radius: 50%; background: var(--c-pale); }
.tb-kpi > * { position: relative; z-index: 1; }
.tb-kpi .tb-libelle .ico { color: var(--c); }
.tb-kpi strong { font-size: 1.55rem; font-weight: 780; letter-spacing: -.02em; }
.lien-kpi:hover { transform: translateY(-2px); box-shadow: var(--ombre-3); }
.c-vert { --c: var(--succes); --c-pale: var(--succes-pale); }
.c-bleu { --c: var(--info); --c-pale: #eff6ff; }
.c-rouge { --c: #e11d48; --c-pale: #fff1f2; }

/* Bandeau d'état du dépôt */
.tb-etats { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.tb-etat {
  --c: var(--texte-discret); --c-pale: var(--surface-2);
  display: flex; align-items: center; gap: .85rem; padding: .9rem 1rem; border-radius: var(--rayon); background: var(--surface);
  border: 1px solid var(--bordure); box-shadow: var(--ombre-1); text-decoration: none; color: var(--texte);
  transition: transform var(--transition), box-shadow var(--transition), border-color var(--transition);
}
.tb-etat:hover { transform: translateY(-2px); box-shadow: var(--ombre-2); border-color: var(--c); }
.tb-etat-ico { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: var(--c-pale); color: var(--c); }
.tb-etat-ico .ico { width: 21px; height: 21px; }
.tb-etat strong { display: block; font-size: .98rem; }
.tb-etat small { display: block; color: var(--texte-discret); font-size: .8rem; margin-top: .1rem; }
.tb-etat.danger { --c: var(--danger); --c-pale: var(--danger-pale); border-color: #fecaca; background: linear-gradient(135deg, #fff5f5, #fff 60%); }
.tb-etat.alerte { --c: var(--alerte); --c-pale: var(--alerte-pale); border-color: #fde68a; background: linear-gradient(135deg, #fffbeb, #fff 60%); }
.tb-etat.ok { --c: var(--succes); --c-pale: var(--succes-pale); }
.tb-etat.violet { --c: var(--violet); --c-pale: var(--violet-pale); }
.tb-etat.info { --c: var(--info); --c-pale: var(--info-pale); }
.tb-etat.neutre { --c: var(--primaire-fonce); --c-pale: var(--primaire-pale); }

/* Grilles */
.tb-grille { display: grid; gap: 1.25rem; align-items: start; }
.tb-2-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
.tb-1-1 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tb-grille > .carte { margin-bottom: 0; }
.tb-grille + .tb-grille, .tb-grille + .tb-raccourcis { margin-top: 1.25rem; }
.tb-carte { min-width: 0; }
.tb-carte-entete { display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; margin-bottom: .9rem; }
.tb-carte-entete h2 { display: flex; align-items: center; gap: .5rem; margin: 0; font-size: 1.02rem; }
.tb-carte-entete h2 .ico { width: 19px; height: 19px; color: var(--primaire); }
.tb-aide { font-size: .82rem; margin: -.4rem 0 .9rem; }
.tb-grand { display: block; font-size: 1.9rem; font-weight: 800; letter-spacing: -.03em; margin-bottom: .35rem; }
.tb-vide { display: flex; align-items: center; gap: .9rem; padding: 1rem; border-radius: var(--rayon-sm); background: var(--surface-2); color: var(--texte-discret); }
.tb-vide .ico { width: 34px; height: 34px; padding: 7px; border-radius: 50%; background: var(--succes-pale); color: var(--succes); flex: none; }
.tb-vide p { margin: 0; }
.tb-vide strong { color: var(--texte-2); }
.tb-plus { margin: .8rem 0 0; font-size: .88rem; font-weight: 600; }
.tb-titre-section { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-discret); margin: 1.75rem 0 .75rem; }

/* Résumé au-dessus de l'histogramme */
.tb-resume { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: .75rem; margin-bottom: 1.2rem; }
.tb-resume > div { padding: .65rem .8rem; border-radius: var(--rayon-sm); background: var(--surface-2); }
.tb-resume small { display: flex; align-items: center; gap: .3rem; color: var(--texte-discret); font-size: .74rem; font-weight: 600; }
.tb-resume small .ico { width: 13px; height: 13px; color: var(--accent); }
.tb-resume b { display: block; font-size: 1rem; margin-top: .15rem; }
.tb-resume em { font-style: normal; font-weight: 500; color: var(--texte-discret); font-size: .82rem; }

/* Histogramme HTML/CSS : barres <= 24 px, coin arrondi en haut, grille fine */
.histo { --h: 230px; padding-left: 2.6rem; }
.histo-zone { position: relative; height: var(--h); }
.histo-grad { position: absolute; left: 0; right: 0; height: 0; border-top: 1px solid var(--bordure); }
.histo-grad span { position: absolute; left: -2.6rem; top: -.55rem; width: 2.3rem; text-align: right; font-size: .68rem; color: var(--texte-discret); font-variant-numeric: tabular-nums; }
.histo-moy { position: absolute; left: 0; right: 0; height: 0; border-top: 1.5px solid var(--accent); z-index: 2; pointer-events: none; }
.histo-moy span { position: absolute; right: 0; top: -1.35rem; font-size: .7rem; font-weight: 700; color: var(--accent-fonce); background: var(--surface); padding: 0 .3rem; border-radius: 4px; }
.histo-barres { position: absolute; inset: 0; display: flex; align-items: flex-end; gap: 4px; }
.histo.serre .histo-barres { gap: 2px; }
.histo-col { flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; border-radius: 6px; outline: none; }
.histo-col:hover, .histo-col:focus-visible { background: rgba(13, 148, 136, .06); }
.histo-col i { display: block; width: 100%; max-width: 24px; min-height: 2px; border-radius: 4px 4px 0 0; background: #5eb8ae; transition: background var(--transition); }
.histo-col.weekend i { background: #8fd3ca; }
.histo-col.aujourdhui i { background: var(--primaire-fonce); }
.histo-col:hover i, .histo-col:focus-visible i { background: var(--primaire); }
.histo-col.vide i { background: var(--bordure-forte); }
.histo-axe { display: flex; gap: 4px; margin-top: .4rem; }
.histo.serre .histo-axe { gap: 2px; }
.histo-axe span { flex: 1; min-width: 0; text-align: center; font-size: .68rem; color: var(--texte-discret); white-space: nowrap; overflow: visible; }
.histo-axe span:last-child { color: var(--primaire-fonce); font-weight: 700; }

/* Mois */
.tb-liste { display: grid; grid-template-columns: 1fr auto; gap: .45rem 1rem; margin: 1rem 0; font-size: .9rem; }
.tb-liste dt { color: var(--texte-discret); }
.tb-liste dd { margin: 0; font-weight: 650; text-align: right; }
.tb-projection { padding: .9rem 1rem; border-radius: var(--rayon-sm); background: linear-gradient(135deg, var(--primaire-pale), #fff); border: 1px solid #b2f0e6; }
.tb-projection-haut { display: flex; justify-content: space-between; gap: .5rem; margin-bottom: .55rem; font-size: .88rem; }
.tb-projection-haut b { color: var(--primaire-tres-fonce); }
.tb-projection small { display: block; margin-top: .4rem; font-size: .76rem; }

/* Prévisions */
.tb-prev td { vertical-align: middle; }
.tb-jauge { min-width: 120px; }
.tb-jauge span { display: block; font-weight: 650; font-size: .86rem; margin-bottom: .3rem; }
.tb-jauge .progression { height: 6px; min-width: 0; }
.tb-jauge.alerte span { color: var(--alerte); }
.tb-jauge.alerte .progression i { background: var(--accent); }
.tb-jauge.danger span { color: var(--danger); }
.tb-jauge.danger .progression i { background: var(--danger); }
a.badge { text-decoration: none; }

/* Anneau des catégories */
.tb-anneau { position: relative; width: 190px; max-width: 100%; margin: .25rem auto 1.1rem; }
.anneau { display: block; width: 100%; transform: rotate(0deg); }
.anneau circle { fill: none; stroke-width: 5.2; cursor: pointer; transition: stroke-width var(--transition); }
.anneau circle:hover { stroke-width: 6.4; }
.anneau .anneau-fond { stroke: var(--surface-2); cursor: default; }
.anneau-centre { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; pointer-events: none; }
.anneau-centre b { font-size: 1.35rem; font-weight: 800; letter-spacing: -.02em; }
.anneau-centre small { color: var(--texte-discret); font-size: .72rem; }
.tb-legende { list-style: none; margin: 0; padding: 0; display: grid; gap: .45rem; }
.tb-legende li { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; align-items: center; gap: .6rem; font-size: .88rem; }
.tb-legende i { width: 12px; height: 12px; border-radius: 4px; }
.tb-legende i.neutre { background: var(--bordure-forte); }
.tb-legende span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); }
.tb-legende b { font-variant-numeric: tabular-nums; }

/* Meilleures ventes */
.tb-top { list-style: none; margin: 0; padding: 0; display: grid; gap: .95rem; }
.tb-top li { display: flex; gap: .8rem; align-items: flex-start; }
.tb-rang { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border-radius: 9px; font-weight: 800; font-size: .85rem; background: var(--surface-2); color: var(--texte-discret); }
.tb-top li:first-child .tb-rang { background: #fef3c7; color: #b45309; }
.tb-top li:nth-child(2) .tb-rang { background: #e2e8f0; color: #475569; }
.tb-top li:nth-child(3) .tb-rang { background: #ffedd5; color: #c2410c; }
.tb-top-corps { flex: 1; min-width: 0; }
.tb-top-ligne { display: flex; justify-content: space-between; gap: .75rem; font-size: .9rem; margin-bottom: .3rem; }
.tb-top-ligne strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-top-ligne b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tb-barre { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-bottom: .25rem; }
.tb-barre i { display: block; height: 100%; border-radius: 99px; background: var(--primaire); }
.tb-barre.alerte i { background: var(--accent); }
.tb-barre.danger i { background: var(--danger); }

/* Carte d'affluence (jours x heures) : une teinte, du clair au foncé */
.carte-chaleur { display: grid; gap: 3px; overflow-x: auto; padding-bottom: .2rem; }
.chaleur-ligne { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(14px, 1fr); grid-template-columns: 2.6rem; gap: 3px; align-items: center; }
.chaleur-jour { font-size: .72rem; font-weight: 650; color: var(--texte-discret); }
.chaleur-ligne i { display: block; height: 24px; border-radius: 5px; background: #eef2f6; cursor: pointer; transition: transform var(--transition); }
.chaleur-ligne i:hover { transform: scale(1.12); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3px var(--primaire); }
.carte-chaleur .n1, .chaleur-legende .n1 { background: #ccfbf1; }
.carte-chaleur .n2, .chaleur-legende .n2 { background: #99f6e4; }
.carte-chaleur .n3, .chaleur-legende .n3 { background: #2dd4bf; }
.carte-chaleur .n4, .chaleur-legende .n4 { background: #0d9488; }
.carte-chaleur .n5, .chaleur-legende .n5 { background: #115e59; }
.chaleur-heures em { font-style: normal; font-size: .66rem; color: var(--texte-discret); white-space: nowrap; }
.chaleur-legende { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: .8rem; font-size: .72rem; color: var(--texte-discret); }
.chaleur-legende i { width: 16px; height: 12px; border-radius: 3px; }
.chaleur-legende span { margin: 0 .3rem; }

/* Encaissements : barre empilée (2 px d'espace entre segments) */
.tb-empile { display: flex; gap: 2px; height: 18px; border-radius: 8px; overflow: hidden; margin-bottom: 1rem; }
.tb-empile i { display: block; height: 100%; min-width: 4px; cursor: pointer; }
.tb-empile i:hover { filter: brightness(1.1); }
.tb-legende-montants li { font-size: .9rem; }
.tb-caisse { display: flex; align-items: center; gap: .6rem; margin-top: 1rem; padding: .8rem 1rem; border-radius: var(--rayon-sm); background: var(--primaire-pale); border: 1px solid #b2f0e6; }
.tb-caisse .ico { width: 20px; height: 20px; color: var(--primaire-fonce); }
.tb-caisse span { flex: 1; font-weight: 600; color: var(--primaire-tres-fonce); }
.tb-caisse b { font-size: 1.1rem; color: var(--primaire-tres-fonce); }

/* Flux des dernières ventes */
.tb-flux { list-style: none; margin: 0; padding: 0; }
.tb-flux li + li { border-top: 1px solid var(--bordure); }
.tb-flux a { display: grid; grid-template-columns: 6.8rem minmax(0, 1fr) auto; gap: .75rem; align-items: center; padding: .6rem .35rem; color: inherit; text-decoration: none; border-radius: 8px; }
.tb-flux a:hover { background: var(--surface-2); }
.tb-flux-heure { font-size: .76rem; color: var(--texte-discret); font-variant-numeric: tabular-nums; }
.tb-flux-corps { min-width: 0; }
.tb-flux-corps strong, .tb-flux-corps small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-flux-corps small, .tb-flux-montant small { font-size: .74rem; color: var(--texte-discret); }
.tb-flux-montant { text-align: right; }
.tb-flux-montant b, .tb-flux-montant small { display: block; white-space: nowrap; }

/* Débiteurs et commandes */
.tb-debiteurs, .tb-commandes { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.tb-debiteurs li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .3rem .9rem; align-items: center; padding: .8rem .9rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); }
.tb-debiteurs .tb-deb-haut, .tb-debiteurs .tb-barre, .tb-debiteurs small { grid-column: 1; }
.tb-debiteurs .bouton { grid-column: 2; grid-row: 1 / span 3; }
.tb-deb-haut { display: flex; justify-content: space-between; gap: .75rem; align-items: baseline; }
.tb-deb-haut > span { min-width: 0; }
.tb-deb-haut b { white-space: nowrap; }
.tb-tel { display: inline-flex; align-items: center; gap: .25rem; margin-left: .5rem; font-size: .78rem; color: var(--texte-discret); text-decoration: none; }
.tb-tel .ico { width: 12px; height: 12px; }
.tb-commandes a { display: block; padding: .8rem .9rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); color: inherit; text-decoration: none; transition: border-color var(--transition), background var(--transition); }
.tb-commandes a:hover { border-color: #99e6da; background: var(--primaire-pale); }
.tb-cmd-bas { display: flex; align-items: center; gap: .7rem; margin-top: .5rem; }
.tb-cmd-bas .progression { flex: 1; height: 6px; min-width: 40px; }
.tb-cmd-bas small { font-size: .75rem; color: var(--texte-discret); white-space: nowrap; }
.tb-trio { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1rem; }
.tb-trio > div { padding: .65rem .75rem; border-radius: var(--rayon-sm); background: var(--violet-pale); }
.tb-trio small { display: block; font-size: .72rem; font-weight: 600; color: var(--violet); }
.tb-trio b { display: block; font-size: .92rem; margin-top: .15rem; }

/* Infobulle commune aux graphiques */
.infobulle {
  position: fixed; z-index: 100; pointer-events: none; max-width: 260px; padding: .55rem .75rem; border-radius: 10px;
  background: #0f172a; color: #f8fafc; font-size: .8rem; line-height: 1.45; white-space: pre-line;
  box-shadow: 0 10px 30px rgba(15, 23, 42, .3); opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s;
}
.infobulle.visible { opacity: 1; transform: none; }
.infobulle::first-line { font-weight: 700; }

@media (max-width: 1280px) {
  .tb-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1100px) {
  .tb-2-1, .tb-1-1 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .tb-entete { align-items: stretch; }
  .tb-actions { width: 100%; }
  .tb-actions .bouton { flex: 1; }
  .tb-periodes { flex: 1; }
  .tb-periodes a { flex: 1; text-align: center; }
  .tb-kpis { grid-template-columns: minmax(0, 1fr); gap: .7rem; }
  .tb-hero { min-height: 170px; }
  .tb-kpi { padding: 1rem; }
  .tb-kpi strong { font-size: 1.3rem; }
  .tb-etats { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .histo { --h: 170px; padding-left: 2.2rem; }
  .histo-grad span { left: -2.2rem; width: 1.9rem; }
  .histo-barres, .histo-axe { gap: 2px; }
  .histo-axe span { font-size: .6rem; }
  .tb-flux a { grid-template-columns: minmax(0, 1fr) auto; }
  .tb-flux-heure { grid-column: 1 / -1; }
  .tb-trio { grid-template-columns: minmax(0, 1fr); }
  .tb-trio > div { display: flex; justify-content: space-between; align-items: center; }
  .tb-debiteurs li { grid-template-columns: minmax(0, 1fr); }
  .tb-debiteurs .bouton { grid-column: 1; grid-row: auto; justify-self: start; }
  /* Prévisions : chaque produit devient une petite fiche */
  .tb-prev, .tb-prev tbody { display: block; }
  .tb-prev thead { display: none; }
  .tb-prev tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .45rem 1rem; padding: .85rem 0; border-bottom: 1px solid var(--bordure); }
  .tb-prev tr:last-child { border-bottom: 0; }
  .tb-prev td { display: block; padding: 0 !important; border: 0 !important; }
  .tb-prev td:nth-child(1) { grid-column: 1 / -1; }
  .tb-prev td:nth-child(2) { grid-column: 2; grid-row: 2; text-align: right; }
  .tb-prev td:nth-child(4) { grid-column: 1; grid-row: 2; align-self: center; }
  .tb-prev td:nth-child(5) { grid-column: 1 / -1; grid-row: 3; text-align: left; }
  .tb-prev td.masque-mobile { display: none; }
  .tb-prev .bouton.commander { width: 100%; justify-content: center; }
}
@media print {
  .tb-periodes, .tb-actions, .tb-actualise, .tb-raccourcis { display: none !important; }
  .tb-hero { color: #000; background: none; box-shadow: none; border: 1px solid #999; }
  .tb-hero .tb-libelle, .tb-hero-valeur, .tb-hero-detail, .tb-hero-detail b { color: #000; }
  .tb-spark { display: none; }
}

/* ================================================================== */
/* Situation des clients à crédit                                      */
/* ================================================================== */
.texte-succes { color: var(--succes); }
.credit-synthese { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.cs-bloc {
  --c: var(--info); --c-pale: #eff6ff;
  position: relative; overflow: hidden; isolation: isolate; display: flex; flex-direction: column; gap: .2rem; padding: 1.1rem 1.25rem 1.1rem 1.4rem;
  background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre-2);
}
.cs-bloc::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--c); }
.cs-bloc span { color: var(--texte-discret); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.cs-bloc strong { font-size: 1.55rem; font-weight: 780; letter-spacing: -.02em; }
.cs-bloc small { color: var(--texte-discret); font-size: .8rem; }
.cs-bloc.paye { --c: var(--succes); }
.cs-bloc.paye strong { color: var(--succes); }
.cs-bloc.reste { --c: var(--danger); background: linear-gradient(135deg, #fff5f5, #fff 60%); border-color: #fecaca; }
.cs-bloc.reste strong { color: var(--danger); }
.cs-progression { grid-column: 1 / -1; display: flex; align-items: center; gap: 1rem; }
.cs-progression .tb-barre { flex: 1; margin: 0; height: 10px; }
.cs-progression .tb-barre i, .cr-barre i { background: linear-gradient(90deg, var(--succes), #4ade80); }
.cs-progression small { color: var(--texte-discret); white-space: nowrap; }
.cr-barre { max-width: 260px; height: 5px; margin: .45rem 0 0; }
.tableau tfoot th { border-top: 2px solid var(--bordure-forte); background: var(--surface-2); font-size: .92rem; color: var(--texte); text-transform: none; letter-spacing: 0; padding-top: .8rem; padding-bottom: .8rem; }
.tableau-credits td { vertical-align: middle; }
.tableau-credits .actions { white-space: nowrap; }
@media (max-width: 640px) {
  .credit-synthese { grid-template-columns: minmax(0, 1fr); gap: .6rem; }
  .cs-bloc strong { font-size: 1.25rem; }
  .cs-progression { flex-direction: column; align-items: stretch; gap: .35rem; }
  .cs-progression .tb-barre { flex: none; width: 100%; }
  /* Chaque client devient une fiche : nom et reste à payer, puis les boutons */
  .tableau-credits, .tableau-credits tbody, .tableau-credits tfoot { display: block; }
  .tableau-credits thead { display: none; }
  .tableau-credits tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .5rem .9rem; padding: .9rem 0; border-bottom: 1px solid var(--bordure); }
  .tableau-credits td, .tableau-credits th { display: block; padding: 0 !important; border: 0 !important; background: none !important; }
  .tableau-credits .masque-mobile, .tableau-credits .no-print:empty { display: none !important; }
  .tableau-credits td:nth-child(4), .tableau-credits th:nth-child(4) { grid-column: 2; grid-row: 1; text-align: right; }
  .tableau-credits td.actions { grid-column: 1 / -1; display: flex; gap: .5rem; }
  .tableau-credits td.actions .bouton { flex: 1; justify-content: center; }
  .tableau-credits tfoot tr { border-bottom: 0; border-top: 2px solid var(--bordure-forte); }
}
@media print {
  .credit-synthese { grid-template-columns: repeat(3, 1fr); }
  .cs-bloc { box-shadow: none; border: 1px solid #999; background: none; }
  .cs-bloc::before, .cs-progression, .cr-barre { display: none; }
}

/* ================================================================== */
/* Journal des ventes journalier                                       */
/* ================================================================== */
.jr-nav { display: flex; align-items: flex-end; gap: .4rem; }
.jr-nav label { margin: 0; }
.jr-nav > .bouton { min-width: 44px; padding: 0 .9rem; font-size: 1.3rem; line-height: 1; }
.bouton.desactive { opacity: .4; pointer-events: none; }
.journal { background: var(--surface); border: 1px solid var(--bordure); border-radius: var(--rayon); box-shadow: var(--ombre-2); padding: 1.6rem 1.75rem; }
.jr-entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.25rem; flex-wrap: wrap; padding-bottom: 1.1rem; border-bottom: 2px solid var(--texte); margin-bottom: 1.25rem; }
.jr-entete h2 { margin: .1rem 0 .35rem; font-size: 1.4rem; }
.jr-entete p { margin: 0; }
.jr-depot { font-size: .78rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--primaire-fonce); }
.jr-cumul { text-align: right; padding: .7rem 1rem; border-radius: var(--rayon-sm); background: var(--primaire-pale); border: 1px solid #b2f0e6; }
.jr-cumul small { display: block; color: var(--texte-discret); font-size: .74rem; }
.jr-cumul strong { display: block; font-size: 1.25rem; color: var(--primaire-tres-fonce); }
.jr-synthese { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: .6rem; margin-bottom: 1.5rem; }
.jr-synthese > div { padding: .75rem .85rem; border-radius: var(--rayon-sm); background: var(--surface-2); border: 1px solid var(--bordure); }
.jr-synthese small { display: block; color: var(--texte-discret); font-size: .72rem; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; }
.jr-synthese b { display: block; font-size: 1.12rem; margin-top: .2rem; }
.jr-synthese em { display: block; font-style: normal; font-size: .72rem; color: var(--texte-discret); }
.jr-synthese .fort { background: var(--primaire-pale); border-color: #b2f0e6; }
.jr-synthese .fort b { color: var(--primaire-tres-fonce); }
.jr-synthese .vert b { color: var(--succes); }
.jr-synthese .rouge b { color: var(--danger); }
.jr-section { margin-bottom: 1.6rem; min-width: 0; }
.jr-section h3 { font-size: .9rem; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-2); margin: 0 0 .7rem; padding-bottom: .4rem; border-bottom: 1px solid var(--bordure); }
.jr-table td, .jr-table th { white-space: nowrap; }
.jr-table td:nth-child(3), .jr-table td:nth-child(12) { white-space: normal; min-width: 120px; }
.jr-annulee td { color: var(--texte-discret); background: #fafafa; }
.jr-annulee td.nombre { text-decoration: line-through; }
.jr-note { font-size: .78rem; margin: .5rem 0 0; }
.jr-deux { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; }
.jr-caisse { display: grid; grid-template-columns: 1fr auto; gap: .4rem 1rem; margin: 1rem 0 0; padding: .9rem 1rem; border-radius: var(--rayon-sm); background: var(--primaire-pale); border: 1px solid #b2f0e6; font-size: .9rem; }
.jr-caisse dt { color: var(--texte-2); }
.jr-caisse dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; }
.jr-caisse .total { font-weight: 800; color: var(--primaire-tres-fonce); border-top: 1px solid #99e6da; padding-top: .45rem; font-size: 1rem; }
.jr-signatures { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3rem; margin-top: 2.5rem; }
.jr-signatures div { display: flex; flex-direction: column; gap: 3.2rem; font-size: .85rem; color: var(--texte-2); font-weight: 600; }
.jr-signatures i { display: block; border-bottom: 1px dashed var(--bordure-forte); }
@media (max-width: 1100px) {
  .jr-synthese { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .jr-deux { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .journal { padding: 1rem; }
  .jr-cumul { text-align: left; width: 100%; }
  .jr-synthese { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .jr-nav { width: 100%; }
  .jr-nav label { flex: 1; min-width: 0 !important; }
  .jr-nav input { min-width: 0; }
  .jr-signatures { display: none; }
}
@media print {
  @page { size: A4; margin: 12mm; }
  .journal { border: 0; box-shadow: none; padding: 0; }
  .jr-synthese { grid-template-columns: repeat(6, 1fr); }
  .jr-deux { grid-template-columns: 1fr 1fr; }
  .journal .tableau-defilant { overflow: visible; }
  .journal .tableau { font-size: .7rem; }
  .jr-table { table-layout: auto; width: 100%; }
  .jr-table { font-size: .62rem !important; }
  .jr-table td, .jr-table th { padding: .22rem .25rem; white-space: nowrap; }
  .jr-table th { font-size: .55rem; letter-spacing: 0; }
  .jr-table td:nth-child(3) { white-space: normal; min-width: 30mm; }
  .jr-table td:nth-child(12) { white-space: nowrap; min-width: 0; }
  .journal tfoot { display: table-row-group; }
  .jr-table tr, .jr-deux { break-inside: avoid; }
  .jr-synthese > div { padding: .45rem .5rem; }
  .jr-synthese b { font-size: .85rem; }
  .jr-synthese small, .jr-synthese em { font-size: .6rem; }
  .jr-signatures { display: grid; }
}

/* ================================================================== */
/* Rapports (étape 8)                                                  */
/* ================================================================== */
.rp-synthese { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.rp-note { margin: -.2rem 0 .7rem; }
.rp-graph { display: flex; align-items: flex-end; gap: 3px; height: 170px; padding: .5rem 0 1.4rem; margin-bottom: .8rem; border-bottom: 1px solid var(--bordure); }
.rp-col { position: relative; flex: 1; height: 100%; display: flex; align-items: flex-end; justify-content: center; cursor: pointer; border-radius: 4px; outline: none; }
.rp-col:hover, .rp-col:focus-visible { background: rgba(13, 148, 136, .06); }
.rp-col i { display: block; width: 100%; max-width: 22px; min-height: 2px; border-radius: 4px 4px 0 0; background: #5eb8ae; }
.rp-col.accent i { background: var(--primaire-fonce); }
.rp-col span { position: absolute; bottom: -1.25rem; font-size: .62rem; color: var(--texte-discret); }
.rp-col:nth-child(even) span { visibility: hidden; }
.rp-groupe td { background: var(--primaire-pale) !important; font-weight: 750; color: var(--primaire-tres-fonce); }
.rp-sous-total td { font-weight: 700; background: var(--surface-2); }
.rp-barre td { color: var(--texte-discret); text-decoration: line-through; }
.rp-saisie { min-width: 70px; border-left: 1px solid var(--bordure); }
.rp-table td, .rp-table th { white-space: nowrap; }
.rp-table td:first-child { white-space: normal; }
@media (max-width: 640px) {
  .rp-graph { height: 120px; gap: 1px; }
  .rp-col span { display: none; }
}
@media print {
  .rapport .tableau-defilant { overflow: visible; }
  .rapport .tableau { font-size: .68rem; }
  .rp-table td, .rp-table th { padding: .22rem .3rem; }
  .rp-saisie { border: 1px solid #999 !important; min-width: 22mm; height: 7mm; }
}

/* ================================================================== */
/* Sauvegardes (étape 9)                                               */
/* ================================================================== */
.sv-etat { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-bottom: .6rem; }
.sv-bloc { --c: var(--succes); --c-pale: var(--succes-pale); display: flex; gap: .85rem; align-items: flex-start; padding: 1rem 1.1rem;
  background: var(--surface); border: 1px solid var(--bordure); border-left: 4px solid var(--c); border-radius: var(--rayon); box-shadow: var(--ombre-1); }
.sv-bloc.alerte { --c: var(--accent); --c-pale: var(--accent-pale); }
.sv-bloc.danger { --c: var(--danger); --c-pale: var(--danger-pale); }
.sv-ico { flex: none; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; background: var(--c-pale); color: var(--c); }
.sv-bloc small { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-discret); }
.sv-bloc strong { display: block; margin: .15rem 0; overflow-wrap: anywhere; }
.sv-bloc em { display: block; font-style: normal; font-size: .82rem; color: var(--texte-discret); overflow-wrap: anywhere; }
.sv-lien { margin: 0 0 1.25rem; font-size: .88rem; }
.sv-actions { display: flex; gap: .4rem; justify-content: flex-end; align-items: flex-start; flex-wrap: wrap; }
.sv-restaurer { position: relative; }
.sv-restaurer summary { list-style: none; cursor: pointer; }
.sv-restaurer summary::-webkit-details-marker { display: none; }
.sv-restaurer[open] { order: 5; flex-basis: 100%; }
.sv-confirmer { margin-top: .6rem; padding: 1rem; text-align: left; white-space: normal; max-width: 460px; margin-left: auto;
  background: #fff5f5; border: 1px solid #fecaca; border-radius: var(--rayon-sm); }
.sv-confirmer p { font-size: .84rem; margin: 0 0 .7rem; color: var(--texte-2); }
.sv-confirmer label { font-size: .84rem; font-weight: 600; display: block; margin-bottom: .6rem; }
@media (max-width: 960px) { .sv-etat { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 640px) { .sv-actions { justify-content: flex-start; } .sv-confirmer { margin-left: 0; } }

/* ================================================================== */
/* Application installable (étape 9)                                   */
/* ================================================================== */
.menu-installer { padding: .3rem .75rem .5rem; border-top: 1px solid rgba(255, 255, 255, .06); }
.menu-installer .menu-entree { font-size: .84rem; }
.bouton-installer { width: 100%; border: 0; background: rgba(245, 158, 11, .14); color: #fcd34d; cursor: pointer; font: inherit; text-align: left; }
.bouton-installer:hover { background: rgba(245, 158, 11, .24); }
.mode-app .menu-installer { display: none; } /* déjà installée */
.inst-grille { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.25rem; align-items: start; }
.inst-grille .carte { margin: 0; height: 100%; }
.inst-grille h2 { display: flex; align-items: center; gap: .5rem; }
.inst-etapes { margin: .5rem 0 0; padding-left: 1.2rem; display: grid; gap: .55rem; font-size: .92rem; }
.inst-etapes li::marker { font-weight: 800; color: var(--primaire); }
.inst-adresses { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 1rem; margin-top: 1rem; }
.inst-qr { display: flex; flex-direction: column; align-items: center; gap: .5rem; padding: 1rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); background: #fff; text-align: center; }
.inst-qr img { width: 180px; height: 180px; image-rendering: pixelated; }
.inst-qr code { font-size: .9rem; word-break: break-all; }
.inst-statut { display: flex; gap: .8rem; align-items: center; padding: .9rem 1rem; border-radius: var(--rayon-sm); margin-bottom: 1.25rem; }
.inst-statut.ok { background: var(--succes-pale); color: var(--succes); }
.inst-statut.info { background: var(--info-pale); color: #1e40af; }
.inst-statut.alerte { background: var(--alerte-pale); color: var(--alerte); }
.inst-statut p { margin: 0; color: var(--texte-2); }
.sans-menu .inst-grille { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 1100px) { .inst-grille { grid-template-columns: minmax(0, 1fr); } }
/* Page « hors ligne » (servie sans gabarit) */
body.hors-ligne { min-height: 100vh; display: grid; place-items: center; padding: 1.25rem; background: linear-gradient(160deg, #0f2a2e, #115e59); }
.hl-carte { max-width: 440px; background: var(--surface); border-radius: var(--rayon); padding: 2rem; box-shadow: var(--ombre-3); }
.hl-carte img { border-radius: 16px; }
.hl-carte h1 { font-size: 1.35rem; margin: 1rem 0 .5rem; }
.hl-carte ul { padding-left: 1.2rem; display: grid; gap: .4rem; margin: 0 0 1.25rem; }
.sans-menu .entete-page h1, .sans-menu .entete-page .discret { color: #fff; text-shadow: 0 1px 4px rgba(0, 0, 0, .6); }
.sans-menu .contenu-etroit:has(.inst-grille) { max-width: 880px; }

/* ================================================================== */
/* Logo de la société                                                  */
/* ================================================================== */
.logo-zone { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 1.25rem; align-items: start; }
.logo-apercu { display: grid; place-items: center; gap: .4rem; min-height: 140px; padding: 1rem; border-radius: var(--rayon-sm);
  background: repeating-conic-gradient(#f1f5f9 0 25%, #fff 0 50%) 0 0 / 16px 16px; border: 1px solid var(--bordure); text-align: center; }
.logo-apercu img { max-width: 100%; max-height: 120px; object-fit: contain; }
.logo-apercu .logo-defaut { width: 64px; height: 64px; }
.logo-apercu small { color: var(--texte-discret); font-size: .75rem; }
.logo-formulaire { display: flex; flex-wrap: wrap; gap: .6rem; align-items: center; margin: .8rem 0; }
.logo-formulaire input[type=file] { flex: 1; min-width: 200px; margin: 0; }
.marque-logo { flex: none; display: grid; place-items: center; width: 40px; height: 40px; padding: 3px; border-radius: 10px; background: #fff; }
.marque-logo img { max-width: 100%; max-height: 100%; object-fit: contain; }
/* Écran d'accueil : le logo apparaît en douceur à l'ouverture du logiciel. */
.accueil-societe { display: flex; flex-direction: column; align-items: flex-start; gap: .6rem; margin-bottom: 2.2rem; }
.accueil-logo { display: grid; place-items: center; min-width: 150px; max-width: 320px; height: 150px; padding: 18px 22px; border-radius: 28px; background: #fff;
  box-shadow: 0 18px 40px rgba(0, 0, 0, .35); animation: logo-apparition .9s cubic-bezier(.2, .8, .2, 1) both; }
.accueil-logo img { max-width: 276px; max-height: 114px; object-fit: contain; }
.accueil-nom { margin: .4rem 0 0; color: #fff; font-size: 1.6rem; font-weight: 800; letter-spacing: -.02em; animation: texte-apparition .9s .25s both; }
.accueil-app { display: flex; align-items: center; gap: .45rem; margin: 0; color: #99f6e4; font-size: .9rem; animation: texte-apparition .9s .45s both; }
.accueil-app img { border-radius: 6px; }
@keyframes logo-apparition { from { opacity: 0; transform: scale(.85) translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes texte-apparition { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .accueil-logo, .accueil-nom, .accueil-app { animation: none; } }
.ticket-logo { display: block; max-width: 140px; max-height: 70px; margin: 0 auto .5rem; object-fit: contain; }
.jr-entete { align-items: center; }
.jr-logo { flex: none; max-width: 120px; max-height: 64px; object-fit: contain; }
.jr-titre { flex: 1; min-width: 0; }
@media (max-width: 1100px) {
  .accueil-societe { flex-direction: row; align-items: center; margin: 0; gap: .8rem; }
  .accueil-logo { min-width: 56px; max-width: 120px; height: 56px; padding: 6px 8px; border-radius: 14px; }
  .accueil-logo img { max-width: 104px; max-height: 44px; }
  .accueil-nom { margin: 0; font-size: 1.2rem; }
  .accueil-app { display: none; }
}
@media (max-width: 640px) { .logo-zone { grid-template-columns: minmax(0, 1fr); } }

/* ================================================================== */
/* Couleurs personnalisées (Administration › Paramètres › Couleurs)   */
/* ================================================================== */
/* Bande verticale claire : textes foncés. */
.menu-clair .menu-lateral { border-right: 1px solid var(--bordure); box-shadow: 4px 0 18px rgba(15, 23, 42, .05); }
.menu-clair .marque, .menu-clair .carte-utilisateur { color: var(--texte); }
.menu-clair .marque { border-bottom-color: rgba(15, 23, 42, .08); }
.menu-clair .marque img { box-shadow: 0 2px 8px rgba(15, 23, 42, .15); }
.menu-clair .marque-logo { box-shadow: inset 0 0 0 1px var(--bordure); }
.menu-clair .menu-entree:hover { background: rgba(15, 23, 42, .05); color: var(--texte); }
.menu-clair .menu-entree.actif { background: var(--primaire-pale); color: var(--primaire-tres-fonce); }
.menu-clair .menu-entree.actif .ico { color: var(--primaire); }
.menu-clair .menu-pied { background: rgba(15, 23, 42, .03); border-top-color: rgba(15, 23, 42, .08); }
.menu-clair .menu-installer { border-top-color: rgba(15, 23, 42, .08); }
.menu-clair .bouton-installer { color: var(--accent-fonce); }
.menu-clair .bouton-deconnexion { background: rgba(15, 23, 42, .05); }
.menu-clair .menu-defilant { scrollbar-color: rgba(15, 23, 42, .2) transparent; }
/* Fond de page sombre : titres posés sur le fond en clair. */
.fond-sombre .entete-page h1, .fond-sombre .tb-entete h1, .fond-sombre .tb-titre-section { color: #f8fafc; }
.fond-sombre .titre-page > p, .fond-sombre .tb-entete p, .fond-sombre .pied, .fond-sombre .sv-lien,
.fond-sombre .entete-page > div > p { color: #cbd5e1; }
.fond-sombre .sv-lien a { color: #99f6e4; }
/* Réglage des couleurs */
.couleurs-themes { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: .6rem; margin: .4rem 0 1.2rem; }
.theme-choix { display: flex; align-items: center; gap: .6rem; padding: .5rem .6rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm);
  background: var(--surface); cursor: pointer; font: inherit; font-size: .84rem; font-weight: 600; color: var(--texte-2); text-align: left; }
.theme-choix:hover, .theme-choix.choisi { border-color: var(--primaire); box-shadow: var(--anneau); }
.theme-apercu { flex: none; display: flex; width: 44px; height: 30px; border-radius: 7px; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12); }
.theme-apercu i { display: block; width: 14px; }
.theme-apercu b { display: block; flex: 1; }
.couleurs-perso { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.couleurs-perso input[type=color] { width: 100%; height: 46px; }
@media (max-width: 640px) { .couleurs-perso { grid-template-columns: minmax(0, 1fr); } }

/* ===================== Aide (version 1.0) ===================== */
.aide-guides { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); margin-bottom: 1rem; }
.aide-guide { display: flex; gap: 1.1rem; align-items: flex-start; }
.aide-couverture { flex: 0 0 92px; height: 124px; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .5rem;
  color: #fff; background: linear-gradient(160deg, var(--menu-degrade-1, #0f2a2e), var(--menu-degrade-2, #0f766e)); box-shadow: 0 6px 16px rgba(15,23,42,.18); }
.aide-couverture.admin { background: linear-gradient(160deg, #1e293b, #475569); }
.aide-couverture svg { width: 34px; height: 34px; }
.aide-couverture span { font-size: .72rem; opacity: .85; }
.aide-texte h2 { margin: 0 0 .35rem; font-size: 1.1rem; }
.aide-texte p { margin: 0 0 .9rem; color: var(--texte-2, #475569); font-size: .9rem; }
.aide-texte .actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.aide-raccourcis dl { display: grid; grid-template-columns: minmax(180px, 30%) 1fr; gap: .55rem 1rem; margin: 0; }
.aide-raccourcis dt { font-weight: 700; }
.aide-raccourcis dd { margin: 0; color: var(--texte-2, #475569); }
@media (max-width: 640px) { .aide-raccourcis dl { grid-template-columns: 1fr; } .aide-raccourcis dd { margin-bottom: .5rem; } .aide-couverture { flex-basis: 70px; height: 96px; } }

/* ============== Tableaux de bord personnalisés (version 1.1) ============== */
.tdbp-grille { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; align-items: stretch; }
.tdbp-w { margin: 0; min-width: 0; display: flex; flex-direction: column; gap: .55rem; position: relative; }
.tdbp-w.l1 { grid-column: span 1; } .tdbp-w.l2 { grid-column: span 2; } .tdbp-w.l3 { grid-column: span 3; } .tdbp-w.l4 { grid-column: span 4; }
.tdbp-w-entete { display: flex; align-items: baseline; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.tdbp-w-entete h2 { margin: 0; font-size: .95rem; }
.v-chiffre .tdbp-w-entete h2, .v-jauge .tdbp-w-entete h2 { color: var(--texte-discret); font-size: .74rem; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; }
.tdbp-sous { font-size: .72rem; color: var(--texte-discret); background: var(--surface-2); border: 1px solid var(--bordure); border-radius: 99px; padding: .05rem .5rem; }
.tdbp-valeur { font-size: clamp(1.45rem, 2.2vw, 1.9rem); font-weight: 800; letter-spacing: -.025em; line-height: 1.1; font-variant-numeric: tabular-nums; }
.tdbp-w .tb-delta { align-self: flex-start; }
.v-chiffre::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 4px; border-radius: 0 4px 4px 0; background: var(--primaire); }
.tdbp-w.etat-alerte { border-color: #fecaca; background: linear-gradient(135deg, #fff5f5, var(--surface) 60%); }
.tdbp-w.etat-alerte::before { background: var(--danger); }
.tdbp-w.etat-alerte .tdbp-valeur { color: #b91c1c; }
.tdbp-w.etat-ok::before { background: var(--succes); }
.tdbp-w.etat-encours::before { background: var(--accent); }
.tdbp-objectif small, .tdbp-seuil, .tdbp-seuil-pied { display: flex; align-items: center; gap: .3rem; font-size: .78rem; color: var(--texte-discret); }
.tdbp-objectif .tb-barre { margin-bottom: .3rem; }
.etat-ok .tdbp-objectif .tb-barre i { background: var(--succes); }
.etat-encours .tdbp-objectif .tb-barre i { background: var(--accent); }
.tdbp-seuil .ico, .tdbp-objectif .ico, .tdbp-seuil-pied .ico { width: 14px; height: 14px; }
.etat-alerte .tdbp-seuil { color: #b91c1c; font-weight: 650; }
.etat-ok .tdbp-seuil { color: var(--succes); }
.tdbp-seuil-pied { margin-top: auto; padding-top: .3rem; }
.tdbp-masque, .tdbp-vide { display: flex; align-items: center; gap: .45rem; color: var(--texte-discret); font-size: .86rem; margin: auto 0; padding: .8rem 0; }
.tdbp-masque.erreur { color: #b91c1c; }
.tdbp-vide-tableau { align-items: center; text-align: center; padding: 2.5rem 1rem; color: var(--texte-discret); }
.tdbp-vide-tableau .ico { width: 34px; height: 34px; color: var(--primaire); }

/* Jauge */
.tdbp-jauge { position: relative; max-width: 220px; width: 100%; margin: .2rem auto 0; }
.tdbp-jauge svg { display: block; width: 100%; }
.tdbp-jauge path { fill: none; stroke-width: 11; stroke-linecap: round; }
.tdbp-jauge .fond { stroke: var(--surface-2); stroke: #e8edf3; }
.tdbp-jauge .niveau { stroke: var(--accent); transition: stroke-dasharray .8s ease; }
.etat-ok .tdbp-jauge .niveau { stroke: var(--succes); }
.etat-alerte .tdbp-jauge .niveau { stroke: var(--danger); }
.tdbp-jauge-centre { position: absolute; left: 0; right: 0; bottom: 2px; text-align: center; }
.tdbp-jauge-centre b { display: block; font-size: 1.45rem; font-weight: 800; letter-spacing: -.02em; }
.tdbp-jauge-centre small { color: var(--texte-discret); font-size: .72rem; }
.tdbp-jauge-detail { text-align: center; margin: 0; font-size: .84rem; color: var(--texte-discret); }
.tdbp-jauge-detail strong { color: var(--texte); }
.v-jauge .tb-delta { align-self: center; }

/* Courbe */
.tdbp-courbe { width: 100%; height: auto; display: block; overflow: visible; }
.tdbp-courbe .grille { stroke: var(--bordure); stroke-width: 1; }
.tdbp-courbe text { font-size: 11px; fill: var(--texte-discret); font-family: inherit; }
.tdbp-courbe .axe-y { text-anchor: end; }
.tdbp-courbe .axe-x { text-anchor: middle; }
.tdbp-courbe .ligne { fill: none; stroke: var(--primaire); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; }
.tdbp-courbe .aire { fill: var(--primaire); opacity: .09; }
.tdbp-courbe circle { fill: var(--surface); stroke: var(--primaire); stroke-width: 2; cursor: pointer; outline: none; }
.tdbp-courbe circle:hover, .tdbp-courbe circle:focus { fill: var(--primaire); r: 6; }
.tdbp-courbe circle.alerte { stroke: var(--danger); fill: var(--danger-pale); }
.tdbp-histo { --h: 200px; }
.histo-col.alerte i { background: var(--danger) !important; }

/* Anneau et classement */
.tdbp-anneau { display: grid; grid-template-columns: minmax(130px, 170px) minmax(0, 1fr); gap: 1rem; align-items: center; }
.tdbp-anneau .tb-anneau { margin: 0; width: 100%; }
.tdbp-anneau .anneau-centre b { font-size: 1.1rem; }
.tb-legende li.alerte span { color: #b91c1c; font-weight: 650; }
.tdbp-barres { list-style: none; margin: 0; padding: 0; display: grid; gap: .7rem; }
.tdbp-barres li { display: flex; gap: .7rem; align-items: center; }
.tdbp-barres li:first-child .tb-rang { background: #fef3c7; color: #b45309; }
.tdbp-barres li.autres .tb-rang { background: transparent; }
.tdbp-barre-corps { flex: 1; min-width: 0; }
.tdbp-barre-ligne { display: flex; justify-content: space-between; gap: .6rem; font-size: .86rem; margin-bottom: .25rem; }
.tdbp-barre-ligne span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdbp-barre-ligne b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.tdbp-barres li.alerte .tdbp-barre-ligne { color: #b91c1c; }
.tdbp-barres li.alerte .tb-barre i { background: var(--danger) !important; }
.tdbp-barres li.autres { opacity: .75; }
.tdbp-tableau tr.alerte td { color: #b91c1c; background: #fff5f5; }
.tdbp-tableau tr.alerte .ico { width: 14px; height: 14px; vertical-align: -2px; }
.tdbp-tableau tr.autres td { color: var(--texte-discret); font-style: italic; }
.tdbp-part { display: inline-block; width: 46px; height: 6px; border-radius: 99px; background: var(--surface-2); margin-right: .45rem; vertical-align: middle; overflow: hidden; }
.tdbp-part i { display: block; height: 100%; background: var(--primaire); border-radius: 99px; }

/* Filtres */
.tdbp-filtres { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .75rem 1rem; padding: .85rem 1rem; margin-bottom: 1rem; }
.tdbp-filtres label { display: flex; flex-direction: column; gap: .25rem; font-size: .76rem; font-weight: 700; color: var(--texte-discret); }
.tdbp-filtres label[hidden] { display: none; }
.tdbp-filtres label .ico { width: 14px; height: 14px; vertical-align: -2px; }
.tdbp-filtres select, .tdbp-filtres input { min-width: 150px; }

/* Liste et modèles */
.tdbp-modeles { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: .9rem; }
.tdbp-modele { display: flex; flex-direction: column; gap: .35rem; padding: 1rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); background: linear-gradient(160deg, var(--surface), var(--surface-2)); transition: border-color var(--transition), transform var(--transition), box-shadow var(--transition); }
.tdbp-modele:hover { border-color: var(--primaire); transform: translateY(-2px); box-shadow: var(--ombre-2); }
.tdbp-modele-ico { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; background: var(--primaire-pale); color: var(--primaire-fonce); margin-bottom: .2rem; }
.tdbp-modele small { color: var(--texte-2); font-size: .82rem; }
.tdbp-modele .bouton { margin-top: auto; align-self: flex-start; }
.tdbp-nouveau { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.5fr) minmax(0, 1fr) auto; gap: 0 .9rem; align-items: end; }
.tdbp-nouveau .bouton { margin-bottom: .9rem; }
.role-puce { display: inline-block; font-size: .74rem; font-weight: 650; padding: .1rem .5rem; border-radius: 99px; background: var(--info-pale); color: #1e40af; margin: .1rem 0; }

/* Éditeur */
.tdbp-editeur { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.05fr); gap: 1.25rem; align-items: start; margin-bottom: 1.5rem; }
.tdbp-col > .carte:last-child { margin-bottom: 0; }
.tdbp-assistant { position: sticky; top: 76px; margin: 0; max-height: calc(100vh - 92px); overflow-y: auto; }
.tdbp-etape { border: 0; padding: 0; margin: 0 0 1rem; }
.tdbp-etape legend { display: flex; align-items: center; gap: .5rem; font-weight: 750; font-size: .92rem; margin-bottom: .6rem; padding: 0; }
.tdbp-etape legend > span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--primaire); color: #fff; font-size: .78rem; }
.tdbp-etape legend .ico { width: 16px; height: 16px; color: var(--primaire); }
.tdbp-tuiles { display: grid; gap: .5rem; }
.tdbp-tuiles.sources { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.tdbp-tuiles.visuels { grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); }
.formulaire .tdbp-tuile { margin: 0; cursor: pointer; }
.tdbp-tuile input { position: absolute; opacity: 0; pointer-events: none; }
.tdbp-tuile > span { display: flex; flex-direction: column; gap: .15rem; height: 100%; padding: .6rem .7rem; border: 1.5px solid var(--bordure); border-radius: var(--rayon-sm); background: var(--surface); transition: border-color var(--transition), background var(--transition), box-shadow var(--transition); }
.tdbp-tuile strong { font-size: .86rem; color: var(--texte); }
.tdbp-tuile small { font-weight: 500; font-size: .74rem; color: var(--texte-discret); line-height: 1.3; }
.tdbp-tuile:hover > span { border-color: var(--bordure-forte); }
.tdbp-tuile input:checked + span { border-color: var(--primaire); background: var(--primaire-pale); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.tdbp-tuile input:focus-visible + span { outline: 2px solid var(--primaire); outline-offset: 2px; }
.tdbp-tuile.visuel > span { align-items: center; text-align: center; padding: .55rem .3rem; }
.tdbp-tuile.visuel .ico { width: 26px; height: 26px; color: var(--primaire-fonce); }
.tdbp-tuile.visuel strong { font-size: .76rem; }
.tdbp-tuile.indisponible { opacity: .38; cursor: not-allowed; }
.tdbp-seuil-saisie { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .5rem; }
.tdbp-icones { border: 0; padding: 0; margin: 0 0 .9rem; display: flex; flex-wrap: wrap; gap: .35rem; }
.tdbp-icones legend { font-weight: 600; font-size: .86rem; color: var(--texte-2); margin-bottom: .35rem; padding: 0; }
.formulaire .tdbp-icones label { margin: 0; }
.tdbp-icones input { position: absolute; opacity: 0; }
.tdbp-icones span { display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px; border: 1.5px solid var(--bordure); cursor: pointer; color: var(--texte-2); }
.tdbp-icones input:checked + span { border-color: var(--primaire); background: var(--primaire-pale); color: var(--primaire-fonce); }
.tdbp-diffusion { border: 0; padding: 0; margin: 0 0 .6rem; }
.tdbp-diffusion legend { font-weight: 700; padding: 0; margin-bottom: .2rem; }
.tdbp-diffusion .case { margin: 0; }
.tdbp-liste-widgets { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: .5rem; }
.tdbp-liste-widgets li { display: flex; align-items: center; gap: .7rem; padding: .55rem .65rem; border: 1px solid var(--bordure); border-radius: var(--rayon-sm); background: var(--surface); }
.tdbp-liste-widgets li.edite { border-color: var(--primaire); box-shadow: 0 0 0 3px rgba(13, 148, 136, .15); }
.tdbp-lw-ico { flex: none; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--primaire-pale); color: var(--primaire-fonce); }
.tdbp-lw-corps { flex: 1; min-width: 0; }
.tdbp-lw-corps strong { display: block; font-size: .9rem; }
.tdbp-lw-corps small { display: block; color: var(--texte-discret); font-size: .76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tdbp-lw-actions { display: flex; gap: .2rem; }
.tdbp-lw-actions form { margin: 0; }
.bouton-icone { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 8px; border: 1px solid transparent; background: none; color: var(--texte-2); cursor: pointer; text-decoration: none; }
.bouton-icone:hover:not(:disabled) { background: var(--surface-2); border-color: var(--bordure); color: var(--primaire-fonce); }
.bouton-icone.danger:hover { color: var(--danger); background: var(--danger-pale); }
.bouton-icone:disabled { opacity: .3; cursor: default; }
.bouton-icone .ico { width: 17px; height: 17px; }
.tdbp-apercu { padding: 1.25rem; border: 2px dashed var(--bordure-forte); border-radius: var(--rayon); margin-bottom: 1.25rem; background: repeating-linear-gradient(135deg, transparent 0 14px, rgba(148, 163, 184, .04) 14px 28px); }
.tdbp-danger { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: flex-end; }
.tdbp-danger form { margin: 0; }

@media (max-width: 1200px) {
  .tdbp-grille { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tdbp-w.l3, .tdbp-w.l4 { grid-column: span 2; }
  .tdbp-editeur { grid-template-columns: 1fr; }
  .tdbp-assistant { position: static; max-height: none; }
}
@media (max-width: 640px) {
  .tdbp-grille { grid-template-columns: 1fr; }
  .tdbp-w.l1, .tdbp-w.l2, .tdbp-w.l3, .tdbp-w.l4 { grid-column: span 1; }
  .tdbp-anneau { grid-template-columns: 1fr; }
  .tdbp-anneau .tb-anneau { max-width: 170px; margin: 0 auto; }
  .tdbp-nouveau { grid-template-columns: 1fr; }
  .tdbp-filtres select, .tdbp-filtres input { min-width: 0; width: 100%; }
  .tdbp-filtres label { flex: 1 1 140px; }
}
@media print {
  .tdbp-grille { grid-template-columns: repeat(2, 1fr); }
  .tdbp-w { break-inside: avoid; }
}
.tdbp-assistant [hidden] { display: none !important; }
.tdbp-assistant .requis input { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(245, 158, 11, .15); }
.tdbp-valeur small { font-size: .5em; font-weight: 700; color: var(--texte-discret); letter-spacing: 0; margin-left: .2rem; }
.tdbp-filtres label > span { display: inline-flex; align-items: center; gap: .3rem; }
