/* Customer app. Tokens first; restaurants can override --soleil from settings. */
:root {
  --encre: #14202b;
  --papier: #f4f6f3;
  --surface: #ffffff;
  --texte: #14202b;
  --doux: #55616c;
  --ligne: #d5dbd3;
  --soleil: #f5b800;
  --soleil-texte: #14202b;
  --braise: #b42318;
  --braise-bg: #fdecea;
  --feuille: #16794a;
  --feuille-bg: #e3f4ea;
  --ticket: #fcfcfa;
  --ticket-texte: #14202b;
  --ticket-ligne: #aab2b8;
  --titre: "sans-serif-condensed", "Roboto Condensed", "Arial Narrow", "Helvetica Neue", system-ui, sans-serif;
  --corps: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --papier: #0d151d;
    --surface: #17222d;
    --texte: #eef1ee;
    --doux: #a3aeb7;
    --ligne: #2c3a47;
    --braise: #ff8f80;
    --braise-bg: #3a1a17;
    --feuille: #6fd09a;
    --feuille-bg: #143324;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--papier); color: var(--texte); font: 16px/1.5 var(--corps); }
a { color: inherit; }
button { font-family: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--texte); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
[hidden] { display: none !important; }

.page { max-width: 640px; margin: 0 auto; padding: 0 16px 120px; }

/* ---------- banners ---------- */
#offline { position: sticky; top: 0; z-index: 30; padding: 10px 16px; background: var(--braise); color: #fff; font-weight: 600; text-align: center; }
.banner { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--braise); border-radius: 8px; background: var(--braise-bg); color: var(--braise); font-weight: 600; }
.banner.ok { border-color: var(--feuille); background: var(--feuille-bg); color: var(--feuille); }
#toast { position: fixed; left: 50%; bottom: 96px; z-index: 40; max-width: 90vw; padding: 10px 16px; border-radius: 10px; background: var(--texte); color: var(--papier); font-weight: 600; opacity: 0; transform: translate(-50%, 8px); pointer-events: none; transition: opacity .15s, transform .15s; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- header ---------- */
.hero { padding: max(22px, env(safe-area-inset-top)) 16px 18px; background: var(--encre); color: #f4f6f3; border-bottom: 6px solid var(--soleil); }
.hero-in { max-width: 640px; margin: 0 auto; }
.brand { margin: 0 0 8px; font: 800 clamp(2.1rem, 10vw, 3rem)/.95 var(--titre); letter-spacing: -.01em; overflow-wrap: anywhere; }
.hero p { margin: 2px 0 0; color: #c9d2d8; font-size: .95rem; }
.hero a { color: #fff; }
.hero .mine { display: inline-block; margin-top: 12px; min-height: 40px; padding: 8px 14px; border: 2px solid #f4f6f3; border-radius: 10px; font-weight: 700; text-decoration: none; }

.bar { display: flex; align-items: center; gap: 4px; padding: max(8px, env(safe-area-inset-top)) 8px 8px; background: var(--encre); color: #f4f6f3; border-bottom: 6px solid var(--soleil); }
.bar h1 { margin: 0 0 0 4px; font: 800 1.5rem/1 var(--titre); }
.bar .back { display: grid; place-items: center; width: 44px; height: 44px; font-size: 2rem; line-height: 1; text-decoration: none; color: #fff; }
.bar .back:focus-visible { outline-color: #fff; }

/* ---------- menu ---------- */
.cats { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; margin: 0 -16px; padding: 10px 16px; overflow-x: auto; background: var(--papier); border-bottom: 1px solid var(--ligne); scrollbar-width: none; }
.cats::-webkit-scrollbar { display: none; }
.cats button { flex: none; min-height: 40px; padding: 0 16px; border: 2px solid var(--ligne); border-radius: 99px; background: var(--surface); color: var(--texte); font-weight: 600; font-size: .95rem; }
section.cat { scroll-margin-top: 64px; }
section.cat h2 { margin: 26px 0 4px; font: 800 1.6rem/1.1 var(--titre); }
.dishes { margin: 0; padding: 0; list-style: none; }
.dish { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--ligne); }
.dish-head { display: flex; align-items: baseline; gap: 8px; }
.dish h3 { margin: 0; font: 700 1.2rem/1.2 var(--titre); overflow-wrap: anywhere; }
.leader { flex: 1; min-width: 10px; border-bottom: 2px dotted var(--doux); opacity: .5; transform: translateY(-4px); }
.price { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.desc { max-width: 46ch; margin: 4px 0 0; color: var(--doux); font-size: .92rem; }
.dish img { display: block; width: 100%; max-width: 220px; aspect-ratio: 4/3; margin-top: 8px; border-radius: 8px; object-fit: cover; background: var(--ligne); }

.add { min-height: 44px; padding: 0 18px; border: 0; border-radius: 10px; background: var(--soleil); color: var(--soleil-texte); font-weight: 700; font-size: 1rem; }
.qty { display: inline-flex; align-items: center; overflow: hidden; border: 2px solid var(--texte); border-radius: 10px; }
.qty button { width: 44px; height: 44px; border: 0; background: var(--surface); color: var(--texte); font-size: 1.4rem; font-weight: 700; }
.qty span { min-width: 32px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }

.cartbar { position: fixed; left: 12px; right: 12px; bottom: max(12px, env(safe-area-inset-bottom)); z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; max-width: 616px; min-height: 58px; margin: 0 auto; padding: 0 18px; border-radius: 14px; background: var(--soleil); color: var(--soleil-texte); font-weight: 700; font-size: 1.05rem; text-decoration: none; box-shadow: 0 6px 18px rgba(0, 0, 0, .28); }
.cartbar.enter { animation: rise .22s ease-out; }
@keyframes rise { from { transform: translateY(26px); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cartbar.enter { animation: none; } #toast { transition: none; } }

/* ---------- the ticket ---------- */
.ticket { position: relative; margin: 20px 0 34px; padding: 18px 16px 20px; background: var(--ticket); color: var(--ticket-texte); box-shadow: 0 1px 0 rgba(0, 0, 0, .08); }
.ticket::after { content: ""; position: absolute; left: 0; right: 0; top: 100%; height: 10px;
  background: linear-gradient(135deg, var(--ticket) 5px, transparent 0) 0 0 / 14px 10px, linear-gradient(225deg, var(--ticket) 5px, transparent 0) 0 0 / 14px 10px; }
.ticket h2 { margin: 0 0 8px; font: 800 1.45rem/1.1 var(--titre); }
.ticket .qty { border-color: var(--ticket-texte); }
.ticket .qty button { width: 38px; height: 38px; background: transparent; color: var(--ticket-texte); }
.lines { margin: 0; padding: 0; list-style: none; }
.lines li { display: grid; grid-template-columns: 1fr auto auto; gap: 6px 12px; align-items: center; padding: 10px 0; border-bottom: 2px dashed var(--ticket-ligne); }
.lines .nm { font-weight: 600; overflow-wrap: anywhere; }
.lines .pr { min-width: 5.5em; text-align: right; font-variant-numeric: tabular-nums; }
.sum { margin: 12px 0 0; }
.sum div { display: flex; justify-content: space-between; gap: 12px; padding: 3px 0; }
.sum dt, .sum dd { margin: 0; font-variant-numeric: tabular-nums; }
.sum .total { margin-top: 8px; padding-top: 10px; border-top: 2px solid var(--ticket-texte); font: 800 1.6rem/1 var(--titre); }
.tk-no { margin: 0; font: 800 3.4rem/.95 var(--titre); letter-spacing: -.01em; }
.tk-meta { margin: 6px 0 0; font-weight: 600; }
.tk-total { margin: 10px 0 0; padding-top: 10px; border-top: 2px dashed var(--ticket-ligne); font: 800 1.9rem/1 var(--titre); font-variant-numeric: tabular-nums; }
.tk-status { margin: 12px 0 0; padding-top: 12px; border-top: 2px dashed var(--ticket-ligne); font: 700 1.3rem/1.25 var(--corps); }
.tk-eta { margin: 6px 0 0; font-weight: 600; }

/* ---------- forms ---------- */
form.co { padding-top: 4px; }
.field { margin: 0 0 24px; padding: 0; border: 0; min-width: 0; }
.field legend, .field label, .lbl { display: block; margin: 0 0 6px; padding: 0; font-weight: 700; }
.opt { font-weight: 400; color: var(--doux); }
.hint { margin: 6px 0 0; color: var(--doux); font-size: .9rem; }
input, select, textarea { width: 100%; min-height: 50px; padding: 10px 12px; border: 2px solid var(--ligne); border-radius: 8px; background: var(--surface); color: var(--texte); font: 16px var(--corps); }
textarea { min-height: 76px; resize: vertical; }
[aria-invalid="true"] { border-color: var(--braise); }
.tiles { display: grid; gap: 8px; }
.tiles.three { grid-template-columns: repeat(3, 1fr); }
.tiles.two { grid-template-columns: repeat(2, 1fr); }
.tile { position: relative; display: block; margin: 0; font-weight: 700; }
.tile input { position: absolute; inset: 0; width: 100%; height: 100%; min-height: 0; margin: 0; opacity: 0; cursor: pointer; }
.tile span { display: flex; align-items: center; justify-content: center; min-height: 54px; padding: 8px; border: 2px solid var(--ligne); border-radius: 10px; background: var(--surface); text-align: center; }
.tile input:checked + span { border-color: var(--texte); background: var(--soleil); color: var(--soleil-texte); }
.tile input:checked + span::before { content: "✓\00a0"; }
.tile input:focus-visible + span { outline: 3px solid var(--texte); outline-offset: 2px; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 54px; padding: 0 22px; border: 2px solid var(--texte); border-radius: 12px; background: transparent; color: var(--texte); font-weight: 700; font-size: 1.05rem; text-decoration: none; }
.btn.primary { width: 100%; border-color: var(--texte); background: var(--soleil); color: var(--soleil-texte); }
.btn.small { min-height: 44px; padding: 0 14px; font-size: .95rem; }
.btn[disabled] { opacity: .55; cursor: default; }
.err { min-height: 1.5em; margin: 12px 0 0; color: var(--braise); font-weight: 600; }
.empty { padding: 40px 0; text-align: center; }
.empty p { margin: 0 0 16px; font-size: 1.1rem; }

.pinmap, .livemap { height: 270px; margin: 0 0 8px; overflow: hidden; border: 2px solid var(--ligne); border-radius: 10px; background: var(--ligne); }
.livemap { height: 340px; margin: 20px 0; }
.pin { background: none; border: 0; }
.pin i { display: block; width: 28px; height: 28px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: var(--braise); transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0, 0, 0, .4); }
.pin .pill { display: block; padding: 4px 10px; border: 2px solid var(--encre); border-radius: 99px; background: var(--soleil); color: var(--encre); font-weight: 800; font-size: .8rem; text-align: center; white-space: nowrap; }
.pin .pill.me { background: #fff; }

/* ---------- payment + tracking ---------- */
.steps { margin: 0 0 24px; padding-left: 1.4em; }
.steps li { margin: 0 0 12px; padding-left: 4px; }
.num { display: inline-flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.num strong { font: 800 1.5rem/1 var(--titre); font-variant-numeric: tabular-nums; }
.stepper { margin: 20px 0 8px; padding: 0; list-style: none; }
.stepper li { position: relative; padding: 7px 0 7px 30px; color: var(--doux); }
.stepper li::before { content: ""; position: absolute; left: 0; top: 12px; width: 16px; height: 16px; border: 2px solid var(--doux); border-radius: 50%; }
.stepper li.done { color: var(--texte); }
.stepper li.done::before { border-color: var(--feuille); background: var(--feuille); }
.stepper li.now { color: var(--texte); font-weight: 700; }
.stepper li.now::before { border-color: var(--texte); background: var(--soleil); }
.share { display: flex; flex-wrap: wrap; gap: 10px; margin: 20px 0; }

.orders { margin: 20px 0; padding: 0; list-style: none; }
.orders li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--ligne); }
.orders .n { font: 800 1.5rem/1 var(--titre); }
.orders small { display: block; color: var(--doux); }

/* ---------- Leaflet minimal fixes ---------- */
.leaflet-container { font: inherit; }
