/* Minute à Table — feuille de style (charte v1 : olive, crème olive, nuit, laiton) */
:root {
  --olive: #56622A;
  --olive-dark: #434d1f;
  --cream: #EEF0E2;
  --lin: #F7F6F0;
  --night: #14233A;
  --brass: #C9A76A;
  --brass-ink: #83642F;
  --line: #d9dccb;
  --muted: #5d6470;
  --white: #fff;
  --red: #a3312a;
  --red-bg: #fbeceb;
  --green: #2f6b3a;
  --green-bg: #e8f3ea;
  --blue-bg: #e9eef6;
  --radius: 14px;
  --serif: "Cormorant Garamond", Georgia, serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--sans); font-size: 17px; line-height: 1.5; color: var(--night); background: var(--lin); }
img { max-width: 100%; }
a { color: var(--olive); }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .5em; }
h1 { font-size: 2.1rem; }
h2 { font-size: 1.6rem; margin-top: 1.2em; }
h3 { font-size: 1.3rem; }
p { margin: 0 0 1em; }
.muted { color: var(--muted); }
.small { font-size: .9rem; }
.num { font-variant-numeric: tabular-nums; }
.wrap { max-width: 1080px; margin: 0 auto; padding: 0 16px; }
.wrap.narrow { max-width: 620px; padding-top: 24px; padding-bottom: 40px; }
.wrap.wide { max-width: none; }
.hidden { display: none !important; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px; border-radius: 999px; border: 0; background: var(--olive); color: #fff; font: 600 1rem var(--sans); text-decoration: none; cursor: pointer; }
.btn:hover { background: var(--olive-dark); }
.btn.big { min-height: 56px; padding: 14px 28px; font-size: 1.1rem; }
.btn.block { width: 100%; }
.btn.light { background: var(--white); color: var(--night); border: 1.5px solid var(--line); }
.btn.light:hover { border-color: var(--olive); }
.btn.night { background: var(--night); }
.btn.danger { background: var(--red); }
.btn.small { min-height: 38px; padding: 6px 14px; font-size: .92rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linkbtn { background: none; border: 0; color: var(--olive); font: inherit; cursor: pointer; padding: 0; text-decoration: underline; }
.linkbtn.danger { color: var(--red); }

/* Messages */
.flash { padding: 14px 16px; border-radius: 12px; margin: 14px 0; font-weight: 500; }
.flash.ok { background: var(--green-bg); color: var(--green); }
.flash.err { background: var(--red-bg); color: var(--red); }
.flash.info { background: var(--blue-bg); color: var(--night); }

/* Cartes */
.card { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; margin: 16px 0; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.grid.two { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid.three { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid.four { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.kpi { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.kpi .v { font-size: 1.8rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.kpi .l { color: var(--muted); font-size: .92rem; }

/* Formulaires */
.form label { display: block; font-weight: 600; margin: 0 0 14px; }
.form label small { font-weight: 400; color: var(--muted); display: block; }
input, select, textarea { width: 100%; font: 400 1rem var(--sans); color: var(--night); padding: 12px 14px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; margin-top: 6px; min-height: 48px; }
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 3px solid rgba(86, 98, 42, .25); border-color: var(--olive); }
.form .check, label.check { display: flex; align-items: center; gap: 10px; font-weight: 500; }
.check input { width: 24px; height: 24px; min-height: 0; margin: 0; flex: none; accent-color: var(--olive); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.row > .btn, .row > .auto { flex: 0 0 auto; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px 16px; margin: 0 0 16px; }
legend { font-weight: 600; padding: 0 6px; }
.allergen-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 14px; }
.allergen-grid label { font-weight: 400; margin: 0; }
.voice-wrap { display: flex; gap: 6px; align-items: flex-start; }
.voice-wrap > input, .voice-wrap > textarea { flex: 1; }
.mic { flex: none; margin-top: 6px; width: 48px; height: 48px; border-radius: 10px; border: 1.5px solid var(--line); background: #fff; font-size: 1.2rem; cursor: pointer; }
.mic.on { background: var(--red-bg); border-color: var(--red); animation: pulse 1s infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* Tableaux */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--radius); overflow: hidden; }
table.list th, table.list td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { background: var(--cream); font-size: .9rem; text-transform: uppercase; letter-spacing: .03em; }
table.list td.r, table.list th.r { text-align: right; font-variant-numeric: tabular-nums; }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: .85rem; font-weight: 600; background: var(--cream); color: var(--night); white-space: nowrap; }
.badge.nouvelle { background: #fff1d6; color: #7a4e00; }
.badge.preparation { background: var(--blue-bg); }
.badge.prete { background: var(--green-bg); color: var(--green); }
.badge.en_livraison { background: #efe7fb; color: #4b2a85; }
.badge.annulee { background: var(--red-bg); color: var(--red); }
.badge.attente_paiement { background: #f2f2f2; color: var(--muted); }

/* ---------- Public ---------- */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--night); font-family: var(--serif); font-size: 1.45rem; font-weight: 600; }
.footer { margin-top: 48px; padding: 28px 0 40px; background: var(--night); color: #dfe3ea; }
.footer a { color: #fff; margin-right: 16px; display: inline-block; margin-bottom: 6px; }
.footer .muted { color: #aab3c2; }
.hero { background: var(--cream); padding: 48px 0 40px; }
.hero h1 { font-size: 2.6rem; max-width: 18ch; }
.hero p { font-size: 1.15rem; max-width: 46ch; }
.doors { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); margin-top: 24px; }
.door { display: block; background: #fff; border: 1.5px solid var(--line); border-radius: var(--radius); padding: 22px; text-decoration: none; color: var(--night); }
.door:hover { border-color: var(--olive); }
.door strong { display: block; font-family: var(--serif); font-size: 1.6rem; margin-bottom: 4px; }
.resto-list { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.resto-card { display: block; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-decoration: none; color: var(--night); }
.resto-card:hover { border-color: var(--olive); }
.resto-card h3 { margin-bottom: 4px; }
.pill { display: inline-block; font-size: .82rem; padding: 2px 10px; border-radius: 999px; background: var(--cream); margin: 4px 4px 0 0; }
.pill.closed { background: var(--red-bg); color: var(--red); }

/* Menu client */
.menu-head { background: var(--cream); padding: 22px 0 16px; }
.menu-head h1 { margin-bottom: 4px; }
.table-tag { display: inline-block; background: var(--olive); color: #fff; padding: 4px 14px; border-radius: 999px; font-weight: 700; }
.cat-nav { display: flex; gap: 8px; overflow-x: auto; padding: 12px 16px; background: var(--white); border-bottom: 1px solid var(--line); position: sticky; top: 63px; z-index: 10; scrollbar-width: none; }
.cat-nav a { flex: none; padding: 8px 16px; border-radius: 999px; background: var(--cream); color: var(--night); text-decoration: none; font-weight: 600; font-size: .95rem; }
.cat-block { scroll-margin-top: 130px; }
.dish { display: flex; gap: 14px; align-items: flex-start; justify-content: space-between; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 10px 0; }
.dish h3 { font-size: 1.35rem; margin: 0 0 2px; }
.dish p { margin: 0 0 6px; color: var(--muted); font-size: .95rem; }
.dish .price { font-weight: 700; font-variant-numeric: tabular-nums; }
.dish .allerg { font-size: .82rem; color: var(--brass-ink); }
.dish.off { opacity: .55; }
.qty { display: flex; align-items: center; gap: 6px; flex: none; }
.qty button { width: 44px; height: 44px; border-radius: 50%; border: 1.5px solid var(--olive); background: #fff; color: var(--olive); font-size: 1.4rem; font-weight: 700; cursor: pointer; line-height: 1; }
.qty button.add { background: var(--olive); color: #fff; }
.qty span { min-width: 24px; text-align: center; font-weight: 700; font-variant-numeric: tabular-nums; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: var(--white); border-top: 1px solid var(--line); z-index: 30; box-shadow: 0 -6px 20px rgba(20, 35, 58, .08); }
.cartbar .btn { width: 100%; max-width: 620px; margin: 0 auto; display: flex; justify-content: space-between; }
body.has-cart main { padding-bottom: 96px; }
.sheet { position: fixed; inset: 0; background: rgba(20, 35, 58, .45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.sheet-in { background: var(--lin); width: 100%; max-width: 640px; max-height: 92vh; overflow-y: auto; border-radius: 20px 20px 0 0; padding: 20px 16px 28px; }
.sheet-close { float: right; }
.line-item { display: flex; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.modes { display: grid; gap: 8px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); margin-bottom: 14px; }
.modes label { display: flex; gap: 10px; align-items: center; background: #fff; border: 1.5px solid var(--line); border-radius: 12px; padding: 12px; margin: 0; font-weight: 600; cursor: pointer; }
.modes input { width: 22px; height: 22px; min-height: 0; margin: 0; accent-color: var(--olive); }
.modes label:has(input:checked) { border-color: var(--olive); background: var(--cream); }
.totals .line-item { border: 0; padding: 4px 0; }
.totals .grand { font-weight: 700; font-size: 1.15rem; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 6px; }

/* Suivi */
.track { text-align: center; padding: 28px 0; }
.track-steps { display: flex; justify-content: space-between; gap: 6px; margin: 24px 0; counter-reset: s; }
.track-steps li { list-style: none; flex: 1; position: relative; padding-top: 42px; font-size: .9rem; color: var(--muted); }
.track-steps li::before { counter-increment: s; content: counter(s); position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 34px; height: 34px; border-radius: 50%; background: #fff; border: 2px solid var(--line); line-height: 30px; font-weight: 700; }
.track-steps li.done { color: var(--night); font-weight: 600; }
.track-steps li.done::before { background: var(--olive); border-color: var(--olive); color: #fff; content: "✓"; }
.track-steps li.now::before { border-color: var(--olive); color: var(--olive); }
.track-steps { padding: 0; }
.big-status { font-family: var(--serif); font-size: 2.2rem; }

/* ---------- Back-office ---------- */
body.bo { background: #f3f4ee; }
.bobar { background: var(--night); color: #fff; position: sticky; top: 0; z-index: 20; }
.bobar-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; }
.bobar-title { flex: 1; min-width: 0; }
.bobar-title strong { display: block; font-size: 1.1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bobar-title small { color: var(--brass); }
.navbtn { display: inline-flex; align-items: center; gap: 8px; min-height: 52px; min-width: 52px; padding: 8px 16px; border-radius: 12px; background: var(--olive); color: #fff; border: 0; font: 700 1.05rem var(--sans); text-decoration: none; cursor: pointer; }
.navbtn.ghost { background: transparent; border: 1.5px solid rgba(255, 255, 255, .35); }
.bonav { display: flex; gap: 6px; overflow-x: auto; padding: 0 16px 10px; scrollbar-width: thin; }
.bonav a { flex: none; display: flex; align-items: center; gap: 6px; padding: 9px 14px; border-radius: 10px; color: #dfe3ea; text-decoration: none; font-weight: 600; background: rgba(255, 255, 255, .07); }
.bonav a.on { background: var(--cream); color: var(--night); }
body.bo main.wrap { padding-top: 8px; padding-bottom: 48px; }
.page-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 12px 0; }
.steps li { margin-bottom: 8px; }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
@media (max-width: 640px) {
  .navbtn span { display: none; }
  .hero h1 { font-size: 2.1rem; }
  h1 { font-size: 1.8rem; }
  table.list th, table.list td { padding: 10px; }
}

/* Écran cuisine */
body.fullscreen .bobar-row { padding: 8px 16px; }
.kitchen { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; align-items: start; }
@media (max-width: 900px) { .kitchen { grid-template-columns: 1fr; } }
.kcol { background: #e8eadf; border-radius: var(--radius); padding: 12px; min-height: 60vh; }
.kcol h2 { margin: 0 0 10px; font-size: 1.4rem; display: flex; justify-content: space-between; }
.ticket { background: #fff; border-radius: 12px; padding: 14px; margin-bottom: 12px; border-left: 6px solid var(--brass); box-shadow: 0 2px 6px rgba(20, 35, 58, .08); }
.ticket.new { animation: flashin 1.2s ease 3; }
@keyframes flashin { 50% { background: #fff1d6; } }
.ticket .t-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.ticket .t-where { font-size: 1.35rem; font-weight: 800; }
.ticket .t-time { color: var(--muted); font-variant-numeric: tabular-nums; }
.ticket ul { padding: 0; margin: 10px 0; list-style: none; }
.ticket li { padding: 4px 0; font-size: 1.08rem; border-bottom: 1px dashed var(--line); }
.ticket li b { display: inline-block; min-width: 34px; }
.ticket .t-note { background: #fff1d6; padding: 8px 10px; border-radius: 8px; font-weight: 600; margin: 8px 0; }
.ticket .t-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.ticket .t-actions .btn { flex: 1; }
.ticket.mode-livraison { border-left-color: #6b4bb0; }
.ticket.mode-retrait { border-left-color: var(--night); }
.ticket.mode-table { border-left-color: var(--olive); }
.sound-hint { background: #fff1d6; padding: 10px 14px; border-radius: 10px; margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* QR à imprimer */
.qr-sheet { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.qr-card { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; text-align: center; break-inside: avoid; }
.qr-card .qr { display: flex; justify-content: center; margin: 12px 0; }
.qr-card .lbl { font-family: var(--serif); font-size: 1.8rem; font-weight: 600; }
@media print {
  .bobar, .no-print, .flash { display: none !important; }
  body.bo { background: #fff; }
  .qr-card { border: 1px solid #999; }
}

/* Livreur */
.deliv { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin: 12px 0; }
.deliv .addr { font-size: 1.2rem; font-weight: 700; }

/* v1.1 : navigation du compte, régions, abonnement */
.topnav { display: flex; gap: 14px; align-items: center; }
.topnav a { font-weight: 600; text-decoration: none; color: var(--olive, #56622A); padding: 8px 12px; border-radius: 999px; border: 1px solid var(--line); }
.topnav a:hover { background: var(--cream, #EEF0E2); }
.status-banner { padding: 14px 16px; border-radius: 12px; margin: 0 0 16px; border: 1px solid var(--line); background: #FFF8E6; }
.status-banner strong { display: block; margin-bottom: 4px; }
.plan-price { font-size: 2rem; font-weight: 700; }

/* v1.2 : suivi du livreur sur carte */
.map { height: 320px; border-radius: 14px; border: 1px solid var(--line); margin: 8px 0; z-index: 0; }
.map.big { height: 520px; }
.live { margin: 14px 0; }
.eta { font-size: 1.2rem; font-weight: 700; margin: 6px 0; }
.code-box { margin: 12px 0; padding: 12px 14px; border-radius: 12px; background: var(--cream); border: 1px dashed var(--olive); font-size: 1.05rem; }
.code-box strong { font-size: 1.6rem; letter-spacing: .25em; margin-left: 6px; }
.geo-box { padding: 12px 14px; border-radius: 12px; background: var(--blue-bg); border: 1px solid var(--line); margin-bottom: 14px; }
.pin { display: flex; align-items: center; justify-content: center; font-size: 22px; background: #fff; border-radius: 50%; border: 2px solid var(--olive); box-shadow: 0 2px 6px rgba(0,0,0,.25); }
.pin.driver { border-color: var(--night); }
.addr-suggest { display: block; border: 1px solid var(--line); border-radius: 10px; margin-top: 4px; background: #fff; overflow: hidden; }
.addr-suggest button { display: block; width: 100%; text-align: left; padding: 10px 12px; border: 0; border-bottom: 1px solid var(--line); background: #fff; font: inherit; cursor: pointer; }
.addr-suggest button:last-child { border-bottom: 0; }
.addr-suggest button:hover, .addr-suggest button:focus { background: var(--cream); }

/* ---- v1.3 : options des plats ---- */
.opt-hint { color: var(--brass-ink); margin-top: 2px; }
.opt-line { color: var(--brass-ink); }
.opt-fs { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 0 0 12px; background: #fff; }
.opt-fs legend { font-weight: 700; padding: 0 6px; }
.opt-fs.opt-missing { border-color: var(--red); box-shadow: 0 0 0 2px rgba(180, 40, 40, .15); }
.opt-choice { display: flex; align-items: center; gap: 10px; padding: 9px 2px; border-bottom: 1px solid var(--line); margin: 0; }
.opt-choice:last-child { border-bottom: 0; }
.opt-choice span:first-of-type { flex: 1; }
.opt-choice input { width: 22px; height: 22px; min-height: 0; margin: 0; flex: none; }
.opt-choice input:disabled + span { opacity: .45; }
.opt-foot { position: sticky; bottom: -28px; background: var(--lin); display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; padding: 12px 0 4px; border-top: 1px solid var(--line); }
.opt-foot .btn { flex: 1; }
.opt-group table input[type=text], .opt-group table input:not([type]) { width: 100%; }
.t-opts { font-size: .9rem; color: var(--brass-ink); margin: 2px 0 4px 1.6em; }

/* ---- v1.3 : alertes de commande ---- */
.alert-toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; background: var(--night, #14233A); color: #fff; border-radius: 12px; padding: 12px 14px 12px 18px; display: flex; gap: 12px; align-items: center; box-shadow: 0 8px 24px rgba(0,0,0,.25); max-width: calc(100vw - 20px); }
.alert-toast a, .alert-toast div { color: #fff; font-weight: 700; text-decoration: none; }
.alert-toast button { background: transparent; border: 0; color: #fff; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.alert-toast.hidden { display: none; }
#alert-bell.muted-bell { opacity: .6; }
#alert-bell[data-mode=locked] { background: #fff1d6; color: #14233A; animation: flashin 1.5s ease 2; }
.opt-foot .flash { flex: 0 0 100%; margin: 0; }

/* ---- v1.4 : photos ---- */
.dish-txt { flex: 1; min-width: 0; }
.dish-side { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; flex: none; }
.dish-photo { width: 112px; height: 112px; object-fit: cover; border-radius: 12px; display: block; background: var(--cream); }
.dish.has-photo .qty { margin-top: -30px; margin-right: -6px; background: #fff; border-radius: 999px; padding: 2px; box-shadow: 0 2px 8px rgba(20, 35, 58, .15); }
.dish.has-photo .qty .n:not(.hidden) { padding: 0 2px; }
.dish.off .dish-photo { filter: grayscale(1); opacity: .6; }
.cover-photo { max-width: 1100px; margin: 0 auto; }
.cover-photo img { display: block; width: 100%; height: clamp(160px, 32vw, 320px); object-fit: cover; }
@media (min-width: 1100px) { .cover-photo img { border-radius: 0 0 var(--radius) var(--radius); } }
.resto-card.has-cover { padding: 0; overflow: hidden; }
.resto-card.has-cover > :not(.resto-cover) { margin-left: 18px; margin-right: 18px; }
.resto-card.has-cover > :last-child { margin-bottom: 18px; }
.resto-cover { display: block; width: 100%; height: 150px; object-fit: cover; margin-bottom: 14px; }
.opt-photo { display: block; max-width: none; width: calc(100% + 32px); max-height: 220px; object-fit: cover; margin: -20px -16px 14px; border-radius: 20px 20px 0 0; }
.opt-photo.hidden { display: none; }
.photo-field { display: flex; gap: 16px; align-items: flex-start; margin: 6px 0 14px; }
.photo-field > div:last-child { flex: 1; }
.photo-preview { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; flex: none; background: var(--cream); display: flex; align-items: center; justify-content: center; font-size: 2rem; border: 1.5px dashed var(--line); }
.photo-preview.cover { width: 200px; height: 120px; }
.photo-preview img { width: 100%; height: 100%; object-fit: cover; }
.photo-preview:not(.empty) { border-style: solid; }
input[type=file] { padding: 10px; background: #fff; }
.thumb { width: 44px; height: 44px; object-fit: cover; border-radius: 8px; vertical-align: middle; margin-right: 8px; float: left; }
@media (max-width: 520px) { .photo-field { flex-direction: column; } .photo-preview.cover { width: 100%; height: 150px; } .dish-photo { width: 96px; height: 96px; } }
#opt-sheet .sheet-in { position: relative; }
#opt-sheet .sheet-close { position: absolute; top: 14px; right: 14px; float: none; z-index: 2; box-shadow: 0 2px 8px rgba(20, 35, 58, .2); }
#opt-title { padding-right: 96px; }
#opt-photo:not(.hidden) + #opt-title { padding-right: 0; }
