/* Le QG · Commande à table — écran client
   Charte : vert #4F5940, moutarde #C99A35, crème #F1E5CF, charbon #24231F, bois #76563B
   Règle : jamais de texte moutarde sur le vert ; la moutarde = boutons, texte charbon. */
:root {
  --vert: #4F5940;
  --moutarde: #C99A35;
  --creme: #F1E5CF;
  --charbon: #24231F;
  --bois: #76563B;
  --creme-doux: #DCD0B8;
  --vert-ligne: rgba(241, 229, 207, .22);
  --titre: "Montserrat", "Arial Black", system-ui, sans-serif;
  --texte: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --g: 20px;
  --r-btn: 14px;
  --r-carte: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--vert); color: var(--creme);
  font-family: var(--texte); font-size: 17px; line-height: 1.5;
  -webkit-font-smoothing: antialiased; min-height: 100vh;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid var(--creme); outline-offset: 3px; }
[hidden] { display: none !important; }

.demo-banner { background: var(--charbon); color: var(--creme); font-size: 13px; font-weight: 600; padding: 8px var(--g); text-align: center; }

/* Barre du haut */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 var(--g); background: var(--vert); border-bottom: 1px solid var(--vert-ligne); }
.topbar-logo { height: 30px; width: auto; }
.table-pill { font-weight: 700; font-size: 14px; padding: 4px 10px; border-radius: 999px; border: 1.5px solid var(--creme); }
.topbar-btn { margin-left: auto; background: var(--creme); color: var(--charbon); border: 0; border-radius: 999px;
  padding: 7px 14px; font-weight: 700; font-size: 14px; }

/* Écrans */
.screen { display: none; padding: 20px var(--g) calc(110px + env(safe-area-inset-bottom)); max-width: 560px; margin: 0 auto; }
.screen.is-active { display: block; animation: arrive .28s ease-out; }
@keyframes arrive { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.center { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.center-text { text-align: center; }

/* Typo */
.h1 { font-family: var(--titre); font-weight: 800; font-size: clamp(26px, 7.5vw, 34px); line-height: 1.12; margin: 6px 0 10px; }
.h1-small { font-size: 26px; }
.lead { font-size: 18px; font-weight: 600; margin: 0 0 18px; }
.soft { color: var(--creme-doux); font-weight: 500; }
.small { font-size: 14px; }
.big-emoji { font-size: 52px; margin: 0; }
.label { display: block; font-weight: 700; margin: 18px 0 8px; }
.hint { font-size: 14px; color: var(--creme-doux); margin: 8px 0 0; }
.hint.dark { color: var(--bois); }
.error { background: var(--creme); color: var(--charbon); border-left: 5px solid var(--bois);
  padding: 10px 12px; border-radius: 10px; font-weight: 600; font-size: 15px; margin: 14px 0 0; }

/* Champs */
.input { width: 100%; padding: 14px 16px; border-radius: var(--r-btn); border: 2px solid transparent;
  background: var(--creme); color: var(--charbon); font-size: 17px; }
.input:focus { outline: none; border-color: var(--moutarde); }
.input::placeholder { color: #8b8473; }
.input-code { text-transform: uppercase; letter-spacing: 3px; font-weight: 700; font-family: var(--titre); }

/* Choix seul / groupe / code */
.choices { display: grid; gap: 10px; }
.choice { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; padding: 14px 16px;
  border-radius: var(--r-carte); border: 2px solid var(--vert-ligne); background: transparent; }
.choice strong { display: block; font-size: 17px; }
.choice small { display: block; color: var(--creme-doux); font-size: 14px; }
.choice-emoji { font-size: 26px; }
.choice[aria-checked="true"] { background: var(--creme); color: var(--charbon); border-color: var(--moutarde); }
.choice[aria-checked="true"] small { color: var(--bois); }
.join-code { margin-top: 4px; }

/* Boutons */
.actions { margin-top: 24px; }
.btn { display: block; width: 100%; border: 0; border-radius: var(--r-btn); padding: 16px 18px;
  font-family: var(--titre); font-weight: 800; font-size: 17px; transition: transform .1s; }
.btn:active { transform: scale(.98); }
.btn-main { background: var(--moutarde); color: var(--charbon); }
.btn-main:disabled { background: var(--creme-doux); color: #5c5747; }
.btn-dark { background: var(--charbon); color: var(--creme); margin-top: 16px; }
.link-back { background: none; border: 0; padding: 4px 0; font-weight: 700; color: var(--creme); }

/* Code de groupe */
.code-card { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 22px; text-align: center; }
.code-big { font-family: var(--titre); font-weight: 900; font-size: 40px; letter-spacing: 4px; margin: 0 0 12px; color: var(--charbon); }
.qr { width: 200px; height: 200px; margin: 0 auto; background: var(--creme); }
.qr svg { width: 100%; height: 100%; display: block; }

/* Menu */
.cat-tabs { position: sticky; top: 56px; z-index: 5; display: flex; gap: 8px; overflow-x: auto; padding: 10px var(--g);
  margin: 0 calc(var(--g) * -1) 6px; background: var(--vert); scrollbar-width: none; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tab { flex: none; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--vert-ligne); background: none;
  font-weight: 700; font-size: 15px; white-space: nowrap; }
.cat-tab.is-on { background: var(--creme); color: var(--charbon); border-color: var(--creme); }
.cat-title { font-family: var(--titre); font-weight: 800; font-size: 20px; margin: 22px 0 10px; scroll-margin-top: 120px; }
.product { display: flex; gap: 12px; align-items: center; background: var(--creme); color: var(--charbon);
  border-radius: var(--r-carte); padding: 10px; margin-bottom: 10px; }
.product-photo { width: 76px; height: 76px; flex: none; border-radius: 12px; object-fit: cover; background: var(--creme-doux); }
.product-photo.placeholder { display: flex; align-items: center; justify-content: center; background: var(--vert); }
.product-photo.placeholder img { width: 46px; }
.product-info { flex: 1; min-width: 0; }
.product-name { font-weight: 700; margin: 0; line-height: 1.25; }
.product-desc { font-size: 14px; color: var(--bois); margin: 2px 0 4px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.product-price { font-weight: 800; font-family: var(--titre); font-size: 15px; }
.product.is-out { background: var(--creme-doux); }
.product.is-out .product-photo { filter: grayscale(1); }
.tag-out { display: inline-block; background: var(--charbon); color: var(--creme); font-size: 12px; font-weight: 700;
  padding: 3px 8px; border-radius: 999px; }

/* Bouton + et compteur */
.add { flex: none; width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--moutarde); color: var(--charbon);
  font-size: 26px; font-weight: 700; line-height: 1; }
.stepper { flex: none; display: flex; align-items: center; gap: 4px; background: var(--charbon); color: var(--creme); border-radius: 999px; padding: 3px; }
.stepper button { width: 36px; height: 36px; border-radius: 50%; border: 0; background: none; color: var(--creme); font-size: 22px; font-weight: 700; line-height: 1; }
.stepper span { min-width: 22px; text-align: center; font-weight: 800; }

/* Barre panier */
.cart-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 12px var(--g) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(to bottom, rgba(79, 89, 64, 0), var(--vert) 35%); }
.btn-cart { display: flex; justify-content: space-between; align-items: center; max-width: 520px; margin: 0 auto; }
.badge { display: inline-block; min-width: 26px; padding: 1px 7px; margin-left: 6px; border-radius: 999px; background: var(--charbon); color: var(--creme); font-size: 14px; text-align: center; }

/* Panier */
.cart-line { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 12px 14px; margin-bottom: 10px; }
.cart-line-top { display: flex; align-items: center; gap: 10px; }
.cart-line-name { flex: 1; font-weight: 700; margin: 0; }
.cart-line-price { font-size: 14px; color: var(--bois); }
.cart-line-note { margin-top: 8px; }
.cart-line-note .input { padding: 10px 12px; font-size: 15px; background: #fff8ea; border-color: var(--creme-doux); }
.link-note { background: none; border: 0; padding: 6px 0 0; font-size: 14px; font-weight: 700; color: var(--bois); text-decoration: underline; }
.total-line { display: flex; justify-content: space-between; align-items: baseline; margin: 20px 0 0; padding-top: 14px; border-top: 1px solid var(--vert-ligne); font-weight: 700; }
.total-line strong { font-family: var(--titre); font-size: 22px; }

/* Suivi */
.tab-head { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 16px; }
.tab-head h1 { font-family: var(--titre); font-weight: 800; font-size: 22px; margin: 0 0 4px; }
.tab-head p { margin: 0; color: var(--bois); font-size: 15px; }
.members { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.member { background: var(--vert); color: var(--creme); font-size: 13px; font-weight: 700; padding: 3px 10px; border-radius: 999px; }
.tab-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px dashed var(--creme-doux); }
.tab-code strong { font-family: var(--titre); letter-spacing: 2px; font-size: 18px; }
.btn-invite { background: var(--charbon); color: var(--creme); border: 0; border-radius: 999px; padding: 8px 14px; font-weight: 700; font-size: 14px; }

.order { border: 1.5px solid var(--vert-ligne); border-radius: var(--r-carte); padding: 14px; margin-top: 14px; }
.order-top { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; color: var(--creme-doux); }
.order-top strong { color: var(--creme); }
.order-step { font-family: var(--titre); font-weight: 800; font-size: 18px; margin: 8px 0 10px; }
.steps { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin-bottom: 12px; }
.steps span { height: 6px; border-radius: 3px; background: var(--vert-ligne); }
.steps span.on { background: var(--moutarde); }
.order-items { list-style: none; margin: 0; padding: 0; font-size: 15px; }
.order-items li { display: flex; justify-content: space-between; gap: 10px; padding: 3px 0; }
.order-items li.removed { color: var(--creme-doux); text-decoration: line-through; }
.order-items .why { text-decoration: none; display: inline-block; font-size: 12px; font-weight: 700; background: var(--creme); color: var(--charbon); padding: 1px 7px; border-radius: 999px; margin-left: 6px; }
.order-items .note { display: block; font-size: 13px; color: var(--creme-doux); }
.order.is-refused { border-style: dashed; }
.order-refused { background: var(--creme); color: var(--charbon); border-radius: 10px; padding: 8px 10px; font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.order.is-ready { border-color: var(--moutarde); border-width: 2.5px; }

.paid { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 18px; margin-top: 14px; text-align: center; border: 3px solid var(--moutarde); }
.paid .paid-title { font-family: var(--titre); font-weight: 900; font-size: 30px; margin: 0; }
.paid .paid-amount { font-family: var(--titre); font-weight: 800; font-size: 22px; margin: 4px 0; }
.paid p { margin: 2px 0; color: var(--bois); font-size: 15px; }
.paid .paid-title, .paid .paid-amount { color: var(--charbon); }

/* Fenêtre et toast */
.sheet { position: fixed; inset: 0; z-index: 40; background: rgba(36, 35, 31, .75); display: flex; align-items: center; justify-content: center; padding: var(--g); }
.sheet-box { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 24px; width: 100%; max-width: 360px; text-align: center; }
.toast { pointer-events: none; position: fixed; left: 50%; bottom: calc(96px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50;
  background: var(--charbon); color: var(--creme); font-weight: 700; padding: 12px 18px; border-radius: 999px; max-width: 90vw; text-align: center; }

.loader { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--vert-ligne); border-top-color: var(--moutarde); animation: tour 0.9s linear infinite; }
@keyframes tour { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }

/* Choix obligatoire et mode de service */
.option-name { font-weight: 700; color: var(--bois); margin: 0 0 4px; }
.option-choices { display: grid; gap: 10px; margin-top: 8px; }
.serve-info { margin: -4px 0 10px; font-weight: 700; font-size: 15px; }

/* Menu d'abord, appels, note */
.join-banner { background: var(--creme); color: var(--charbon); font-weight: 700; border-radius: 12px; padding: 10px 12px; margin: 4px 0 8px; }
.btn-light { background: var(--creme); color: var(--charbon); margin-top: 10px; }
.btn-light-dark { background: none; border: 2px solid var(--creme-doux); color: var(--charbon); }
.call-pending { background: var(--creme); color: var(--charbon); border-left: 6px solid var(--moutarde); border-radius: 12px; padding: 10px 12px; margin-top: 12px; font-weight: 700; }
.call-pending small { display: block; font-weight: 500; color: var(--bois); }
.rate { background: var(--creme); color: var(--charbon); border-radius: var(--r-carte); padding: 18px; margin-top: 14px; text-align: center; }
.rate h2 { font-family: var(--titre); font-weight: 800; font-size: 22px; margin: 0 0 8px; }
.stars { display: flex; justify-content: center; gap: 6px; margin: 6px 0 10px; }
.stars button { background: none; border: 0; font-size: 40px; line-height: 1; padding: 2px; color: var(--creme-doux); }
.stars button.on { color: var(--moutarde); }
.rate p { margin: 6px 0; }
.rate textarea { width: 100%; min-height: 90px; padding: 12px; border-radius: 12px; border: 2px solid var(--creme-doux); background: #fff8ea; color: var(--charbon); font: inherit; font-size: 16px; resize: vertical; }
.rate .btn { margin-top: 10px; }
.rate .skip { background: none; border: 0; color: var(--bois); font-weight: 700; text-decoration: underline; margin-top: 8px; padding: 6px; }
.insta { display: inline-block; margin-top: 8px; background: var(--charbon); color: var(--creme); text-decoration: none; font-weight: 800; padding: 12px 18px; border-radius: 999px; }

/* Tablo : logo du restaurant (ou son nom s'il n'a pas de logo) */
.topbar-logo { display: inline-flex; align-items: center; height: auto; min-height: 30px; }
.topbar-logo img { height: 30px; width: auto; display: block; }
.product-photo.placeholder .ph-initial { font: 900 26px/1 var(--titre); color: var(--creme); opacity: .5; }
.cat-desc { margin: -6px 0 10px; font-size: 14px; font-weight: 600; color: var(--charbon); background: var(--moutarde); border-radius: 10px; padding: 7px 12px; }
