@font-face { font-family: "Atkinson"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(/fonts/atkinson/files/atkinson-hyperlegible-next-latin-wght-normal.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2212; }
@font-face { font-family: "Atkinson"; font-style: normal; font-display: swap; font-weight: 200 800; src: url(/fonts/atkinson/files/atkinson-hyperlegible-next-latin-ext-wght-normal.woff2) format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF; }
:root {
  --cream: #F8F2E1; --cream-2: #F1E9D3; --ocre: #D1B740; --ocre-dark: #8f7420; --charcoal: #36353A; --white: #fff;
  --line: rgba(54, 53, 58, .16); --muted: rgba(54, 53, 58, .65); --danger: #a33a2e; --ok: #3c5c33; --ok-bg: rgba(158, 203, 137, .35);
  font-family: "Atkinson", "Segoe UI", system-ui, sans-serif; color-scheme: light; font-size: 17px; letter-spacing: .005em;
}
@media (prefers-color-scheme: dark) {
  :root { --cream: #221F17; --cream-2: #2A261C; --white: #2E2A20; --charcoal: #F2EDE0; --line: rgba(242, 237, 224, .18); --muted: rgba(242, 237, 224, .65);
    --danger: #f08a7c; --ok: #b9e0a8; --ocre-dark: #d9bf5a; color-scheme: dark; }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--cream); color: var(--charcoal); -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
:focus-visible { outline: 2px solid var(--ocre-dark); outline-offset: 2px; }
.loading { padding: 40px; text-align: center; color: var(--muted); }
.muted { color: var(--muted); }
.err { color: var(--danger); min-height: 1.2em; margin: 6px 0; font-weight: 600; }
.right { text-align: right; }
.num { font-variant-numeric: tabular-nums; }

/* Boutons */
.btn { min-height: 44px; padding: 8px 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); font-weight: 600; }
.btn:hover { background: var(--cream-2); }
.btn.primary { background: var(--ocre); border-color: var(--ocre-dark); color: #2a2820; }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.big { min-height: 60px; font-size: 1.1rem; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { min-height: 34px; padding: 4px 10px; border-radius: 9px; font-size: .9rem; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--white); font-weight: 600; }
.chip.on { background: var(--charcoal); color: var(--cream); border-color: var(--charcoal); }

/* Structure : barre du haut + contenu */
.shell { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }
header.top { display: flex; align-items: center; gap: 8px; padding: 8px 12px; background: #36353A; color: #F8F2E1; flex-wrap: wrap; }
header.top h1 { margin: 0 8px 0 0; font-size: 1.05rem; }
header.top .nav { display: flex; gap: 6px; flex-wrap: wrap; }
header.top .nav button, header.top a.home { min-height: 40px; padding: 4px 14px; border-radius: 10px; border: 1px solid rgba(255, 255, 255, .3); background: transparent; color: #F8F2E1; font-weight: 600; text-decoration: none; display: inline-flex; align-items: center; }
header.top .nav button.on { background: #F8F2E1; color: #36353A; }
header.top .who { margin-left: auto; font-size: .85rem; opacity: .8; }
main.page { flex: 1; min-height: 0; overflow: auto; padding: 14px; }

/* Écran de vente */
.sale { display: grid; grid-template-columns: 1fr 380px; gap: 12px; height: 100%; min-height: 0; padding: 12px; overflow: hidden; }
.sale .left { display: flex; flex-direction: column; min-height: 0; gap: 10px; }
.orders-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; flex: none; }
.orders-strip .chip { white-space: nowrap; }
.cats { display: flex; gap: 8px; overflow-x: auto; flex: none; padding: 2px 2px 6px; }
.cats .cat { flex: 1 0 auto; min-width: 108px; min-height: 58px; padding: 6px 14px; border: 3px solid transparent; border-radius: 14px; background: var(--pc); color: var(--pt); font-weight: 600; font-size: 1.05rem; line-height: 1.15; opacity: .8; box-shadow: 0 2px 0 rgba(0, 0, 0, .15); }
.cats .cat.on { opacity: 1; font-weight: 700; border-color: var(--charcoal); box-shadow: 0 0 0 2px var(--cream), 0 3px 8px rgba(0, 0, 0, .28); }
.subs { display: flex; gap: 6px; overflow-x: auto; flex: none; padding: 0 2px 4px; }
.subs .sub { flex: none; min-height: 42px; padding: 4px 14px; border-radius: 999px; border: 2px solid var(--pc); background: color-mix(in srgb, var(--pc) 16%, var(--white)); color: var(--charcoal); font-weight: 500; font-size: .98rem; }
.subs .sub.on { background: var(--pc); color: var(--pt); font-weight: 700; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 8px; overflow-y: auto; align-content: start; flex: 1; min-height: 0; padding-bottom: 8px; }
.pbtn { min-height: 88px; border: 0; border-radius: 12px; background: color-mix(in srgb, var(--pc, #c98a2b) 30%, #ffffff); color: #1d1b18; padding: 9px 10px 8px; display: flex; flex-direction: column; justify-content: space-between; text-align: left; border-bottom: 5px solid var(--pc, #c98a2b); box-shadow: 0 1px 2px rgba(0, 0, 0, .18); }
.pbtn:active { transform: scale(.96); filter: brightness(.9); }
.pbtn .n { font-weight: 600; line-height: 1.18; font-size: 1.04rem; }
.pbtn .p { font-size: 1rem; font-weight: 500; color: #3a362f; }
.pbtn.out { opacity: .4; text-decoration: line-through; }
.ticket { background: var(--white); border: 1px solid var(--line); border-radius: 16px; display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ticket .thead { padding: 10px 12px; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ticket .thead b { font-size: 1.05rem; }
.modes { display: flex; gap: 6px; padding: 8px 12px 0; }
.modes .chip { flex: 1; justify-content: center; min-height: 40px; padding: 4px 6px; font-size: .9rem; }
.tlines { flex: 1; overflow-y: auto; padding: 6px 8px; min-height: 80px; }
.tline { display: grid; grid-template-columns: 1fr auto; gap: 2px 8px; padding: 8px 6px; border-bottom: 1px dashed var(--line); border-radius: 8px; }
.tline:active { background: var(--cream-2); }
.tline .nm { font-weight: 600; }
.tline .opt { grid-column: 1; font-size: .85rem; color: var(--muted); }
.tline .pr { text-align: right; font-weight: 700; }
.tline .qty { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.qty button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--cream-2); font-size: 1.2rem; font-weight: 700; }
.qty .q { min-width: 28px; text-align: center; font-weight: 700; }
.tline .disc { color: var(--danger); font-size: .85rem; }
.tfoot { padding: 10px 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.tfoot .total { display: flex; justify-content: space-between; font-size: 1.5rem; font-weight: 800; }
.tfoot .sub { display: flex; justify-content: space-between; color: var(--muted); font-size: .9rem; }
.tfoot .row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.empty { padding: 30px 12px; text-align: center; color: var(--muted); }

/* Fenêtres */
.overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; z-index: 100; padding: 12px; }
.modal { background: var(--cream); color: var(--charcoal); border-radius: 18px; padding: 18px; width: min(460px, 100%); max-height: 94vh; overflow-y: auto; box-shadow: 0 12px 40px rgba(0, 0, 0, .35); }
.modal.wide { width: min(860px, 100%); }
.modal h2 { margin: 0 0 12px; font-size: 1.2rem; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; flex-wrap: wrap; }
.field { display: grid; gap: 4px; margin: 8px 0; }
.field label { font-weight: 600; font-size: .9rem; }
.field input, .field select, .field textarea { min-height: 44px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--white); width: 100%; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.checks { display: grid; gap: 6px; margin: 8px 0; }
.checks label { display: flex; gap: 8px; align-items: center; min-height: 36px; }
.checks input { width: 22px; height: 22px; }

/* Encaissement */
.paygrid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pay-methods { display: grid; gap: 8px; align-content: start; }
.pay-methods .btn { min-height: 56px; font-size: 1.05rem; text-align: left; }
.pay-methods .btn.on { background: var(--charcoal); color: var(--cream); }
.bigamt { font-size: 2rem; font-weight: 800; text-align: right; padding: 8px 12px; background: var(--white); border: 1px solid var(--line); border-radius: 12px; min-height: 60px; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 8px; }
.keypad button { min-height: 56px; font-size: 1.3rem; font-weight: 700; border-radius: 12px; border: 1px solid var(--line); background: var(--white); }
.paylist { margin: 8px 0; display: grid; gap: 4px; }
.paylist div { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.remain { font-size: 1.2rem; font-weight: 800; }
.change { font-size: 1.6rem; font-weight: 800; color: var(--ok); text-align: center; padding: 14px; background: var(--ok-bg); border-radius: 14px; }

/* Tableaux et pages */
table.t { width: 100%; border-collapse: collapse; background: var(--white); border-radius: 12px; overflow: hidden; }
table.t th, table.t td { padding: 9px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { background: var(--cream-2); font-size: .85rem; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover { background: var(--cream-2); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; margin: 10px 0; }
.card { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.card .k { font-size: .85rem; color: var(--muted); }
.card .v { font-size: 1.5rem; font-weight: 800; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
h2.sec { margin: 18px 0 8px; font-size: 1.1rem; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .8rem; font-weight: 700; background: var(--cream-2); border: 1px solid var(--line); }
.badge.bad { color: var(--danger); border-color: var(--danger); }
.badge.good { color: var(--ok); }
.denied { max-width: 480px; margin: 12vh auto; text-align: center; padding: 20px; }
.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: #36353A; color: #F8F2E1; padding: 10px 18px; border-radius: 12px; z-index: 200; font-weight: 600; }

/* Ticket imprimé (80 mm) */
#print-area { display: none; }
.rcpt { width: 72mm; font: 12px/1.35 "Courier New", monospace; color: #000; background: #fff; }
.rcpt .c { text-align: center; } .rcpt .b { font-weight: 700; } .rcpt .big { font-size: 15px; }
.rcpt hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
.rcpt .r { display: flex; justify-content: space-between; gap: 6px; }
.rcpt .sm { font-size: 10px; }
.rcpt .opt { padding-left: 10px; font-size: 11px; }
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { display: block; position: absolute; left: 0; top: 0; }
  @page { margin: 3mm; }
}

@media (max-width: 900px) {
  .sale { grid-template-columns: 1fr; grid-template-rows: 1fr auto; overflow: auto; }
  .ticket { max-height: 55vh; }
  .paygrid { grid-template-columns: 1fr; }
}

.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatches .sw { width: 36px; height: 36px; border-radius: 50%; border: 3px solid transparent; box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .6), 0 0 0 1px rgba(0, 0, 0, .25); padding: 0; }
.swatches .sw.on { border-color: var(--charcoal); transform: scale(1.12); }
.swatches .sw.none { background: var(--white); color: var(--muted); font-size: 1.1rem; }
.swatches input[type=color] { width: 40px; height: 40px; border: 0; padding: 0; background: none; }
.dot { display: inline-block; width: 16px; height: 16px; border-radius: 50%; vertical-align: -2px; margin-right: 6px; box-shadow: 0 0 0 1px rgba(0, 0, 0, .25); }

/* Écran d'accès de la tablette */
.gate { max-width: 420px; margin: 4vh auto; padding: 16px; text-align: center; }
.gate h1 { margin: 0 0 6px; }
.pinbox { font-size: 2.2rem; letter-spacing: .25em; min-height: 70px; display: flex; align-items: center; justify-content: center; background: var(--white); border: 1px solid var(--line); border-radius: 14px; margin: 8px 0; }
.keypad.bigpad button { min-height: 72px; font-size: 1.6rem; font-weight: 600; }
.keypad.bigpad button.ok { background: var(--ocre); border-color: var(--ocre-dark); }
header.top .switch { margin-left: 10px; min-height: 34px; padding: 2px 12px; border-radius: 9px; border: 1px solid rgba(255, 255, 255, .4); background: transparent; color: inherit; }

/* Application plein écran sur iPad : zones sûres (encoche, barre d'accueil), pas de sélection ni de zoom, pas de rebond */
html { -webkit-text-size-adjust: 100%; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
input, textarea, select { -webkit-user-select: text; user-select: text; font-size: 17px; }
.shell { height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
.offline-bar { background: var(--danger); color: #fff; text-align: center; padding: 6px 10px; font-weight: 600; }

/* Mode « Modifier la carte » */
.chip.edit { border-style: dashed; }
.chip.edit.on { background: var(--ocre); border-color: var(--ocre-dark); color: #2a2820; }
.cats .cat.addcat { background: var(--white); color: var(--charcoal); border: 3px dashed var(--line); opacity: 1; min-width: 96px; }
.subs .sub.tool { background: var(--white); border-style: dashed; border-color: var(--muted); color: var(--charcoal); }
.pbtn.editing { outline: 2px dashed var(--charcoal); outline-offset: -3px; }
.pbtn.addtile { background: var(--white); border: 2px dashed var(--muted); border-bottom-width: 2px; justify-content: center; align-items: center; text-align: center; gap: 4px; color: var(--charcoal); }
.welcome { max-width: 640px; margin: 6vh auto; padding: 20px; }
.welcome h1 { margin: 0 0 8px; }
.welcome li { margin: 8px 0; line-height: 1.4; }
.welcome .btn { margin: 14px 0 8px; }
