/* ==================================================================
   Boutique — styles (mobile d'abord, mode sombre automatique)
   ================================================================== */

:root {
  --marine: #0c2f3d;
  --marine-2: #12465a;
  --vert: #0b8a7d;
  --vert-fonce: #087064;
  --vert-pale: rgba(11, 138, 125, .12);
  --poisson: #2f6fdb;
  --boisson: #ee8a1f;
  --autre: #7c5cd6;
  --rouge: #d64545;
  --orange: #e68a00;
  --fond: #eef3f6;
  --carte: #ffffff;
  --carte-2: #f5f8fa;
  --texte: #14232b;
  --doux: #5d7380;
  --bord: #dde6ec;
  --ombre: 0 1px 2px rgba(12, 47, 61, .05), 0 4px 16px rgba(12, 47, 61, .06);
  --rayon: 16px;
  --haut-sure: env(safe-area-inset-top, 0px);
  --bas-sure: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --fond: #0a1a21;
    --carte: #11262f;
    --carte-2: #163039;
    --texte: #e7f0f4;
    --doux: #93a9b4;
    --bord: #21404c;
    --vert-pale: rgba(20, 170, 155, .16);
    --poisson: #5b93f0;
    --boisson: #f5a04a;
    --autre: #a08af0;
    --rouge: #ef6b6b;
    --orange: #f2a33a;
    --ombre: none;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  background: var(--fond);
  color: var(--texte);
  overflow-x: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
[hidden] { display: none !important; }
.cache-visuel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------------- Barre du haut ---------------- */
.barre-haut {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 12px;
  padding: calc(10px + var(--haut-sure)) 16px 10px;
  background: var(--marine);
  color: #fff;
}
.barre-haut .logo { width: 34px; height: 34px; border-radius: 10px; }
.barre-haut .titre { flex: 1; min-width: 0; }
.barre-haut .boutique { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.barre-haut .qui { font-size: 12px; opacity: .78; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pastille-reseau {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px; border-radius: 999px; border: 0;
  background: rgba(255, 255, 255, .12); color: #fff; font-size: 12px; font-weight: 700; white-space: nowrap;
}
.pastille-reseau.hors-ligne { background: var(--rouge); }
.pastille-reseau.attente { background: var(--orange); }

/* ---------------- Contenu ---------------- */
main {
  max-width: 760px; margin: 0 auto;
  padding: 16px 16px calc(var(--nav-h) + var(--bas-sure) + 24px);
}
body.avec-panier main { padding-bottom: calc(var(--nav-h) + var(--bas-sure) + 96px); }

.entete-page { display: flex; align-items: center; gap: 10px; margin: 2px 0 14px; min-height: 44px; }
.entete-page h1 { flex: 1; margin: 0; font-size: 21px; font-weight: 800; letter-spacing: -.01em; }
.retour {
  display: inline-flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: 12px; background: none;
}

.carte {
  background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  padding: 16px; margin-bottom: 14px; box-shadow: var(--ombre);
}
.carte h2, .section-titre {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 0 0 12px; font-size: 15px; font-weight: 800;
}
.section-titre { margin: 22px 2px 10px; }
.section-titre small, .carte h2 small { font-weight: 600; color: var(--doux); font-size: 13px; }
.doux { color: var(--doux); }
.petit { font-size: 13px; }
.rouge { color: var(--rouge); }
.orange { color: var(--orange); }
.vert { color: var(--vert); }
.gras { font-weight: 800; }
.droite { text-align: right; }
.vide { text-align: center; color: var(--doux); padding: 26px 12px; font-size: 14px; }
.vide svg { display: block; margin: 0 auto 8px; opacity: .5; }
.chargement { text-align: center; padding: 40px; color: var(--doux); }
.chargement::before {
  content: ""; display: block; width: 28px; height: 28px; margin: 0 auto 10px;
  border: 3px solid var(--bord); border-top-color: var(--vert); border-radius: 50%;
  animation: tourne .8s linear infinite;
}
@keyframes tourne { to { transform: rotate(360deg); } }

/* ---------------- Boutons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 10px 18px; border-radius: 12px; border: 1px solid transparent;
  background: var(--vert); color: #fff; font-weight: 700; font-size: 15px; text-decoration: none;
  transition: transform .08s, background .15s;
}
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .55; pointer-events: none; }
.btn.bloc { width: 100%; }
.btn.secondaire { background: var(--carte-2); color: var(--texte); border-color: var(--bord); }
.btn.danger { background: var(--rouge); }
.btn.contour-danger { background: transparent; color: var(--rouge); border-color: var(--rouge); }
.btn.petit-btn { min-height: 40px; padding: 6px 14px; font-size: 14px; }
.btn.icone { width: 44px; min-height: 44px; padding: 0; }
.rangee-btn { display: flex; gap: 10px; }
.rangee-btn > .btn { flex: 1; }

/* Puces (filtres, choix rapides) */
.puces { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.puces::-webkit-scrollbar { display: none; }
.puces.enveloppe { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.puce {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 40px; padding: 6px 14px; border-radius: 999px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--texte); font-weight: 600; font-size: 14px;
}
.puce.active { background: var(--marine); border-color: var(--marine); color: #fff; }
@media (prefers-color-scheme: dark) { .puce.active { background: var(--vert); border-color: var(--vert); } }

/* Contrôle segmenté (onglets, paiement) */
.segments { display: flex; gap: 4px; padding: 4px; background: var(--carte-2); border: 1px solid var(--bord); border-radius: 14px; margin-bottom: 14px; }
.segments button {
  flex: 1; min-height: 42px; border: 0; border-radius: 10px; background: none;
  font-weight: 700; font-size: 14px; color: var(--doux);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
}
.segments button.actif { background: var(--carte); color: var(--texte); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.segments.paiement button { flex-direction: column; gap: 2px; min-height: 58px; font-size: 13px; }
@media (prefers-color-scheme: dark) { .segments button.actif { background: var(--vert); color: #fff; } }

/* ---------------- Formulaires ---------------- */
.champ { margin-bottom: 14px; }
.champ label, .champ .etiquette { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.champ .aide { font-size: 12px; color: var(--doux); margin-top: 5px; }
.saisie, select.saisie {
  width: 100%; min-height: 48px; padding: 10px 14px; font-size: 16px;
  background: var(--carte-2); border: 1px solid var(--bord); border-radius: 12px; outline: none;
  appearance: none; -webkit-appearance: none;
}
select.saisie {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' fill='none' stroke='%235d7380' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 8l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.saisie:focus { border-color: var(--vert); box-shadow: 0 0 0 3px var(--vert-pale); }
.saisie.erreur { border-color: var(--rouge); }
.deux-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.recherche { position: relative; margin-bottom: 12px; }
.recherche svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--doux); pointer-events: none; }
.recherche .saisie { padding-left: 42px; background: var(--carte); }
.case-cocher { display: flex; align-items: center; gap: 12px; min-height: 48px; font-weight: 600; cursor: pointer; }
.case-cocher input { width: 22px; height: 22px; accent-color: var(--vert); margin: 0; }
.message-erreur { color: var(--rouge); font-size: 14px; font-weight: 600; margin: 4px 0 12px; }
.encadre { border-radius: 12px; padding: 12px 14px; font-size: 14px; background: var(--carte-2); border: 1px solid var(--bord); margin-bottom: 14px; }
.encadre.attention { background: rgba(230, 138, 0, .1); border-color: rgba(230, 138, 0, .35); }
.encadre.danger { background: rgba(214, 69, 69, .1); border-color: rgba(214, 69, 69, .35); color: var(--rouge); }
.encadre ul { margin: 6px 0 0; padding-left: 20px; }
.encadre ul.liste { padding-left: 0; }
.encadre li { margin: 3px 0; }

/* ---------------- Connexion ---------------- */
.ecran-connexion {
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: calc(24px + var(--haut-sure)) 20px calc(24px + var(--bas-sure));
  background: linear-gradient(160deg, var(--marine) 0%, var(--marine-2) 55%, var(--vert) 130%);
}
.ecran-connexion .logo-grand { width: 84px; height: 84px; border-radius: 24px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.ecran-connexion h1 { color: #fff; margin: 16px 0 2px; font-size: 24px; font-weight: 800; text-align: center; }
.ecran-connexion .sous-titre { color: rgba(255,255,255,.75); margin: 0 0 24px; font-size: 14px; }
.ecran-connexion .carte { width: 100%; max-width: 400px; padding: 22px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.ecran-connexion .signature { color: rgba(255,255,255,.65); font-size: 12px; margin-top: 22px; }
.mdp-boite { position: relative; }
.mdp-boite .saisie { padding-right: 52px; }
.mdp-boite button { position: absolute; right: 2px; top: 2px; width: 44px; height: 44px; border: 0; background: none; color: var(--doux); }

/* ---------------- Barre de navigation du bas ---------------- */
.nav-bas {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: center;
  background: var(--carte); border-top: 1px solid var(--bord);
  padding-bottom: var(--bas-sure);
}
.nav-bas .interieur { display: flex; width: 100%; max-width: 760px; }
.nav-bas a {
  flex: 1; height: var(--nav-h);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--doux); text-decoration: none; font-size: 11.5px; font-weight: 700;
}
.nav-bas a.actif { color: var(--vert); }
.nav-bas a svg { width: 24px; height: 24px; padding: 4px 16px; border-radius: 999px; box-sizing: content-box; }
.nav-bas a.actif svg { background: var(--vert-pale); }

/* ---------------- Accueil ---------------- */
.bandeau {
  border-radius: 20px; padding: 18px 18px 16px; margin-bottom: 14px; color: #fff;
  background: linear-gradient(135deg, var(--marine) 0%, var(--marine-2) 50%, var(--vert) 140%);
  position: relative; overflow: hidden;
}
.bandeau::after {
  content: ""; position: absolute; right: -40px; top: -40px; width: 160px; height: 160px;
  border-radius: 50%; background: rgba(255,255,255,.06);
}
.bandeau .libelle { font-size: 13px; opacity: .8; font-weight: 600; }
.bandeau .montant { font-size: 32px; font-weight: 800; letter-spacing: -.02em; margin: 2px 0 12px; }
.bandeau .montant small { font-size: 16px; font-weight: 700; opacity: .8; }
.bandeau .chiffres { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 13px; }
.bandeau .chiffres b { display: block; font-size: 16px; }
.bandeau .chiffres span { opacity: .78; }
.bandeau.negatif { background: linear-gradient(135deg, #5b1f24 0%, #8d2f35 60%, var(--rouge) 140%); }

.actions-rapides { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.action-rapide {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  min-height: 88px; padding: 10px 6px; border-radius: var(--rayon); border: 1px solid var(--bord);
  background: var(--carte); font-weight: 700; font-size: 13px; text-align: center; box-shadow: var(--ombre);
}
a.action-rapide { color: inherit; text-decoration: none; }
.action-rapide .rond { width: 42px; height: 42px; border-radius: 14px; display: flex; align-items: center; justify-content: center; color: #fff; }

.tuiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.tuile { background: var(--carte-2); border-radius: 12px; padding: 10px; min-width: 0; display: flex; flex-direction: column; }
.tuile .t-lib { font-size: 12px; color: var(--doux); font-weight: 600; display: flex; align-items: center; gap: 5px; }
.tuile .t-val { font-weight: 800; font-size: 15px; margin-top: auto; padding-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuile .t-val small { font-size: 11px; color: var(--doux); font-weight: 700; }
.tuiles.deux { grid-template-columns: 1fr 1fr; }

/* Graphique en barres CSS */
.graphe { display: flex; align-items: flex-end; gap: 6px; height: 150px; padding-top: 18px; }
.graphe .col { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 4px; }
.graphe .barre { width: 100%; max-width: 38px; border-radius: 7px 7px 3px 3px; background: var(--vert); min-height: 3px; position: relative; }
.graphe .barre.aujourdhui { background: var(--marine); }
@media (prefers-color-scheme: dark) { .graphe .barre.aujourdhui { background: #4fd1c1; } }
.graphe .barre .val { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 700; color: var(--doux); white-space: nowrap; margin-bottom: 2px; }
.graphe .jour { font-size: 11px; color: var(--doux); font-weight: 600; white-space: nowrap; }
.graphe.dense { gap: 2px; }
.graphe.dense .barre .val { display: none; }
.graphe-defile { overflow-x: auto; }

/* ---------------- Listes ---------------- */
.liste { list-style: none; margin: 0; padding: 0; }
.liste > li + li { border-top: 1px solid var(--bord); }
.element {
  display: flex; align-items: center; gap: 12px; width: 100%;
  padding: 11px 0; min-height: 56px; background: none; border: 0; text-align: left;
}
button.element:active { opacity: .7; }
.element .corps { flex: 1; min-width: 0; }
.element .nom { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.element .detail { font-size: 13px; color: var(--doux); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.element .detail.multi { white-space: normal; }
.element .fin { text-align: right; flex: none; }
.element .fin .montant { font-weight: 800; }
.carte > .liste { margin: -6px 0; }

.icone-cat { width: 42px; height: 42px; border-radius: 13px; display: flex; align-items: center; justify-content: center; flex: none; }
.icone-cat.poisson { background: color-mix(in srgb, var(--poisson) 14%, transparent); color: var(--poisson); }
.icone-cat.boisson { background: color-mix(in srgb, var(--boisson) 16%, transparent); color: var(--boisson); }
.icone-cat.autre { background: color-mix(in srgb, var(--autre) 14%, transparent); color: var(--autre); }
.icone-cat.entree { background: var(--vert-pale); color: var(--vert); }
.icone-cat.perte { background: color-mix(in srgb, var(--rouge) 13%, transparent); color: var(--rouge); }
.icone-cat.inventaire { background: color-mix(in srgb, var(--autre) 14%, transparent); color: var(--autre); }
.icone-cat.depense { background: color-mix(in srgb, var(--orange) 15%, transparent); color: var(--orange); }

.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 999px;
  font-size: 11.5px; font-weight: 700; white-space: nowrap; background: var(--carte-2); color: var(--doux);
}
.badge.rouge { background: color-mix(in srgb, var(--rouge) 14%, transparent); color: var(--rouge); }
.badge.orange { background: color-mix(in srgb, var(--orange) 16%, transparent); color: var(--orange); }
.badge.vert { background: var(--vert-pale); color: var(--vert); }
.badge.bleu { background: color-mix(in srgb, var(--poisson) 14%, transparent); color: var(--poisson); }
.badge.violet { background: color-mix(in srgb, var(--autre) 14%, transparent); color: var(--autre); }

.groupe-titre { display: flex; align-items: center; gap: 8px; margin: 18px 2px 8px; font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); }
.groupe-titre .point { width: 8px; height: 8px; border-radius: 50%; }

/* Navigation par jour */
.nav-jour { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.nav-jour .btn { width: 48px; padding: 0; flex: none; }
.nav-jour .jour-centre {
  flex: 1; min-height: 48px; display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; position: relative;
}
.nav-jour .jour-centre b { font-size: 15px; }
.nav-jour .jour-centre span { font-size: 12px; color: var(--doux); }
.nav-jour input[type=date] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }

/* ---------------- Caisse ---------------- */
.grille-produits { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grille-produits { grid-template-columns: repeat(3, 1fr); } }
.carte-produit {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; text-align: left;
  min-height: 132px; padding: 12px; border-radius: var(--rayon); border: 1px solid var(--bord);
  background: var(--carte); box-shadow: var(--ombre); position: relative;
}
.carte-produit:active { transform: scale(.98); }
.carte-produit.epuise { opacity: .62; }
.carte-produit.dans-panier { border-color: var(--vert); box-shadow: 0 0 0 1px var(--vert); }
.carte-produit .icone-cat { width: 38px; height: 38px; }
.carte-produit .nom { font-weight: 700; font-size: 14.5px; line-height: 1.25; flex: 1; overflow-wrap: anywhere; }
.carte-produit .prix { font-weight: 800; font-size: 15px; }
.carte-produit .prix small { font-weight: 600; color: var(--doux); font-size: 12px; }
.carte-produit .qte-panier {
  position: absolute; top: 10px; right: 10px; min-width: 26px; height: 26px; padding: 0 7px; border-radius: 999px;
  background: var(--vert); color: #fff; font-size: 12.5px; font-weight: 800; display: flex; align-items: center; justify-content: center;
}

.barre-panier {
  position: fixed; left: 0; right: 0; z-index: 19;
  bottom: calc(var(--nav-h) + var(--bas-sure) + 10px);
  display: flex; justify-content: center; padding: 0 12px; pointer-events: none;
}
.barre-panier button {
  pointer-events: auto; width: 100%; max-width: 736px;
  display: flex; align-items: center; gap: 12px; min-height: 60px; padding: 8px 8px 8px 16px;
  border: 0; border-radius: 18px; background: var(--marine); color: #fff;
  box-shadow: 0 10px 30px rgba(12,47,61,.35); text-align: left;
  animation: monte .2s ease-out;
}
@media (prefers-color-scheme: dark) { .barre-panier button { background: #1b5a6e; } }
.barre-panier .nb { background: rgba(255,255,255,.16); border-radius: 10px; padding: 6px 10px; font-weight: 800; font-size: 14px; }
.barre-panier .tot { flex: 1; font-weight: 800; font-size: 17px; }
.barre-panier .tot small { display: block; font-size: 11.5px; font-weight: 600; opacity: .7; }
.barre-panier .go { background: var(--vert); border-radius: 12px; padding: 12px 16px; font-weight: 800; display: flex; align-items: center; gap: 6px; }

/* Pavé numérique */
.affichage-qte { text-align: center; padding: 6px 0 10px; }
.affichage-qte .valeur { font-size: 40px; font-weight: 800; letter-spacing: -.02em; min-height: 52px; }
.affichage-qte .valeur small { font-size: 18px; color: var(--doux); font-weight: 700; margin-left: 4px; }
.affichage-qte .valeur.vide-qte { color: var(--doux); }
.affichage-qte .sous-total { font-size: 15px; font-weight: 700; color: var(--vert); }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0 12px; }
.pave button {
  min-height: 54px; border-radius: 14px; border: 1px solid var(--bord); background: var(--carte-2);
  font-size: 22px; font-weight: 700; display: flex; align-items: center; justify-content: center;
}
.pave button:active { background: var(--bord); }
.pave button:disabled { opacity: .3; }
.qte-rapides { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.qte-rapides .puce { justify-content: center; padding: 6px 0; min-width: 0; }

/* Panier */
.ligne-panier { display: flex; align-items: center; gap: 10px; padding: 10px 0; }
.ligne-panier + .ligne-panier { border-top: 1px solid var(--bord); }
.ligne-panier .corps { flex: 1; min-width: 0; background: none; border: 0; text-align: left; padding: 4px 0; }
.ligne-panier .nom { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-panier .detail { font-size: 13px; color: var(--doux); }
.ligne-panier .montant { font-weight: 800; white-space: nowrap; }
.stepper { display: flex; align-items: center; gap: 2px; background: var(--carte-2); border: 1px solid var(--bord); border-radius: 12px; }
.stepper button { width: 40px; height: 40px; border: 0; background: none; display: flex; align-items: center; justify-content: center; border-radius: 10px; }
.stepper span { min-width: 34px; text-align: center; font-weight: 800; font-size: 14px; }
.total-panier { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 0; padding-top: 14px; border-top: 2px dashed var(--bord); }
.total-panier b { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }

/* Succès */
.succes { text-align: center; margin: 4px 0 12px; }
.succes .coche {
  width: 64px; height: 64px; margin: 0 auto 8px; border-radius: 50%; background: var(--vert); color: #fff;
  display: flex; align-items: center; justify-content: center; animation: pop .35s cubic-bezier(.2,1.4,.5,1);
}
.succes.attente .coche { background: var(--orange); }
.succes h3 { margin: 0; font-size: 18px; }
@keyframes pop { from { transform: scale(.4); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---------------- Reçu (ticket) ---------------- */
.ticket {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  font-size: 13px; line-height: 1.45; color: #111;
  background: #fff; border-radius: 6px; padding: 16px 14px 20px; margin: 0 auto 14px; max-width: 340px;
  border: 1px solid #e3e3e3; position: relative;
  -webkit-mask: radial-gradient(circle 6px at 50% 100%, transparent 98%, #000) 50% 100% / 14px 100% repeat-x;
          mask: radial-gradient(circle 6px at 50% 100%, transparent 98%, #000) 50% 100% / 14px 100% repeat-x;
}
.ticket .t-centre { text-align: center; }
.ticket .t-nom { font-weight: 800; font-size: 15px; text-transform: uppercase; }
.ticket hr { border: 0; border-top: 1px dashed #999; margin: 8px 0; }
.ticket .t-ligne { display: flex; justify-content: space-between; gap: 10px; }
.ticket .t-ligne span:first-child { overflow-wrap: anywhere; }
.ticket .t-ligne span:last-child { white-space: nowrap; }
.ticket .t-art { margin-bottom: 4px; }
.ticket .t-qte { color: #444; padding-left: 8px; }
.ticket .t-total { font-weight: 800; font-size: 16px; }
.ticket .t-statut { text-align: center; font-weight: 800; margin: 6px 0; padding: 4px; border: 2px dashed currentColor; }
.ticket .t-statut.annulee { color: #c62828; }
.ticket .t-statut.attente { color: #b26a00; }
#zone-impression { display: none; }

/* ---------------- Rapports ---------------- */
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.kpi { background: var(--carte); border: 1px solid var(--bord); border-radius: 14px; padding: 12px 14px; box-shadow: var(--ombre); min-width: 0; }
.kpi .k-lib { font-size: 12.5px; color: var(--doux); font-weight: 600; }
.kpi .k-val { font-size: 17px; font-weight: 800; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comparaison { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.comparaison .bloc { border-radius: 14px; padding: 12px; background: var(--carte-2); }
.comparaison .bloc .titre { display: flex; align-items: center; gap: 8px; font-weight: 800; margin-bottom: 8px; }
.comparaison .bloc .ligne { display: flex; justify-content: space-between; font-size: 13px; margin: 3px 0; gap: 6px; }
.comparaison .bloc .ligne b { white-space: nowrap; }
.repartition { display: flex; height: 10px; border-radius: 999px; overflow: hidden; background: var(--carte-2); margin: 12px 0 4px; }
.repartition div { height: 100%; }
.tableau-defile { overflow-x: auto; margin: 0 -16px; padding: 0 16px; }
table.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tableau th { text-align: left; font-size: 12px; color: var(--doux); font-weight: 700; padding: 6px 6px 8px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.tableau td { padding: 9px 6px; border-bottom: 1px solid var(--bord); }
.tableau tr:last-child td { border-bottom: 0; }
.tableau .num { text-align: right; white-space: nowrap; }
.tableau td:first-child { font-weight: 600; }
.periode-perso { display: grid; grid-template-columns: 1fr 1fr auto; gap: 8px; align-items: end; margin-top: 10px; }
.periode-perso .champ { margin: 0; }

/* ---------------- Plus ---------------- */
.carte-utilisateur { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 52px; height: 52px; border-radius: 16px; flex: none;
  background: linear-gradient(135deg, var(--marine), var(--vert)); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 18px;
}
.menu .element { padding: 12px 0; }
.menu .element .icone-cat { width: 38px; height: 38px; border-radius: 12px; background: var(--carte-2); color: var(--texte); }
.menu .element.danger { color: var(--rouge); }
.menu .element.danger .icone-cat { color: var(--rouge); }
.chevron { color: var(--doux); }
.pied-app { text-align: center; color: var(--doux); font-size: 12px; margin: 22px 0 6px; }

/* ---------------- Feuilles (fenêtres qui montent du bas) ---------------- */
.voile {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(6, 22, 29, .5);
  display: flex; align-items: flex-end; justify-content: center;
  animation: fondu .2s ease-out;
}
.voile.ferme { animation: fondu-sortie .18s ease-in forwards; }
.feuille {
  width: 100%; max-width: 560px; max-height: calc(100vh - 36px - var(--haut-sure)); max-height: calc(100dvh - 36px - var(--haut-sure));
  display: flex; flex-direction: column;
  background: var(--carte); border-radius: 22px 22px 0 0;
  animation: monte .26s cubic-bezier(.2,.9,.3,1);
  padding-bottom: var(--bas-sure);
}
.voile.ferme .feuille { animation: descend .18s ease-in forwards; }
.feuille .poignee { width: 40px; height: 5px; border-radius: 3px; background: var(--bord); margin: 8px auto 0; flex: none; }
.feuille .f-tete { display: flex; align-items: center; gap: 10px; padding: 8px 12px 6px 18px; flex: none; }
.feuille .f-tete h2 { flex: 1; margin: 0; font-size: 18px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feuille .f-tete .fermer { width: 44px; height: 44px; border: 0; border-radius: 12px; background: var(--carte-2); display: flex; align-items: center; justify-content: center; }
.feuille .f-corps { padding: 8px 18px 18px; overflow-y: auto; overscroll-behavior: contain; flex: 1; }
.feuille .f-pied { padding: 10px 18px 14px; border-top: 1px solid var(--bord); flex: none; }
@media (min-width: 700px) {
  .voile { align-items: center; padding: 24px; }
  .feuille { border-radius: 22px; max-height: calc(100vh - 48px); padding-bottom: 0; }
  .feuille .poignee { display: none; }
  .barre-panier { bottom: calc(var(--nav-h) + 14px); }
}
@keyframes monte { from { transform: translateY(100%); } to { transform: none; } }
@keyframes descend { to { transform: translateY(100%); } }
@keyframes fondu { from { opacity: 0; } }
@keyframes fondu-sortie { to { opacity: 0; } }

.fiche-stock { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.fiche-stock .grand { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.grille-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.grille-actions .btn { min-height: 52px; }

/* ---------------- Toasts ---------------- */
#toasts {
  position: fixed; left: 0; right: 0; z-index: 100; pointer-events: none;
  top: calc(12px + var(--haut-sure));
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 0 16px;
}
.toast {
  max-width: 480px; padding: 12px 16px; border-radius: 14px; background: #10303c; color: #fff;
  font-weight: 600; font-size: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25);
  display: flex; align-items: center; gap: 10px; animation: toast-entre .25s ease-out;
}
.toast.succes-t { background: var(--vert-fonce); }
.toast.erreur { background: #b83232; }
.toast.sortie { animation: fondu-sortie .2s forwards; }
@keyframes toast-entre { from { transform: translateY(-12px); opacity: 0; } }

/* ---------------- Impression du reçu (72 mm) ---------------- */
@media print {
  @page { size: 80mm auto; margin: 4mm; }
  body { background: #fff !important; }
  body > *:not(#zone-impression) { display: none !important; }
  #zone-impression { display: block !important; width: 72mm; }
  #zone-impression .ticket { border: 0; max-width: none; margin: 0; padding: 0; -webkit-mask: none; mask: none; font-size: 11.5px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition: none !important; }
}
