@font-face { font-family: 'Fraunces'; src: url('f/fraunces.woff2') format('woff2'); font-weight: 600 800; font-display: swap; }

:root {
  --bg: #F5EFE3; --paper: #FFFCF6; --paper-2: #FBF6EC; --ink: #1A2A21; --ink-2: #5C6A61; --ink-3: #8E978F;
  --line: #E7DECD; --line-2: #EFE8DA;
  --sauge: #2E5C45; --sauge-2: #E3ECE4; --sauge-ink: #FFFCF6;
  --clem: #FF6B2C; --clem-2: #FFE6D8; --clem-glow: rgba(255, 107, 44, .35);
  --ok: #2E8B57; --danger: #C8402F;
  --shadow: 0 1px 0 rgba(26, 42, 33, .04), 0 8px 24px -12px rgba(26, 42, 33, .18);
  --shadow-lg: 0 24px 60px -20px rgba(26, 42, 33, .35);
  --r: 18px; --r-sm: 12px;
  --disp: 'Fraunces', ui-serif, Georgia, serif;
  --ui: ui-rounded, 'SF Pro Rounded', system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #101612; --paper: #18211B; --paper-2: #1D2720; --ink: #EEF3EC; --ink-2: #A9B5AC; --ink-3: #75817A;
    --line: #26322A; --line-2: #212B24;
    --sauge: #8CC7A4; --sauge-2: #213429; --sauge-ink: #0F1A13;
    --clem: #FF7D42; --clem-2: #3A2418; --clem-glow: rgba(255, 125, 66, .35);
    --shadow: 0 1px 0 rgba(0,0,0,.2), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #101612; --paper: #18211B; --paper-2: #1D2720; --ink: #EEF3EC; --ink-2: #A9B5AC; --ink-3: #75817A;
  --line: #26322A; --line-2: #212B24;
  --sauge: #8CC7A4; --sauge-2: #213429; --sauge-ink: #0F1A13;
  --clem: #FF7D42; --clem-2: #3A2418; --clem-glow: rgba(255, 125, 66, .35);
  --shadow: 0 1px 0 rgba(0,0,0,.2), 0 8px 24px -12px rgba(0,0,0,.6); --shadow-lg: 0 24px 60px -20px rgba(0,0,0,.8);
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--ink); font: 16px/1.35 var(--ui);
  -webkit-font-smoothing: antialiased; overscroll-behavior-y: contain;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input { font: inherit; color: inherit; -webkit-user-select: text; user-select: text; }
img { display: block; }
.app { max-width: 640px; margin: 0 auto; min-height: 100%; display: flex; flex-direction: column; }

/* ---------- En-tête ---------- */
.top {
  position: sticky; top: 0; z-index: 20; padding: calc(var(--safe-t) + 10px) 16px 10px;
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px);
}
.brand-row { display: flex; align-items: center; gap: 10px; }
.brand { display: flex; align-items: center; gap: 9px; margin-right: auto; }
.brand svg { width: 34px; height: 34px; }
.brand b { font: 700 25px/1 var(--disp); letter-spacing: -.02em; font-variation-settings: 'opsz' 72; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border-radius: 99px;
  background: var(--paper); border: 1px solid var(--line); font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums;
}
.pill small { color: var(--ink-3); font-weight: 550; }
.icon-btn { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink); }
.icon-btn:active { background: var(--line-2); }
.icon-btn svg { width: 22px; height: 22px; }

.seg {
  margin-top: 12px; display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 14px;
  background: var(--line-2); position: relative;
}
.seg button { position: relative; z-index: 1; height: 38px; border-radius: 11px; font-weight: 650; font-size: 15px; color: var(--ink-2); display: flex; align-items: center; justify-content: center; gap: 7px; transition: color .2s; }
.seg button[aria-pressed="true"] { color: var(--ink); }
.seg button img { width: 20px; height: 20px; }
.seg .thumb { position: absolute; top: 4px; bottom: 4px; left: 4px; width: calc(50% - 4px); border-radius: 11px; background: var(--paper); box-shadow: var(--shadow); transition: transform .28s cubic-bezier(.3, .9, .3, 1); }
.store .seg .thumb { transform: translateX(100%); }

/* ---------- Liste ---------- */
main { flex: 1; padding: 6px 16px calc(var(--safe-b) + 130px); }
.fam { margin-top: 18px; }
.fam-h { display: flex; align-items: center; gap: 10px; padding: 0 4px 8px; }
.fam-h img { width: 30px; height: 30px; }
.fam-h h2 { margin: 0; font: 700 19px/1.1 var(--disp); letter-spacing: -.01em; font-variation-settings: 'opsz' 40; }
.fam-h .n { margin-left: auto; min-width: 24px; height: 24px; padding: 0 8px; border-radius: 99px; display: grid; place-items: center; font-size: 13px; font-weight: 700; color: var(--ink-2); background: var(--line-2); }
.card { background: var(--paper); border-radius: var(--r); box-shadow: var(--shadow); overflow: hidden; border: 1px solid var(--line-2); }
.row { display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 8px 10px 8px 12px; position: relative; transition: transform .35s cubic-bezier(.4, 0, .2, 1), opacity .3s, background .2s; }
.row + .row::before { content: ''; position: absolute; left: 68px; right: 0; top: 0; height: 1px; background: var(--line-2); }
.row .ic { width: 44px; height: 44px; flex: none; filter: drop-shadow(0 3px 4px rgba(0,0,0,.10)); }
.row .tx { flex: 1; min-width: 0; }
.row .nm { font-weight: 640; font-size: 17px; letter-spacing: -.005em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: 13px; color: var(--ink-3); margin-top: 1px; font-variant-numeric: tabular-nums; }
.row .sub .op { font-style: italic; }
.qty { flex: none; padding: 4px 10px; border-radius: 99px; background: var(--sauge-2); color: var(--sauge); font-weight: 750; font-size: 14px; font-variant-numeric: tabular-nums; }
.row .x { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-3); flex: none; }
.row .x:active { background: var(--line-2); color: var(--danger); }
.row:active { background: var(--paper-2); }
.row.flash { animation: flash .9s; }
@keyframes flash { 0% { background: var(--clem-2); } 100% { background: transparent; } }
.row.new { animation: pop .45s cubic-bezier(.3, 1.4, .5, 1); }
@keyframes pop { from { transform: scale(.9); opacity: 0; } }

/* Mode magasin : grandes lignes, case à cocher */
.store .row { min-height: 72px; }
.store .row .ic { width: 52px; height: 52px; }
.store .row .nm { font-size: 19px; }
.chk { width: 32px; height: 32px; border-radius: 50%; border: 2.5px solid var(--line); flex: none; display: grid; place-items: center; transition: all .2s; }
.chk svg { width: 18px; height: 18px; opacity: 0; color: #fff; }
.row.taking .chk { background: var(--ok); border-color: var(--ok); }
.row.taking .chk svg { opacity: 1; }
.row.taking { transform: translateX(110%); opacity: 0; }
.row.taking .nm { text-decoration: line-through; }

/* ---------- Vide ---------- */
.empty { text-align: center; padding: 36px 12px 8px; }
.empty .hero { width: 120px; height: 120px; margin: 0 auto 8px; }
.empty h1 { font: 700 30px/1.1 var(--disp); letter-spacing: -.02em; margin: 6px 0 8px; font-variation-settings: 'opsz' 96; }
.empty p { color: var(--ink-2); margin: 0 auto; max-width: 300px; }
.empty .ex { margin-top: 14px; display: inline-block; padding: 10px 14px; border-radius: 14px; background: var(--paper); border: 1px dashed var(--line); color: var(--ink-2); font-size: 15px; }
.done .hero { animation: bounce 1s cubic-bezier(.3, 1.5, .5, 1); }
@keyframes bounce { from { transform: scale(.4) rotate(-12deg); opacity: 0; } }
.big-total { font: 800 44px/1 var(--disp); margin: 14px 0 4px; font-variant-numeric: tabular-nums; }

.sec-t { margin: 26px 4px 10px; font-size: 13px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); display: flex; align-items: center; }
.sec-t button { margin-left: auto; text-transform: none; letter-spacing: 0; font-size: 14px; color: var(--sauge); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 8px; }
.tile { background: var(--paper); border: 1px solid var(--line-2); border-radius: 16px; padding: 10px 4px 9px; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 620; text-align: center; line-height: 1.15; box-shadow: var(--shadow); min-height: 92px; }
.tile img { width: 44px; height: 44px; filter: drop-shadow(0 3px 4px rgba(0,0,0,.1)); }
.tile:active { transform: scale(.95); }
.tile.on { background: var(--sauge-2); border-color: var(--sauge); }
.tile.fam-t { min-height: 104px; }
.tile.fam-t img { width: 50px; height: 50px; }

/* ---------- Barre du bas ---------- */
.dock { position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; padding: 10px 16px calc(var(--safe-b) + 12px); pointer-events: none; }
.dock-in { max-width: 608px; margin: 0 auto; display: flex; align-items: center; gap: 10px; pointer-events: auto; }
.field { flex: 1; height: 56px; display: flex; align-items: center; gap: 8px; padding: 0 8px 0 16px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }
.field input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; font-size: 17px; height: 100%; }
.field input::placeholder { color: var(--ink-3); }
.field .add { width: 40px; height: 40px; border-radius: 12px; background: var(--sauge); color: var(--sauge-ink); display: none; place-items: center; }
.field.has .add { display: grid; }
.field .add svg { width: 22px; height: 22px; }
.mic {
  width: 64px; height: 64px; border-radius: 22px; flex: none; display: grid; place-items: center; color: #fff;
  background: radial-gradient(120% 120% at 30% 20%, #FF9A5C 0%, var(--clem) 55%, #E5531A 100%);
  box-shadow: 0 12px 28px -8px var(--clem-glow), inset 0 1px 0 rgba(255,255,255,.35); transition: transform .15s;
}
.mic:active { transform: scale(.93); }
.mic svg { width: 28px; height: 28px; }
.store .dock .field { display: none; }
.store .dock-in { justify-content: flex-end; }

.sugg { position: fixed; left: 0; right: 0; bottom: calc(var(--safe-b) + 84px); z-index: 29; padding: 0 16px; display: none; }
.sugg.on { display: block; }
.sugg-in { max-width: 608px; margin: 0 auto; display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 4px 2px; }
.sugg-in::-webkit-scrollbar { display: none; }
.chip { flex: none; display: flex; align-items: center; gap: 7px; height: 44px; padding: 0 14px 0 8px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow); font-weight: 640; font-size: 15px; white-space: nowrap; }
.chip img { width: 28px; height: 28px; }

/* Barre chariot (magasin) */
.cart { flex: 1; height: 56px; border-radius: 18px; background: var(--paper); border: 1px solid var(--line); box-shadow: var(--shadow-lg); display: none; align-items: center; gap: 10px; padding: 0 16px 0 10px; font-weight: 650; }
.store .cart { display: flex; }
.cart img { width: 36px; height: 36px; }
.cart .t { margin-left: auto; font: 750 18px var(--ui); font-variant-numeric: tabular-nums; }

/* ---------- Écoute vocale ---------- */
.voice { position: fixed; inset: 0; z-index: 50; display: none; flex-direction: column; justify-content: flex-end; background: rgba(16, 22, 18, .38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.voice.on { display: flex; animation: fade .18s; }
@keyframes fade { from { opacity: 0; } }
.voice-p { background: var(--paper); border-radius: 28px 28px 0 0; padding: 22px 20px calc(var(--safe-b) + 20px); box-shadow: var(--shadow-lg); animation: up .28s cubic-bezier(.2, .9, .3, 1); max-width: 640px; width: 100%; margin: 0 auto; }
@keyframes up { from { transform: translateY(40%); opacity: .4; } }
.voice-h { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--clem); font-size: 15px; letter-spacing: .02em; }
.voice-h .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--clem); animation: blink 1.2s infinite; }
@keyframes blink { 50% { opacity: .25; } }
.voice-h.idle { color: var(--ink-3); } .voice-h.idle .dot { background: var(--ink-3); animation: none; }
.said { min-height: 62px; margin: 12px 0 6px; font: 650 24px/1.25 var(--disp); letter-spacing: -.01em; font-variation-settings: 'opsz' 48; }
.said .interim { color: var(--ink-3); }
.said .ph { color: var(--ink-3); font-family: var(--ui); font-size: 17px; font-weight: 500; }
.heard { display: flex; flex-wrap: wrap; gap: 8px; min-height: 48px; max-height: 34vh; overflow-y: auto; padding: 4px 0 8px; }
.heard .chip { animation: pop .35s cubic-bezier(.3, 1.4, .5, 1); box-shadow: none; }
.heard .chip.ghost { opacity: .5; border-style: dashed; animation: none; }
.heard .chip.rm { text-decoration: line-through; color: var(--danger); }
.wave { display: flex; align-items: center; justify-content: center; gap: 5px; height: 56px; margin: 6px 0 14px; }
.wave i { width: 6px; border-radius: 6px; background: var(--clem); height: 10px; transition: height .12s; }
.voice-a { display: flex; gap: 10px; }
.btn { height: 54px; border-radius: 16px; padding: 0 20px; font-weight: 700; font-size: 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn.pri { background: var(--sauge); color: var(--sauge-ink); flex: 1; }
.btn.sec { background: var(--line-2); color: var(--ink); }
.btn.dng { background: transparent; color: var(--danger); }
.btn.clem { background: var(--clem); color: #fff; flex: 1; }
.btn svg { width: 20px; height: 20px; }

/* ---------- Feuilles (bas d'écran) ---------- */
.sheet { position: fixed; inset: 0; z-index: 60; display: none; flex-direction: column; justify-content: flex-end; background: rgba(16, 22, 18, .38); }
.sheet.on { display: flex; animation: fade .18s; }
.sheet-p { background: var(--bg); border-radius: 26px 26px 0 0; max-height: 92vh; overflow-y: auto; padding: 8px 18px calc(var(--safe-b) + 20px); animation: up .26s cubic-bezier(.2, .9, .3, 1); max-width: 640px; width: 100%; margin: 0 auto; -webkit-overflow-scrolling: touch; }
.grip { width: 40px; height: 5px; border-radius: 9px; background: var(--line); margin: 4px auto 12px; }
.sheet h3 { margin: 4px 0 14px; font: 700 24px/1.15 var(--disp); letter-spacing: -.015em; display: flex; align-items: center; gap: 12px; font-variation-settings: 'opsz' 60; }
.sheet h3 img { width: 54px; height: 54px; }
.sheet h4 { margin: 20px 2px 8px; font-size: 13px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.inp { width: 100%; height: 52px; padding: 0 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--paper); font-size: 17px; outline: 0; }
.inp:focus { border-color: var(--sauge); }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 52px; height: 52px; border-radius: 14px; background: var(--paper); border: 1px solid var(--line); font-size: 24px; font-weight: 600; }
.stepper output { min-width: 60px; text-align: center; font: 750 24px var(--ui); font-variant-numeric: tabular-nums; }
.units { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.units button { height: 36px; padding: 0 12px; border-radius: 99px; background: var(--paper); border: 1px solid var(--line); font-size: 14px; font-weight: 640; }
.units button.on { background: var(--sauge); border-color: var(--sauge); color: var(--sauge-ink); }
.famgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(70px, 1fr)); gap: 6px; }
.famgrid button { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 8px 2px; border-radius: 14px; font-size: 11px; font-weight: 640; line-height: 1.1; text-align: center; border: 1.5px solid transparent; }
.famgrid button img { width: 34px; height: 34px; }
.famgrid button.on { background: var(--paper); border-color: var(--sauge); }
.sheet .acts { display: flex; gap: 10px; margin-top: 22px; }
.list-s { background: var(--paper); border-radius: var(--r); border: 1px solid var(--line-2); overflow: hidden; }
.list-s > * { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 56px; padding: 8px 14px; text-align: left; position: relative; }
.list-s > * + *::before { content: ''; position: absolute; left: 14px; right: 0; top: 0; height: 1px; background: var(--line-2); }
.list-s img { width: 32px; height: 32px; }
.list-s .grow { flex: 1; min-width: 0; }
.list-s small { display: block; color: var(--ink-3); font-size: 13px; }
.list-s .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.sw { width: 50px; height: 30px; border-radius: 99px; background: var(--line); position: relative; flex: none; transition: background .2s; }
.sw::after { content: ''; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .2s; }
.sw.on { background: var(--ok); } .sw.on::after { transform: translateX(20px); }
.note { color: var(--ink-2); font-size: 14px; line-height: 1.45; }
.note a { color: var(--sauge); }

/* ---------- Pavé prix (magasin) ---------- */
.pad { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: none; }
.pad.on { display: block; animation: up .22s cubic-bezier(.2, .9, .3, 1); }
.pad-p { max-width: 640px; margin: 0 auto; background: var(--paper); border-radius: 24px 24px 0 0; box-shadow: 0 -10px 40px -10px rgba(0,0,0,.3); padding: 14px 14px calc(var(--safe-b) + 12px); }
.pad-h { display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; }
.pad-h img { width: 40px; height: 40px; }
.pad-h .grow { flex: 1; min-width: 0; }
.pad-h b { display: block; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pad-h small { color: var(--ink-3); font-size: 13px; }
.pad-h .amt { font: 800 30px var(--ui); font-variant-numeric: tabular-nums; color: var(--ink); }
.pad-h .amt.zero { color: var(--ink-3); }
.keys { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.keys button { height: 50px; border-radius: 13px; background: var(--paper-2); border: 1px solid var(--line-2); font: 650 22px var(--ui); }
.keys button:active { background: var(--line); }
.keys .ok { grid-row: span 2; height: auto; background: var(--sauge); color: var(--sauge-ink); font-size: 18px; border: 0; }
.keys .skip { font-size: 14px; color: var(--ink-2); }

/* ---------- Toast ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--safe-b) + 96px); transform: translateX(-50%) translateY(20px); z-index: 70; background: var(--ink); color: var(--bg); padding: 0 6px 0 16px; height: 48px; border-radius: 14px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 15px; opacity: 0; pointer-events: none; transition: all .25s; max-width: calc(100% - 32px); white-space: nowrap; box-shadow: var(--shadow-lg); }
.toast.on { opacity: 1; transform: translateX(-50%); pointer-events: auto; }
.toast button { color: var(--clem); font-weight: 750; padding: 0 12px; height: 40px; border-radius: 10px; }
.toast span { overflow: hidden; text-overflow: ellipsis; }

@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
@media (min-width: 700px) { main { padding-top: 12px; } }
