* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #f4f5f7; --card: #fff; --text: #1a1d21; --muted: #6b7280;
  --credit: #0a7d33; --debit: #b3261e; --info: #1a56db; --admin: #4a3b8c;
  --border: #e2e4e8; --radius: 12px;
}
body { font-family: system-ui, -apple-system, "Segoe UI", sans-serif; background: var(--bg); color: var(--text); }
header { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; color: #fff; }
header.credit { background: var(--credit); }
header.debit { background: var(--debit); }
header.info { background: var(--info); }
header.admin { background: var(--admin); }
header h1 { font-size: 1.1rem; }
header .who { font-size: .85rem; opacity: .9; }
header button { background: rgba(255,255,255,.18); color: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 8px; padding: 6px 12px; cursor: pointer; }
main { max-width: 720px; margin: 0 auto; padding: 16px; }
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2 { font-size: 1rem; margin-bottom: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
label { display: block; font-size: .85rem; color: var(--muted); margin: 10px 0 4px; }
input, select { width: 100%; padding: 12px; font-size: 1.05rem; border: 1px solid var(--border); border-radius: 8px; }
input:focus { outline: 2px solid var(--info); }
button.big { width: 100%; padding: 16px; font-size: 1.15rem; font-weight: 600; border: none; border-radius: var(--radius); cursor: pointer; margin-top: 12px; color: #fff; }
button.big.credit { background: var(--credit); }
button.big.debit { background: var(--debit); }
button.big.info { background: var(--info); }
button.big.admin { background: var(--admin); }
button.big.gray { background: #4b5563; }
button:disabled { opacity: .5; cursor: not-allowed; }
.amounts { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-top: 8px; }
.amounts button { padding: 14px 4px; font-size: 1.05rem; font-weight: 700; border: 2px solid var(--border); background: #fff; border-radius: 10px; cursor: pointer; }
.amounts button.sel { border-color: var(--info); background: #eef3ff; }
.balance { font-size: 2.2rem; font-weight: 800; text-align: center; margin: 8px 0; }
.status-pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .8rem; font-weight: 700; }
.st-ACTIVE { background: #d9f2e2; color: var(--credit); }
.st-INACTIVE { background: #eee; color: var(--muted); }
.st-BLOCKED { background: #fde2e0; color: var(--debit); }
.msg { padding: 12px; border-radius: 8px; margin-top: 12px; font-weight: 600; display: none; }
.msg.ok { background: #d9f2e2; color: var(--credit); display: block; }
.msg.err { background: #fde2e0; color: var(--debit); display: block; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-size: .78rem; text-transform: uppercase; }
td.num { text-align: right; font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.muted { color: var(--muted); font-size: .85rem; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
#reader { width: 100%; border-radius: var(--radius); overflow: hidden; }
.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-wrap h1 { text-align: center; margin-bottom: 20px; }
.tag { font-size: .75rem; padding: 2px 8px; border-radius: 99px; background: #eef; }
a.linklike { color: var(--info); cursor: pointer; text-decoration: underline; font-size: .85rem; }
.checkline { display: flex; align-items: center; gap: 10px; margin-top: 12px; font-size: .95rem; }
.checkline input { width: 22px; height: 22px; }
@media print {
  body * { visibility: hidden; }
  #printCard, #printCard * { visibility: visible; }
  #printCard { position: fixed; left: 0; top: 0; }
}
.print-card { border: 2px dashed #999; border-radius: 12px; padding: 20px; width: 300px; text-align: center; margin: 12px auto; background: #fff; }
.print-card .code { font-size: 2rem; font-weight: 800; letter-spacing: .2em; }
/* Planche d'impression en lot */
.sheet { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.sheet .mini-card { border: 1.5px dashed #999; border-radius: 8px; padding: 10px; text-align: center; background: #fff; break-inside: avoid; }
.sheet .mini-card .code { font-size: 1.15rem; font-weight: 800; letter-spacing: .15em; margin-top: 6px; }
.sheet .mini-card .qr { display: flex; justify-content: center; }
/* Grille d'articles vendeur */
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(105px, 1fr)); gap: 10px; }
.product { border: 2px solid var(--border); border-radius: 10px; background: #fff; padding: 8px; text-align: center; cursor: pointer; user-select: none; }
.product:active { border-color: var(--debit); }
.product .pic { height: 54px; display: flex; align-items: center; justify-content: center; font-size: 2.2rem; }
.product .pic img { max-height: 54px; max-width: 100%; border-radius: 6px; }
.product .name { font-weight: 600; font-size: .85rem; }
.product .price { color: var(--muted); font-size: .85rem; }
.product .badge { position: relative; }
.product .count { display: inline-block; min-width: 24px; background: var(--debit); color: #fff; border-radius: 99px; font-weight: 800; margin-top: 4px; }
.cart-line { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--border); }
.cart-line .qtybtns button { width: 34px; height: 34px; font-size: 1.1rem; font-weight: 800; border: 1px solid var(--border); background: #fff; border-radius: 8px; cursor: pointer; }
.qty-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.qty-grid button { padding: 14px 0; font-size: 1.1rem; font-weight: 700; border: 2px solid var(--border); background: #fff; border-radius: 10px; cursor: pointer; }
.qty-grid button.sel { border-color: var(--info); background: #eef3ff; }
.chart-bars { display: flex; align-items: flex-end; gap: 6px; height: 180px; padding-top: 10px; overflow-x: auto; }
.chart-bars .bar { flex: 1; min-width: 34px; background: var(--admin); border-radius: 4px 4px 0 0; position: relative; }
.chart-bars .bar span { position: absolute; top: -20px; left: 0; right: 0; text-align: center; font-size: .7rem; font-weight: 700; }
.chart-bars .bar label { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); overflow: hidden; white-space: nowrap; }
