:root {
  --bg: #FAF6F0; --card: #FFFFFF; --ink: #1E1B16; --muted: #6F685E; --line: #E6DFD3; --line-strong: #CFC6B8;
  --accent: #C8321E; --accent-soft: #FBE6E2; --accent-ink: #FFFFFF;
  --amber: #B35A00; --amber-soft: #FDEBD3; --green: #1F7A45; --green-soft: #DDF3E4; --gray-soft: #F1ECE4;
  --radius: 14px; --tabbar: 64px;
  --sat: env(safe-area-inset-top, 0px); --sab: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; font-size: 16px; line-height: 1.4; color: var(--ink); background: var(--bg); overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
h1, h2, h3 { margin: 0; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.center { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* En-tête */
.header { position: sticky; top: 0; z-index: 20; background: var(--bg); padding: calc(var(--sat) + 8px) 16px 8px; border-bottom: 1px solid var(--line); }
.header-row { display: flex; align-items: center; gap: 10px; }
.logo { width: 36px; height: 36px; border-radius: 50%; background: #fff url('/icons/icon-192.png') center/cover; border: 1px solid var(--line); flex: none; }
.brand { font-weight: 800; font-size: 18px; flex: 1; letter-spacing: .2px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--green); flex: none; }
.dot.off { background: var(--accent); }
.who { font-size: 13px; color: var(--muted); }
.datenav { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.datenav .label { flex: 1; text-align: center; font-weight: 600; text-transform: capitalize; }
.datenav button { width: 40px; height: 36px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 18px; }
.datenav .today { width: auto; padding: 0 10px; font-size: 14px; }

/* Contenu */
.main { padding: 12px 16px calc(var(--tabbar) + var(--sab) + 84px); max-width: 720px; margin: 0 auto; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 12px; }
.card.hint { background: var(--gray-soft); border-style: dashed; color: var(--muted); }
.card.warn { background: var(--amber-soft); border-color: #F0C89A; color: var(--amber); }
.row { display: flex; align-items: center; gap: 10px; }
.row .grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.empty { text-align: center; color: var(--muted); padding: 40px 16px; }
.empty .big { font-size: 40px; margin-bottom: 8px; }

/* Bandeau four */
.oven { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.oven .next { font-size: 15px; color: var(--muted); }
.oven .next b { font-size: 26px; color: var(--ink); display: block; line-height: 1.1; }
.strip { display: flex; gap: 6px; align-items: flex-end; height: 56px; margin-top: 10px; }
.strip .blk { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; height: 100%; gap: 4px; }
.strip .bar { width: 100%; background: var(--green-soft); border-radius: 6px 6px 2px 2px; min-height: 4px; transition: height .3s; }
.strip .bar.mid { background: #F7D9A3; } .strip .bar.full { background: #F3B5AB; }
.strip .t { font-size: 11px; color: var(--muted); }
.rush { margin-top: 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; padding: 0 16px; border-radius: 12px; font-weight: 600; font-size: 16px; background: var(--card); border: 1px solid var(--line-strong); color: var(--ink); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; }
.btn.amber { background: var(--amber); border-color: var(--amber); color: #fff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent); }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: 14px; border-radius: 10px; }
.btn.block { width: 100%; }
.btn:disabled { opacity: .5; }
.btn:active { transform: scale(.98); }
.fab { position: fixed; right: 16px; bottom: calc(var(--tabbar) + var(--sab) + 14px); z-index: 25; height: 56px; padding: 0 20px 0 16px; border-radius: 28px; background: var(--accent); color: #fff; font-weight: 700; font-size: 17px; box-shadow: 0 6px 18px rgba(200,50,30,.35); display: flex; align-items: center; gap: 8px; }
.fab span.plus { font-size: 26px; line-height: 1; }

/* Chips & segments */
.chip { display: inline-flex; align-items: center; min-height: 28px; padding: 2px 10px; border-radius: 999px; font-size: 13px; font-weight: 600; background: var(--gray-soft); color: var(--muted); }
.chip.a_preparer { background: var(--gray-soft); color: var(--muted); }
.chip.au_four { background: var(--amber-soft); color: var(--amber); }
.chip.prete { background: var(--green-soft); color: var(--green); }
.chip.recuperee, .chip.partie { background: var(--gray-soft); color: var(--muted); }
.chip.annulee { background: var(--accent-soft); color: var(--accent); }
.chip.attendue { background: var(--amber-soft); color: var(--amber); }
.chip.installee { background: var(--green-soft); color: var(--green); }
.chip.late { background: var(--accent-soft); color: var(--accent); }
.seg { display: flex; background: var(--gray-soft); border-radius: 12px; padding: 3px; margin-bottom: 12px; }
.seg button { flex: 1; min-height: 36px; border-radius: 10px; font-weight: 600; font-size: 14px; color: var(--muted); }
.seg button.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chips .pick { min-height: 40px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); font-weight: 600; font-size: 15px; }
.chips .pick.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.chips .pick.soft { font-weight: 500; }

/* Cartes commande / réservation */
.order { display: flex; gap: 12px; }
.order .time { width: 64px; flex: none; font-size: 22px; font-weight: 800; line-height: 1; padding-top: 2px; }
.order .time.late { color: var(--accent); }
.order .time small { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-top: 4px; }
.order .name { font-weight: 700; font-size: 17px; }
.order .items { margin: 4px 0; }
.order .note { color: var(--amber); font-style: italic; }
.order.done { opacity: .6; }
.actions { display: flex; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.actions .btn { flex: 1; }
.actions .btn.sm { flex: 0 0 auto; }
.section-title { display: flex; align-items: baseline; gap: 8px; margin: 18px 0 8px; }
.section-title h3 { flex: 1; }

/* Barre d'onglets */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; height: calc(var(--tabbar) + var(--sab)); padding-bottom: var(--sab); display: flex; background: var(--card); border-top: 1px solid var(--line); }
.tabbar button { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); }
.tabbar button .ic { font-size: 22px; line-height: 1; }
.tabbar button.on { color: var(--accent); }
.tabbar button .badge { position: absolute; margin-left: 28px; margin-top: -4px; background: var(--accent); color: #fff; font-size: 10px; border-radius: 999px; padding: 1px 5px; }

/* Feuilles (formulaires plein écran) */
#sheet { display: none; }
#sheet.open { display: block; position: fixed; inset: 0; z-index: 40; background: var(--bg); overflow: hidden; }
.sheet-head { position: sticky; top: 0; display: flex; align-items: center; gap: 10px; padding: calc(var(--sat) + 10px) 16px 10px; background: var(--bg); border-bottom: 1px solid var(--line); z-index: 2; }
.sheet-head h2 { flex: 1; font-size: 18px; }
.sheet-head .close { width: 40px; height: 40px; border-radius: 50%; background: var(--card); border: 1px solid var(--line); font-size: 20px; }
.sheet-body { height: 100%; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 12px 16px 140px; max-width: 720px; margin: 0 auto; }
.sheet-foot { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(var(--sab) + 12px); background: var(--card); border-top: 1px solid var(--line); z-index: 3; }
.sheet-foot .inner { max-width: 720px; margin: 0 auto; display: flex; align-items: center; gap: 12px; }
.sheet-foot .total { font-weight: 800; font-size: 18px; flex: 1; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px; }
.field input[type=text], .field input[type=tel], .field input[type=number], .field input[type=password], .field input[type=time], .field input[type=date], .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); font-size: 17px; -webkit-appearance: none; appearance: none; }
.field textarea { min-height: 72px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.field .help { font-size: 13px; color: var(--muted); margin-top: 6px; }
.menu-row { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.menu-row:last-child { border-bottom: 0; }
.menu-row .n { flex: 1; min-width: 0; }
.menu-row .n b { display: block; }
.menu-row .n span { font-size: 13px; color: var(--muted); }
.menu-row .p { color: var(--muted); font-size: 14px; white-space: nowrap; }
.qty { display: flex; align-items: center; gap: 0; }
.qty button { width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line-strong); background: var(--card); font-size: 22px; font-weight: 600; }
.qty button.plus { background: var(--accent); border-color: var(--accent); color: #fff; }
.qty b { width: 34px; text-align: center; font-size: 18px; }
.qty b.zero { color: var(--line-strong); }
.stepper { display: flex; align-items: center; gap: 12px; }
.stepper button { width: 48px; height: 48px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--card); font-size: 24px; }
.stepper b { min-width: 60px; text-align: center; font-size: 22px; }
.cat { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; margin: 14px 0 4px; }
.known { background: var(--green-soft); color: var(--green); border-radius: 10px; padding: 8px 10px; font-size: 14px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.known .btn { min-height: 34px; }
.pick-row { display: flex; align-items: center; gap: 10px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.pick-row:last-child { border-bottom: 0; }
.pick-row .grow { flex: 1; min-width: 0; }
.pick-row .sub { font-size: 13px; color: var(--muted); }
.toggle { width: 52px; height: 32px; border-radius: 16px; background: var(--line-strong); position: relative; flex: none; }
.toggle::after { content: ''; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; transition: left .15s; }
.toggle.on { background: var(--green); } .toggle.on::after { left: 23px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 12px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font-size: 26px; line-height: 1.1; }
.kpi span { font-size: 13px; color: var(--muted); }
.chart { width: 100%; height: auto; display: block; }
.code { font-family: ui-monospace, Menlo, monospace; background: var(--gray-soft); padding: 10px; border-radius: 10px; word-break: break-all; font-size: 14px; }
.login { max-width: 420px; margin: 0 auto; padding: calc(var(--sat) + 40px) 20px 40px; }
.login .biglogo { width: 120px; height: 120px; border-radius: 50%; margin: 0 auto 16px; background: #fff url('/icons/icon-512.png') center/cover; border: 1px solid var(--line); }
.login h1 { text-align: center; font-size: 26px; margin-bottom: 4px; }
.login .sub { text-align: center; color: var(--muted); margin-bottom: 24px; }
.userbtn { width: 100%; min-height: 60px; border-radius: 14px; background: var(--card); border: 1px solid var(--line-strong); font-size: 19px; font-weight: 700; margin-bottom: 10px; text-align: left; padding: 0 18px; display: flex; align-items: center; gap: 12px; }
.userbtn .av { width: 40px; height: 40px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); display: flex; align-items: center; justify-content: center; font-size: 18px; }
.userbtn .r { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: auto; }
.error { background: var(--accent-soft); color: var(--accent); border-radius: 10px; padding: 10px 12px; margin-bottom: 12px; font-weight: 600; }
#confirm:empty, #toast:empty { display: none; }
#confirm { position: fixed; inset: 0; z-index: 60; background: rgba(30,27,22,.45); display: flex; align-items: flex-end; justify-content: center; padding: 16px; padding-bottom: calc(var(--sab) + 16px); }
#confirm .box { background: var(--card); border-radius: 18px; padding: 18px; width: 100%; max-width: 440px; }
#confirm .box p { margin: 0 0 14px; font-size: 17px; font-weight: 600; }
#confirm .box .row .btn { flex: 1; }
#toast { position: fixed; left: 16px; right: 16px; bottom: calc(var(--tabbar) + var(--sab) + 16px); z-index: 70; display: flex; justify-content: center; pointer-events: none; }
#toast div { background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: 440px; box-shadow: 0 6px 18px rgba(0,0,0,.2); }
.install { background: #fff8e6; border: 1px solid #F0D9A0; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 14px; }
.install b { display: block; margin-bottom: 4px; font-size: 15px; }
.tel { color: var(--ink); font-weight: 600; text-decoration: underline; text-decoration-color: var(--line-strong); }
@media (min-width: 720px) { .kpis { grid-template-columns: repeat(4, 1fr); } }

.chip.online { background: #E3ECFB; color: #1D4FA8; }
.catbar { position: sticky; top: 0; z-index: 1; display: flex; gap: 6px; overflow-x: auto; padding: 8px 0; margin: 0 -16px; padding-left: 16px; padding-right: 16px; background: var(--bg); scrollbar-width: none; }
.catbar::-webkit-scrollbar { display: none; }
.catbar .pick { flex: none; min-height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); font-size: 14px; font-weight: 600; color: var(--ink); }
.cat { scroll-margin-top: 56px; }
.hin { min-height: 42px; padding: 6px 8px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--card); font-size: 16px; width: 110px; }

/* Page client */
body.client .main { padding-bottom: 120px; }
.c-head { display: flex; align-items: center; gap: 12px; padding: calc(var(--sat) + 14px) 16px 12px; max-width: 720px; margin: 0 auto; }
.c-logo { width: 56px; height: 56px; border-radius: 50%; flex: none; background: #fff url('/icons/icon-192.png') center/cover; border: 1px solid var(--line); }
.c-name { font-size: 22px; font-weight: 800; }
.c-main { padding-top: 4px; }
.c-status { border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 15px; }
.c-status.ok { background: var(--green-soft); color: var(--green); font-weight: 600; }
.c-status.off { background: var(--amber-soft); color: var(--amber); }
.c-status a { color: inherit; font-weight: 700; }
.c-cat { margin: 18px 0 8px; font-size: 20px; scroll-margin-top: 60px; }
.c-list { padding: 4px 14px; }
.c-price { font-weight: 700; margin-top: 4px; color: var(--ink); }
.c-bar { position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 16px calc(var(--sab) + 12px); background: var(--card); border-top: 1px solid var(--line); z-index: 30; }
.c-bar .c-cta { max-width: 688px; margin: 0 auto; display: flex; justify-content: space-between; min-height: 54px; font-size: 17px; }
.c-select { width: 100%; min-height: 44px; margin-top: 8px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--card); padding: 0 12px; font-size: 16px; }
.c-time { font-size: 56px; font-weight: 800; line-height: 1.1; margin: 4px 0 14px; }
.c-steps { display: flex; justify-content: space-between; gap: 4px; margin: 6px 0 14px; }
.c-step { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.c-step span { width: 100%; height: 6px; border-radius: 3px; background: var(--line); }
.c-step.on { color: var(--green); font-weight: 700; }
.c-step.on span { background: var(--green); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; color: var(--muted); text-decoration: none; }
.tabbar a .ic { font-size: 22px; line-height: 1; }
.tabbar a:active { color: var(--accent); }
