/* =========================================================================
   BarFlow — design system condiviso
   Tema scuro: in un bar la luce è bassa e gli schermi restano accesi ore.
   Priorità: contrasto alto, aree di tocco grandi, gerarchia leggibile a colpo
   d'occhio da un metro di distanza.
   ========================================================================= */

:root {
  --bg: #0e0f13;
  --surface: #17181e;
  --surface-2: #1e2027;
  --surface-3: #24262f;
  --border: #2a2c36;
  --border-strong: #3a3d4a;

  --text: #f2f3f5;
  --muted: #9a9daa;
  --faint: #6b6e7b;

  --accent: #ff9f1c;
  --accent-ink: #1a1204;
  --accent-soft: rgba(255, 159, 28, 0.14);

  --blue: #4dabf7;
  --green: #2ec27e;
  --amber: #f5a524;
  --red: #e5484d;
  --violet: #a78bfa;

  --radius: 14px;
  --radius-sm: 9px;
  --radius-lg: 20px;

  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.3);

  --font: "Segoe UI", -apple-system, BlinkMacSystemFont, system-ui, Roboto, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body { min-height: 100dvh; }

h1, h2, h3, h4 { margin: 0; font-weight: 700; line-height: 1.2; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }

button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 8px; }
::-webkit-scrollbar-track { background: transparent; }

/* ----------------------------------------------------------------- marchio */

/* Il logo ha la scritta "di caffè" in bianco: su fondo chiaro sparirebbe.
   Tutte le interfacce sono scure, ma dove serve un fondo chiaro (stampa)
   va appoggiato su .brand__plate. */
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand__logo { display: block; width: auto; height: 38px; flex: 0 0 auto; }
.brand__logo--sm { height: 30px; }
.brand__logo--lg { height: 92px; }
.brand__logo--xl { height: 140px; }
.brand__text { min-width: 0; }
.brand__name { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; line-height: 1.15; }
.brand__sub { font-size: 12px; color: var(--muted); }

.brand__plate {
  display: inline-grid; place-items: center;
  background: var(--bg); border-radius: 18px; padding: 10px 14px;
}

/* ---------------------------------------------------------------- layout */

.app { display: flex; flex-direction: column; min-height: 100dvh; }

.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 18px;
  background: rgba(14, 15, 19, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
}
.topbar__title { font-size: 18px; font-weight: 800; letter-spacing: -0.01em; }
.topbar__sub { font-size: 12px; color: var(--muted); }
.topbar__spacer { flex: 1; }

.container { width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px; }
.container--narrow { max-width: 760px; }
.container--wide { max-width: 1800px; }

.stack { display: flex; flex-direction: column; gap: 14px; }
.stack--sm { gap: 8px; }
.stack--lg { gap: 22px; }
.row { display: flex; align-items: center; gap: 10px; }
.row--wrap { flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.row--end { justify-content: flex-end; }
.spacer { flex: 1; }

.grid { display: grid; gap: 14px; }
.grid--auto { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.grid--stats { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

/* ----------------------------------------------------------------- cards */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}
.card--flat { background: var(--surface-2); }
.card--pad-lg { padding: 22px; }
.card__title { font-size: 15px; font-weight: 700; }
.card__hint { font-size: 13px; color: var(--muted); line-height: 1.5; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.panel__head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px;
}
.panel__body { padding: 18px; }

/* --------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600; font-size: 14px;
  transition: transform .06s ease, background .15s ease, border-color .15s ease;
  white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--surface-3); }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.btn--primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn--primary:hover:not(:disabled) { background: #ffb03d; }
.btn--success { background: var(--green); color: #04160d; border-color: transparent; }
.btn--success:hover:not(:disabled) { filter: brightness(1.08); }
.btn--danger { background: transparent; color: var(--red); border-color: rgba(229, 72, 77, .45); }
.btn--danger:hover:not(:disabled) { background: rgba(229, 72, 77, .12); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }

.btn--lg { padding: 15px 22px; font-size: 16px; border-radius: var(--radius); }
.btn--xl { padding: 18px 24px; font-size: 18px; font-weight: 700; border-radius: var(--radius); }
.btn--sm { padding: 7px 11px; font-size: 13px; }
.btn--block { width: 100%; }
.btn--icon { padding: 9px 11px; }

.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px; font-weight: 700;
  letter-spacing: .02em; text-transform: uppercase;
  border: 1px solid transparent;
}
.badge--new { background: rgba(77, 171, 247, .16); color: var(--blue); border-color: rgba(77,171,247,.35); }
.badge--prep { background: rgba(245, 165, 36, .16); color: var(--amber); border-color: rgba(245,165,36,.35); }
.badge--ready { background: rgba(46, 194, 126, .16); color: var(--green); border-color: rgba(46,194,126,.35); }
.badge--done { background: var(--surface-3); color: var(--muted); border-color: var(--border-strong); }
.badge--cancel { background: rgba(229, 72, 77, .14); color: var(--red); border-color: rgba(229,72,77,.35); }
.badge--open { background: rgba(46, 194, 126, .16); color: var(--green); border-color: rgba(46,194,126,.35); }
.badge--payment { background: rgba(245, 165, 36, .16); color: var(--amber); border-color: rgba(245,165,36,.35); }
.badge--paid { background: rgba(77, 171, 247, .16); color: var(--blue); border-color: rgba(77,171,247,.35); }
.badge--closed { background: var(--surface-3); color: var(--muted); border-color: var(--border-strong); }
.badge--accent { background: var(--accent-soft); color: var(--accent); border-color: rgba(255,159,28,.35); }

.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ----------------------------------------------------------------- forms */

.field { display: flex; flex-direction: column; gap: 6px; }
.field__label { font-size: 13px; font-weight: 600; color: var(--muted); }
.field__hint { font-size: 12px; color: var(--faint); line-height: 1.5; }

.input, .select, .textarea {
  width: 100%;
  padding: 11px 13px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s ease;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); }
.textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: right 16px center, right 11px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 34px; }

.checkbox { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

/* ---------------------------------------------------------------- tables */

.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 10px 12px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); font-weight: 700;
  border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr.is-clickable { cursor: pointer; }
.table tbody tr.is-clickable:hover { background: var(--surface-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

/* ------------------------------------------------------------ statistiche */

.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px 16px;
}
.stat__label { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; }
.stat__value { font-size: 26px; font-weight: 800; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat__value--accent { color: var(--accent); }
.stat__value--green { color: var(--green); }
.stat__sub { font-size: 12px; color: var(--faint); margin-top: 2px; }

.bar-track { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; background: var(--accent); border-radius: 99px; }

/* ----------------------------------------------------------------- varie */

.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.strong { font-weight: 700; }
.mono { font-variant-numeric: tabular-nums; }
.center { text-align: center; }
.right { text-align: right; }
.uppercase { text-transform: uppercase; letter-spacing: .05em; }
.hidden { display: none !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.empty {
  padding: 44px 20px; text-align: center; color: var(--muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.empty__icon { font-size: 34px; margin-bottom: 10px; opacity: .8; }

.divider { height: 1px; background: var(--border); margin: 6px 0; }

/* ---------------------------------------------------------------- toasts */

.toasts {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(20px + var(--safe-bottom)); z-index: 400;
  display: flex; flex-direction: column; gap: 8px; align-items: center;
  pointer-events: none; width: min(520px, calc(100vw - 32px));
}
.toast {
  pointer-events: auto;
  background: var(--surface-3); border: 1px solid var(--border-strong);
  color: var(--text); padding: 12px 16px; border-radius: var(--radius);
  box-shadow: var(--shadow); font-size: 14px; font-weight: 600;
  animation: toast-in .18s ease; max-width: 100%;
}
.toast--error { border-color: rgba(229, 72, 77, .5); background: #2a1417; color: #ffd9da; }
.toast--success { border-color: rgba(46, 194, 126, .5); background: #0f2419; color: #c6f2dc; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------------------------------------------------------------- modali */

.modal-backdrop {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .65); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 20px;
  animation: fade .15s ease;
}
.modal {
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg); box-shadow: var(--shadow);
  width: min(620px, 100%); max-height: 88dvh; display: flex; flex-direction: column;
  animation: pop .18s ease;
}
.modal--wide { width: min(920px, 100%); }
.modal__head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.modal__title { font-size: 17px; font-weight: 700; }
.modal__body { padding: 20px; overflow-y: auto; }
.modal__foot { padding: 16px 20px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(.98); } }

/* ------------------------------------------------------- stato real-time */

.conn {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 700; color: var(--muted);
  padding: 5px 10px; border-radius: 999px; border: 1px solid var(--border);
}
.conn__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.conn.is-off .conn__dot { background: var(--red); animation: pulse 1.2s infinite; }
.conn.is-poll .conn__dot { background: var(--amber); }
@keyframes pulse { 50% { opacity: .3; } }

/* ------------------------------------------------------------------ tabs */

.tabs { display: flex; gap: 6px; background: var(--surface-2); padding: 5px; border-radius: var(--radius); }
.tab {
  flex: 1; padding: 10px 14px; border: none; background: transparent; color: var(--muted);
  border-radius: var(--radius-sm); font-weight: 700; font-size: 14px;
}
.tab.is-active { background: var(--surface-3); color: var(--text); }

.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto; padding: 9px 15px; border-radius: 999px;
  border: 1px solid var(--border-strong); background: var(--surface-2);
  color: var(--muted); font-weight: 700; font-size: 14px; white-space: nowrap;
}
.chip.is-active { background: var(--accent); color: var(--accent-ink); border-color: transparent; }

/* ================================================== interfaccia CLIENTE == */

.client { padding-bottom: 96px; }

.client-head {
  position: sticky; top: 0; z-index: 40;
  background: rgba(14, 15, 19, .95); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 12px 16px 10px;
}
.client-head__row { display: flex; align-items: center; gap: 11px; }
.client-head__logo { display: block; width: auto; height: 42px; flex: 0 0 auto; }
.client-head__bar { font-size: 17px; font-weight: 800; }
.client-head__table {
  background: var(--accent); color: var(--accent-ink);
  padding: 5px 12px; border-radius: 999px; font-weight: 800; font-size: 14px;
  white-space: nowrap;
}
.client-head__total { font-size: 13px; color: var(--muted); margin-top: 2px; }
.client-head__total b { color: var(--text); }

.client-tabs { display: flex; gap: 4px; margin-top: 10px; }
.client-tab {
  flex: 1; padding: 9px; border: none; background: transparent;
  color: var(--muted); font-weight: 700; font-size: 14px;
  border-bottom: 2px solid transparent;
}
.client-tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }

.cat-title {
  font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin: 22px 0 10px; display: flex; align-items: center; gap: 8px;
}

.product {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 12px; margin-bottom: 10px;
}
.product.is-out { opacity: .5; }
.product__img {
  width: 68px; height: 68px; flex: 0 0 auto;
  border-radius: 10px; object-fit: cover; background: var(--surface-3);
}
.product__img--placeholder { display: grid; place-items: center; font-size: 26px; }
.product__body { flex: 1; min-width: 0; }
.product__name { font-weight: 700; font-size: 15px; }
.product__desc { font-size: 13px; color: var(--muted); line-height: 1.45; margin-top: 3px; }
.product__foot { display: flex; align-items: center; gap: 10px; margin-top: 9px; }
.product__price { font-weight: 800; font-size: 16px; }
.product__out { font-size: 12px; font-weight: 700; color: var(--red); text-transform: uppercase; }

.qty {
  display: inline-flex; align-items: center; gap: 2px;
  background: var(--surface-2); border: 1px solid var(--border-strong); border-radius: 999px;
}
.qty button {
  width: 34px; height: 34px; border: none; background: transparent; color: var(--text);
  font-size: 19px; font-weight: 700; border-radius: 999px; display: grid; place-items: center;
}
.qty button:disabled { opacity: .3; }
.qty__value { min-width: 26px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

.add-btn {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent); color: var(--accent-ink);
  border: none; font-size: 22px; font-weight: 700; line-height: 1;
  display: grid; place-items: center;
}

.cart-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: rgba(23, 24, 30, .97); backdrop-filter: blur(12px);
  border-top: 1px solid var(--border);
  transform: translateY(120%); transition: transform .2s ease;
}
.cart-bar.is-visible { transform: translateY(0); }
.cart-bar__btn {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 15px 18px; border-radius: var(--radius); border: none;
  background: var(--accent); color: var(--accent-ink); font-weight: 800; font-size: 16px;
}
.cart-bar__count {
  background: rgba(0,0,0,.2); border-radius: 999px; padding: 2px 10px; font-size: 14px;
}

.cart-line { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--border); }
.cart-line:last-of-type { border-bottom: none; }
.cart-line__body { flex: 1; min-width: 0; }
.cart-line__name { font-weight: 700; }
.cart-line__meta { font-size: 13px; color: var(--muted); margin-top: 2px; }
.cart-line__total { font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }

.summary-row { display: flex; justify-content: space-between; padding: 7px 0; font-size: 15px; }
.summary-row--total { font-size: 20px; font-weight: 800; border-top: 1px solid var(--border); margin-top: 6px; padding-top: 12px; }

.order-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.order-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.order-card__num { font-weight: 800; font-size: 16px; }
.order-card__time { font-size: 12px; color: var(--faint); }
.order-line { display: flex; justify-content: space-between; gap: 12px; font-size: 14px; padding: 3px 0; }
.order-line__qty { color: var(--accent); font-weight: 800; }

.progress-steps { display: flex; gap: 4px; margin-top: 12px; }
.progress-step { flex: 1; height: 5px; border-radius: 99px; background: var(--surface-3); }
.progress-step.is-done { background: var(--green); }
.progress-step.is-current { background: var(--accent); }

/* =================================================== interfaccia BARMAN == */

.board {
  display: grid; gap: 14px; padding: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  align-items: start;
}
.column { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.column__head {
  position: sticky; top: 62px; z-index: 20;
  display: flex; align-items: center; gap: 9px;
  padding: 11px 14px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
}
.column__title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; }
.column__count {
  margin-left: auto; background: var(--surface-3); border-radius: 999px;
  padding: 2px 10px; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
}
.column--new .column__head { border-color: rgba(77,171,247,.4); }
.column--new .column__title { color: var(--blue); }
.column--prep .column__head { border-color: rgba(245,165,36,.4); }
.column--prep .column__title { color: var(--amber); }
.column--ready .column__head { border-color: rgba(46,194,126,.4); }
.column--ready .column__title { color: var(--green); }

.ticket {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.ticket--new { border-color: rgba(77, 171, 247, .55); box-shadow: 0 0 0 1px rgba(77,171,247,.18); animation: ticket-in .25s ease; }
.ticket--late { border-color: rgba(245, 165, 36, .6); }
.ticket--very-late { border-color: rgba(229, 72, 77, .7); box-shadow: 0 0 0 1px rgba(229,72,77,.25); }
@keyframes ticket-in { from { opacity: 0; transform: translateY(-8px); } }

.ticket__head { padding: 12px 14px; display: flex; align-items: center; gap: 10px; background: var(--surface-2); }
.ticket__num { font-size: 15px; font-weight: 800; color: var(--muted); font-variant-numeric: tabular-nums; }
.ticket__table { font-size: 19px; font-weight: 800; }
.ticket__timer {
  margin-left: auto; font-size: 13px; font-weight: 800; font-variant-numeric: tabular-nums;
  padding: 3px 9px; border-radius: 999px; background: var(--surface-3); color: var(--muted);
}
.ticket__timer.is-late { background: rgba(245,165,36,.18); color: var(--amber); }
.ticket__timer.is-very-late { background: rgba(229,72,77,.18); color: var(--red); }

.ticket__body { padding: 12px 14px; }
.ticket__item { display: flex; gap: 10px; padding: 5px 0; font-size: 15px; align-items: baseline; }
.ticket__qty {
  min-width: 30px; font-size: 17px; font-weight: 800; color: var(--accent);
  font-variant-numeric: tabular-nums;
}
.ticket__name { flex: 1; font-weight: 600; }
.ticket__variant { display: block; font-size: 13px; color: var(--muted); font-weight: 500; }
.ticket__item-note { display: block; font-size: 13px; color: var(--amber); font-weight: 600; }

.ticket__note {
  margin-top: 10px; padding: 9px 11px; border-radius: var(--radius-sm);
  background: rgba(245, 165, 36, .12); border: 1px solid rgba(245, 165, 36, .3);
  color: #ffd89b; font-size: 14px; font-weight: 600; line-height: 1.45;
}
.ticket__foot { padding: 10px 14px 14px; display: flex; gap: 8px; align-items: center; }
.ticket__total { font-weight: 800; font-variant-numeric: tabular-nums; }

.ticket--done { opacity: .62; }
.ticket--done .ticket__table { font-size: 16px; }

/* ==================================================== interfaccia CASSA == */

.tables-grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }
.table-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 14px; text-align: left; width: 100%; transition: border-color .15s ease, transform .06s ease;
}
.table-card:hover { border-color: var(--border-strong); }
.table-card:active { transform: scale(.985); }
.table-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.table-card--open { border-left: 3px solid var(--green); }
.table-card--payment { border-left: 3px solid var(--amber); }
.table-card--paid { border-left: 3px solid var(--blue); }
.table-card--free { border-style: dashed; opacity: .65; }
.table-card__num { font-size: 21px; font-weight: 800; }
.table-card__meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.table-card__total { font-size: 25px; font-weight: 800; margin-top: 10px; font-variant-numeric: tabular-nums; }
.table-card__alert { font-size: 12px; font-weight: 700; color: var(--amber); margin-top: 6px; }

.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 200;
  width: min(560px, 100%); background: var(--surface);
  border-left: 1px solid var(--border-strong); box-shadow: -20px 0 50px rgba(0,0,0,.5);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .22s ease;
}
.drawer.is-open { transform: translateX(0); }
.drawer__head { padding: 18px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; }
.drawer__body { flex: 1; overflow-y: auto; padding: 18px 20px; }
.drawer__foot { padding: 16px 20px calc(16px + var(--safe-bottom)); border-top: 1px solid var(--border); background: var(--surface-2); }
.drawer__total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.drawer__total-value { font-size: 30px; font-weight: 800; font-variant-numeric: tabular-nums; }

.bill-order { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px; }
.bill-order--cancelled { opacity: .5; }
.bill-order__head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 13px; color: var(--muted); }
.bill-line { display: flex; gap: 10px; font-size: 14px; padding: 2px 0; }
.bill-line__qty { min-width: 26px; font-weight: 800; color: var(--accent); }
.bill-line__name { flex: 1; }
.bill-line__price { font-variant-numeric: tabular-nums; }

/* ==================================================== interfaccia ADMIN == */

.admin-layout { display: grid; grid-template-columns: 224px 1fr; min-height: calc(100dvh - 57px); }
.sidenav { border-right: 1px solid var(--border); padding: 14px 12px; background: var(--surface); }
.sidenav__item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 11px 13px; border-radius: var(--radius-sm); border: none;
  background: transparent; color: var(--muted); font-weight: 600; font-size: 14px;
  text-align: left; margin-bottom: 3px;
}
.sidenav__item:hover { background: var(--surface-2); color: var(--text); }
.sidenav__item.is-active { background: var(--accent-soft); color: var(--accent); }

.qr-tile { text-align: center; }
.qr-tile img, .qr-tile svg { width: 100%; max-width: 150px; background: #fff; border-radius: 10px; padding: 8px; }

.rank-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.rank-row__pos { width: 24px; font-weight: 800; color: var(--faint); font-variant-numeric: tabular-nums; }
.rank-row__name { flex: 1; font-weight: 600; }
.rank-row__bar { flex: 2; }
.rank-row__value { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 78px; text-align: right; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1200px) {
  .board { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .admin-layout { grid-template-columns: 1fr; }
  .sidenav { border-right: none; border-bottom: 1px solid var(--border); display: flex; gap: 6px; overflow-x: auto; }
  .sidenav__item { width: auto; white-space: nowrap; margin-bottom: 0; }
}
@media (max-width: 700px) {
  .board { grid-template-columns: 1fr; padding: 12px; }
  .container { padding: 14px; }
  .drawer { width: 100%; }
  .modal__foot { flex-direction: column-reverse; }
  .modal__foot .btn { width: 100%; }
}

/* ------------------------------------------------------------------ home */

.launcher { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.launcher__card {
  display: block; padding: 24px; border-radius: var(--radius-lg);
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  transition: border-color .15s ease, transform .08s ease;
}
.launcher__card:hover { border-color: var(--accent); transform: translateY(-2px); }
.launcher__icon { font-size: 32px; }
.launcher__title { font-size: 18px; font-weight: 800; margin-top: 10px; }
.launcher__desc { font-size: 13px; color: var(--muted); margin-top: 5px; line-height: 1.5; }

.login-wrap { min-height: 100dvh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); }
