/* ============ Thème (clair par défaut, style appli de commande de repas) ============ */
:root, [data-theme="light"] {
  --bg: #f5f9f8; --surface: #ffffff; --surface-2: #eef3f1; --surface-3: #e1e9e6;
  --line: #e7eeeb; --text: #17211c; --muted: #77817b; --shadow: 0 8px 28px rgb(24 60 44 / .09); --shadow-sm: 0 2px 8px rgb(24 60 44 / .06);
  --c-new: #2f6fe0; --c-cook: #d98a00; --c-ready: #1f9d63; --c-na: #e53935; --c-done: #8a918c;
  --accent: #2e7d5b; --accent-ink: #ffffff;
  --accent-text: color-mix(in srgb, var(--accent) 85%, #000);
  --brand-red: #fe0000;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0f1412; --surface: #18201c; --surface-2: #212a25; --surface-3: #2b352f;
  --line: #2a332e; --text: #eef3f0; --muted: #93a099; --shadow: 0 10px 30px rgb(0 0 0 / .45); --shadow-sm: 0 2px 8px rgb(0 0 0 / .3);
  --c-new: #5b9bff; --c-cook: #f5b13d; --c-ready: #34c77b; --c-na: #f0565b; --c-done: #7a818d;
  --accent-text: color-mix(in srgb, var(--accent) 55%, #fff);
  color-scheme: dark;
}
:root {
  --accent-soft: color-mix(in srgb, var(--accent) 12%, transparent);
  --r-xl: 24px; --r-lg: 20px; --r: 14px; --r-sm: 10px;
  --tap: 48px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.45 "Outfit", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
button:disabled { opacity: .4; cursor: not-allowed; }
input, select, textarea { width: 100%; padding: 15px 16px; border-radius: 16px; border: 1.5px solid transparent; background: var(--surface); box-shadow: 0 1px 2px rgb(24 60 44 / .05), 0 0 0 1px var(--line); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ic { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -0.22em; }
.muted { color: var(--muted); }
h1, h2, h3 { letter-spacing: -.015em; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap);
  padding: 0 22px; border-radius: 99px; background: var(--surface-2); font-weight: 600; transition: transform .08s, background .15s, box-shadow .15s; white-space: nowrap; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 30%, transparent); }
.btn.soft { background: var(--accent-soft); color: var(--accent-text); }
.btn.ghost { background: var(--surface); border: 1.5px solid var(--line); }
.btn.danger { background: transparent; border: 1.5px solid color-mix(in srgb, var(--c-na) 50%, transparent); color: var(--c-na); }
.btn.ready { background: var(--c-ready); color: #fff; }
.btn.cook { background: var(--c-cook); color: #fff; }
.btn.block { width: 100%; }
.btn.lg { min-height: 58px; font-size: 17px; }
.btn.sm { min-height: 38px; padding: 0 16px; font-size: 14px; }
.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; color: var(--muted); background: var(--surface-2); }
.icon-btn:hover { color: var(--text); background: var(--surface-3); }
.round-add { width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); color: var(--accent-ink); flex: none; box-shadow: 0 4px 12px color-mix(in srgb, var(--accent) 35%, transparent); }
.round-add .ic { width: 20px; height: 20px; stroke-width: 2.4; }

/* Avatars & logos */
.avatar { --h: 150; width: 40px; height: 40px; border-radius: 50%; display: inline-grid; place-items: center; flex: none;
  background: hsl(var(--h) 45% 92%); color: hsl(var(--h) 45% 32%); font-weight: 800; font-size: 15px; }
[data-theme="dark"] .avatar { background: hsl(var(--h) 35% 28%); color: hsl(var(--h) 60% 85%); }
.avatar.sm { width: 28px; height: 28px; font-size: 11px; }
.avatar.lg { width: 68px; height: 68px; font-size: 24px; }
.logo { width: 42px; height: 42px; object-fit: contain; flex: none; }
.monogram { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; flex: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 18px; }

/* ============ Connexion ============ */
.auth { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px;
  background: radial-gradient(900px 520px at 50% -8%, color-mix(in srgb, var(--accent) 16%, transparent), transparent 70%), var(--bg); }
.auth-box { width: 100%; max-width: 560px; text-align: center; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 6px; margin-bottom: 24px; }
.auth-brand .full-logo { max-width: min(240px, 60vw); max-height: 230px; object-fit: contain; filter: drop-shadow(0 8px 20px rgb(24 60 44 / .12)); }
.auth-brand h1 { margin: 6px 0 0; font-size: 28px; }
.auth-brand p { margin: 4px 0 0; color: var(--muted); font-weight: 600; }
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); gap: 12px; }
.person { background: var(--surface); border-radius: var(--r-lg); padding: 20px 10px 16px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; align-items: center; gap: 10px; transition: transform .1s, box-shadow .15s; border: 1.5px solid transparent; }
.person:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.person:active { transform: scale(.97); }
.person b { font-size: 16px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.role-tag { font-size: 12px; font-weight: 600; color: var(--accent-text); background: var(--accent-soft); padding: 2px 10px; border-radius: 99px; }
.auth-links { display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; margin-top: 22px; }
.auth-links button { color: var(--muted); padding: 10px 16px; border-radius: 99px; font-weight: 600; }
.auth-links button:hover { color: var(--accent-text); background: var(--accent-soft); }
.card { background: var(--surface); border-radius: var(--r-xl); padding: 24px; text-align: left; box-shadow: var(--shadow-sm); }
.card h2 { margin: 0 0 4px; font-size: 18px; }
.field { margin-top: 16px; }
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--text); margin-bottom: 7px; }
.field .hint { font-size: 12.5px; color: var(--muted); margin-top: 5px; }
.err { color: var(--c-na); min-height: 20px; margin-top: 12px; font-size: 14px; font-weight: 600; }
.seg { display: flex; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 99px; }
.seg button { flex: 1; min-height: 42px; padding: 0 16px; border-radius: 99px; font-weight: 700; color: var(--muted); white-space: nowrap; }
.seg button.on { background: var(--accent); color: var(--accent-ink); box-shadow: var(--shadow-sm); }

/* PIN */
.pin-card { max-width: 360px; margin: 0 auto; text-align: center; }
.pin-who { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 18px; }
.pin-dots { display: flex; justify-content: center; gap: 14px; margin: 6px 0 4px; height: 18px; }
.pin-dots i { width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); transition: all .12s; }
.pin-dots i.on { background: var(--accent); transform: scale(1.15); }
.pin-dots.shake { animation: shake .35s; }
@keyframes shake { 25% { transform: translateX(-8px); } 75% { transform: translateX(8px); } }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 18px; }
.keypad button { height: 66px; border-radius: 20px; background: var(--surface-2); font-size: 26px; font-weight: 700; }
.keypad button:active { background: var(--surface-3); transform: scale(.96); }
.keypad .ok { background: var(--accent); color: var(--accent-ink); font-size: 17px; }
.keypad .k-del { color: var(--muted); }

/* ============ Structure ============ */
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 10px 18px; background: color-mix(in srgb, var(--surface) 94%, transparent); backdrop-filter: blur(12px); box-shadow: 0 1px 0 var(--line); }
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand b { font-size: 17px; font-weight: 800; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 200px; }
.tabs { display: flex; gap: 4px; margin-left: 8px; }
.tab { display: flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 16px; border-radius: 99px;
  color: var(--muted); font-weight: 700; white-space: nowrap; position: relative; font-size: 15px; }
.tab:hover { color: var(--text); background: var(--surface-2); }
.tab.on { color: var(--accent-ink); background: var(--accent); }
.tab .dotbadge { position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--brand-red); color: #fff; font-size: 11px; font-weight: 800; display: grid; place-items: center; }
.dotbadge[hidden] { display: none; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); padding: 0 10px; }
.live i { width: 8px; height: 8px; border-radius: 50%; background: var(--c-na); }
.live.on i { background: var(--c-ready); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-ready) 22%, transparent); }
.me-btn { display: flex; align-items: center; gap: 8px; padding: 4px 12px 4px 4px; border-radius: 99px; background: var(--surface-2); }
.me-btn:hover { background: var(--surface-3); }
.me-btn span { font-weight: 700; font-size: 14px; }
.menu { position: fixed; right: 12px; top: 62px; z-index: 40; min-width: 250px; background: var(--surface);
  border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 6px; border: 1px solid var(--line); }
.menu .mh { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 12px; border-radius: var(--r-sm); text-align: left; font-weight: 600; }
.menu button:hover { background: var(--surface-2); }
main { padding: 18px; max-width: 1600px; margin: 0 auto; overflow-x: clip; }
.bottomnav { display: none; }
.page-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 4px 0 16px; }
.page-title h1 { margin: 0; font-size: 24px; }
.page-title p { margin: 2px 0 0; color: var(--muted); }

/* Pastilles de statut */
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; padding: 4px 11px; border-radius: 99px; white-space: nowrap;
  --c: var(--c-done); color: var(--c); background: color-mix(in srgb, var(--c) 13%, transparent); }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.s-nouvelle, .s-en_attente { --c: var(--c-new); } .s-en_cours { --c: var(--c-cook); } .s-prete, .s-pret { --c: var(--c-ready); }
.s-non_disponible { --c: var(--c-na); } .s-servie, .s-annulee { --c: var(--c-done); }

/* ============ Écran cuisine ============ */
.k-toolbar { display: flex; gap: 10px; align-items: stretch; flex-wrap: wrap; margin-bottom: 16px; }
.kpi { background: var(--surface); border-radius: var(--r-lg); padding: 10px 16px 10px 10px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
.kpi .ico { width: 42px; height: 42px; border-radius: 13px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.kpi .ico .ic { width: 21px; height: 21px; }
.kpi b { font-size: 24px; line-height: 1; font-weight: 800; font-variant-numeric: tabular-nums; }
.kpi small { color: var(--muted); font-size: 12.5px; line-height: 1.2; font-weight: 600; }
.kpi.alert .ico { background: color-mix(in srgb, var(--c-na) 12%, transparent); color: var(--c-na); } .kpi.alert b { color: var(--c-na); }
.k-toolbar .spacer { flex: 1; }
.k-layout { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.k-layout.with-prod { grid-template-columns: 1fr 290px; }
.k-layout > *, .order-layout > *, .settings > *, .dash-grid > * { min-width: 0; }
.board { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: start; }
.board.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.col { background: color-mix(in srgb, var(--surface-3) 45%, transparent); border-radius: var(--r-xl); padding: 8px; min-height: 260px; }
.col-h { display: flex; align-items: center; gap: 8px; padding: 8px 10px 12px; font-weight: 800; }
.col-h::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--c); }
.col-h .count { margin-left: auto; background: var(--surface); color: var(--c); border-radius: 99px; min-width: 30px; padding: 2px 10px; text-align: center; font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 38px 10px; font-size: 14px; font-weight: 500; }

.ticket { background: var(--surface); border-radius: var(--r-lg); margin-bottom: 10px; overflow: hidden; box-shadow: var(--shadow-sm); border-top: 5px solid var(--c); }
.ticket.fresh { animation: pop 1s ease 2; }
@keyframes pop { 50% { box-shadow: 0 0 0 4px var(--accent); } }
.t-head { display: flex; align-items: center; gap: 10px; padding: 12px 14px 6px; }
.t-table { font-size: 24px; font-weight: 800; letter-spacing: -.02em; line-height: 1; white-space: nowrap; }
.t-table small { font-size: 13px; font-weight: 700; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.t-head .timer { margin-left: auto; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 15px; padding: 5px 11px; border-radius: 99px; background: var(--surface-2); display: inline-flex; align-items: center; gap: 6px; }
.timer.warn { color: #fff; background: var(--c-cook); }
.timer.late { color: #fff; background: var(--c-na); animation: pulse 1.4s infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.t-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 4px 14px 10px; font-size: 14px; color: var(--muted); font-weight: 500; }
.t-meta span { display: inline-flex; align-items: center; gap: 6px; }
.t-meta b { color: var(--text); }
.progress { height: 5px; background: var(--surface-2); margin: 0 14px 6px; border-radius: 99px; overflow: hidden; }
.progress i { display: block; height: 100%; background: var(--c-ready); border-radius: 99px; transition: width .3s; }
.t-items { list-style: none; margin: 0; padding: 2px 8px; }
.t-item { display: flex; align-items: center; gap: 4px; border-radius: var(--r-sm); }
.t-item + .t-item { border-top: 1px dashed var(--line); }
.t-item .tap { flex: 1; display: flex; align-items: center; gap: 10px; padding: 10px 6px; text-align: left; border-radius: var(--r-sm); min-height: 54px; }
.t-item .tap:hover:not(:disabled) { background: var(--surface-2); }
.t-item .tap:disabled { opacity: 1; cursor: default; }
.chk { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface-3); display: grid; place-items: center; flex: none; color: transparent; }
.t-item.en_cours .chk { border-color: var(--c-cook); background: conic-gradient(var(--c-cook) 50%, transparent 0); }
.t-item.pret .chk { border-color: var(--c-ready); background: var(--c-ready); color: #fff; }
.t-item.non_disponible .chk { border-color: var(--c-na); background: var(--c-na); color: #fff; }
.chk .ic { width: 15px; height: 15px; stroke-width: 3; }
.t-item .q { font-weight: 800; font-size: 19px; min-width: 32px; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.t-item .n { flex: 1; font-size: 16.5px; font-weight: 700; line-height: 1.25; }
.t-item .n small { display: flex; align-items: center; gap: 4px; font-size: 13.5px; font-weight: 600; color: var(--c-cook); margin-top: 3px; }
.t-item.pret .n, .t-item.pret .q { color: var(--muted); text-decoration: line-through; }
.t-item.non_disponible .n, .t-item.non_disponible .q { color: var(--c-na); text-decoration: line-through; }
.t-item .na { width: 40px; height: 40px; border-radius: 50%; color: var(--muted); display: grid; place-items: center; }
.t-item .na:hover { color: var(--c-na); background: color-mix(in srgb, var(--c-na) 10%, transparent); }
.t-note { margin: 6px 14px 0; padding: 9px 12px; border-radius: var(--r-sm); background: color-mix(in srgb, var(--c-cook) 11%, transparent);
  font-size: 14.5px; font-weight: 600; display: flex; gap: 8px; }
.t-note .ic { color: var(--c-cook); }
.t-actions { display: flex; flex-wrap: wrap; gap: 8px; padding: 12px 14px 14px; }
.t-actions .btn { flex: 1 1 120px; }
.t-actions .btn.danger { flex: 0 0 48px; padding: 0; }

.prod-panel { background: var(--surface); border-radius: var(--r-xl); padding: 16px; position: sticky; top: 80px; box-shadow: var(--shadow-sm); }
.prod-panel h3 { margin: 0 0 10px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.prod-panel ul { list-style: none; margin: 0; padding: 0; }
.prod-panel li { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 15px; font-weight: 600; }
.prod-panel li b { min-width: 36px; height: 30px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); font-variant-numeric: tabular-nums; }

/* ============ Prise de commande ============ */
.order-layout { display: grid; grid-template-columns: minmax(0, 1fr) 390px; gap: 18px; align-items: start; }
.hello { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.hello h1 { margin: 0; font-size: 22px; }
.hello p { margin: 2px 0 0; color: var(--muted); font-weight: 500; }
.catalog-head { position: sticky; top: 63px; z-index: 5; background: var(--bg); padding: 4px 0 12px; }
.searchbox { position: relative; }
.searchbox .ic { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.searchbox input { padding-left: 46px; min-height: 52px; border-radius: 16px; border-color: transparent; box-shadow: var(--shadow-sm); }
.chips { display: flex; gap: 10px; overflow-x: auto; padding: 12px 2px 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 18px 0 6px; border-radius: 99px; background: var(--surface); font-weight: 700; color: var(--text); box-shadow: var(--shadow-sm); }
.chip .cico { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.chip .cico .ic { width: 18px; height: 18px; }
.chip.on { background: var(--accent); color: var(--accent-ink); }
.chip.on .cico { background: rgb(255 255 255 / .2); color: inherit; }
.grid-products { display: grid; grid-template-columns: repeat(auto-fill, minmax(168px, 1fr)); gap: 14px; }
.pcard { position: relative; text-align: left; background: var(--surface); border-radius: var(--r-xl); padding: 10px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; transition: transform .1s, box-shadow .15s; border: 1.5px solid transparent; }
.pcard:hover:not(:disabled) { box-shadow: var(--shadow); }
.pcard:active:not(:disabled) { transform: scale(.97); }
.pcard.incart { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.pcard.bump { animation: bump .25s; }
@keyframes bump { 50% { transform: scale(1.04); } }
.pcard .ph { aspect-ratio: 4 / 3; border-radius: 16px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; }
.pcard .ph img { width: 100%; height: 100%; object-fit: cover; }
.pcard .ph .ic { width: 44px; height: 44px; stroke-width: 1.5; color: var(--accent); opacity: .75; }
.pcard .ph.tint { background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 10%, var(--surface)), color-mix(in srgb, var(--accent) 22%, var(--surface))); }
.pcard .pb { padding: 10px 4px 2px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.pcard .pn { font-weight: 750; line-height: 1.25; font-size: 15.5px; }
.pcard .pc { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.pcard .pf { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; padding-top: 8px; }
.pcard .pp { font-weight: 800; font-size: 16px; }
.pcard:disabled .round-add { background: var(--surface-3); color: var(--muted); box-shadow: none; }
.stock { position: absolute; top: 18px; left: 18px; font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 99px; background: rgb(255 255 255 / .92); color: var(--muted); }
[data-theme="dark"] .stock { background: rgb(0 0 0 / .55); }
.stock.low { color: var(--c-cook); } .stock.out { color: #fff; background: var(--c-na); }
.qty-bubble { position: absolute; top: 14px; right: 14px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 15px;
  background: var(--brand-red); color: #fff; font-weight: 800; display: grid; place-items: center; box-shadow: var(--shadow); }

.order-panel { background: var(--surface); border-radius: var(--r-xl); position: sticky; top: 80px; box-shadow: var(--shadow);
  max-height: calc(100vh - 96px); display: flex; flex-direction: column; overflow: hidden; }
.op-head { padding: 18px 18px 14px; border-bottom: 1px solid var(--line); }
.op-head h2 { margin: 0 0 14px; font-size: 19px; display: flex; align-items: center; justify-content: space-between; }
.op-head h2 > span { display: flex; gap: 6px; }
.op-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.table-btn { display: flex; align-items: center; gap: 12px; min-height: 58px; padding: 0 14px; border-radius: 16px; background: var(--surface-2); border: 2px dashed var(--surface-3); text-align: left; }
.table-btn .tico { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: var(--surface); color: var(--accent-text); }
.table-btn.set { border: 2px solid var(--accent); background: var(--accent-soft); }
.table-btn.set .tico { background: var(--accent); color: var(--accent-ink); }
.table-btn small { display: block; font-size: 12px; color: var(--muted); font-weight: 700; }
.table-btn b { font-size: 19px; }
.stepper { display: flex; align-items: center; background: var(--surface-2); border-radius: 16px; padding: 5px; gap: 2px; }
.stepper button { width: 42px; height: 48px; border-radius: 12px; display: grid; place-items: center; }
.stepper button:hover { background: var(--surface); }
.stepper .val { min-width: 50px; text-align: center; }
.stepper .val b { display: block; font-size: 19px; line-height: 1.1; }
.stepper .val small { font-size: 11px; color: var(--muted); font-weight: 600; }
.op-lines { flex: 1; overflow: auto; padding: 4px 18px; list-style: none; margin: 0; }
.op-empty { text-align: center; color: var(--muted); padding: 36px 10px; font-weight: 500; }
.op-empty .ico { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.op-empty .ico .ic { width: 28px; height: 28px; }
.line { padding: 12px 0; border-bottom: 1px solid var(--line); }
.line-top { display: flex; align-items: center; gap: 10px; }
.line .thumb { width: 44px; height: 44px; border-radius: 12px; overflow: hidden; flex: none; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-text); }
.line .thumb img { width: 100%; height: 100%; object-fit: cover; }
.line .nm { flex: 1; min-width: 0; }
.line .n { font-weight: 700; display: block; }
.line .p { font-weight: 800; font-size: 14px; color: var(--accent-text); font-variant-numeric: tabular-nums; }
.mini-step { display: flex; align-items: center; gap: 2px; background: var(--surface-2); border-radius: 99px; padding: 3px; }
.mini-step button { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); box-shadow: var(--shadow-sm); }
.mini-step button:last-child { background: var(--accent); color: var(--accent-ink); }
.mini-step b { min-width: 24px; text-align: center; font-variant-numeric: tabular-nums; }
.note-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); margin: 6px 0 0 54px; padding: 4px 0; }
.line input { margin: 8px 0 0 54px; width: calc(100% - 54px); padding: 9px 12px; font-size: 14px; }
.op-foot { padding: 14px 18px 18px; border-top: 1px solid var(--line); background: var(--surface); }
.op-foot textarea { resize: none; font-size: 14px; padding: 11px 13px; }
.total { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 0; }
.total span { color: var(--muted); font-weight: 600; }
.total b { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }
.cartbar { display: none; }
.only-phone { display: none !important; }

/* Fenêtres (plan de salle, formulaires) */
.sheet-bg { position: fixed; inset: 0; z-index: 50; background: rgb(10 25 18 / .45); display: grid; place-items: center; padding: 16px; animation: fade .15s; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: 100%; max-width: 640px; max-height: calc(100vh - 32px); overflow: auto; background: var(--surface); border-radius: 28px; padding: 22px; box-shadow: var(--shadow); animation: up .2s ease; }
@keyframes up { from { transform: translateY(24px); opacity: 0; } }
.sheet-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.sheet-h h2 { margin: 0; font-size: 20px; }
.legend { display: flex; gap: 14px; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 14px; flex-wrap: wrap; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 4px; vertical-align: -1px; margin-right: 5px; }
.tables { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 10px; }
.tbl { aspect-ratio: 1; border-radius: 20px; background: var(--surface-2); border: 2px solid transparent; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.tbl b { font-size: 24px; font-weight: 800; }
.tbl small { font-size: 11px; color: var(--muted); font-weight: 700; }
.tbl.busy { border-color: color-mix(in srgb, var(--c) 65%, transparent); background: color-mix(in srgb, var(--c) 10%, var(--surface)); }
.tbl.busy small { color: var(--c); }
.tbl.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.tbl.on small { color: inherit; }
.tbl-other { display: flex; gap: 10px; margin-top: 16px; }
.tbl-other input { flex: 1; }

.my-orders { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; align-items: start; }

/* ============ Stocks, tableau de bord ============ */
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }
.toolbar .searchbox { flex: 1; max-width: 380px; }
.toolbar .searchbox input { min-height: 46px; }
.table-wrap { background: var(--surface); border-radius: var(--r-xl); overflow: auto; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 13px 16px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 700; font-size: 12.5px; text-transform: uppercase; letter-spacing: .04em; }
td.r, th.r { text-align: right; font-variant-numeric: tabular-nums; }
.banner { display: flex; gap: 12px; align-items: center; background: var(--accent-soft); color: var(--text);
  padding: 13px 16px; border-radius: var(--r); margin-bottom: 16px; font-size: 14px; font-weight: 500; }
.banner > .ic { color: var(--accent-text); }
.banner.warn { background: color-mix(in srgb, var(--c-cook) 12%, transparent); } .banner.warn > .ic { color: var(--c-cook); }
.who-cell { display: flex; align-items: center; gap: 10px; }
.thumb-sm { width: 46px; height: 46px; border-radius: 12px; object-fit: cover; flex: none; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-text); }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; }

.dash-tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 18px; scrollbar-width: none; }
.dash-tabs::-webkit-scrollbar { display: none; }
.dash-tabs button { flex: none; display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: 99px; background: var(--surface); font-weight: 700; color: var(--muted); box-shadow: var(--shadow-sm); }
.dash-tabs button.on { background: var(--accent); color: var(--accent-ink); }
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 16px; }
.kcard { background: var(--surface); border-radius: var(--r-xl); padding: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.kcard .ico { width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-text); }
.kcard .ico .ic { width: 22px; height: 22px; }
.kcard small { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.kcard b { font-size: 26px; font-weight: 800; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kcard.hero { background: var(--accent); color: var(--accent-ink); }
.kcard.hero small { color: inherit; opacity: .8; } .kcard.hero .ico { background: rgb(255 255 255 / .18); color: inherit; }
.dash-grid { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.dash-grid .card + .card { margin-top: 16px; }
.chart { display: flex; align-items: flex-end; gap: 4px; height: 210px; padding-top: 16px; }
.chart .bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 6px; height: 100%; min-width: 0; }
.chart .bar i { display: block; width: 100%; max-width: 34px; border-radius: 8px 8px 4px 4px; background: var(--accent); min-height: 3px; opacity: .9; }
.chart .bar i.zero { background: var(--surface-3); }
.chart .bar span { font-size: 11px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.chart .bar:hover i { opacity: 1; }
.rank { list-style: none; margin: 10px 0 0; padding: 0; }
.rank li { padding: 10px 0; border-bottom: 1px solid var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank .rl { display: flex; justify-content: space-between; gap: 10px; font-weight: 700; font-size: 15px; }
.rank .rl span:last-child { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.rank .meter { height: 6px; border-radius: 99px; background: var(--surface-2); margin-top: 7px; overflow: hidden; }
.rank .meter i { display: block; height: 100%; border-radius: 99px; background: var(--accent); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--surface-3); transition: background .15s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 24px; height: 24px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgb(0 0 0 / .25); transition: transform .15s; }
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(20px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.codebox { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; background: var(--surface-2); border-radius: var(--r); padding: 12px 14px; margin-top: 10px; }
.codebox code { font-size: 18px; font-weight: 800; letter-spacing: .04em; flex: 1; word-break: break-all; }
.photo-edit { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.photo-edit .ph { width: 110px; height: 84px; border-radius: 16px; overflow: hidden; background: var(--accent-soft); display: grid; place-items: center; color: var(--accent-text); flex: none; }
.photo-edit .ph img { width: 100%; height: 100%; object-fit: cover; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.settings { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.settings .card + .card { margin-top: 16px; }
.logo-drop { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.logo-drop .prev { width: 84px; height: 84px; border-radius: 20px; background: var(--surface-2); display: grid; place-items: center; overflow: hidden; flex: none; }
.logo-drop .prev img { max-width: 76px; max-height: 76px; object-fit: contain; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.swatch { width: 42px; height: 42px; border-radius: 50%; background: var(--sw); border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line); }
.swatch.on { box-shadow: 0 0 0 2.5px var(--text); }
.swatches input[type=color] { width: 50px; height: 44px; padding: 2px; cursor: pointer; }
.check { display: flex; align-items: center; gap: 10px; margin-top: 16px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--accent); }
.preview { position: sticky; top: 80px; }
.preview .card { padding: 0; overflow: hidden; }
.preview .pv-top { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.preview .pv-body { padding: 14px; display: grid; gap: 12px; background: var(--bg); }

/* Toasts */
#toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 10px; z-index: 100; max-width: calc(100vw - 32px); }
.toast { display: flex; gap: 12px; align-items: center; background: var(--surface); padding: 12px 16px 12px 12px; border-radius: 18px;
  box-shadow: var(--shadow); width: 370px; max-width: 100%; animation: up .25s ease; cursor: pointer; border: 1px solid var(--line); }
.toast .ico { width: 42px; height: 42px; border-radius: 14px; display: grid; place-items: center; flex: none; background: var(--accent-soft); color: var(--accent-text); }
.toast.ready .ico { background: color-mix(in srgb, var(--c-ready) 14%, transparent); color: var(--c-ready); }
.toast.na .ico { background: color-mix(in srgb, var(--c-na) 12%, transparent); color: var(--c-na); }
.toast b { display: block; font-size: 15.5px; }
.toast span { color: var(--muted); font-size: 13.5px; font-weight: 500; }

/* ============ Responsive ============ */
@media (max-width: 1250px) {
  .k-layout.with-prod { grid-template-columns: 1fr; }
  .prod-panel { position: static; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1050px) {
  .board, .board.c3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .order-layout { grid-template-columns: minmax(0, 1fr) 340px; }
  .settings, .dash-grid { grid-template-columns: 1fr; }
  .preview { position: static; }
  .tabs .tab span { display: none; }
  .tabs .tab { padding: 0 13px; }
}
@media (max-width: 760px) {
  main { padding: 12px 12px 160px; }
  .topbar { padding: 8px 12px; }
  .tabs, .live span, .me-btn > span:not(.avatar) { display: none; }
  .me-btn { padding: 4px; }
  .bottomnav { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: var(--surface); box-shadow: 0 -4px 20px rgb(24 60 44 / .08);
    padding: 6px 8px calc(8px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; }
  .bottomnav .tab { flex: 1; flex-direction: column; gap: 3px; min-height: 56px; font-size: 11px; padding: 0; border-radius: 16px; }
  .bottomnav .tab.on { background: var(--accent-soft); color: var(--accent-text); }
  .bottomnav .tab .ic { width: 23px; height: 23px; }
  .bottomnav .tab .dotbadge { right: calc(50% - 24px); top: 2px; }
  .only-phone { display: inline-grid !important; }
  .order-layout { grid-template-columns: 1fr; }
  .order-panel { display: none; }
  .order-panel.open { display: flex; position: fixed; inset: auto 0 0 0; top: 7vh; z-index: 45; border-radius: 28px 28px 0 0; max-height: none; animation: up .2s ease; box-shadow: 0 0 0 100vmax rgb(10 25 18 / .45); }
  .cartbar { display: flex; position: fixed; left: 12px; right: 12px; bottom: calc(82px + env(safe-area-inset-bottom)); z-index: 29; align-items: center; gap: 12px;
    min-height: 60px; padding: 0 18px; border-radius: 20px; background: var(--accent); color: var(--accent-ink); font-weight: 800; box-shadow: 0 10px 26px color-mix(in srgb, var(--accent) 40%, transparent); }
  .cartbar .count { background: rgb(255 255 255 / .22); border-radius: 99px; min-width: 30px; padding: 3px 10px; text-align: center; }
  .cartbar .sum { margin-left: auto; }
  .catalog-head { top: 57px; }
  .grid-products { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .pcard { border-radius: 20px; padding: 8px; }
  .board, .board.c3 { grid-template-columns: repeat(var(--n, 4), 86vw); overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 6px; }
  .col { scroll-snap-align: start; }
  .k-toolbar .kpi small { display: none; }
  .kpis { gap: 10px; } .kcard { padding: 14px; } .kcard b { font-size: 21px; }
  .sheet-bg { place-items: end center; padding: 0; }
  .sheet { border-radius: 28px 28px 0 0; max-height: 92vh; }
  .grid2 { grid-template-columns: 1fr; }
  .hide-phone { display: none; }
  #toasts { bottom: calc(160px + env(safe-area-inset-bottom)); left: 12px; right: 12px; }
  .toast { width: auto; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* ============ Style D-Eat : écran d'accueil, formulaires, profil, catégories ============ */
.splash { position: fixed; inset: 0; z-index: 200; display: grid; place-items: center; background: var(--surface); transition: opacity .35s; }
.splash.out { opacity: 0; pointer-events: none; }
.splash-in { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; padding: 24px; animation: up .5s ease; }
.splash-in img { width: min(220px, 55vw); max-height: 260px; object-fit: contain; }
.splash-in h1 { margin: 10px 0 0; font-size: 30px; color: var(--brand-red); font-weight: 700; }
.splash-in p { margin: 0; color: var(--brand-red); opacity: .85; font-weight: 500; }

.auth { place-items: start center; padding-top: max(28px, 6vh); background: var(--bg); }
.auth-box { max-width: 460px; text-align: left; }
.auth-box.wide { max-width: 600px; }
.auth-brand { align-items: center; margin-bottom: 22px; }
.auth-brand .full-logo { max-width: min(170px, 45vw); max-height: 170px; filter: none; }
.auth-title h1 { margin: 0; font-size: 28px; font-weight: 700; }
.auth-title p { margin: 6px 0 0; color: var(--muted); font-size: 16.5px; }
.auth-form { margin-top: 8px; }
.auth-form .field label { font-weight: 500; font-size: 15px; }
.input-ic { position: relative; }
.input-ic > .ic:first-child { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 22px; height: 22px; pointer-events: none; }
.input-ic input { padding-left: 50px; min-height: 56px; }
.input-ic .eye { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); width: 42px; height: 42px; display: grid; place-items: center; border-radius: 50%; color: var(--muted); }
.or { display: flex; align-items: center; gap: 14px; color: var(--muted); margin: 22px 30px; font-size: 15px; }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--surface-3); }
.auth-foot { text-align: center; margin-top: 28px; color: var(--text); }
.auth-foot button { color: var(--accent-text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; margin-left: 4px; }
.link-back { display: inline-flex; align-items: center; gap: 6px; color: var(--accent-text); font-weight: 600; margin-bottom: 16px; }
.link-back .ic { transform: rotate(180deg); }

/* Sélecteur en pilule (onglets du haut, tableau de bord, périodes) */
.tabs { background: var(--surface-2); padding: 4px; border-radius: 99px; }
.tab { min-height: 40px; }
.dash-tabs { background: var(--surface-2); padding: 5px; border-radius: 99px; display: inline-flex; max-width: 100%; }
.dash-tabs button { box-shadow: none; background: transparent; min-height: 44px; }
.dash-tabs button.on { background: var(--accent); color: var(--accent-ink); box-shadow: 0 4px 14px color-mix(in srgb, var(--accent) 30%, transparent); }

/* Catégories en cercles */
.section-h { display: flex; align-items: baseline; justify-content: space-between; margin: 14px 2px 4px; }
.section-h h2 { margin: 0; font-size: 18px; font-weight: 600; }
.section-h span { color: var(--accent-text); font-weight: 500; font-size: 14px; }
.chips { gap: 14px; padding: 8px 2px 6px; }
.chip { flex-direction: column; gap: 6px; min-height: 0; padding: 0; background: none; box-shadow: none; font-weight: 500; font-size: 14px; color: var(--text); width: 78px; }
.chip .cico { width: 72px; height: 72px; background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.chip .cico .ic { width: 30px; height: 30px; stroke-width: 1.6; }
.chip.on { background: none; color: var(--accent-text); font-weight: 700; }
.chip.on .cico { background: var(--accent); color: var(--accent-ink); box-shadow: 0 6px 16px color-mix(in srgb, var(--accent) 35%, transparent); }

/* Profil : listes groupées avec icônes de couleur */
.group-title { color: var(--muted); font-size: 14px; font-weight: 500; margin: 18px 4px 8px; }
.group { background: var(--surface); border-radius: 18px; padding: 4px 6px; box-shadow: 0 0 0 1px var(--line); }
.group-row { display: flex; align-items: center; gap: 14px; width: 100%; padding: 13px 10px; text-align: left; font-size: 16.5px; border-radius: 14px; }
button.group-row:hover { background: var(--surface-2); }
.group-row + .group-row { border-top: 1px solid var(--line); }
.group-row .gi { width: 26px; height: 26px; color: var(--gc, var(--accent)); stroke-width: 1.8; }
.group-row .gl { flex: 1; }
.group-row .gl small { display: block; color: var(--muted); font-size: 13px; }
.group-row > .ic:last-child { color: var(--text); width: 20px; height: 20px; }
.profile-head { display: flex; align-items: center; gap: 14px; }
.profile-head h2 { margin: 0; font-size: 24px; }

/* Barre du bas : onglet actif simplement coloré (style D-Eat) */
@media (max-width: 760px) {
  .bottomnav { border-radius: 0; box-shadow: 0 -1px 0 var(--line); }
  .bottomnav .tab { background: none !important; color: var(--muted); font-size: 12px; font-weight: 500; }
  .bottomnav .tab.on { color: var(--accent-text); font-weight: 700; }
  .bottomnav .tab.on .ic { fill: color-mix(in srgb, var(--accent) 18%, transparent); }
  .tabs { display: none; }
  .chip { width: 70px; } .chip .cico { width: 64px; height: 64px; }
}
/* Seule la recherche reste visible en défilant ; les catégories défilent avec les plats */
.catalog-head { position: static; padding-top: 0; }
