/* =========================================================================
   GOLD CAFÉ — Interface de caisse
   Charte : vert profond (logo) · doré · blanc
   ========================================================================= */
:root {
  --green-950: #061a10;
  --green-900: #0b3220;
  --green-850: #0d3a25;
  --green-800: #10432b;
  --green-700: #155534;
  --green-600: #1c6b42;
  --green-500: #23874f;
  --green-soft: #e6f2ea;

  --gold: #f2a71b;
  --gold-600: #dc9008;
  --gold-700: #b87406;
  --gold-200: #fbe0a6;
  --gold-100: #fdf3dc;

  --cream: #f6f3ea;
  --cream-2: #eee9db;
  --ink: #15211a;
  --ink-2: #4a5a50;
  --ink-3: #8a968e;
  --line: #e3ddcc;
  --danger: #c2412d;
  --danger-soft: #fbe9e5;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(11, 50, 32, .06), 0 1px 1px rgba(11, 50, 32, .04);
  --shadow: 0 6px 18px -6px rgba(11, 50, 32, .18), 0 2px 4px rgba(11, 50, 32, .05);
  --shadow-lg: 0 24px 60px -18px rgba(6, 26, 16, .45);

  --font-ui: "Manrope", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --font-logo: "Cinzel", "Trajan Pro", Georgia, serif;

  --topbar-h: 76px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font-ui);
  color: var(--ink);
  background: var(--cream);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; touch-action: manipulation; }
a { touch-action: manipulation; }
input { font: inherit; }
svg { display: block; }
[hidden] { display: none !important; }

#app { height: 100vh; height: 100dvh; display: flex; flex-direction: column; }

/* ---------- Logo SVG ---------- */
.logo-gold { font-family: var(--font-logo); font-weight: 600; font-size: 150px; fill: #fff; }
.logo-cafe { font-family: var(--font-logo); font-weight: 500; font-size: 52px; fill: #fff; }
.logo-wave { fill: var(--gold); }
.logo.dark .logo-gold, .logo.dark .logo-cafe { fill: var(--green-900); }

/* ---------- Topbar ---------- */
.topbar {
  height: var(--topbar-h);
  flex: none;
  display: flex; align-items: center; gap: 28px;
  padding: 0 24px;
  background:
    radial-gradient(120% 180% at 0% 0%, #13472d 0%, transparent 55%),
    linear-gradient(180deg, var(--green-900), var(--green-950));
  color: #fff;
  position: relative; z-index: 20;
  box-shadow: 0 2px 0 rgba(242, 167, 27, .55), 0 10px 30px -10px rgba(0,0,0,.5);
}
.brand { display: flex; align-items: center; text-decoration: none; }
.brand .logo { height: 54px; width: auto; }
.topnav { display: flex; gap: 6px; margin-left: 8px; }
.topnav a {
  display: flex; align-items: center; gap: 9px;
  padding: 10px 16px; border-radius: 999px;
  color: rgba(255,255,255,.72); text-decoration: none; font-weight: 600; font-size: 14.5px;
  transition: background .2s, color .2s;
}
.topnav a svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.topnav a:hover { color: #fff; background: rgba(255,255,255,.06); }
.topnav a.active { color: var(--green-950); background: var(--gold); }

.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 18px; position: relative; }
.cashier { display: flex; align-items: center; gap: 10px; }
.cashier .avatar {
  width: 38px; height: 38px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 800; font-size: 13px;
  background: rgba(242,167,27,.14); color: var(--gold); border: 1px solid rgba(242,167,27,.45);
}
.cashier strong, .clock strong { display: block; font-size: 14px; }
.cashier small, .clock small { display: block; font-size: 12px; color: rgba(255,255,255,.6); }
.clock { text-align: right; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.12); }
.clock strong { font-size: 20px; letter-spacing: .5px; font-variant-numeric: tabular-nums; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center;
  background: rgba(255,255,255,.06); transition: background .2s;
}
.icon-btn:hover { background: rgba(255,255,255,.12); }
.icon-btn svg { width: 20px; height: 20px; fill: currentColor; }
.dropdown {
  position: absolute; right: 0; top: calc(100% + 10px);
  background: #fff; color: var(--ink); border-radius: 14px; padding: 6px; min-width: 270px;
  box-shadow: var(--shadow-lg); animation: pop .16s ease-out;
}
.dropdown button {
  width: 100%; display: flex; align-items: center; gap: 10px; text-align: left;
  padding: 12px 12px; border-radius: 10px; font-weight: 600; font-size: 14px;
}
.dropdown button:hover { background: var(--cream); }
.dropdown svg { width: 18px; height: 18px; fill: none; stroke: var(--green-700); stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- View ---------- */
.view { flex: 1; min-height: 0; position: relative; }
.screen { height: 100%; animation: slideIn .28s ease-out; }

/* ======================= TABLEAU DE BORD ======================= */
.dash { height: 100%; overflow: auto; padding: 28px 32px 40px; }
.dash-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 22px; }
.eyebrow { text-transform: uppercase; letter-spacing: 2.4px; font-size: 11.5px; font-weight: 700; color: var(--gold-700); margin: 0 0 6px; }
.dash-head h1, .page-title {
  font-family: var(--font-display); font-weight: 600; font-size: 40px; line-height: 1; margin: 0; color: var(--green-900);
}
.dash-head p.sub { margin: 8px 0 0; color: var(--ink-2); font-size: 14.5px; }

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 26px; }
.stat {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm);
}
.stat .ico { width: 46px; height: 46px; border-radius: 13px; display: grid; place-items: center; flex: none; }
.stat .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.stat .ico.g { background: var(--green-soft); color: var(--green-600); }
.stat .ico.o { background: var(--gold-100); color: var(--gold-700); }
.stat .ico.d { background: var(--green-900); color: var(--gold); }
.stat small { display: block; color: var(--ink-3); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .8px; }
.stat strong { display: block; font-size: 24px; font-weight: 800; color: var(--green-900); margin-top: 2px; font-variant-numeric: tabular-nums; }
.stat strong span { font-size: 14px; font-weight: 700; color: var(--ink-3); margin-left: 3px; }

.segmented { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 4px; box-shadow: var(--shadow-sm); }
.segmented button { padding: 10px 18px; border-radius: 999px; font-weight: 700; font-size: 14px; color: var(--ink-2); display: flex; align-items: center; gap: 8px; }
.segmented button .dot { width: 8px; height: 8px; border-radius: 50%; }
.segmented button.active { background: var(--green-900); color: #fff; }
.dot.free { background: var(--green-500); }
.dot.busy { background: var(--gold); }

.tables-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 18px; }
.tcard {
  position: relative; text-align: left;
  background: #fff; border-radius: 20px; padding: 18px 18px 16px;
  border: 1.5px solid var(--line);
  min-height: 200px; display: flex; flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s;
  overflow: hidden;
}
.tcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.tcard:active { transform: translateY(0) scale(.985); }
.tcard::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 5px; background: var(--green-500); }
.tcard.busy {
  border-color: var(--gold-200);
  background: linear-gradient(165deg, #fffaf0 0%, #fff 55%);
}
.tcard.busy::before { background: linear-gradient(90deg, var(--gold), var(--gold-600)); }
.tcard-top { display: flex; justify-content: space-between; align-items: flex-start; }
.tcard .tlabel { font-size: 12px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: 1.6px; }
.tcard .tnum { font-family: var(--font-display); font-weight: 700; font-size: 54px; line-height: .95; color: var(--green-900); margin-top: 2px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 11px; border-radius: 999px; font-size: 12px; font-weight: 800; letter-spacing: .3px;
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; }
.pill.free { background: var(--green-soft); color: var(--green-600); }
.pill.busy { background: var(--gold-100); color: var(--gold-700); }
.pill.busy .dot { animation: pulse 1.8s infinite; }
.tcard-body { margin-top: auto; padding-top: 14px; }
.tcard .amount { font-size: 26px; font-weight: 800; color: var(--green-900); font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.tcard .amount span { font-size: 14px; color: var(--gold-700); margin-left: 3px; }
.tcard .meta { display: flex; gap: 12px; margin-top: 8px; color: var(--ink-2); font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.tcard .meta span { display: inline-flex; align-items: center; gap: 5px; }
.tcard .meta svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tcard .free-cta {
  display: flex; align-items: center; gap: 8px; color: var(--green-600); font-weight: 800; font-size: 14px;
  padding: 11px 13px; border-radius: 12px; background: var(--green-soft); border: 1.5px dashed rgba(35,135,79,.35);
}
.tcard .free-cta svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.tcard .chairs { position: absolute; right: -18px; bottom: -18px; width: 110px; height: 110px; opacity: .06; color: var(--green-900); }
.tcard.busy .chairs { color: var(--gold-700); opacity: .08; }

.legend { display: flex; gap: 20px; color: var(--ink-2); font-size: 13px; font-weight: 600; margin-top: 22px; }
.legend span { display: inline-flex; align-items: center; gap: 8px; }
.legend .dot { width: 10px; height: 10px; border-radius: 50%; }

/* ======================= PRISE DE COMMANDE ======================= */
.order { height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 420px; grid-template-rows: minmax(0, 1fr); }
.catalog { min-width: 0; display: flex; flex-direction: column; height: 100%; }
.order-head {
  display: flex; align-items: center; gap: 16px; padding: 18px 26px 12px; flex-wrap: wrap;
}
.back-btn { text-decoration: none;
  display: inline-flex; align-items: center; gap: 8px; height: 46px; padding: 0 16px 0 12px;
  border-radius: 12px; background: #fff; border: 1px solid var(--line); font-weight: 700; color: var(--green-900);
  box-shadow: var(--shadow-sm); transition: background .15s;
}
.back-btn:hover { background: var(--cream-2); }
.back-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.order-title { display: flex; align-items: center; gap: 12px; }
.order-title h2 { font-family: var(--font-display); font-size: 34px; margin: 0; color: var(--green-900); font-weight: 700; line-height: 1; }
.search {
  margin-left: auto; position: relative; flex: 0 1 320px; min-width: 170px;
}
.search input {
  width: 100%; height: 46px; border-radius: 12px; border: 1px solid var(--line); background: #fff;
  padding: 0 14px 0 42px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
.search input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px rgba(242,167,27,.18); }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 18px; height: 18px; fill: none; stroke: var(--ink-3); stroke-width: 2; stroke-linecap: round; }

.cats { display: flex; gap: 8px; padding: 4px 26px 14px; overflow-x: auto; scrollbar-width: none; flex: none; }
.cats::-webkit-scrollbar { display: none; }
.cat {
  flex: none; height: 44px; padding: 0 18px; border-radius: 999px; font-weight: 700; font-size: 14px;
  background: #fff; border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap;
  transition: all .15s;
}
.cat:hover { border-color: var(--gold-200); color: var(--green-900); }
.cat.active { background: var(--green-900); border-color: var(--green-900); color: #fff; box-shadow: 0 6px 14px -6px rgba(11,50,32,.6); }
.cat .count { display: inline-block; margin-left: 6px; font-size: 12px; opacity: .55; }

.products { flex: 1; min-height: 0; overflow: auto; padding: 4px 26px 30px; }
.products-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(176px, 1fr)); gap: 16px; }
.section-label { grid-column: 1 / -1; font-family: var(--font-display); font-weight: 700; font-size: 22px; color: var(--green-900); margin: 10px 0 -4px; display: flex; align-items: center; gap: 12px; }
.section-label::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.pcard {
  position: relative; text-align: left; background: #fff; border-radius: 18px; overflow: hidden;
  border: 1px solid var(--line); box-shadow: var(--shadow-sm);
  transition: transform .15s ease, box-shadow .15s ease, border-color .15s;
  display: flex; flex-direction: column;
}
.pcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); border-color: var(--gold-200); }
.pcard:active { transform: scale(.97); }
.pcard .ph { position: relative; aspect-ratio: 4 / 3; background: linear-gradient(135deg, #efe9da, #e2dac6); overflow: hidden; }
.pcard .ph img { position: relative; z-index: 1; width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .4s ease; }
.pcard:hover .ph img { transform: scale(1.06); }
.pcard .ph .fallback { position: absolute; inset: 0; display: grid; place-items: center; color: var(--green-700); font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; padding: 10px; }
.pcard .info { padding: 11px 13px 13px; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.pcard .name { font-weight: 700; font-size: 14.5px; line-height: 1.25; color: var(--ink); }
.pcard .price { font-weight: 800; font-size: 15px; color: var(--green-700); white-space: nowrap; margin-top: 3px; display: block; }
.pcard .add {
  flex: none; width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center;
  background: var(--gold); color: var(--green-950); box-shadow: 0 4px 10px -4px rgba(220,144,8,.8);
}
.pcard .add svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.pcard .qty-badge {
  position: absolute; top: 10px; right: 10px; min-width: 30px; height: 30px; padding: 0 8px; border-radius: 999px;
  background: var(--green-900); color: var(--gold); font-weight: 800; font-size: 14px; display: grid; place-items: center;
  box-shadow: 0 4px 12px rgba(0,0,0,.25); border: 2px solid #fff;
}
.pcard.bump { animation: bump .35s ease; }
.pcard .flash { position: absolute; inset: 0; background: rgba(242,167,27,.28); opacity: 0; pointer-events: none; }
.pcard.bump .flash { animation: flash .45s ease; }
.empty-search { grid-column: 1/-1; text-align: center; padding: 60px 0; color: var(--ink-3); font-weight: 600; }

/* ---------- Panier ---------- */
.cart {
  height: 100%; min-height: 0; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--green-900) 0%, var(--green-950) 100%);
  color: #fff; position: relative;
  box-shadow: -12px 0 40px -20px rgba(6,26,16,.6);
}
.cart-head { padding: 20px 22px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.cart-head .row { display: flex; align-items: center; justify-content: space-between; }
.cart-head h3 { margin: 0; font-family: var(--font-display); font-size: 28px; font-weight: 700; display: flex; align-items: baseline; gap: 10px; }
.cart-head h3 small { font-family: var(--font-ui); font-size: 13px; font-weight: 600; color: rgba(255,255,255,.55); }
.cart-head .sub { margin-top: 8px; display: flex; gap: 14px; color: rgba(255,255,255,.62); font-size: 13px; font-weight: 600; flex-wrap: wrap; }
.cart-head .sub span { display: inline-flex; align-items: center; gap: 6px; }
.cart-head .sub svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.save-state { font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; }
.save-state.saved { background: rgba(35,135,79,.25); color: #8fe0b0; }
.save-state.dirty { background: rgba(242,167,27,.18); color: var(--gold); }

.cart-lines { flex: 1; min-height: 0; overflow: auto; padding: 10px 14px; }
.cart-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: rgba(255,255,255,.55); padding: 30px; gap: 12px; }
.cart-empty svg { width: 64px; height: 64px; fill: none; stroke: rgba(242,167,27,.6); stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.cart-empty strong { color: #fff; font-size: 16px; }
.line {
  display: grid; grid-template-columns: 52px minmax(0,1fr) auto; gap: 12px; align-items: center;
  padding: 10px 8px; border-radius: 14px; transition: background .2s;
}
.line + .line { border-top: 1px solid rgba(255,255,255,.06); }
.line:hover { background: rgba(255,255,255,.04); }
.line.hl { animation: hl .7s ease; }
.line .thumb { width: 52px; height: 52px; border-radius: 12px; object-fit: cover; background: rgba(255,255,255,.08); }
.line .lname { font-weight: 700; font-size: 14.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line .lunit { font-size: 12.5px; color: rgba(255,255,255,.55); margin-top: 2px; font-weight: 600; }
.line .controls { display: flex; align-items: center; gap: 6px; margin-top: 8px; }
.qbtn {
  width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center;
  background: rgba(255,255,255,.09); color: #fff; transition: background .15s, transform .1s;
}
.qbtn:hover { background: rgba(255,255,255,.18); }
.qbtn:active { transform: scale(.9); }
.qbtn.plus { background: var(--gold); color: var(--green-950); }
.qbtn.plus:hover { background: #f8b93d; }
.qbtn svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.6; stroke-linecap: round; }
.qval { min-width: 28px; text-align: center; font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }
.line .right { text-align: right; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.line .lsub { font-weight: 800; font-size: 15.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.del { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: rgba(255,255,255,.5); transition: all .15s; }
.del:hover { background: rgba(194,65,45,.22); color: #ff9c8a; }
.del svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.cart-foot { padding: 16px 20px 20px; border-top: 1px solid rgba(255,255,255,.08); background: rgba(0,0,0,.14); }
.sum-row { display: flex; justify-content: space-between; color: rgba(255,255,255,.7); font-weight: 600; font-size: 14px; padding: 3px 0; }
.sum-row b { color: #fff; font-variant-numeric: tabular-nums; }
.total-row { display: flex; justify-content: space-between; align-items: baseline; margin: 10px 0 16px; padding-top: 12px; border-top: 1px dashed rgba(255,255,255,.16); }
.total-row span { font-weight: 700; font-size: 15px; text-transform: uppercase; letter-spacing: 1.4px; color: rgba(255,255,255,.8); }
.total-row strong { font-size: 34px; font-weight: 800; color: var(--gold); font-variant-numeric: tabular-nums; letter-spacing: -.5px; }
.total-row strong small { font-size: 17px; margin-left: 4px; }
.total-row.tick strong { animation: tick .35s ease; }
.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.btn {
  height: 52px; border-radius: 13px; font-weight: 800; font-size: 15px;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 16px;
  transition: transform .1s, background .15s, opacity .15s, box-shadow .15s;
}
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .4; pointer-events: none; }
.btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2.1; stroke-linecap: round; stroke-linejoin: round; }
.btn-gold { background: linear-gradient(180deg, #f6b432, var(--gold-600)); color: var(--green-950); box-shadow: 0 10px 22px -10px rgba(242,167,27,.9), inset 0 1px 0 rgba(255,255,255,.35); }
.btn-gold:hover { background: linear-gradient(180deg, #f8bf4f, #e59a12); }
.btn-light { background: #fff; color: var(--green-900); }
.btn-light:hover { background: #f1efe7; }
.btn-ghost { background: rgba(255,255,255,.07); color: rgba(255,255,255,.88); }
.btn-ghost:hover { background: rgba(194,65,45,.2); color: #ffb4a6; }
.btn-green { background: var(--green-900); color: #fff; }
.btn-green:hover { background: var(--green-800); }
.btn-outline { background: #fff; color: var(--green-900); border: 1.5px solid var(--line); }
.btn-outline:hover { border-color: var(--green-700); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a93623; }
.btn-wide { grid-column: 1 / -1; height: 58px; font-size: 16px; }

.cart-fab { display: none; }
.cart-close { display: none; width: 36px; height: 36px; border-radius: 10px; place-items: center; background: rgba(255,255,255,.08); color: #fff; }
.cart-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

/* ======================= MODALES ======================= */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(6, 26, 16, .55); backdrop-filter: blur(6px);
  display: grid; place-items: center; padding: 20px; animation: fadeIn .18s ease-out;
}
.modal {
  background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); width: min(460px, 100%);
  max-height: calc(100dvh - 40px); overflow: auto; animation: pop .22s cubic-bezier(.2,.9,.3,1.2);
}
.modal.wide { width: min(880px, 100%); }
.confirm { padding: 28px 28px 24px; text-align: center; }
.confirm .cicon { width: 64px; height: 64px; border-radius: 50%; margin: 0 auto 16px; display: grid; place-items: center; }
.confirm .cicon svg { width: 30px; height: 30px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.confirm .cicon.warn { background: var(--danger-soft); color: var(--danger); }
.confirm .cicon.gold { background: var(--gold-100); color: var(--gold-700); }
.confirm .cicon.ok { background: var(--green-soft); color: var(--green-600); }
.confirm h3 { margin: 0 0 8px; font-family: var(--font-display); font-size: 28px; color: var(--green-900); }
.confirm p { margin: 0 0 22px; color: var(--ink-2); line-height: 1.5; }
.confirm .btns { display: flex; gap: 10px; }
.confirm .btns .btn { flex: 1; }

/* ---------- Ticket ---------- */
.ticket-modal { display: grid; grid-template-columns: minmax(0, 1fr) 300px; }
.ticket-stage {
  background: repeating-linear-gradient(45deg, #ece6d6 0 12px, #e7e0cf 12px 24px);
  padding: 30px 20px; display: flex; justify-content: center; align-items: flex-start;
  border-radius: 22px 0 0 22px; max-height: calc(100dvh - 40px); overflow: auto;
}
.ticket-side { padding: 26px 24px; display: flex; flex-direction: column; gap: 12px; }
.ticket-side h3 { margin: 0; font-family: var(--font-display); font-size: 30px; color: var(--green-900); line-height: 1.05; }
.ticket-side p { margin: 0 0 6px; color: var(--ink-2); font-size: 14px; line-height: 1.5; }
.ticket-side .tot { background: var(--cream); border-radius: 14px; padding: 14px 16px; margin: 4px 0 8px; }
.ticket-side .tot small { display: block; color: var(--ink-3); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; }
.ticket-side .tot strong { font-size: 30px; color: var(--green-900); font-weight: 800; font-variant-numeric: tabular-nums; }
.ticket-side .btn { width: 100%; }
.ticket-side .spacer { flex: 1; }
.ticket-side .close-x { align-self: flex-end; margin: -10px -8px 0 0; width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; color: var(--ink-3); }
.ticket-side .close-x:hover { background: var(--cream); color: var(--ink); }
.ticket-side .close-x svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }

.receipt {
  width: 320px; background: #fff; color: #111; padding: 22px 20px 26px;
  font-family: "Manrope", sans-serif; font-size: 12.5px; position: relative;
  box-shadow: 0 18px 40px -16px rgba(0,0,0,.35);
  --zig: radial-gradient(circle at 6px 0, transparent 6px, #fff 6.5px);
}
.receipt::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -10px; height: 10px;
  background: radial-gradient(circle at 7px -1px, transparent 7px, #fff 7.5px) repeat-x; background-size: 14px 10px;
}
.receipt .r-logo { background: var(--green-900); border-radius: 10px; padding: 14px 10px 10px; margin-bottom: 12px; }
.receipt .r-logo svg { width: 170px; margin: 0 auto; }
.receipt .center { text-align: center; }
.receipt .r-name { font-family: var(--font-logo); font-weight: 700; letter-spacing: 3px; font-size: 15px; }
.receipt .r-addr { color: #555; font-size: 11px; margin-top: 2px; }
.receipt .hr { border-top: 1.5px dashed #bbb; margin: 12px 0; }
.receipt .r-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 11.5px; }
.receipt .r-meta .r { text-align: right; }
.receipt .r-table { font-family: var(--font-display); font-size: 22px; font-weight: 700; text-align: center; margin: 4px 0 0; }
.receipt table { width: 100%; border-collapse: collapse; }
.receipt th { font-size: 10.5px; text-transform: uppercase; letter-spacing: .6px; color: #666; font-weight: 700; text-align: left; padding-bottom: 6px; }
.receipt td { padding: 4px 0; vertical-align: top; font-variant-numeric: tabular-nums; }
.receipt .num { text-align: right; white-space: nowrap; }
.receipt .qty { text-align: center; width: 30px; }
.receipt .iname { font-weight: 700; }
.receipt .totals .row { display: flex; justify-content: space-between; padding: 2px 0; }
.receipt .grand { display: flex; justify-content: space-between; align-items: baseline; background: #111; color: #fff; padding: 10px 12px; border-radius: 6px; margin-top: 8px; }
.receipt .grand span { font-weight: 700; letter-spacing: 1px; font-size: 12px; }
.receipt .grand strong { font-size: 20px; font-weight: 800; }
.receipt .thanks { text-align: center; margin-top: 16px; font-family: var(--font-display); font-size: 17px; font-weight: 700; font-style: italic; }
.receipt .foot { text-align: center; color: #777; font-size: 10.5px; margin-top: 6px; }
.receipt .barcode { height: 34px; margin: 12px auto 0; width: 80%; background: repeating-linear-gradient(90deg, #111 0 2px, transparent 2px 4px, #111 4px 5px, transparent 5px 8px, #111 8px 11px, transparent 11px 12px); }

/* ======================= HISTORIQUE ======================= */
.history { height: 100%; overflow: auto; padding: 28px 32px 40px; }
.hist-table { width: 100%; background: #fff; border-radius: var(--radius); border: 1px solid var(--line); border-collapse: separate; border-spacing: 0; overflow: hidden; box-shadow: var(--shadow-sm); margin-top: 20px; }
.hist-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-3); padding: 14px 18px; background: #faf8f2; border-bottom: 1px solid var(--line); }
.hist-table td { padding: 14px 18px; border-bottom: 1px solid var(--line); font-weight: 600; font-variant-numeric: tabular-nums; }
.hist-table tr:last-child td { border-bottom: 0; }
.hist-table tbody tr { cursor: pointer; transition: background .15s; }
.hist-table tbody tr:hover { background: var(--gold-100); }
.hist-table .amt { font-weight: 800; color: var(--green-900); text-align: right; }
.hist-empty { text-align: center; padding: 70px 20px; color: var(--ink-3); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); margin-top: 20px; }
.hist-empty svg { width: 54px; height: 54px; margin: 0 auto 12px; fill: none; stroke: var(--gold); stroke-width: 1.4; }

/* ======================= TOASTS ======================= */
.toasts { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: center; pointer-events: none; }
.toast {
  display: flex; align-items: center; gap: 12px; padding: 13px 18px 13px 14px; border-radius: 14px;
  background: var(--green-950); color: #fff; font-weight: 700; font-size: 14.5px; box-shadow: var(--shadow-lg);
  border: 1px solid rgba(242,167,27,.35); animation: toastIn .3s cubic-bezier(.2,.9,.3,1.2);
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast .ti { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--gold); color: var(--green-950); flex: none; }
.toast .ti svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2.8; stroke-linecap: round; stroke-linejoin: round; }
.toast.warn .ti { background: #ff8f7a; }

/* ======================= ANIMATIONS ======================= */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { transform: translateY(8px); } to { transform: none; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes bump { 0% { transform: scale(1); } 40% { transform: scale(.95); } 100% { transform: scale(1); } }
@keyframes flash { 0% { opacity: 1; } 100% { opacity: 0; } }
@keyframes hl { 0% { background: rgba(242,167,27,.35); } 100% { background: transparent; } }
@keyframes tick { 0% { transform: scale(1); } 40% { transform: scale(1.08); } 100% { transform: scale(1); } }
@keyframes pulse { 0%,100% { box-shadow: 0 0 0 0 rgba(242,167,27,.6); } 50% { box-shadow: 0 0 0 5px rgba(242,167,27,0); } }
@keyframes toastIn { from { opacity: 0; transform: translateY(14px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(10px); } }

/* ======================= RESPONSIVE ======================= */
@media (max-width: 1380px) {
  .tables-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .order { grid-template-columns: minmax(0, 1fr) 380px; }
}
@media (max-width: 1180px) {
  .cashier { display: none; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tables-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .products-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
}
@media (max-width: 920px) {
  :root { --topbar-h: 66px; }
  .topbar { gap: 14px; padding: 0 14px; }
  .brand .logo { height: 44px; }
  .topnav a { padding: 9px 12px; font-size: 13.5px; }
  .topnav a svg { display: none; }
  .clock { display: none; }
  .dash, .history { padding: 20px 16px 110px; }
  .tables-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .order { grid-template-columns: 1fr; }
  .order-head { padding: 14px 16px 10px; }
  .cats { padding: 2px 16px 12px; }
  .products { padding: 4px 16px 110px; }
  .search { flex: 1 1 100%; margin-left: 0; order: 3; }
  .cart {
    position: fixed; left: 0; right: 0; bottom: 0; height: 86dvh; z-index: 60;
    border-radius: 24px 24px 0 0; transform: translateY(105%); transition: transform .32s cubic-bezier(.2,.8,.2,1);
  }
  .cart.open { transform: none; }
  .cart-close { display: grid; }
  .cart-fab {
    display: flex; position: fixed; left: 14px; right: 14px; bottom: 14px; z-index: 55; height: 62px;
    border-radius: 16px; align-items: center; justify-content: space-between; padding: 0 20px;
    background: var(--green-900); color: #fff; font-weight: 800; box-shadow: var(--shadow-lg);
    border: 1px solid rgba(242,167,27,.4);
  }
  .cart-fab b { color: var(--gold); font-size: 20px; }
  .cart-scrim { position: fixed; inset: 0; background: rgba(6,26,16,.45); z-index: 58; }
}
@media (max-width: 760px) {
  .ticket-modal { grid-template-columns: 1fr; }
  .ticket-stage { border-radius: 22px 22px 0 0; max-height: none; }
}
@media (max-width: 560px) {
  .stats { gap: 10px; }
  .stat { padding: 14px; gap: 12px; }
  .stat .ico { width: 38px; height: 38px; }
  .stat strong { font-size: 19px; }
  .tcard { min-height: 170px; padding: 14px; }
  .tcard .tnum { font-size: 42px; }
  .tcard .amount { font-size: 21px; }
  .dash-head h1, .page-title { font-size: 32px; }
  .topnav a[data-nav="historique"] { font-size: 0; padding: 9px 11px; }
  .topnav a[data-nav="historique"] svg { display: block; width: 18px; height: 18px; }
  .receipt { width: 290px; }
}

/* ======================= IMPRESSION ======================= */
#print-area { display: none; }
@media print {
  @page { size: 80mm auto; margin: 0; }
  html, body { background: #fff !important; overflow: visible !important; height: auto !important; }
  #app, .modal-backdrop, .toasts { display: none !important; }
  #print-area { display: block !important; }
  #print-area .receipt { width: 80mm; box-shadow: none; padding: 4mm 4mm 6mm; margin: 0; }
  #print-area .receipt::after { display: none; }
  #print-area .r-logo { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  #print-area .grand { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
