/* ============================================================
   Bar Leonardi — Palmare · tema moderno minimal
   Bianco / inchiostro / rosso caffè / tipo Archivo
   ============================================================ */

:root {
  --bg: #f5f4f1;
  --surface: #ffffff;
  --surface-2: #f1efe9;
  --line: #e6e3da;
  --line-strong: #d9d5c8;
  --ink: #17130d;
  --ink-dim: #48423a;
  --muted: #7b7468;
  --faint: #b6b0a3;
  --brand: #e0222b;
  --brand-deep: #b8121b;
  --dark: #17130d;
  --paper: #fffdf9;
  --good: #2f9e63;
  --danger: #e0222b;
  --radius: 12px;
  --shadow-sm: 0 1px 2px rgba(20, 16, 10, 0.05);
  --shadow-lg: 0 18px 44px -20px rgba(20, 16, 10, 0.35);

  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-tap-highlight-color: transparent; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Archivo", system-ui, sans-serif;
  min-height: 100vh;
  padding: calc(58px + var(--sat)) var(--sal) calc(120px + var(--sab)) var(--sar);
  position: relative;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed; inset: 0; z-index: -2;
  background:
    radial-gradient(600px 360px at 85% -10%, rgba(224, 34, 43, 0.06), transparent 60%),
    linear-gradient(180deg, #faf9f6 0%, var(--bg) 40%);
}

/* ---------- header ---------- */
.topbar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(58px + var(--sat));
  padding: var(--sat) 16px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: rgba(250, 249, 246, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 36px; height: 36px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 4px;
  border: 1px solid var(--line);
  box-shadow: 0 4px 12px -4px rgba(20, 16, 10, 0.25);
}
.brand-name {
  font-size: 1.14rem; font-weight: 800; letter-spacing: -0.3px; line-height: 1;
}
.brand-sub {
  font-size: 0.58rem; color: var(--muted); letter-spacing: 1.8px;
  text-transform: uppercase; font-weight: 600; margin-top: 3px;
}
.clock { text-align: right; font-family: "IBM Plex Mono", monospace; line-height: 1.25; }
.clock #clock-time { font-size: 0.98rem; font-weight: 600; color: var(--ink); }
.clock #clock-date { display: block; font-size: 0.58rem; color: var(--muted); letter-spacing: 1px; text-transform: uppercase; }

.topbar-right { display: flex; align-items: center; gap: 14px; }
.voice-btn {
  position: relative;
  width: 44px; height: 44px;
  display: grid; place-items: center;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink);
  border-radius: 14px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.voice-btn:active { transform: scale(0.92); }
.voice-btn.is-listening {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  animation: mic-pulse 1.15s ease-in-out infinite;
}
@keyframes mic-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224, 34, 43, 0.55); }
  50% { box-shadow: 0 0 0 10px rgba(224, 34, 43, 0); }
}

.voice-panel {
  position: fixed; top: 0; left: 0; right: 0;
  margin: 0 auto;
  max-width: 560px;
  z-index: 60;
  background: #14110c;
  color: #fff;
  border-radius: 0 0 22px 22px;
  padding: calc(var(--sat) + 16px) 18px 20px;
  box-shadow: 0 22px 44px -14px rgba(0, 0, 0, 0.5);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: none;
}
.voice-panel.show { display: block; animation: sheet-up 0.28s ease both; }
.voice-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.voice-ico {
  width: 42px; height: 42px; flex: 0 0 auto;
  display: grid; place-items: center;
  background: var(--brand);
  border-radius: 13px;
  box-shadow: 0 8px 18px -6px rgba(224, 34, 43, 0.8);
}
.voice-meta {
  flex: 1; min-width: 0;
  font-size: 0.74rem; font-weight: 800;
  letter-spacing: 1.4px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.68);
  display: flex; align-items: center; gap: 9px;
}
.voice-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--brand); flex: 0 0 auto;
}
.voice-dot.idle { background: var(--faint); }
.voice-dot.live {
  background: var(--brand);
  animation: dot-blink 1s ease-in-out infinite;
}
@keyframes dot-blink {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.8); }
}
.voice-close {
  margin-left: auto;
  width: 34px; height: 34px;
  display: grid; place-items: center;
  border: 0; border-radius: 10px;
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.75);
  font-size: 0.9rem; font-weight: 700;
  cursor: pointer;
}
.voice-close:active { background: rgba(255, 255, 255, 0.22); }
.voice-transcript {
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: -0.3px;
  line-height: 1.35;
  padding: 0;
  margin: 0;
  text-align: left;
  overflow-wrap: anywhere;
  min-height: 1.4em;
}
.voice-transcript:empty { min-height: 0; }
.voice-order {
  display: none;
  margin-top: 14px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 14px;
}
.voice-order:not(:empty) { display: block; }
.voice-order .vo-row {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px;
  font-size: 1.1rem; font-weight: 600; color: #fff;
  padding: 4px 0;
}
.voice-order .vo-row .vo-qty { color: var(--brand); font-variant-numeric: tabular-nums; }
.voice-order .vo-row .vo-pz { color: rgba(255, 255, 255, 0.6); font-weight: 500; font-size: 0.84rem; flex: 0 0 auto; }
.voice-order .vo-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 10px; padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.14);
  font-size: 0.74rem; font-weight: 800; letter-spacing: 1.2px; text-transform: uppercase;
  color: rgba(255, 255, 255, 0.7);
}
.voice-order .vo-total b {
  font-size: 1.25rem; letter-spacing: 0;
  color: #fff; font-weight: 800;
}
.voice-order .vo-confirm-ask {
  margin-top: 12px;
  font-size: 1.05rem; font-weight: 700; color: #fff;
}
.voice-order .vo-confirm-ask .sì { color: var(--good); }
.voice-order .vo-confirm-ask .no { color: #ff9d9d; }
.voice-result {
  display: none;
  margin-top: 12px;
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--good);
  line-height: 1.45;
}
.voice-result:not(:empty) { display: block; }
.voice-result.err { color: #ff9d9d; }
.voice-result {
  display: none;
  margin-top: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--good);
  line-height: 1.45;
}
.voice-result:not(:empty) { display: block; }
.voice-result.err { color: #ff9d9d; }

/* ---------- stage / views ---------- */
.stage { max-width: 700px; margin: 0 auto; }
.view { display: none; padding: 16px 16px 24px; animation: rise 0.32s ease both; }
.view.is-active { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.view-head { margin-bottom: 14px; }
.view-head h1 {
  font-size: 1.8rem; font-weight: 800; letter-spacing: -0.8px;
  display: flex; align-items: center; gap: 12px;
}
.view-head h1::after { content: ""; flex: 1; height: 2px; background: var(--ink); }
.hint { font-size: 0.82rem; color: var(--muted); margin-top: 8px; line-height: 1.5; }
.hint b { color: var(--brand); font-weight: 700; }

/* ---------- hero / vetrina ---------- */
.showcase {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px 18px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.showcase::before {
  content: "";
  position: absolute; top: 0; left: 0; right: 0; height: 3px;
  background: var(--brand);
}
.showcase-head {
  display: flex; align-items: center; gap: 16px;
}
.showcase-logo {
  width: 84px; height: 84px; flex: 0 0 auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 6px;
  box-shadow: var(--shadow-sm);
}
.showcase-hero { min-width: 0; }
.showcase-kicker {
  font-size: 0.6rem; letter-spacing: 2.2px; text-transform: uppercase;
  color: var(--brand); font-weight: 800; margin-bottom: 5px;
}
.showcase-name {
  font-size: 2.1rem; font-weight: 900; letter-spacing: -1.2px; line-height: 1;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.showcase-sub {
  font-size: 0.72rem; color: var(--muted); font-weight: 600;
  letter-spacing: 0.6px; margin-top: 6px;
}
.showcase-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 16px; }
.showcase-tags span {
  font-size: 0.64rem; font-weight: 700; letter-spacing: 0.3px;
  color: var(--ink-dim);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 100px;
}

/* ---------- search ---------- */
.search-wrap { position: relative; margin-bottom: 12px; }
.search-wrap.small { margin: 2px 0 12px; }
.search-ico {
  position: absolute; left: 16px; top: 50%; transform: translateY(-50%);
  color: var(--faint); font-size: 1.05rem; pointer-events: none;
}
.search-wrap input {
  width: 100%;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: 100px;
  padding: 13px 18px 13px 44px;
  font-family: "Archivo", sans-serif; font-size: 0.96rem; font-weight: 500;
  outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.search-wrap input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(23,19,13,0.08); }
.search-wrap input::placeholder { color: var(--faint); }

/* ---------- chips (categorie) ---------- */
.chips {
  display: flex; gap: 8px; overflow-x: auto;
  padding: 2px 16px 12px; margin: 0 -16px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 1.5px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-dim);
  font-size: 0.86rem; font-weight: 700;
  padding: 10px 15px;
  border-radius: 100px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex; align-items: center; gap: 8px;
}
.chip .chip-mono {
  width: 21px; height: 21px; border-radius: 6px;
  display: grid; place-items: center;
  font-size: 0.72rem; font-weight: 900;
  background: var(--surface-2); color: var(--ink);
}
.chip .chip-count {
  font-size: 0.68rem; color: var(--faint); font-weight: 600;
  font-family: "IBM Plex Mono", monospace;
}
.chip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.chip.is-active .chip-mono { background: var(--brand); color: #fff; }
.chip.is-active .chip-count { color: rgba(255,255,255,0.6); }

.chip.tables { min-width: 90px; justify-content: center; padding: 12px 10px; flex-direction: column; gap: 1px; }
.chip.tables .chip-num { display: block; font-size: 1rem; font-weight: 800; }
.chip.tables em {
  display: block; font-style: normal; font-size: 0.59rem; color: var(--faint);
  margin-top: 1px; font-weight: 600;
}
.chip.tables.is-active em { color: rgba(255,255,255,0.7); }

/* ---------- elenco piatti ---------- */
.dish-grid { display: grid; grid-template-columns: 1fr; gap: 10px; padding-top: 2px; }
.dish {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 10px 11px 15px;
  cursor: pointer;
  animation: rise 0.3s ease both;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
  user-select: none;
}
.dish:active { transform: scale(0.985); background: var(--surface-2); }
.dish.added { border-color: var(--ink); background: var(--paper); }
.dish.unavailable { opacity: 0.5; }
.dish-main { flex: 1; min-width: 0; }
.dish-head { display: flex; align-items: baseline; gap: 8px; }
.dish-name { font-size: 1.02rem; font-weight: 700; letter-spacing: -0.2px; line-height: 1.2; }
.dish-cat {
  font-size: 0.58rem; letter-spacing: 1.2px; text-transform: uppercase;
  color: var(--faint); font-weight: 700; white-space: nowrap;
}
.dish-price {
  font-family: "IBM Plex Mono", monospace; font-size: 0.92rem; font-weight: 600;
  color: var(--ink); margin-top: 4px;
}
.dish-price .dish-label {
  display: block; font-family: "Archivo", sans-serif; font-size: 0.62rem;
  color: var(--brand); font-weight: 800; letter-spacing: 0.4px;
  text-transform: uppercase;
}

.dish-ctl { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.ctl-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
  background: var(--surface); color: var(--ink-dim);
  font-size: 1.2rem; font-weight: 700; line-height: 1;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all 0.14s ease;
}
.ctl-btn.plus { border-color: var(--brand); color: var(--brand); font-weight: 800; }
.ctl-btn:active { transform: scale(0.88); }
.ctl-btn.minus:active { background: var(--danger); border-color: var(--danger); color: #fff; }
.ctl-btn.plus:active { background: var(--brand); color: #fff; }
.ctl-btn:disabled { background: var(--surface-2); color: var(--faint); border-color: var(--line); }
.qty-pill {
  min-width: 26px; height: 26px; padding: 0 6px;
  border-radius: 100px;
  display: grid; place-items: center;
  background: var(--ink); color: #fff;
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 0.82rem;
}

/* ---------- barra carrello ---------- */
.cartbar {
  position: fixed; left: 0; right: 0; bottom: calc(62px + var(--sab));
  z-index: 25;
  padding: 0 14px;
  pointer-events: none;
}
.cartbar-btn {
  pointer-events: auto;
  width: 100%; max-width: 700px; margin: 0 auto;
  display: flex; align-items: center; gap: 12px;
  background: var(--dark);
  color: #fff;
  border: 0; border-radius: 14px;
  padding: 11px 10px 11px 12px;
  box-shadow: var(--shadow-lg);
  cursor: pointer;
  animation: cart-in 0.25s ease both;
}
@keyframes cart-in { from { transform: translateY(22px); opacity: 0; } to { transform: none; opacity: 1; } }
.cartbar-btn:active { transform: scale(0.99); }
.cart-bag {
  position: relative;
  width: 40px; height: 40px; flex: 0 0 auto;
  border-radius: 11px;
  display: grid; place-items: center;
  background: rgba(255,255,255,0.12);
  font-size: 1.15rem; line-height: 1;
}
.cart-bag b {
  position: absolute; top: -7px; right: -7px;
  min-width: 21px; height: 21px; padding: 0 5px;
  border-radius: 100px;
  background: var(--brand); color: #fff;
  font-family: "IBM Plex Mono", monospace; font-size: 0.7rem; font-weight: 700;
  display: grid; place-items: center;
}
.cart-mid { flex: 1; text-align: left; min-width: 0; }
.cart-label { display: block; font-size: 0.62rem; letter-spacing: 1.6px; text-transform: uppercase; color: rgba(255,255,255,0.6); font-weight: 700; }
.cart-total { display: block; font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 1.18rem; margin-top: 1px; }
.cart-cta {
  flex: 0 0 auto;
  font-size: 0.82rem; font-weight: 800;
  background: var(--brand); color: #fff;
  border-radius: 10px; padding: 11px 15px;
}

/* ---------- riepilogo (checkout) ---------- */
.tables-scroll { margin-bottom: 6px; }
.field-label {
  display: block; font-size: 0.62rem; color: var(--muted);
  letter-spacing: 2px; text-transform: uppercase; margin-bottom: 10px; font-weight: 800;
}
.order-items { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 14px; }
.oi {
  display: flex; align-items: center; gap: 10px;
  background: var(--paper); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 8px 10px;
  animation: rise 0.22s ease both;
}
.oi-ctl {
  display: grid; place-items: center;
  width: 32px; height: 32px; flex: 0 0 auto;
  border: 1.5px solid var(--line-strong); border-radius: 10px;
  background: var(--surface); color: var(--ink-dim);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
}
.oi-ctl.plus-ctl { border-color: var(--brand); color: var(--brand); }
.oi-ctl:active { background: var(--ink); color: #fff; border-color: var(--ink); }
.oi-main { flex: 1; min-width: 0; }
.oi-name { font-size: 0.9rem; font-weight: 700; line-height: 1.25; }
.oi-sub { font-size: 0.68rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.oi-off { color: var(--brand); font-weight: 600; }
.oi-qty {
  min-width: 32px; text-align: center;
  font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 0.95rem;
}
.oi-price {
  font-family: "IBM Plex Mono", monospace; font-weight: 600;
  color: var(--ink); font-size: 0.86rem; min-width: 52px; text-align: right;
}

.note-field textarea {
  width: 100%; resize: none;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 12px 14px; font-size: 0.9rem; font-weight: 500;
  font-family: "Archivo", sans-serif;
  outline: none; transition: border-color 0.15s ease;
}
.note-field textarea:focus { border-color: var(--ink); }

.checkout-total {
  display: flex; align-items: baseline; justify-content: space-between;
  border-top: 2px solid var(--ink);
  margin: 4px 0 14px; padding-top: 12px;
}
.checkout-total span { font-size: 0.84rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; }
.checkout-total b { font-family: "Archivo", sans-serif; font-size: 1.7rem; font-weight: 900; letter-spacing: -1px; }

/* ---------- pulsanti ---------- */
.btn-primary {
  width: 100%;
  background: var(--brand);
  color: #fff;
  border: 0; border-radius: var(--radius);
  font-family: "Archivo", sans-serif;
  font-size: 1rem; font-weight: 800; letter-spacing: 0.2px;
  padding: 16px 18px; cursor: pointer;
  box-shadow: 0 12px 26px -12px rgba(224, 34, 43, 0.55);
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
}
.btn-primary:active { transform: scale(0.985); background: var(--brand-deep); }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; box-shadow: none; }
.btn-primary + .btn-primary { margin-top: 10px; }

.btn-ghost {
  background: var(--surface); color: var(--ink-dim);
  border: 1.5px solid var(--line-strong); border-radius: 100px;
  font-size: 0.82rem; font-weight: 700;
  padding: 9px 15px; cursor: pointer;
  transition: all 0.15s ease;
}
.btn-ghost:active { border-color: var(--ink); color: var(--ink); }
.btn-danger-ghost {
  background: transparent; color: var(--danger);
  border: 1.5px solid rgba(224,34,43,0.4); border-radius: 100px;
  font-size: 0.82rem; font-weight: 700; padding: 9px 15px; cursor: pointer;
}
.btn-danger-ghost:active { background: var(--danger); color: #fff; }

/* ---------- comande ---------- */
.sec-title {
  display: flex; align-items: center; gap: 10px;
  font-size: 0.7rem; letter-spacing: 2px; text-transform: uppercase; font-weight: 800;
  color: var(--muted); margin: 6px 0 11px;
}
.sec-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.count-pill {
  font-family: "IBM Plex Mono", monospace; font-size: 0.68rem; font-weight: 700;
  color: var(--ink); border: 1.5px solid var(--line-strong);
  padding: 1px 9px; border-radius: 100px;
}

.ticket {
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  margin-bottom: 12px;
  overflow: hidden;
  animation: rise 0.3s ease both;
}
.ticket-head {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px;
  cursor: pointer;
}
.ticket-table {
  font-size: 0.98rem; font-weight: 800; letter-spacing: -0.2px;
  background: var(--ink); color: #fff;
  border-radius: 8px; padding: 5px 10px; white-space: nowrap;
}
.ticket-meta { flex: 1; font-size: 0.68rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; }
.ticket-status {
  font-size: 0.58rem; letter-spacing: 1.4px; text-transform: uppercase; font-weight: 800;
  padding: 5px 10px; border-radius: 100px;
  background: rgba(224,34,43,0.1); color: var(--brand);
}
.ticket-status.done { background: rgba(47,158,99,0.12); color: var(--good); }
.ticket-body {
  border-top: 1px dashed var(--line-strong);
  padding: 10px 14px 12px;
}
.ticket-line {
  display: flex; justify-content: space-between; gap: 10px;
  font-size: 0.86rem; padding: 3px 0; line-height: 1.4;
}
.ticket-line .t-lq { font-family: "IBM Plex Mono", monospace; color: var(--faint); margin-right: 7px; }
.ticket-line .t-amt { font-family: "IBM Plex Mono", monospace; font-weight: 600; }
.ticket-note {
  margin-top: 8px; font-size: 0.8rem; font-style: italic;
  border-left: 3px solid var(--brand); padding-left: 10px; color: var(--muted);
}
.ticket-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  border-top: 1px solid var(--line);
  padding: 10px 14px; background: var(--surface-2);
  flex-wrap: wrap;
}
.ticket-total { font-family: "IBM Plex Mono", monospace; font-weight: 600; font-size: 0.92rem; }
.ticket-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.tbtn {
  border: 1.5px solid var(--line-strong); background: var(--surface);
  border-radius: 100px; padding: 8px 14px; font-size: 0.76rem; font-weight: 800;
  cursor: pointer; transition: all 0.14s ease; color: var(--ink-dim);
}
.tbtn.serve { color: var(--good); background: rgba(47,158,99,0.08); border-color: rgba(47,158,99,0.4); }
.tbtn.serve:active { background: var(--good); color: #fff; }
.tbtn.kill { color: var(--danger); }
.tbtn.kill:active { background: var(--danger); color: #fff; }
.tbtn.merge { color: var(--ink); }
.tbtn.merge.active { background: var(--ink); border-color: var(--ink); color: #fff; }
.tbtn.merge-go { color: var(--brand); border-color: rgba(224, 34, 43, 0.45); }
.tbtn.merge-go:active { background: var(--brand); color: #fff; }
.merge-none { font-size: 0.72rem; color: var(--faint); font-weight: 600; }

/* unione tavoli */
.merge-pick {
  width: 100%;
  border-top: 1px dashed var(--line-strong);
  margin-top: 8px; padding-top: 8px;
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
}
.merge-pick .merge-title {
  font-size: 0.62rem; font-weight: 800; letter-spacing: 1.2px;
  text-transform: uppercase; color: var(--muted);
}
.merge-pick .tbtn { font-size: 0.72rem; padding: 6px 11px; }

.ticket-detail { display: none; }
.ticket.open .ticket-detail { display: block; animation: rise 0.22s ease both; }

/* ---------- gestione ---------- */
.manage-block { margin-bottom: 26px; }
.manage-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.manage-title { display: flex; align-items: center; gap: 10px; }
.manage-list { display: flex; flex-direction: column; gap: 8px; }
.manage-item {
  display: flex; align-items: center; gap: 11px;
  background: var(--surface); border: 1.5px solid var(--line);
  border-radius: var(--radius); padding: 9px 12px;
  animation: rise 0.25s ease both;
}
.pill-avail {
  width: 9px; height: 9px; flex: 0 0 auto;
  border-radius: 50%; background: var(--line-strong);
}
.pill-avail.on { background: var(--good); }
.mi-main { flex: 1; min-width: 0; }
.mi-name { font-size: 0.9rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mi-sub { font-size: 0.68rem; color: var(--muted); font-family: "IBM Plex Mono", monospace; margin-top: 1px; }
.mi-off { font-size: 0.6rem; color: var(--danger); text-transform: uppercase; letter-spacing: 1px; font-weight: 800; }
.mi-price { font-family: "IBM Plex Mono", monospace; color: var(--ink); font-size: 0.82rem; font-weight: 600; white-space: nowrap; }
.mi-x {
  border: 0; background: transparent; color: var(--faint);
  font-size: 1rem; cursor: pointer; padding: 8px; border-radius: 9px;
}
.mi-x:active { background: rgba(224,34,43,0.1); color: var(--danger); }
.danger-zone .manage-row > .btn-ghost { color: var(--muted); }

/* ---------- tavoli in home ---------- */
.tables-home { margin-top: 30px; }
.tables-home-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.tables-view-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 400px) {
  .tables-view-grid { grid-template-columns: repeat(3, 1fr); }
}
.tbl-card {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start; gap: 3px;
  text-align: left; padding: 12px 11px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 0.1s ease, border-color 0.15s ease, background 0.15s ease;
  animation: rise 0.3s ease both;
}
.tbl-card:active { transform: scale(0.96); }
.tbl-label { font-size: 0.94rem; font-weight: 800; letter-spacing: -0.3px; color: var(--ink); }
.tbl-sub {
  font-size: 0.62rem; font-family: "IBM Plex Mono", monospace;
  color: var(--faint); font-weight: 500;
}
.tbl-card.active {
  border-color: rgba(224, 34, 43, 0.45);
  background: var(--paper);
  box-shadow: inset 0 0 0 1px rgba(224, 34, 43, 0.12);
}
.tbl-card.active .tbl-sub { color: var(--brand); font-weight: 600; }

.tbl-status {
  font-size: 0.82rem; color: var(--muted); font-weight: 600;
  margin: 2px 0 12px;
}
.tbl-status b { color: var(--ink); }
.ticket.mini { margin-bottom: 10px; }
.ticket.mini .ticket-body { padding-top: 8px; }
.ticket.mini .ticket-meta { font-size: 0.64rem; color: var(--muted); margin-bottom: 6px; }

.credits {
  max-width: 700px;
  margin: 30px auto 0;
  padding: 20px 16px 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 9px;
}
.credits-kicker {
  font-size: 0.6rem;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  color: var(--faint);
  font-weight: 800;
}
.credits-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}
.credits-logo {
  height: 42px;
  object-fit: contain;
  border-radius: 10px;
}
.credits-name {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: 0.2px;
  color: var(--ink);
}
.credits-link:active .credits-name { color: var(--brand); }
.credits-tag {
  font-size: 0.8rem;
  color: var(--brand);
  font-weight: 600;
  font-style: italic;
  letter-spacing: 0.2px;
}

/* ---------- sheets ---------- */
.sheet {
  position: fixed; inset: 0; z-index: 40;
  display: flex; align-items: flex-end; justify-content: center;
  background: rgba(23, 19, 13, 0.5);
  backdrop-filter: blur(3px);
  animation: fade 0.2s ease both;
  padding: var(--sat) var(--sal) var(--sab) var(--sar);
}
.sheet[hidden] { display: none; }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.sheet-inner {
  width: 100%; max-width: 640px;
  background: var(--bg);
  color: var(--ink);
  border-radius: 18px 18px 0 0;
  padding: 20px 18px calc(22px + var(--sab));
  box-shadow: 0 -20px 50px -20px rgba(0,0,0,0.4);
  animation: sheet-up 0.3s cubic-bezier(0.2, 0.8, 0.3, 1) both;
  max-height: 90vh; overflow-y: auto;
}
.sheet-inner.light { background: var(--bg); }
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0.4; } to { transform: none; opacity: 1; } }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.sheet-head h2 { font-size: 1.4rem; font-weight: 900; letter-spacing: -0.6px; }
.sheet-close {
  border: 1.5px solid var(--line-strong); background: var(--surface); color: var(--muted);
  width: 36px; height: 36px; border-radius: 11px; font-size: 1rem; font-weight: 700; cursor: pointer;
}
.sheet-close:active { color: var(--ink); }

.field { display: block; margin-bottom: 14px; }
.field input[type="text"], .field input[type="number"] {
  width: 100%;
  background: var(--surface); color: var(--ink);
  border: 1.5px solid var(--line-strong); border-radius: var(--radius);
  padding: 13px 14px; font-size: 0.95rem; font-weight: 500;
  font-family: "Archivo", sans-serif;
  outline: none; transition: border-color 0.15s ease;
}
.field input:focus { border-color: var(--ink); }
.field input::placeholder { color: var(--faint); }
.field.toggle { display: flex; align-items: center; gap: 13px; }
.field.toggle .field-label { margin-bottom: 0; }
.field.toggle input { accent-color: var(--brand); width: 24px; height: 24px; }

/* ---------- tabbar ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0;
  z-index: 30;
  display: flex;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line-strong);
  padding: 3px 4px calc(3px + var(--sab));
  max-width: 700px; margin: 0 auto;
}
.tab {
  position: relative; flex: 1;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  background: transparent; border: 0; color: var(--faint);
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.6px;
  padding: 9px 4px 7px; cursor: pointer; border-radius: 10px;
  transition: color 0.15s ease;
}
.tab-ico { font-size: 1.15rem; line-height: 1; }
.tab.is-active { color: var(--ink); }
.tab.is-active .tab-ico { position: relative; }
.tab.is-active .tab-ico::after {
  content: ""; position: absolute; left: 50%; bottom: -5px;
  transform: translateX(-50%);
  width: 20px; height: 3px; border-radius: 2px;
  background: var(--brand);
}
.tab-badge {
  position: absolute; top: 1px; right: calc(50% - 26px);
  min-width: 18px; height: 18px; padding: 0 4px;
  display: grid; place-items: center;
  background: var(--brand); color: #fff;
  font-family: "IBM Plex Mono", monospace; font-size: 0.62rem; font-weight: 700;
  border-radius: 100px;
  border: 2px solid #fff;
}
.tab-badge[hidden] { display: none !important; }

/* ---------- toast ---------- */
#toast {
  position: fixed; left: 50%; top: calc(68px + var(--sat));
  transform: translateX(-50%) translateY(-8px);
  z-index: 50;
  background: var(--dark); color: #fff;
  font-size: 0.88rem; font-weight: 700;
  padding: 12px 20px; border-radius: 12px;
  box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: opacity 0.22s ease, transform 0.22s ease;
  max-width: calc(100% - 40px); text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.good { background: var(--good); }

/* ---------- empty ---------- */
.empty {
  text-align: center; color: var(--muted); padding: 44px 12px;
  font-size: 0.88rem; line-height: 1.6; font-weight: 500;
}
.empty .empty-mark {
  display: grid; place-items: center;
  width: 56px; height: 56px; margin: 0 auto 12px;
  border-radius: 14px;
  background: var(--surface-2); border: 1.5px dashed var(--line-strong);
  color: var(--faint); font-size: 1.3rem;
}
.empty b { color: var(--brand); }

@media (min-width: 460px) {
  .dish-grid { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 720px) {
  .topbar { left: 50%; transform: translateX(-50%); max-width: 700px; }
}