/* KzPos — démo PWA. Charte KzSuite, rouge KzPos. Cibles tactiles ≥ 48 px. */
:root {
  --rouge: #d92b17; --rouge-fonce: #a91f10; --bleu: #24d6f4;
  --fond: #f3f5f9; --surface: #ffffff; --texte: #18223a; --texte2: #5b6680;
  --bord: #dde2ec; --vert: #1f8a4c; --danger: #c0392b;
  --rayon: 14px; --ombre: 0 2px 10px rgba(24, 34, 58, .08);
  font-family: "Lato", "Segoe UI", system-ui, -apple-system, sans-serif;
  color: var(--texte); background: var(--fond);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { display: flex; flex-direction: column; overflow: hidden; -webkit-tap-highlight-color: transparent; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; min-height: 48px; padding: 0 16px; }
button:active { transform: scale(.98); }
.b-primaire { background: var(--rouge); color: #fff; font-weight: 700; }
.b-primaire:hover { background: var(--rouge-fonce); }
.b-clair { background: var(--surface); color: var(--texte); border: 1px solid var(--bord); font-weight: 600; }
.b-danger { background: #fff; color: var(--danger); border: 1px solid var(--danger); font-weight: 600; }
.b-lien { background: none; color: var(--rouge); min-height: 32px; padding: 0 6px; text-decoration: underline; }
.lien-bouton { display: inline-flex; align-items: center; min-height: 48px; padding: 0 18px; border-radius: 10px; text-decoration: none; }

.bandeau { display: flex; align-items: center; gap: 16px; padding: 8px 14px; background: var(--surface); border-bottom: 1px solid var(--bord); }
.marque { display: flex; align-items: center; gap: 8px; font-weight: 900; font-size: 22px; }
.marque img { border-radius: 8px; }
.marque em { font-style: normal; font-size: 12px; font-weight: 700; color: #fff; background: var(--bleu); color: var(--texte); padding: 2px 8px; border-radius: 99px; }
.infos { flex: 1; display: flex; gap: 18px; color: var(--texte2); font-size: 14px; }
.actions { display: flex; gap: 8px; }
.actions b { background: var(--rouge); color: #fff; border-radius: 99px; padding: 1px 8px; margin-left: 4px; font-size: 13px; }

.caisse { flex: 1; display: grid; grid-template-columns: 1fr 380px; min-height: 0; }
.catalogue { display: flex; flex-direction: column; min-height: 0; padding: 12px; gap: 10px; }
.recherche input { width: 100%; height: 52px; border: 1px solid var(--bord); border-radius: var(--rayon); padding: 0 16px; font-size: 17px; background: var(--surface); }
.familles { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.familles button { flex: none; background: var(--surface); border: 1px solid var(--bord); font-weight: 600; }
.familles button.actif { background: var(--texte); color: #fff; border-color: var(--texte); }
.tuiles { flex: 1; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; align-content: start; }
.tuile { background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre); padding: 10px; min-height: 140px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; position: relative; border: 2px solid transparent; }
.tuile:hover { border-color: var(--rouge); }
.tuile .visuel { font-size: 40px; line-height: 1.1; }
.tuile .nom { font-weight: 700; font-size: 15px; }
.tuile .prix { color: var(--rouge); font-weight: 900; font-size: 16px; }
.tuile .pastille, .pastille { font-size: 11px; font-weight: 700; background: var(--bleu); color: var(--texte); border-radius: 99px; padding: 1px 7px; }
.tuile .pastille { position: absolute; top: 8px; right: 8px; }

.panier { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--bord); }
.panier-tete { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; font-weight: 800; border-bottom: 1px solid var(--bord); }
.lignes { flex: 1; overflow-y: auto; list-style: none; margin: 0; padding: 0; }
.lignes li { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 10px 14px; border-bottom: 1px solid var(--fond); cursor: pointer; }
.lignes li:hover { background: #fff6f4; }
.lignes .l-nom { font-weight: 700; }
.lignes .l-detail { color: var(--texte2); font-size: 13px; }
.lignes .l-montant { font-weight: 800; grid-row: span 2; align-self: center; }
.lignes .vide { color: var(--texte2); text-align: center; padding: 40px 14px; cursor: default; display: block; }
.totaux { padding: 10px 14px; border-top: 1px solid var(--bord); }
.totaux div { display: flex; justify-content: space-between; color: var(--texte2); padding: 2px 0; }
.totaux .total { color: var(--texte); font-size: 24px; font-weight: 900; padding-top: 6px; }
.panier-actions { display: grid; grid-template-columns: 1fr 1.4fr; gap: 8px; padding: 10px 14px 14px; }
.panier-actions button { min-height: 60px; font-size: 17px; }

.fenetre { border: 0; border-radius: 18px; padding: 20px; width: min(460px, 94vw); box-shadow: 0 20px 60px rgba(0,0,0,.25); color: var(--texte); }
.fenetre::backdrop { background: rgba(24, 34, 58, .45); }
.fenetre h2 { margin: 0 0 12px; }
.fenetre-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; flex-wrap: wrap; }
.du, .recu, .rendu { display: flex; justify-content: space-between; align-items: baseline; font-size: 18px; margin: 6px 0; }
.du b { font-size: 28px; }
.rendu b { font-size: 24px; color: var(--vert); }
.recu output { font-size: 26px; font-weight: 800; background: var(--fond); border-radius: 10px; padding: 4px 12px; min-width: 150px; text-align: right; }
.modes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 10px 0; }
.mode { background: var(--fond); font-weight: 700; }
.mode.actif { background: var(--texte); color: #fff; }
.rapides { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }
.rapides button { background: #fff6f4; color: var(--rouge-fonce); font-weight: 700; min-height: 44px; }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.pave button { background: var(--fond); font-size: 22px; font-weight: 700; min-height: 56px; }
.choix { display: grid; gap: 8px; }
.choix button { display: flex; justify-content: space-between; background: var(--fond); font-weight: 700; min-height: 60px; font-size: 17px; }
.liste { list-style: none; padding: 0; margin: 0; max-height: 50vh; overflow-y: auto; }
.liste li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--fond); }
.ticket-fenetre { width: min(380px, 94vw); }
.ticket { font-family: "Consolas", "Courier New", monospace; font-size: 13px; line-height: 1.35; background: #fffdf5; border: 1px dashed var(--bord); padding: 14px; margin: 0; max-height: 60vh; overflow: auto; white-space: pre; }
.fenetre ul { padding-left: 20px; line-height: 1.5; }
code { background: var(--fond); padding: 1px 5px; border-radius: 5px; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--texte); color: #fff; padding: 12px 18px; border-radius: 12px; z-index: 50; box-shadow: var(--ombre); }

@media (max-width: 820px) {
  body { overflow: auto; }
  .caisse { grid-template-columns: 1fr; }
  .panier { border-left: 0; border-top: 1px solid var(--bord); min-height: 60vh; }
  .infos { display: none; }
  .tuiles { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }
}
@media print {
  body * { visibility: hidden; }
  dialog[open] .ticket, dialog[open] .ticket * { visibility: visible; }
  dialog[open] .ticket { position: absolute; left: 0; top: 0; border: 0; max-height: none; width: 80mm; }
}
