/* ------------------------------------------------------------------
   Identité reprise de TMI Restaurant : vert profond, safran, bordures franches.
   Police : celle du système (Segoe UI, Roboto, San Francisco...).
   Aucune police à télécharger : lisible partout et rapide en réseau faible.
------------------------------------------------------------------- */
:root {
  --ink: #10241d;
  --leaf: #1f6b4f;
  --paper: #f3f5f0;
  --card: #ffffff;
  --line: #d6dcd3;
  --muted: #55655d;
  --saffron: #f2a900;
  --saffron-dark: #c98a00;
  --on-saffron: #2b2000;
  --chili: #b8321f;
  --ok: #1d7a4e;
  --radius: 10px;
  --font-display: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.5;
}
h1, h2, h3 { font-family: var(--font-display); line-height: 1.2; margin: 0; letter-spacing: -.01em; }
button, input, select, textarea { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
:focus-visible { outline: 3px solid var(--saffron); outline-offset: 2px; }
[hidden] { display: none !important; }

.wrap { max-width: 760px; margin: 0 auto; padding: 0 16px; }
.wrap-wide { max-width: 1280px; margin: 0 auto; padding: 0 16px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ----- Boutons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 18px;
  border: 2px solid var(--ink); border-radius: var(--radius);
  background: transparent; font-weight: 700; cursor: pointer; text-decoration: none;
}
.btn:hover { background: rgba(16, 36, 29, .07); }
.btn-primary { background: var(--saffron); border-color: var(--saffron); color: var(--on-saffron); }
.btn-primary:hover { background: var(--saffron-dark); border-color: var(--saffron-dark); }
.btn-dark { background: var(--ink); color: var(--paper); }
.btn-dark:hover { background: #1b3a2f; }
.btn-danger { border-color: var(--chili); color: var(--chili); }
.btn-danger:hover { background: rgba(184, 50, 31, .08); }
.btn-small { min-height: 36px; padding: 0 12px; font-size: .9rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-block { width: 100%; }

/* ----- Formulaires ----- */
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 600; font-size: .92rem; }
.field input, .field select, .field textarea {
  width: 100%; min-height: 44px; padding: 8px 12px;
  background: #fff; border: 2px solid var(--line); border-radius: var(--radius);
}
.field textarea { min-height: 76px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--leaf); outline: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 600; }
.check input { width: 22px; height: 22px; accent-color: var(--leaf); }
.form-error { color: var(--chili); font-weight: 600; min-height: 1.4em; margin: 0 0 8px; }
.trap { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

.banner { padding: 12px 16px; font-weight: 600; text-align: center; }
.banner-error { background: var(--chili); color: #fff; }
.banner-info { background: var(--saffron); color: var(--on-saffron); }
.banner a { color: inherit; }

/* ===================== Espace client ===================== */
.masthead { background: var(--ink); color: var(--paper); padding: 28px 0 22px; }
.masthead h1 { font-size: clamp(1.9rem, 7vw, 2.8rem); font-weight: 800; letter-spacing: -.02em; }
.masthead .wrap { position: relative; }
.masthead p { margin: 6px 0 0; color: #b9cbc2; max-width: 40ch; }
.table-pill {
  display: inline-block; margin-top: 14px; padding: 4px 12px;
  border: 2px solid var(--saffron); border-radius: 99px; color: var(--saffron); font-weight: 700;
}

.tabs {
  position: sticky; top: 0; z-index: 5; background: var(--paper);
  border-bottom: 2px solid var(--ink); overflow-x: auto; white-space: nowrap;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs a {
  display: inline-block; padding: 12px 14px; font-weight: 700; color: var(--ink);
  text-decoration: none; border-bottom: 4px solid transparent; margin-bottom: -2px;
}
.tabs a:hover, .tabs a.active { border-bottom-color: var(--saffron); }

.menu { padding-bottom: 24px; }
.menu section { padding-top: 28px; scroll-margin-top: 56px; }
.menu h2 { font-size: 1.6rem; margin-bottom: 6px; }
.dishes { list-style: none; margin: 0; padding: 0; }
.dish { display: flex; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.dish-photo { width: 72px; height: 72px; border-radius: var(--radius); object-fit: cover; flex: none; background: var(--line); }
.dish-main { flex: 1; min-width: 0; }
.dish-head { display: flex; align-items: baseline; gap: 8px; }
.dish-name { font-weight: 700; font-size: 1.05rem; }
.leader { flex: 1; min-width: 14px; border-bottom: 2px dotted #94a399; transform: translateY(-4px); }
.dish-price { font-weight: 800; white-space: nowrap; }
.dish-desc { margin: 2px 0 0; color: var(--muted); font-size: .92rem; max-width: 52ch; }
.dish.is-out .dish-name, .dish.is-out .dish-price { color: var(--muted); text-decoration: line-through; }
.tag-out { color: var(--chili); font-weight: 700; font-size: .9rem; }
.dish-ctl { flex: none; display: flex; align-items: center; }

.stepper { display: inline-flex; align-items: center; border: 2px solid var(--ink); border-radius: var(--radius); overflow: hidden; }
.stepper button { width: 40px; height: 40px; border: 0; background: transparent; font-size: 1.3rem; font-weight: 800; cursor: pointer; }
.stepper button:hover { background: rgba(16, 36, 29, .08); }
.stepper output { min-width: 32px; text-align: center; font-weight: 800; }
.add-btn {
  width: 44px; height: 44px; border-radius: var(--radius); border: 0; cursor: pointer;
  background: var(--saffron); color: var(--on-saffron); font-size: 1.6rem; font-weight: 800; line-height: 1;
}
.add-btn:hover { background: var(--saffron-dark); }

.cartbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--ink);
}
.cartbar .btn { width: 100%; max-width: 728px; margin: 0 auto; display: flex; justify-content: space-between; }

dialog { border: 0; padding: 0; border-radius: 14px; width: min(560px, 94vw); max-height: 92vh; color: var(--ink); background: var(--card); }
dialog::backdrop { background: rgba(16, 36, 29, .6); }
.dlg-body { padding: 20px; }
.dlg-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.dlg-head h2 { font-size: 1.4rem; }
.icon-btn { width: 44px; height: 44px; border: 0; background: transparent; font-size: 1.6rem; cursor: pointer; border-radius: var(--radius); }
.icon-btn:hover { background: rgba(16, 36, 29, .08); }

.cart-lines { list-style: none; margin: 0 0 14px; padding: 0; }
.cart-line { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cart-line .name { flex: 1; font-weight: 600; }
.cart-line .sum { min-width: 92px; text-align: right; font-weight: 700; }
.cart-total { display: flex; justify-content: space-between; font-size: 1.25rem; font-weight: 800; padding: 8px 0 16px; }
.pay-note { background: rgba(242, 169, 0, .18); border-left: 5px solid var(--saffron); padding: 10px 12px; margin: 0 0 16px; border-radius: 4px; }

/* ===================== Suivi de commande ===================== */
.ticket { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 22px; margin: 24px 0; }
.ticket-number { font-family: var(--font-display); font-weight: 800; font-size: clamp(3rem, 16vw, 5rem); line-height: 1; }
.status-now { font-size: 1.3rem; font-weight: 800; margin: 12px 0 4px; }
.status-now.is-ready { color: var(--ok); }
.status-now.is-cancelled { color: var(--chili); }
.steps { list-style: none; display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin: 18px 0 0; padding: 0; }
.steps li { border-top: 6px solid var(--line); padding-top: 6px; font-size: .85rem; font-weight: 600; color: var(--muted); }
.steps li.done { border-top-color: var(--leaf); color: var(--ink); }
.steps li.current { border-top-color: var(--saffron); color: var(--ink); }
.order-lines { list-style: none; padding: 0; margin: 18px 0 0; }
.order-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-bottom: 1px dotted var(--line); }

/* ===================== Connexion ===================== */
.login { max-width: 420px; margin: 12vh auto 0; padding: 24px; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; }
.login h1 { font-size: 1.8rem; margin-bottom: 4px; }

/* ===================== Espace personnel ===================== */
.topbar { background: var(--ink); color: var(--paper); }
.topbar .wrap-wide { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding-top: 12px; padding-bottom: 12px; }
.topbar h1 { font-size: 1.3rem; margin-right: auto; }
.topbar .btn { border-color: #6c8479; color: var(--paper); }
.topbar .btn:hover { background: rgba(255, 255, 255, .1); }
.topbar .btn[aria-pressed="true"] { background: var(--saffron); border-color: var(--saffron); color: var(--on-saffron); }
.live { display: inline-flex; align-items: center; gap: 6px; font-size: .9rem; color: #b9cbc2; }
.live i { width: 10px; height: 10px; border-radius: 50%; background: #7a8c83; }
.live.on i { background: #38d27c; }

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; padding: 18px 0 60px; align-items: start; }
.col h2 { font-size: 1.1rem; padding: 8px 12px; border-radius: var(--radius) var(--radius) 0 0; background: var(--ink); color: var(--paper); display: flex; justify-content: space-between; }
.col[data-status="en_attente"] h2 { background: var(--saffron); color: var(--on-saffron); }
.col[data-status="prete"] h2 { background: var(--leaf); }
.col-body { display: grid; gap: 12px; padding: 12px; background: rgba(16, 36, 29, .06); border-radius: 0 0 var(--radius) var(--radius); min-height: 90px; }
.col-empty { color: var(--muted); text-align: center; padding: 14px 0; margin: 0; }
.tk { background: var(--card); border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px; }
.tk.is-new { animation: flash 1.6s ease-out 1; }
@keyframes flash { from { background: #ffe9a8; } to { background: var(--card); } }
@media (prefers-reduced-motion: reduce) { .tk.is-new { animation: none; } }
.tk-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.tk-num { font-family: var(--font-display); font-weight: 800; font-size: 1.7rem; }
.tk-meta { color: var(--muted); font-size: .9rem; margin: 0 0 8px; }
.tk-lines { list-style: none; margin: 0 0 8px; padding: 0; }
.tk-lines li { display: flex; gap: 8px; padding: 2px 0; }
.tk-lines b { min-width: 28px; }
.tk-note { background: #fff4d1; border-radius: 6px; padding: 6px 8px; margin: 0 0 8px; font-weight: 600; }
.tk-total { font-weight: 800; margin: 0 0 10px; }
.tk-actions { display: flex; gap: 8px; }
.tk-actions .btn:first-child { flex: 1; }

.done-box { margin: 0 0 60px; }
.done-box summary { cursor: pointer; font-weight: 700; padding: 10px 0; }
.done-list { list-style: none; margin: 0; padding: 0; }
.done-list li { display: flex; justify-content: space-between; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--line); }

/* ===================== Administration ===================== */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 28px; padding: 22px 0 80px; }
.panel { background: var(--card); border: 2px solid var(--ink); border-radius: 14px; padding: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.panel-head h2 { font-size: 1.3rem; }
.rows { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 700; }
.row-thumb { width: 52px; height: 52px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.row-actions { display: flex; gap: 6px; }
.cat-title { margin: 18px 0 4px; font-size: 1.05rem; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; background: var(--line); font-size: .8rem; font-weight: 700; }
.pill.out { background: rgba(184, 50, 31, .15); color: var(--chili); }
.preview { width: 120px; height: 120px; border-radius: var(--radius); object-fit: cover; background: var(--line); margin-bottom: 8px; }

.toast {
  position: fixed; left: 50%; bottom: 90px; transform: translateX(-50%); z-index: 30;
  background: var(--ink); color: var(--paper); padding: 10px 18px; border-radius: 99px; font-weight: 600;
  max-width: 92vw; text-align: center;
}
.toast.error { background: var(--chili); }

@media (max-width: 480px) {
  .field-row { grid-template-columns: 1fr; }
  .dish-photo { width: 60px; height: 60px; }
}

/* ===================== v2 : mode de commande, ventes, réseau faible ===================== */
.choice { border: 0; margin: 0 0 14px; padding: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.choice legend { font-weight: 600; font-size: .92rem; padding: 0; margin-bottom: 6px; }
.radio {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 16px;
  border: 2px solid var(--line); border-radius: var(--radius); font-weight: 700; cursor: pointer; background: #fff;
}
.radio:has(input:checked) { border-color: var(--leaf); background: rgba(31, 107, 79, .08); }
.radio input { width: 20px; height: 20px; accent-color: var(--leaf); }
.stale { background: rgba(242, 169, 0, .2); border-left: 5px solid var(--saffron); padding: 10px 12px; margin: 16px 0 0; border-radius: 4px; font-weight: 600; }

.sales-filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.sales-filters .field { margin-bottom: 0; }
.sales-filters .btn { min-width: 120px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.stat { border: 2px solid var(--ink); border-radius: var(--radius); padding: 12px 14px; background: var(--paper); }
.stat-value { font-family: var(--font-display); font-weight: 800; font-size: 1.45rem; line-height: 1.2; }
.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; min-width: 320px; }
table.data th, table.data td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; }
table.data th { font-weight: 700; border-bottom: 2px solid var(--ink); }
table.data .r { text-align: right; }

/* ===================== v3 : options, Mobile Money, langue, impression ===================== */
.ctl-opts { display: flex; align-items: center; gap: 8px; }
.in-cart { font-size: .85rem; font-weight: 700; color: var(--leaf); white-space: nowrap; }
.opt-check { border-bottom: 1px solid var(--line); }
.opt-check .grow { flex: 1; }
.line-opts { display: block; font-weight: 400; }
.mm-box { background: rgba(31, 107, 79, .08); border-left: 5px solid var(--leaf); border-radius: 4px; padding: 10px 12px; margin: 0 0 14px; }
.mm-box p { margin: 0 0 10px; }
.mm-box .field { margin-bottom: 0; }
.notify-hint { margin: 12px 0 0; }
.ticket .btn-small { margin-top: 12px; }

.opt-add { display: grid; grid-template-columns: 1fr 110px auto; gap: 8px; margin-top: 8px; }
.opt-add input { min-height: 40px; padding: 6px 10px; border: 2px solid var(--line); border-radius: var(--radius); width: 100%; }

.tk-opts { display: block; color: var(--muted); font-size: .85rem; }
.tk-pay { background: rgba(31, 107, 79, .12); border-radius: 6px; padding: 6px 8px; margin: 0 0 8px; font-weight: 700; }
.tk-pay small { display: block; font-weight: 400; color: var(--muted); }
.tk-actions { flex-wrap: wrap; }

/* Ticket imprimé : visible uniquement à l'impression */
#print-area { display: none; }
@media print {
  @page { margin: 4mm; }
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff; }
  #print-area { display: block; width: 72mm; margin: 0; color: #000; font-size: 12px; line-height: 1.35; }
  #print-area p { margin: 0 0 4px; }
  #print-area .pt-name { font-weight: 800; font-size: 15px; text-align: center; }
  #print-area .pt-num { font-weight: 800; font-size: 30px; text-align: center; line-height: 1.1; }
  #print-area .pt-bold { font-weight: 700; }
  #print-area .pt-line { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; }
  #print-area small { display: block; font-size: 11px; }
  #print-area hr { border: 0; border-top: 1px dashed #000; margin: 6px 0; }
}

@media (max-width: 480px) {
  .opt-add { grid-template-columns: 1fr 90px; }
  .opt-add .btn { grid-column: 1 / -1; }
}

/* ===================== v4 : icônes et navigation fluide ===================== */
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
.ic { width: 1.25em; height: 1.25em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[data-icon], .btn-ic, .radio-ic { display: inline-flex; align-items: center; justify-content: center; }

.brand-mark { display: grid; place-items: center; width: 44px; height: 44px; margin-bottom: 12px; border-radius: 50%; background: var(--saffron); color: var(--on-saffron); }
.brand-mark .ic { width: 24px; height: 24px; }
.table-pill { display: inline-flex; align-items: center; gap: 6px; }

.tabs a { transition: border-color .2s, background-color .2s; border-radius: 8px 8px 0 0; }
.tabs a.active { background: rgba(242, 169, 0, .14); }

.add-btn, .stepper button, .icon-btn { display: grid; place-items: center; transition: transform .12s, background-color .15s; }
.add-btn .ic { width: 24px; height: 24px; }
.stepper button .ic, .icon-btn .ic { width: 20px; height: 20px; }
.add-btn:active, .stepper button:active { transform: scale(.9); }

.radio .radio-ic .ic { width: 20px; height: 20px; color: var(--leaf); }
.btn .ic { width: 20px; height: 20px; }
.cartbar .btn { gap: 12px; }
.cartbar #cart-count { flex: 1; min-width: 0; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cartbar:not([hidden]) { animation: slide-up .25s ease-out; }
.ts-box:not(:empty) { margin: 0 0 12px; }

.steps li { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.steps li .ic { width: 24px; height: 24px; }
.steps li.done .ic { color: var(--leaf); }
.steps li.current .ic { color: var(--saffron-dark); }

dialog[open] { animation: dlg-in .22s ease-out; }
dialog[open]::backdrop { animation: fade-in .22s ease-out; }
@keyframes dlg-in { from { opacity: 0; transform: translateY(16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-up { from { transform: translateY(100%); } to { transform: none; } }
@keyframes sheet-in { from { transform: translateY(100%); } to { transform: none; } }

/* Sur téléphone, le panier et les options s'ouvrent comme un tiroir depuis le bas */
@media (max-width: 600px) {
  #cart-dialog, #opt-dialog { margin: auto 0 0 0; width: 100%; max-width: 100%; border-radius: 18px 18px 0 0; max-height: 92vh; }
  #cart-dialog[open], #opt-dialog[open] { animation: sheet-in .25s ease-out; }
}

/* v6 : identité du personnel et traçabilité */
.avatar { display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; color: #fff; font-size: .72rem; font-weight: 800; letter-spacing: .02em; flex: none; }
.avatar.big { width: 52px; height: 52px; font-size: 1.1rem; }
.me-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 180px; }
.me-chip .me-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-head { display: flex; align-items: center; gap: 14px; margin-bottom: 14px; }
.profile-head strong { display: block; font-size: 1.1rem; }
.profile-info { margin: 0 0 14px; display: grid; gap: 6px; }
.profile-info div { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line, #d9dfd5); padding: 6px 0; }
.profile-info dt { color: var(--muted, #5b6b63); margin: 0; }
.profile-info dd { margin: 0; text-align: right; overflow-wrap: anywhere; }
.tk-who { display: flex; align-items: center; gap: 8px; margin: 6px 0 0; font-size: .86rem; color: var(--muted, #5b6b63); }
.tk-who .avatar { width: 22px; height: 22px; font-size: .62rem; }
.who { display: inline-flex; align-items: center; gap: 6px; }
.who .avatar { width: 22px; height: 22px; font-size: .62rem; }
.who small { display: block; color: var(--muted, #5b6b63); }
.table-wrap table.log td, .table-wrap table.log th { text-align: left; }
.table-wrap table.log td.r, .table-wrap table.log th.r { text-align: right; }
.table-wrap table.log td { vertical-align: top; }

.pw-box { border-top: 1px solid var(--line, #d9dfd5); }
.pw-show { font-size: 1.4rem; font-weight: 800; letter-spacing: .04em; text-align: center; padding: 12px; background: var(--bg, #f3f5f0); border-radius: 10px; overflow-wrap: anywhere; }
td.actions { white-space: normal; }
td.actions .btn { margin: 0 0 6px 6px; }

/* Adaptation à l'écran : sur téléphone, les tableaux de l'admin deviennent des fiches empilées (lecture sans défilement latéral) */
@media (max-width: 600px) {
  table.stack, table.stack tbody, table.stack tr, table.stack td { display: block; width: 100%; min-width: 0; }
  table.stack { min-width: 0; }
  table.stack thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  table.stack tr { padding: 8px 0; border-bottom: 2px solid var(--line); }
  table.stack td, table.stack td.r { display: flex; justify-content: space-between; align-items: flex-start; gap: 14px; border: 0; padding: 5px 2px; text-align: right; }
  table.stack td::before { content: attr(data-label); font-weight: 700; text-align: left; flex: none; max-width: 45%; }
  table.stack td[data-label=""]::before, table.stack td:not([data-label])::before { content: none; }
  table.stack td.actions { justify-content: flex-start; flex-wrap: wrap; }
  table.stack td.actions .btn { margin: 4px 8px 4px 0; }
  .table-wrap { overflow-x: visible; }
  .panel { padding: 14px; }
  .sales-filters .field, .sales-filters .btn { width: 100%; }
  .sales-filters input { width: 100%; }
  .topbar .wrap-wide { gap: 8px; }
}
/* Appareils tactiles : zones de toucher confortables */
@media (pointer: coarse) {
  .btn, .btn-small, .icon-btn { min-height: 44px; }
  input, select { min-height: 44px; }
}
/* Écrans larges : colonne du menu client un peu plus large */
@media (min-width: 1100px) {
  .wrap { max-width: 980px; }
}
/* Encoches et bords arrondis des téléphones */
.wrap, .wrap-wide { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); }

/* v7 : choix « Sur place / À emporter » (et paiement) toujours alignés côte à côte, à largeur égale */
.choice { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.choice legend { grid-column: 1 / -1; }
.choice .radio { position: relative; justify-content: center; gap: 8px; padding: 0 10px; min-width: 0; text-align: center; line-height: 1.15; }
/* la pastille native est masquée : l'option choisie se voit à sa bordure verte, son fond et son coche ; le clavier reste utilisable */
.choice .radio input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; pointer-events: none; }
.choice .radio:has(input:checked) { box-shadow: inset 0 0 0 1px var(--leaf); }
.choice .radio:has(input:checked)::after { content: ""; position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--leaf); }
.choice .radio:has(input:focus-visible) { outline: 3px solid var(--saffron); outline-offset: 2px; }
@media (max-width: 360px) {
  .choice .radio { gap: 6px; padding: 0 6px; font-size: .92rem; }
  .choice .radio .radio-ic .ic { width: 18px; height: 18px; }
}

/* v8 : accueil de l'espace admin (grandes icônes) et barre de retour */
.home { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.home[hidden], .back-bar[hidden] { display: none; }
.tile {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: flex-end; gap: 6px; min-height: 168px; padding: 18px;
  background: var(--card, #fff); border: 2px solid var(--ink); border-radius: 18px; color: var(--ink); text-decoration: none;
  transition: transform .15s ease, box-shadow .15s ease, background-color .15s ease;
}
.tile strong { font-size: 1.15rem; line-height: 1.2; }
.tile .muted { font-size: .9rem; }
.tile-ic { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: auto; border-radius: 16px; background: var(--saffron); color: var(--ink); }
.tile-ic .ic { width: 32px; height: 32px; }
.tile:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--ink); }
.tile:active { transform: translateY(0); box-shadow: none; background: rgba(242, 169, 0, .14); }
.tile:focus-visible { outline: 3px solid var(--saffron); outline-offset: 3px; }
@media (min-width: 900px) { .home { grid-template-columns: repeat(4, minmax(0, 1fr)); } .tile { min-height: 210px; } }
@media (max-width: 360px) { .tile { min-height: 148px; padding: 14px; } .tile-ic { width: 52px; height: 52px; } .tile strong { font-size: 1.02rem; } }
@media (prefers-reduced-motion: reduce) { .tile { transition: none; } .tile:hover { transform: none; } }
.back-bar { position: sticky; top: 0; z-index: 5; background: var(--paper); border-bottom: 2px solid var(--ink); }
.back-bar .wrap-wide { display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; }
.back-bar strong { font-size: 1.1rem; }

/* v9 : pied de page (copyright) */
.site-foot { padding: 20px 16px 28px; text-align: center; color: var(--muted, #5b6b63); font-size: .85rem; border-top: 1px solid var(--line, #d9dfd5); margin-top: 8px; }
.site-foot.has-cartbar { padding-bottom: 110px; } /* laisse la place à la barre « Ma commande » fixée en bas */
.site-foot p { margin: 0; }

/* ===================== Boutique : catalogue, fiche produit, panier ===================== */
.search { position: relative; margin: 16px 0 0; }
.search input { width: 100%; min-height: 48px; padding: 8px 14px 8px 44px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; }
.search input:focus { border-color: var(--leaf); outline: none; }
.search [data-icon] { position: absolute; left: 12px; top: 0; bottom: 0; color: var(--muted); pointer-events: none; }
.search .ic { width: 22px; height: 22px; }
.filters { margin: 10px 0 0; }
.filters summary { cursor: pointer; font-weight: 700; padding: 8px 0; }
.filters .field-row { margin-top: 6px; }
.result-info { margin: 12px 0 0; color: var(--muted); font-size: .92rem; }

.grid { list-style: none; margin: 14px 0 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 720px) { .grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.card { display: flex; flex-direction: column; width: 100%; height: 100%; padding: 0; text-align: left; cursor: pointer; background: var(--card); border: 2px solid var(--ink); border-radius: 14px; overflow: hidden; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-3px); box-shadow: 0 6px 0 var(--ink); }
.card:active { transform: none; box-shadow: none; }
.card-photo { position: relative; aspect-ratio: 1 / 1; background: var(--line); display: grid; place-items: center; color: var(--muted); }
.card-photo img { width: 100%; height: 100%; object-fit: cover; }
.card-photo .ic { width: 40px; height: 40px; }
.card-body { padding: 10px 12px 12px; display: grid; gap: 2px; }
.card-name { font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.card-price { font-weight: 800; }
.badge { position: absolute; top: 8px; left: 8px; padding: 2px 10px; border-radius: 99px; background: var(--chili); color: #fff; font-size: .8rem; font-weight: 800; }
.card.is-out .card-photo img { filter: grayscale(1); opacity: .6; }
.card.is-out .card-name, .card.is-out .card-price { color: var(--muted); }
.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.gallery-main { aspect-ratio: 1 / 1; max-height: 52vh; width: 100%; background: var(--line); border-radius: var(--radius); object-fit: contain; display: grid; place-items: center; color: var(--muted); overflow: hidden; }
.gallery-main img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin: 8px 0 12px; overflow-x: auto; }
.thumbs button { flex: none; width: 56px; height: 56px; padding: 0; border: 2px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--line); cursor: pointer; }
.thumbs button[aria-current="true"] { border-color: var(--saffron); }
.thumbs img { width: 100%; height: 100%; object-fit: cover; }
.prod-price { font-size: 1.5rem; font-weight: 800; margin: 4px 0 8px; }
.prod-desc { margin: 0 0 14px; color: var(--muted); white-space: pre-line; }
.chips-label { font-weight: 600; font-size: .92rem; margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.chip { min-width: 48px; min-height: 44px; padding: 0 14px; border: 2px solid var(--line); border-radius: var(--radius); background: #fff; font-weight: 700; cursor: pointer; }
.chip[aria-pressed="true"] { border-color: var(--leaf); background: rgba(31, 107, 79, .1); box-shadow: inset 0 0 0 1px var(--leaf); }
.chip:disabled { color: #9aa79f; text-decoration: line-through; cursor: not-allowed; background: #f3f5f0; }
.stock-note { font-weight: 700; margin: 0 0 12px; min-height: 1.5em; }
.stock-note.low { color: var(--chili); }
.add-row { display: flex; gap: 12px; align-items: center; }
.add-row .btn { flex: 1; }

.cart-line .meta { display: block; font-weight: 400; color: var(--muted); font-size: .88rem; }
.cart-line .thumb { width: 48px; height: 48px; border-radius: 8px; object-fit: cover; background: var(--line); flex: none; }
.fee-note { background: rgba(31, 107, 79, .08); border-left: 5px solid var(--leaf); padding: 10px 12px; margin: 0 0 14px; border-radius: 4px; }
.done-order { text-align: center; padding: 8px 0 4px; }
.done-order .ticket-number { margin: 6px 0; }

.pill.ok { background: rgba(29, 122, 78, .15); color: var(--ok); }
.pill.warn { background: rgba(242, 169, 0, .25); color: var(--on-saffron); }
.steps.five { grid-template-columns: repeat(5, 1fr); }
@media (max-width: 480px) { .steps.five li { font-size: .72rem; } }
