:root {
  --fond: #f3f1ec; --carte: #fff; --encre: #1c2530; --gris: #6b7480; --trait: #d9d5cc;
  --bleu: #1f5fa8; --vert: #1e8a4c; --rouge: #c62828; --violet: #7b2fbe; --orange: #c96a00;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--fond); color: var(--encre); font-size: 16px; }
h1, h2, h3 { margin: 0 0 .5rem; text-wrap: balance; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; border: 1px solid var(--trait); background: #fff; border-radius: 8px; padding: .55rem .9rem; min-height: 44px; }
button:hover { border-color: var(--bleu); }
button.principal { background: var(--bleu); color: #fff; border-color: var(--bleu); font-weight: 600; }
button.danger { color: var(--rouge); border-color: var(--rouge); }
button.actif { background: var(--violet); color: #fff; border-color: var(--violet); }
button:focus-visible, input:focus-visible, select:focus-visible, a:focus-visible { outline: 3px solid #f5b400; outline-offset: 1px; }
input, select, textarea { border: 1px solid var(--trait); border-radius: 8px; padding: .55rem .7rem; background: #fff; min-height: 44px; }
kbd { background: #eceae4; border: 1px solid var(--trait); border-radius: 4px; padding: 0 .3rem; font-size: .8em; }
.carte { background: var(--carte); border: 1px solid var(--trait); border-radius: 12px; padding: 1rem; }
.barre { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; padding: .5rem 1rem; background: var(--encre); color: #fff; }
.barre a { color: #fff; }
.barre .pousse { margin-left: auto; }
.pastille { display: inline-flex; align-items: center; gap: .35rem; padding: .15rem .6rem; border-radius: 99px; font-size: .85rem; font-weight: 600; background: #3a4654; color: #fff; }
.pastille.ok { background: var(--vert); } .pastille.ko { background: var(--rouge); } .pastille.alerte { background: var(--orange); }
.badge { display: inline-block; padding: .1rem .5rem; border-radius: 6px; font-size: .8rem; font-weight: 700; color: #fff; background: var(--gris); }
.badge.surprise { background: var(--violet); } .badge.perso { background: var(--orange); } .badge.classique { background: var(--bleu); }
.gris { color: var(--gris); } .rouge { color: var(--rouge); } .petit { font-size: .85rem; }
.centre { max-width: 460px; margin: 8vh auto; padding: 0 1rem; }
.pile > * + * { margin-top: .75rem; }
.ligne { display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: .45rem .5rem; border-bottom: 1px solid var(--trait); vertical-align: middle; }
th { font-size: .8rem; color: var(--gris); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
#toasts { position: fixed; top: 3.6rem; right: 1rem; display: grid; gap: .4rem; z-index: 50; width: min(92vw, 480px); }
.toast { background: var(--encre); color: #fff; padding: .7rem 1rem; border-radius: 10px; box-shadow: 0 4px 16px #0003; }
.toast.err { background: var(--rouge); } .toast.ok { background: var(--vert); }
dialog { border: 0; border-radius: 14px; padding: 1.25rem; width: min(94vw, 520px); box-shadow: 0 10px 40px #0005; }
dialog::backdrop { background: #0007; }

/* ---------- Caisse ---------- */
.caisse { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 1rem; padding: 1rem; align-items: start; }
@media (max-width: 900px) { .caisse { grid-template-columns: 1fr; } }
#scan { width: 100%; font-size: 1.6rem; padding: .7rem 1rem; border: 2px solid var(--bleu); }
#scan.surprise { border-color: var(--violet); background: #f6edff; }
.panier td { font-size: 1.05rem; }
.panier tr.deja td { background: #fdeaea; }
.panier .x { min-height: 36px; padding: .2rem .6rem; }
.total-zone { text-align: center; }
.total-zone .montant { font-size: 3.4rem; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.recap { display: grid; grid-template-columns: 1fr auto; gap: .2rem .75rem; font-variant-numeric: tabular-nums; }
.offre { background: #e8f6ee; border: 1px solid var(--vert); border-radius: 8px; padding: .5rem .7rem; font-weight: 600; }
.types { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.types button.choisi { background: var(--bleu); color: #fff; border-color: var(--bleu); }
.vignette { height: 40px; border-radius: 4px; vertical-align: middle; }

/* ---------- Contrôle / mobile ---------- */
.verdict { border-radius: 14px; padding: 1.2rem; color: #fff; text-align: center; }
.verdict.ok { background: var(--vert); } .verdict.ko { background: var(--rouge); }
.verdict .gros { font-size: 2rem; font-weight: 800; }
.verdict .badge.surprise { font-size: 1.3rem; padding: .4rem 1rem; border: 3px solid #fff; display: block; margin: .6rem 0; }
.photo-grille { width: 100%; border-radius: 10px; margin-top: .6rem; background: #000; }
.gros-bouton { width: 100%; padding: 1.4rem; font-size: 1.3rem; font-weight: 700; border-radius: 14px; display: block; text-align: center; }
label.gros-bouton { background: var(--bleu); color: #fff; cursor: pointer; }

/* ---------- Ticket thermique ---------- */
#ticket { display: none; }
@media print {
  body > *:not(#ticket) { display: none !important; }
  body { background: #fff; }
  #ticket { display: block; color: #000; font-family: "Courier New", monospace; font-size: 11pt; line-height: 1.25; padding: 0 1mm; }
  #ticket .c { text-align: center; } #ticket .g { font-weight: 700; }
  #ticket .l { display: flex; justify-content: space-between; gap: 2mm; }
  #ticket hr { border: 0; border-top: 1px dashed #000; margin: 1.5mm 0; }
  #ticket .tot { font-size: 15pt; font-weight: 700; }
}
