:root {
  --bg: #faf7f2; --card: #fff; --ink: #1f1a17; --muted: #7a716a; --line: #e8e1d8;
  --accent: #b5452b; --accent-ink: #fff; --ok: #2f7d4f; --warn: #c58a12; --info: #2d5f9a;
  --radius: 14px;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; background: var(--bg); color: var(--ink); }
h1, h2, h3 { margin: 0 0 .4em; }
button { font: inherit; cursor: pointer; border: 0; border-radius: 10px; padding: .7em 1.1em; background: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
button:disabled { opacity: .45; cursor: not-allowed; }
input, textarea, select { font: inherit; padding: .65em .8em; border: 1px solid var(--line); border-radius: 10px; width: 100%; background: #fff; }
.wrap { max-width: 720px; margin: 0 auto; padding: 16px 16px 120px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }
.muted { color: var(--muted); font-size: .9em; }
.row { display: flex; align-items: center; gap: 10px; }
.between { justify-content: space-between; }
.badge { display: inline-block; padding: .2em .6em; border-radius: 99px; font-size: .78em; font-weight: 700; background: var(--line); }
.b-nouvelle { background: #fde7e1; color: var(--accent); }
.b-en_preparation { background: #fdf1d6; color: var(--warn); }
.b-prete { background: #dcf1e4; color: var(--ok); }
.b-servie { background: #e3ebf6; color: var(--info); }
.b-payee { background: #dcf1e4; color: var(--ok); }
.b-a_payer { background: #fde7e1; color: var(--accent); }
.qty { display: flex; align-items: center; gap: 8px; }
.qty button { width: 36px; height: 36px; padding: 0; border-radius: 50%; }
.cats { position: sticky; top: 0; z-index: 5; background: var(--bg); display: flex; gap: 8px; overflow-x: auto; padding: 10px 0; }
.cats a { white-space: nowrap; text-decoration: none; color: var(--ink); border: 1px solid var(--line); border-radius: 99px; padding: .4em .9em; background: #fff; }
.cartbar { position: fixed; left: 0; right: 0; bottom: 0; background: var(--ink); color: #fff; padding: 14px 16px; }
.cartbar .inner { max-width: 720px; margin: 0 auto; display: flex; justify-content: space-between; align-items: center; }
.hidden { display: none !important; }
.error { color: var(--accent); font-weight: 600; }

/* Écrans personnel */
.board { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; padding: 16px; }
.ticket { background: #fff; border-radius: var(--radius); border-top: 6px solid var(--accent); padding: 14px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.ticket.en_preparation { border-top-color: var(--warn); }
.ticket.prete { border-top-color: var(--ok); }
.ticket.servie { border-top-color: var(--info); }
.ticket .table { font-size: 1.6em; font-weight: 800; }
.ticket ul { padding-left: 0; list-style: none; margin: 10px 0; }
.ticket li { padding: 6px 0; border-bottom: 1px dashed var(--line); font-size: 1.1em; }
.ticket li .c { display: block; color: var(--accent); font-size: .85em; font-style: italic; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; background: var(--ink); color: #fff; }
.topbar a { color: #fff; margin-left: 14px; }
.flash { animation: flash 1s ease 3; }
@keyframes flash { 50% { box-shadow: 0 0 0 6px rgba(181,69,43,.45); } }
.qr-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.qr-grid .card { text-align: center; page-break-inside: avoid; }
.qr-grid img { width: 100%; }
@media print { .noprint { display: none !important; } body { background: #fff; } }

/* Reçu client */
.receipt { font-variant-numeric: tabular-nums; }
.receipt hr.dash { border: 0; border-top: 1px dashed var(--line); margin: 12px 0; }
.receipt .rline { padding: 4px 0; }
.pay-banner { margin-top: 14px; padding: 14px; border-radius: 10px; text-align: center; font-size: 1.1em; }
.pay-banner span { font-size: .8em; }
.pay-banner.todo { background: #fde7e1; color: var(--accent); }
.pay-banner.done { background: #dcf1e4; color: var(--ok); font-weight: 700; }

/* Choix d'options (sauce, viande…) */
.chooser { border-top: 1px dashed var(--line); margin-top: 12px; padding-top: 4px; }
.choices { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.choice { display: flex; align-items: center; gap: 6px; border: 1px solid var(--line); border-radius: 99px; padding: .45em .9em; background: #fff; cursor: pointer; }
.choice input { width: auto; margin: 0; }
.choice:has(input:checked) { border-color: var(--accent); background: #fde7e1; color: var(--accent); font-weight: 600; }
.ticket li .o { display: block; font-weight: 700; color: var(--info); font-size: .9em; }
.tags { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.tag { font-size: .72em; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: .15em .55em; border-radius: 99px; background: #eef1e6; color: #5d6b45; }
.choice .delta { color: var(--muted); font-size: .85em; }

/* Suivi de commande, bien visible */
.arrive { background: var(--ok); color: #fff; border-radius: var(--radius); padding: 18px 16px; margin-bottom: 12px;
  font-size: 1.35em; font-weight: 800; text-align: center; animation: pop .5s ease; }
.arrive span { display: block; font-size: .62em; font-weight: 500; margin-top: 4px; opacity: .95; }
@keyframes pop { 0% { transform: scale(.9); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
.track { border-width: 2px; }
.track.nouvelle { border-color: #f3c3b7; }
.track.en_preparation { border-color: #f1d48a; }
.track.prete { border-color: var(--ok); }
.steps { display: grid; grid-template-columns: repeat(4, 1fr); margin: 14px 0 6px; position: relative; }
.steps::before { content: ''; position: absolute; top: 21px; left: 12.5%; right: 12.5%; height: 3px; background: var(--line); z-index: 0; }
.step { text-align: center; position: relative; z-index: 1; }
.step .dot { width: 44px; height: 44px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center;
  background: #fff; border: 3px solid var(--line); font-size: 1.15em; filter: grayscale(1); opacity: .55; }
.step .lbl { font-size: .78em; color: var(--muted); margin-top: 6px; }
.step.done .dot { background: var(--ok); border-color: var(--ok); color: #fff; font-weight: 800; filter: none; opacity: 1; }
.step.now .dot { border-color: var(--accent); background: #fde7e1; filter: none; opacity: 1; transform: scale(1.12); animation: pulse 1.6s ease-in-out infinite; }
.track.prete .step.now .dot { border-color: var(--ok); background: #dcf1e4; }
.step.now .lbl { color: var(--ink); font-weight: 800; font-size: .85em; }
@keyframes pulse { 50% { box-shadow: 0 0 0 7px rgba(181,69,43,.18); } }
@media (prefers-reduced-motion: reduce) { .arrive, .step.now .dot { animation: none; } }
.track-text { margin: 10px 0 0; text-align: center; font-weight: 600; }
.served-line { text-align: center; color: var(--muted); margin: 4px 0 12px; }
.toast { position: fixed; top: 10px; left: 10px; right: 10px; max-width: 700px; margin: 0 auto; z-index: 50;
  background: var(--ok); color: #fff; font-weight: 800; font-size: 1.1em; border-radius: var(--radius);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: center; gap: 10px;
  box-shadow: 0 6px 20px rgba(0,0,0,.25); animation: pop .4s ease; }
.toast button { background: #fff; color: var(--ok); padding: .5em .9em; }

/* ============================================================
   Thème Ô Bellachon (page client) — repris de obellachon.com :
   polices Alice (titres) + Roboto (texte), crème #F5EBDC,
   cartes #FFF7EB, or #BC9450, coins arrondis 13 px.
   ============================================================ */
@font-face { font-family: "Alice"; src: url("/static/fonts/alice-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin-500-normal.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Roboto"; src: url("/static/fonts/roboto-latin-700-normal.woff2") format("woff2"); font-weight: 700; font-display: swap; }

body.theme-blc {
  --bg: #F5EBDC; --card: #FFF7EB; --ink: #1B1714; --muted: #6E6257; --line: #E6D7C0;
  --accent: #BC9450; --accent-ink: #FFF7EB; --radius: 13px;
  font-family: "Roboto", system-ui, sans-serif;
}
.theme-blc h1, .theme-blc h2, .theme-blc h3, .theme-blc .card strong, .theme-blc button, .theme-blc .cats a {
  font-family: "Alice", Georgia, serif; font-weight: 400;
}
.theme-blc .wrap { padding-top: 0; }
/* Bandeau blanc avec le logo, comme l'en-tête du site */
.theme-blc .brandbar { background: #fff; margin: 0 -16px 14px; padding: 10px 16px; display: flex; align-items: center; justify-content: center; box-shadow: 0 1px 0 var(--line); }
.theme-blc .brandbar img { height: 74px; width: auto; display: block; }
.theme-blc .brandbar h1 { margin: 6px 0; font-size: 2rem; color: var(--accent); }
.theme-blc h2 { font-size: 1.7rem; margin-top: 26px; }
.theme-blc .card { border-color: var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(64, 28, 16, .06); }
.theme-blc .card strong { font-size: 1.15rem; letter-spacing: .01em; }
.theme-blc button { border-radius: var(--radius); letter-spacing: .02em; }
.theme-blc button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.theme-blc .qty button { border-radius: 50%; font-family: "Roboto", sans-serif; font-weight: 700; }
.theme-blc .cats { background: var(--bg); }
.theme-blc .cats a { background: var(--card); border-color: var(--line); font-size: 1.02rem; }
.theme-blc .cats a:active { background: var(--accent); color: var(--accent-ink); }
.theme-blc .cartbar { background: var(--ink); }
.theme-blc .cartbar button { background: var(--accent); color: var(--accent-ink); }
.theme-blc .choice { background: var(--card); border-color: var(--line); }
.theme-blc .choice:has(input:checked) { border-color: var(--accent); background: #F3E3C6; color: #7A5A22; }
.theme-blc .choice input { accent-color: var(--accent); }
.theme-blc input, .theme-blc textarea { border-radius: 10px; border-color: var(--line); background: #fff; }
.theme-blc .error { color: #A63D2A; }
.theme-blc .receipt h2 { color: var(--ink); }
.theme-blc .pay-banner.todo { background: #F3E3C6; color: #7A5A22; }
.theme-blc .pay-banner.done { background: #E3EEDB; color: #2F6B3A; }
.theme-blc .brandbar img[hidden] { display: none; }
.theme-blc .track { border-radius: var(--radius); }
.receipt-logo { display: block; height: 64px; margin: 0 auto 4px; }
/* Cartes QR imprimables : logo du restaurant en tête */
.qr-card .qr-logo { width: 55%; margin: 4px auto 0; display: block; }
.qr-card strong { font-family: "Alice", Georgia, serif; font-weight: 400; }
@font-face { font-family: "Alice"; src: url("/static/fonts/alice-latin-400-normal.woff2") format("woff2"); font-weight: 400; font-display: swap; }
.saved { font-size: .85em; margin-right: 10px; }
.saved.ok { color: var(--ok); }
.saved.bad { color: var(--accent); font-weight: 700; }
.save-btn { margin-left: 10px; padding: .45em .9em; font-size: .9em; }

/* ============================================================
   Thème Ô Bellachon — écrans du personnel (cuisine, salle, gestion).
   Mêmes couleurs que le site, mais lisibilité d'abord : grands
   numéros de table, couleurs d'état bien distinctes.
   ============================================================ */
body.theme-staff {
  --bg: #F5EBDC; --card: #FFF7EB; --ink: #1B1714; --muted: #6E6257; --line: #E6D7C0;
  --accent: #BC9450; --accent-ink: #FFF7EB; --radius: 13px;
  --new: #B5452B; --warn: #A87A2E; --ok: #2F7D4F; --info: #6E6257;
  font-family: "Roboto", system-ui, sans-serif;
}
.theme-staff h2, .theme-staff h3, .theme-staff .ticket .table, .theme-staff .topbar strong { font-family: "Alice", Georgia, serif; font-weight: 400; }
.theme-staff .topbar { background: #140E0D; color: #F5EBDC; padding: 8px 16px; }
.theme-staff .topbar a { color: #F5EBDC; }
.theme-staff .topbar .brand { display: flex; align-items: center; gap: 12px; }
.theme-staff .topbar strong { font-size: 1.35rem; }
.theme-staff .topbar .count { font-family: "Roboto", sans-serif; font-size: .7em; background: var(--accent); color: #140E0D; border-radius: 99px; padding: .15em .7em; margin-left: 8px; vertical-align: middle; }
.theme-staff .topbar .hint { font-size: .85em; opacity: .7; }
.topbar-logo { height: 46px; background: #fff; border-radius: 10px; padding: 3px 6px; display: block; }
.theme-staff .topbar .logout { margin-left: 14px; padding: .35em .9em; font-size: .9em; background: transparent; color: #F5EBDC; border: 1px solid #F5EBDC66; }
.theme-staff button { border-radius: var(--radius); letter-spacing: .02em; }
.theme-staff button.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.theme-staff .card { border-color: var(--line); }
.theme-staff .wrap h2 { font-size: 1.6rem; margin-top: 22px; }
/* Tickets : fond crème, bandeau d'état coloré en haut */
.theme-staff .ticket { background: var(--card); border: 1px solid var(--line); border-top: 7px solid var(--new); box-shadow: 0 2px 6px rgba(64, 28, 16, .08); }
.theme-staff .ticket.en_preparation { border-top-color: var(--warn); }
.theme-staff .ticket.prete { border-top-color: var(--ok); }
.theme-staff .ticket.servie { border-top-color: var(--info); }
.theme-staff .ticket .table { font-size: 2rem; }
.theme-staff .ticket li .c { color: var(--new); }
.theme-staff .ticket li .o { color: #7A5A22; }
.theme-staff .ticket .error { color: var(--new); }
.theme-staff .b-nouvelle { background: #F6DDD5; color: var(--new); }
.theme-staff .b-en_preparation { background: #F3E3C6; color: #7A5A22; }
.theme-staff .b-prete { background: #DCEBDD; color: var(--ok); }
.theme-staff .b-servie, .theme-staff .b-a_payer { background: #EDE3D6; color: var(--muted); }
.theme-staff .b-payee { background: #DCEBDD; color: var(--ok); }
.theme-staff .flash { animation: flash-blc 1s ease 3; }
@keyframes flash-blc { 50% { box-shadow: 0 0 0 7px rgba(188, 148, 80, .55); } }
.theme-staff .ticket button { font-size: 1.05em; padding: .8em; }
@media print { .theme-staff, .theme-staff .qr-card { background: #fff !important; } }
.theme-staff input[type=checkbox] { accent-color: var(--accent); width: 18px; height: 18px; }
.theme-staff .ticket.en_preparation button { background: var(--ok); color: #fff; } /* « Prête » en vert */
/* Boissons servies par la salle : bandeau bleu nuit, bien distinct des plats */
.theme-staff .ticket.boissons { border-top-color: #2D5F9A; }
.theme-staff .ticket.boissons .badge { background: #DDE7F3; color: #2D5F9A; }
.theme-staff .ticket.boissons button { background: #2D5F9A; color: #fff; }
