* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif; background: #F7F6F2; color: #2C2C2A; font-size: 15px; overscroll-behavior: none; }
button { font-family: inherit; font-size: inherit; cursor: pointer; }
input, select { font-family: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid #D3D1C7; border-radius: 8px; background: #FFF; color: #2C2C2A; }
input:focus, select:focus { outline: 2px solid #0F6E56; outline-offset: 0; border-color: #0F6E56; }
.gen { color: #5F5E5A; font-size: 13px; }
.centre { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.boite { background: #FFF; border: 1px solid #E5E3DC; border-radius: 14px; padding: 26px; width: 100%; max-width: 440px; }
.boite h1 { font-size: 22px; margin: 0 0 6px; color: #0F6E56; }
.boite p { margin: 0 0 16px; }
.champ { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-size: 13px; color: #5F5E5A; }
.btn { border: none; background: #0F6E56; color: #FFF; padding: 12px 18px; border-radius: 10px; font-weight: 600; min-height: 46px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.p { background: #FFF; color: #2C2C2A; border: 1px solid #D3D1C7; font-weight: 500; }
.btn.rouge { background: #A32D2D; }
.btn.bloc { width: 100%; }
.btn.s { padding: 8px 12px; min-height: 38px; font-size: 14px; }
.msg { padding: 10px 12px; border-radius: 8px; margin: 10px 0; font-size: 14px; }
.msg.err { background: #FCEBEB; color: #A32D2D; } .msg.ok { background: #E1F5EE; color: #0F6E56; } .msg.inf { background: #EEF3FB; color: #185FA5; }

/* Verrou */
.caissiers { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.caissier { background: #FFF; border: 1px solid #D3D1C7; border-radius: 12px; padding: 16px 10px; text-align: center; font-weight: 600; min-height: 72px; }
.caissier .gen { font-weight: 400; margin-top: 4px; }
.caissier.on { border-color: #0F6E56; box-shadow: 0 0 0 2px #0F6E56 inset; }
.points { display: flex; justify-content: center; gap: 12px; margin: 16px 0; }
.points i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #0F6E56; display: block; }
.points i.p { background: #0F6E56; }
.pave { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 300px; margin: 0 auto; }
.pave button { height: 64px; border-radius: 12px; border: 1px solid #D3D1C7; background: #FFF; font-size: 24px; font-weight: 600; }
.pave button.ok { background: #0F6E56; color: #FFF; border-color: #0F6E56; font-size: 18px; }

/* En-tête */
.hd { display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: #FFF; border-bottom: 1px solid #E5E3DC; position: sticky; top: 0; z-index: 5; flex-wrap: wrap; padding-top: max(10px, env(safe-area-inset-top)); }
.hd .marque { font-weight: 700; color: #0F6E56; }
.hd .pt { font-weight: 600; }
.hd .esp { flex: 1; }
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 20px; font-size: 13px; font-weight: 600; border: none; }
.pastille i { width: 9px; height: 9px; border-radius: 50%; display: block; }
.pastille.vert { background: #E1F5EE; color: #0F6E56; } .pastille.vert i { background: #0F6E56; }
.pastille.orange { background: #FFF4E0; color: #8A5300; } .pastille.orange i { background: #E89B1C; }
.pastille.gris { background: #EEEDE8; color: #5F5E5A; } .pastille.gris i { background: #888780; }

/* Caisse */
.caisse { display: grid; grid-template-columns: 230px 1fr 360px; gap: 12px; padding: 12px; height: calc(100vh - 64px); }
.col { background: #FFF; border: 1px solid #E5E3DC; border-radius: 12px; padding: 12px; overflow-y: auto; min-height: 0; }
.col h3 { margin: 0 0 10px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.tables { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.tbl { border: 1px solid #D3D1C7; border-radius: 10px; padding: 10px 8px; text-align: center; background: #FFF; min-height: 62px; }
.tbl b { display: block; font-size: 16px; }
.tbl .m { font-size: 12px; color: #5F5E5A; margin-top: 2px; }
.tbl.occ { background: #FFF4E0; border-color: #E89B1C; }
.tbl.sel { box-shadow: 0 0 0 2px #0F6E56 inset; border-color: #0F6E56; }
.cats { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip { border: 1px solid #D3D1C7; background: #FFF; border-radius: 20px; padding: 8px 14px; font-size: 14px; }
.chip.on { background: #0F6E56; color: #FFF; border-color: #0F6E56; }
.prods { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.prod { border: 1px solid #E5E3DC; border-radius: 10px; padding: 12px 10px; background: #FAFAF7; text-align: left; min-height: 74px; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; }
.prod:active { background: #E1F5EE; }
.prod .px { font-weight: 700; color: #0F6E56; }
.prod s { color: #888780; font-weight: 400; margin-right: 4px; }
.ligne { display: flex; justify-content: space-between; gap: 8px; padding: 9px 4px; border-bottom: 1px solid #F0EEE8; align-items: center; }
.ligne.clic { cursor: pointer; }
.ligne .r { text-align: right; white-space: nowrap; }
.barre { text-decoration: line-through; color: #888780; }
.badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #EEEDE8; color: #5F5E5A; margin-top: 3px; }
.b-orange { background: #FFF4E0; color: #8A5300; } .b-bleu { background: #EEF3FB; color: #185FA5; } .b-vert { background: #E1F5EE; color: #0F6E56; } .b-violet { background: #F1ECFA; color: #5B3B9A; } .b-rouge { background: #FCEBEB; color: #A32D2D; }
.tot { font-size: 26px; font-weight: 700; text-align: right; margin: 12px 0; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.actions .btn { flex: 1; }
.vide { color: #888780; text-align: center; padding: 30px 10px; }

/* Fenêtres */
#fond { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 20; }
#modale { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 94vw); max-height: 90vh; overflow-y: auto; background: #FFF; border-radius: 14px; padding: 20px; z-index: 21; }
#modale h2 { margin: 0 0 12px; font-size: 19px; }
.grille2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modes { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin: 10px 0; }
.pl { display: grid; grid-template-columns: 1fr 120px 1fr 40px; gap: 6px; align-items: center; margin: 6px 0; }
.pl input { width: 100%; }
table.x { width: 100%; border-collapse: collapse; font-size: 14px; }
table.x td { padding: 6px 4px; border-bottom: 1px solid #F0EEE8; }
table.x td.r { text-align: right; white-space: nowrap; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #2C2C2A; color: #FFF; padding: 12px 18px; border-radius: 10px; z-index: 30; max-width: 90vw; font-size: 14px; }
#toast.err { background: #A32D2D; }
.pont { position: absolute; width: 1px; height: 1px; left: -10px; top: -10px; border: 0; opacity: 0; pointer-events: none; }

@media (max-width: 1000px) {
  .caisse { grid-template-columns: 1fr; height: auto; }
  .tables { grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); }
}
