:root {
  --nero: #07060a;
  --nero2: #110f16;
  --nero3: #1c1924;
  --bordo: #3a3448;
  --bordo2: #504870;
  --crema: #f8f4ee;
  --crema2: #ddd4c4;
  --muted: #9088a0;
  --bordeaux: #8a1828;
  --bord2: #b82035;
  --blu2: #3a5aaa;
}
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}
.hidden {
  display: none !important;
}
/* ── 1. LAYOUT BASE APP MODERNA (NO SOVRAPPOSIZIONI) ── */
body {
  background: var(--nero);
  color: var(--crema);
  font-family: "EB Garamond", serif;
  touch-action: manipulation;
  height: 100dvh;
  overflow: hidden;
  padding: 0;
  margin: 0;
}

/* Trasformiamo i 3 contenitori principali in Flexbox Verticali */
#mappa,
#menu,
#view-prenotazioni {
  display: flex;
  flex-direction: column;
  height: 100dvh;
  width: 100%;
  overflow: hidden;
}

/* Nasconde le view non attive */
#mappa.hidden,
#menu.hidden,
#view-prenotazioni.hidden {
  display: none !important;
}

/* Aggiungi questo nel CSS della pagina di gestione */
.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch; /* Fluidità su iOS */
  margin-bottom: 15px;
}

/* Layout per schermi piccoli */
@media screen and (max-width: 768px) {
  /* Trasforma la tabella in blocchi */
  #lista-camerieri table,
  #lista-camerieri thead,
  #lista-camerieri tbody,
  #lista-camerieri th,
  #lista-camerieri td,
  #lista-camerieri tr {
    display: block;
  }

  /* Nascondi l'intestazione originale */
  #lista-camerieri thead tr {
    position: absolute;
    top: -9999px;
    left: -9999px;
  }

  #lista-camerieri tr {
    border: 1px solid #8a1828;
    margin-bottom: 15px;
    background: rgba(42, 12, 18, 0.6);
    border-radius: 8px;
    padding: 5px;
  }

  #lista-camerieri td {
    border: none;
    border-bottom: 1px solid #3a1020;
    position: relative;
    padding-left: 50% !important;
    text-align: right;
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: flex-end;
  }

  /* Il segreto: inserisce il nome della colonna prima del valore */
  #lista-camerieri td:before {
    content: attr(data-label);
    position: absolute;
    left: 10px;
    width: 45%;
    padding-right: 10px;
    white-space: nowrap;
    text-align: left;
    font-weight: bold;
    color: #ffb0c0;
  }

  #lista-camerieri td:last-child {
    border-bottom: 0;
    justify-content: center;
    padding-left: 10px !important;
  }
}

/* ── 2. AREE SCORREVOLI (IL CENTRO CHE SI ADATTA) ── */
.mappa-inner,
#menu > .panel,
#view-prenotazioni > .panel {
  flex: 1; /* Prende in automatico tutto lo spazio tra header e footer */
  overflow-y: auto; /* Scorre SOLO quest'area! */
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 30px 16px; /* Spazio ai lati e a fine pagina */
  animation: fadeUp 0.22s ease;
}

/* ── 3. HEADER E BOTTOM BARS (FISSI NEL FLUSSO) ── */
.header-mappa,
.menu-header {
  flex-shrink: 0; /* Impedisce che si schiacci */
  background: var(--nero);
  border-bottom: 1px solid var(--bordo);
  z-index: 10;
  /* Nessun position: fixed o sticky! Ci pensa Flexbox */
}

.header-mappa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: calc(15px + env(safe-area-inset-top)) 16px 15px 16px;
}

.tab-bar,
.bottom-bar {
  flex-shrink: 0; /* Impedisce che si schiacci */
  background: #0e0b13;
  border-top: 1px solid var(--bordo);
  z-index: 10;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar {
  display: flex;
  align-items: stretch;
  height: 65px;
}

.bottom-bar {
  padding: 10px 14px 16px 14px;
}

/* ── REGOLE INTERNE HEADER MAPPA (Logo e Bottoni) ── */
.header-mappa img {
  width: 140px;
  height: auto;
  margin: 0;
  display: block;
  mix-blend-mode: screen;
}

.refresh-btn,
.cal-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  margin: 0;
}
.refresh-btn {
  border: 1px solid var(--bordo2);
  background: var(--nero2);
  color: var(--muted);
  font-size: 1.1rem;
}
.cal-btn {
  border: 1px solid var(--blu2);
  background: #1c2638;
  color: #90b0e0;
  font-size: 1.1rem;
}
.panel {
  animation: fadeUp 0.22s ease;
  padding: 0 16px 20px 16px;
}

/* ── BOTTOM TAB BAR ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: #0e0b13;
  border-top: 1px solid #2a2038;
  display: flex;
  align-items: stretch;
  z-index: 900;
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.tab-btn {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: #5a4e6a;
  font-size: 0.58rem;
  letter-spacing: 0.04em;
  cursor: pointer;
  gap: 3px;
  transition: color 0.15s;
  padding: 0;
}
.tab-btn .tab-ico {
  font-size: 1.3rem;
  line-height: 1;
}
.tab-btn.active {
  color: #e8b4c0;
}
.tab-btn.active .tab-ico {
  filter: drop-shadow(0 0 6px rgba(220, 80, 120, 0.5));
}

/* ── TAB PANELS ── */
.mappa-inner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 60px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}
.tab-panel {
  display: none;
  padding-bottom: 20px;
}
.tab-panel.active {
  display: block;
}
@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
/* Sovrascrive il display solo quando il tab fatture è attivo */
/* FIX VISIBILITÀ TAB FATTURE */
/* ── TAB FATTURE: layout a 3 zone fisse ───────────────────────
   .mappa-inner viene "bloccata" da switchTab quando si entra
   nella tab fatture, così il flex column ha altezza definita.
── */
#tab-fatture {
  height: calc(100vh - 60px);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#tab-fatture.active {
  flex: 1;
  display: flex !important;
}

/* Zona 1 — Upload + regole spese */
#xml-upload-zone {
  border-bottom: 1px solid var(--bordo);
}

/* Zona 2 — Lista prodotti elaborati (prende tutto lo spazio e SCORRE) */
#tab-fatture-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 8px;
}

/* Zona 3 — Barra Annulla/Salva (sempre visibile, mai sovrapposta) */
#bar-conferma-xml {
  flex-shrink: 0;
  display: none;
  padding: 12px 16px;
  background: var(--nero2);
  border-top: 2px solid var(--blu2);
}
#tab-fatture-scroll {
  min-height: 0;
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0 16px 8px;
}
#bar-conferma-xml {
  flex-shrink: 0;
  display: none;
  padding: 12px 16px;
  background: var(--nero2);
  border-top: 2px solid var(--blu2);
}

/* ── HEADER MAPPA ── */
/* 1. Aumentiamo il padding del contenitore principale dell'header */
/* 1. HEADER: Trasformato in Flexbox per allineamento perfetto */
/* ── 1. HEADER ── */
.header-mappa {
  display: flex;
  align-items: center;
  justify-content: space-between;
  /* Calcolo dinamico per il notch/status bar di iOS e Android */
  padding: calc(15px + env(safe-area-inset-top)) 16px 15px 16px;
  background: var(--nero);
  border-bottom: 1px solid var(--bordo);

  /* Mantieni l'header in alto */
  position: sticky;
  top: 0;
  z-index: 900; /* Z-index altissimo per non farsi coprire da nulla */
}

.header-mappa img {
  width: 140px;
  height: auto;
  margin: 0;
  display: block;
  mix-blend-mode: screen;
}

/* Bottoni laterali dell'header */
.refresh-btn,
.cal-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0; /* Impedisce che il bottone si deformi */
  margin: 0;
}
.refresh-btn {
  border: 1px solid var(--bordo2);
  background: var(--nero2);
  color: var(--muted);
  font-size: 1.1rem;
}
.cal-btn {
  border: 1px solid var(--blu2);
  background: #1c2638;
  color: #90b0e0;
  font-size: 1.1rem;
}

/* ── 2. CONTENITORI (IL VERO FIX) ── */
/* Se hai ancora .mappa-inner nel tuo HTML, DEVI usare questo CSS */
.mappa-inner {
  position: relative; /* NON fixed, NON absolute */
  top: auto;
  bottom: auto;
  padding-bottom: 90px; /* Spazio per la bottom bar */
}

/* Distanziamo le dashboard dall'header */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 20px 16px 14px 16px; /* I 20px spingono in giù la barra */
}

.admin-main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 25px; /* Spinge in giù la griglia admin */
  padding: 0 16px;
}

/* ── SCHERMATA LOGIN CUSTOM ── */
#login-screen {
  position: fixed;
  inset: 0;
  background: var(--nero);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.login-box {
  background: var(--nero2);
  padding: 30px 20px;
  border-radius: 8px;
  border: 1px solid var(--bordo);
  width: 90%;
  max-width: 350px;
  text-align: center;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.8);
}
.login-logo {
  width: 150px;
  margin-bottom: 25px;
  mix-blend-mode: screen;
}

/* ── DASHBOARD STATS BAR ── */
.stats-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  padding: 0 16px 14px;
}
.stat-card {
  background: var(--nero2);
  border: 1px solid var(--bordo);
  border-radius: 5px;
  padding: 9px 8px;
  text-align: center;
  cursor: pointer;
}
.stat-label {
  font-family: "Cormorant SC", serif;
  font-size: 0.52rem;
  letter-spacing: 0.12em;
  color: var(--muted);
}
.stat-val {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.1rem;
  font-style: italic;
  color: var(--crema);
  margin-top: 2px;
}
.stat-card.verde .stat-val {
  color: #4ade80;
}
.stat-card.giallo .stat-val {
  color: #fbbf24;
}
.stat-card.rosso .stat-val {
  color: #f87171;
}
.stat-card.blu .stat-val {
  color: #90b0e0;
}
.auto-refresh-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #22c55e;
  display: inline-block;
  margin-left: 4px;
  animation: pulse-dot 2s infinite;
}
@keyframes pulse-dot {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.3;
  }
}

/* ── TAVOLI ── */
.grid-tavoli {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
/* Tavolo in attesa: coperti impostati ma nessun ordine ancora */
.tavolo-attesa {
  background: linear-gradient(160deg, #3a2800, #705000) !important;
  border: 2px solid #f59e0b !important;
  color: #fff !important;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.35) !important;
  position: relative;
}
.lbl-svuota-tavolo {
  position: absolute;
  top: 5px;
  left: 6px;
  font-size: 0.6rem;
  background: rgba(0, 0, 0, 0.45);
  border: 1px solid rgba(245, 158, 11, 0.5);
  border-radius: 3px;
  color: #fbbf24;
  padding: 1px 5px;
  cursor: pointer;
  z-index: 2;
  line-height: 1.5;
  pointer-events: auto;
}
.tavolo {
  height: 80px;
  border-radius: 5px;
  font-family: "Cormorant SC", serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.1s;
  position: relative;
  color: var(--crema);
}
.tavolo:active {
  transform: scale(0.96);
}
.t-num {
  font-size: 0.72rem;
  letter-spacing: 0.2em;
  color: var(--muted);
}
.t-tot {
  font-size: 1rem;
  color: #ffffff;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  margin-top: 4px;
}
.t-coperti {
  font-size: 0.6rem;
  color: var(--muted);
  margin-top: 2px;
}
.t-cam {
  position: absolute;
  top: 5px;
  right: 7px;
  font-size: 0.55rem;
  color: var(--muted);
  font-family: "Cormorant SC", serif;
}

/* ── SEZIONE ── */
.sezione {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--crema2);
  font-family: "Cormorant SC", serif;
  font-size: 0.63rem;
  letter-spacing: 0.25em;
  margin: 22px 0 10px 0;
}
.sezione::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--bordo2);
}

/* ── MENU TAVOLO E CART ── */
.menu-header {
  position: sticky;
  top: 0;
  background: var(--nero);
  z-index: 10;
  padding: 16px 16px 12px 16px;
  border-bottom: 1px solid var(--bordo);
}
.menu-header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.back-btn {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  color: var(--bord2);
  font-size: 1rem;
  background: none;
  border: none;
  cursor: pointer;
}
.tavolo-title {
  font-family: "Cormorant SC", serif;
  font-size: 1rem;
  letter-spacing: 0.25em;
  color: #ffffff;
}
.action-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.action-btn {
  padding: 12px;
  border-radius: 4px;
  font-family: "Cormorant SC", serif;
  font-size: 0.75rem;
  letter-spacing: 0.15em;
  cursor: pointer;
  border: 1px solid;
}
.btn-sep {
  background: #1c2638;
  border-color: #304a70;
  color: #90b0e0;
}
.btn-cassa {
  background: #2a0c12;
  border-color: var(--bord2);
  color: #ffb0c0;
}

.cart-box {
  background: var(--nero2);
  border: 1px solid var(--bordo);
  border-radius: 4px;
  padding: 10px 12px;
  min-height: 44px;
}
.cart-row {
  display: flex;
  flex-direction: column;
  padding: 6px 0;
  border-bottom: 1px solid var(--bordo);
}
.cart-row:last-child {
  border-bottom: none;
}
.cart-row-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.cart-nome {
  font-size: 0.9rem;
  flex: 1;
  cursor: pointer;
}
.cart-nota-badge {
  font-size: 0.72rem;
  color: #fbbf24;
  font-style: italic;
  margin-top: 2px;
}
.nota-icon {
  font-size: 0.85rem;
  color: #60a5fa;
  cursor: pointer;
  padding: 0 8px;
}
.qty-grp {
  display: flex;
  align-items: center;
  gap: 8px;
}
.qty-btn {
  width: 26px;
  height: 26px;
  border-radius: 3px;
  border: 1px solid var(--bordo2);
  background: var(--nero3);
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #ffffff;
}
.qty-num {
  font-family: "Cormorant Garamond", serif;
  font-size: 1.05rem;
  min-width: 18px;
  text-align: center;
}

/* ── ORDINATO ── */
.sent-box {
  background: #0c0a10;
  border: 1px solid var(--bordo);
  border-left: 2px solid var(--bordeaux);
  border-radius: 4px;
  padding: 10px 12px;
}
.sent-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 0;
  border-bottom: 1px solid var(--bordo);
}
.sent-row:last-child {
  border-bottom: none;
}
.sent-nome {
  font-size: 0.9rem;
  flex: 1;
}
.sent-info {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  flex-wrap: wrap;
}
.tag-rep {
  font-family: "Cormorant SC", serif;
  font-size: 0.52rem;
  padding: 2px 5px;
  border-radius: 2px;
}
.tag-cucina {
  background: #3a1808;
  color: #ffaa60;
  border: 1px solid #804020;
}
.tag-sala {
  background: #0c1a3a;
  color: #80b8ff;
  border: 1px solid #204080;
}
.sent-prezzo {
  font-size: 0.72rem;
  color: var(--crema2);
  font-style: italic;
  margin-right: 6px;
}
.sent-nota {
  font-size: 0.7rem;
  color: #fbbf24;
  font-style: italic;
  width: 100%;
  padding-left: 4px;
}

.timer-badge {
  font-size: 0.6rem;
  font-family: "Cormorant SC", serif;
  padding: 1px 5px;
  border-radius: 3px;
  white-space: nowrap;
}
.timer-verde {
  background: #052e16;
  color: #4ade80;
  border: 1px solid #15803d;
}
.timer-giallo {
  background: #2d1900;
  color: #fbbf24;
  border: 1px solid #92400e;
}
.timer-rosso {
  background: #1c0408;
  color: #f87171;
  border: 1px solid #991b1b;
  animation: blink 1.5s infinite;
}
@keyframes blink {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

.storico-box {
  background: #08060d;
  border: 1px solid var(--bordo);
  border-left: 2px solid var(--muted);
  border-radius: 4px;
  padding: 10px 12px;
  opacity: 0.75;
}
.storico-row {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 0.82rem;
  color: var(--muted);
  border-bottom: 1px dashed var(--bordo);
}
.storico-row:last-child {
  border-bottom: none;
}
.storico-annullato {
  text-decoration: line-through;
  opacity: 0.5;
}
.storico-toggle {
  font-family: "Cormorant SC", serif;
  font-size: 0.6rem;
  letter-spacing: 0.12em;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
}

/* ── ITEMS E BOTTONI ── */
.item-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.item {
  padding: 15px 8px;
  border-radius: 4px;
  font-family: "EB Garamond", serif;
  font-size: 0.95rem;
  text-align: center;
  cursor: pointer;
  border: 1px solid;
  transition: transform 0.1s;
}
.item:active {
  transform: scale(0.97);
}
.item-food {
  background: #1e1530;
  border-color: #5a4080;
  color: #e8d8ff;
}
.item-wine {
  background: #2a0e14;
  border-color: #902030;
  color: #ffc0c8;
}
.item-spirit {
  background: #0e1a38;
  border-color: #2a5090;
  color: #b8d0ff;
}
.item-beer {
  background: #201800;
  border-color: #705000;
  color: #ffd870;
}
.item-acqua {
  background: #081820;
  border-color: #205060;
  color: #90d8f0;
}
/* badge rimanenza sotto il nome prodotto */
.scorta-badge {
  display: block;
  font-size: 0.6rem;
  font-family: "Cormorant SC", serif;
  letter-spacing: 0.05em;
  margin-top: 4px;
  opacity: 0.9;
}
.scorta-ok {
  color: #4ade80;
}
.scorta-warn {
  color: #fbbf24;
}
.scorta-esaurito {
  color: #f87171;
}
.item-esaurito {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(60%);
}

.bottom-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--nero);
  border-top: 1px solid var(--bordo);
  padding: 10px 14px calc(16px + env(safe-area-inset-bottom)) 14px; /* Adattamento per iPhone */
  z-index: 9500; /* FIX: Sta sopra a tutto tranne le modali */
}

/* Aggiungi questo padding per far scorrere il menu sopra la barra fissa */
#menu > .panel {
  padding-bottom: 160px !important; 
}
.btn-void,
.btn-add-confirm {
  width: 100%;
  padding: 11px;
  border-radius: 3px;
  font-family: "Cormorant SC", serif;
  font-size: 0.72rem;
  cursor: pointer;
  margin-bottom: 8px;
  display: none;
}
.btn-void {
  background: #180608;
  border: 1px solid var(--bordeaux);
  color: #c07080;
}
.btn-add-confirm {
  background: #08180e;
  border: 1px solid #286040;
  color: #70b088;
}
.bottom-bar-row {
  display: flex;
  gap: 8px;
}
.btn-clear {
  padding: 14px 16px;
  border-radius: 3px;
  background: var(--nero2);
  border: 1px solid var(--bordo2);
  color: var(--muted);
  cursor: pointer;
}
.btn-invia {
  flex: 1;
  padding: 14px;
  border-radius: 3px;
  background: var(--bordeaux);
  border: 1px solid var(--bord2);
  color: var(--crema);
  font-family: "Cormorant SC", serif;
  letter-spacing: 0.2em;
  cursor: pointer;
}

/* ── MODALI E INPUT ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 3, 6, 0.9);
  display: flex;
  align-items: flex-start; /* FIX: Permette lo scroll naturale senza tagliare l'alto */
  justify-content: center;
  z-index: 9999; /* FIX: Supera l'header fisso che è a 900 */
  backdrop-filter: blur(6px);
  overflow-y: auto;
  padding: 20px 0;
}

.modal-box {
  background: var(--nero2);
  border: 1px solid var(--bordo2);
  border-top: 2px solid var(--bordeaux);
  border-radius: 6px;
  padding: 24px;
  text-align: center;
  width: 92%;
  max-width: 380px;
  margin: 40px auto; /* FIX: Spinge la modale sotto il logo */
  max-height: 85dvh; /* FIX: Limita l'altezza della modale */
  overflow-y: auto;  /* FIX: Rende il contenuto interno della modale scrollabile */
}
.modal-title {
  font-family: "Cormorant SC", serif;
  font-size: 1.1rem;
  letter-spacing: 0.15em;
  margin-bottom: 10px;
}
.modal-btns {
  display: flex;
  gap: 10px;
  margin-top: 15px;
}
.modal-cancel,
.modal-confirm {
  flex: 1;
  padding: 14px;
  border-radius: 4px;
  font-family: "Cormorant SC", serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  border: 1px solid;
}
.modal-cancel {
  background: var(--nero3);
  border-color: var(--bordo2);
  color: var(--muted);
}
.modal-confirm {
  background: var(--bordeaux);
  border-color: var(--bord2);
  color: var(--crema);
}

.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 15px;
}
.dash-card {
  background: var(--nero3);
  border: 1px solid var(--bordo);
  border-radius: 5px;
  padding: 14px;
}
.dash-label {
  font-size: 0.7rem;
  color: var(--muted);
  font-family: "Cormorant SC", serif;
  letter-spacing: 0.1em;
}
.dash-val {
  font-size: 1.6rem;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  margin-top: 4px;
}

.coperti-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 8px;
  margin: 15px 0;
}
.cop-btn {
  padding: 14px 6px;
  border-radius: 4px;
  font-family: "Cormorant SC", serif;
  font-size: 1rem;
  border: 1px solid var(--bordo2);
  background: var(--nero3);
  color: var(--crema2);
  cursor: pointer;
  transition: 0.1s;
}
.cop-btn.sel {
  background: var(--bordeaux);
  border-color: var(--bord2);
  color: #fff;
}
.cop-btn:active {
  transform: scale(0.95);
}

.cassa-input {
  width: 100%;
  padding: 12px;
  font-size: 1.2rem;
  text-align: center;
  background: #0a080e;
  color: #4ade80;
  border: 1px solid var(--bordo2);
  border-radius: 6px;
  margin: 8px 0;
  outline: none;
  font-family: "Courier New", monospace;
}
.cassa-input::placeholder {
  color: #2a2830;
}
.haccp-btn {
  background: var(--nero3);
  border: 1px solid var(--bordo2);
  border-radius: 4px;
  padding: 14px;
  color: var(--crema2);
  font-family: "Cormorant SC", serif;
  font-size: 0.9rem;
  letter-spacing: 0.1em;
  cursor: pointer;
  width: 100%;
  display: block;
  transition: 0.1s;
}
.form-label {
  font-size: 0.85rem;
  color: var(--muted);
  font-weight: bold;
  letter-spacing: 0.05em;
  display: block;
  margin-bottom: 4px;
  text-transform: uppercase;
}

/* ── CALENDARIO ── */
.cal-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 15px;
  background: var(--nero2);
  padding: 10px;
  border-radius: 6px;
  border: 1px solid var(--bordo);
}
.cal-nav button {
  background: var(--nero3);
  border: 1px solid var(--bordo2);
  color: var(--crema2);
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  font-weight: bold;
}
.cal-month {
  font-family: "Cormorant SC", serif;
  font-size: 1.1rem;
  letter-spacing: 0.1em;
  color: var(--crema);
  text-transform: uppercase;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 6px;
  margin-bottom: 15px;
}
.cal-dow {
  text-align: center;
  font-size: 0.75rem;
  color: var(--muted);
  padding: 5px 0;
  font-family: "Cormorant SC", serif;
  letter-spacing: 0.1em;
}
.cal-day {
  aspect-ratio: 1;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  border: 1px solid var(--bordo);
  cursor: pointer;
  background: var(--nero3);
  transition: 0.1s;
  position: relative;
}
.cal-day.empty {
  background: transparent;
  border-color: transparent;
  cursor: default;
}
.cal-day.has-prenotazioni {
  border-color: #3b82f6;
  background: #1e293b;
  color: #93c5fd;
  font-weight: bold;
}
.cal-day.has-evento {
  border-color: #8b5cf6;
  background: #2e1065;
  color: #ddd6fe;
  box-shadow: inset 0 0 8px rgba(139, 92, 246, 0.3);
}
.cal-day.selected {
  border-width: 2px;
  transform: scale(0.95);
  opacity: 0.8;
}
.cal-dot {
  width: 6px;
  height: 6px;
  background: #60a5fa;
  border-radius: 50%;
  margin-top: 4px;
}
.cal-dot-evento {
  width: 6px;
  height: 6px;
  background: #c4b5fd;
  border-radius: 50%;
  margin-top: 4px;
  box-shadow: 0 0 4px #c4b5fd;
}

/* ── SWITCH ADMIN ── */
.switch {
  position: relative;
  display: inline-block;
  width: 60px;
  height: 34px;
}
.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #3a3448;
  transition: 0.4s;
  border-radius: 34px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 26px;
  width: 26px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: 0.4s;
  border-radius: 50%;
}
input:checked + .slider {
  background-color: #b82035;
}
input:checked + .slider:before {
  transform: translateX(26px);
}
.admin-tab {
  flex: 1;
  padding: 12px;
  text-align: center;
  border: 1px solid #8a1828;
  background: #1c080d;
  border-radius: 8px;
  cursor: pointer;
  color: #ffb0c0;
  font-weight: bold;
  transition: 0.2s;
}
.admin-tab.active {
  background: #8a1828;
  color: #fff;
  border-color: #b82035;
}

/* ── TOAST NOTIFICATION ── */
#toast-container {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
}
.toast {
  padding: 12px 20px;
  border-radius: 6px;
  font-family: "Cormorant SC", serif;
  font-size: 0.8rem;
  letter-spacing: 0.1em;
  color: #fff;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  animation:
    toastIn 0.25s ease,
    toastOut 0.3s ease 2.5s forwards;
  pointer-events: none;
  border: 1px solid;
  max-width: 320px;
  text-align: center;
}
.toast-ok {
  background: #064e3b;
  border-color: #10b981;
}
.toast-err {
  background: #450a0a;
  border-color: #f87171;
}
.toast-warn {
  background: #2d1900;
  border-color: #f59e0b;
}
.toast-info {
  background: #1e1b4b;
  border-color: #818cf8;
}
@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
@keyframes toastOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}

/* ── RICERCA PRODOTTI ── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--nero2);
  border: 1px solid var(--bordo2);
  border-radius: 4px;
  padding: 0 10px;
  margin-bottom: 10px;
  gap: 8px;
}
.search-bar input {
  flex: 1;
  background: none;
  border: none;
  outline: none;
  color: var(--crema);
  font-family: "EB Garamond", serif;
  font-size: 1rem;
  padding: 10px 0;
}
.search-bar input::placeholder {
  color: var(--muted);
}
.search-bar .search-clear {
  color: var(--muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 4px;
}

/* ── CHIUSURA GIORNATA ── */
.giornata-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 15px 0;
}
.giornata-card {
  background: var(--nero3);
  border: 1px solid var(--bordo);
  border-radius: 5px;
  padding: 12px;
  text-align: center;
}
.giornata-label {
  font-size: 0.65rem;
  color: var(--muted);
  font-family: "Cormorant SC", serif;
  letter-spacing: 0.1em;
}
.giornata-val {
  font-size: 1.4rem;
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  margin-top: 3px;
}

/* ── BARRA DI PROGRESSO ANIMATA (ZIP FATTURE) ── */
.progress-container {
  width: 100%;
  background-color: var(--nero3);
  border: 1px solid var(--bordo);
  border-radius: 4px;
  overflow: hidden;
  height: 12px;
  margin-top: 8px;
  display: none; /* Nascosta di default */
}
.progress-bar-striped {
  height: 100%;
  width: 100%;
  background: repeating-linear-gradient(
    45deg,
    #3b82f6,
    #3b82f6 10px,
    #2563eb 10px,
    #2563eb 20px
  );
  background-size: 28px 28px;
  animation: moveProgress 1s linear infinite;
}
@keyframes moveProgress {
  0% { background-position: 0 0; }
  100% { background-position: 28px 0; }
}

/* ══════════════════════════════════════════════════════════════
   CLASSI BOTTONI ADMIN (sostituiscono inline styles)
   ══════════════════════════════════════════════════════════════ */
.haccp-btn { display: block; width: 100%; padding: 14px; font-size: 0.85rem; border-radius: 6px; cursor: pointer; border: 1px solid; text-align: center; }
.btn-report { background: #1e1a26; border-color: #403a50; color: #60a5fa; font-weight: bold; }
.btn-costi { background: #1a1020; border-color: #5a3870; color: #c89aee; }
.btn-dashboard { background: #1a2010; border-color: #3a5020; color: #a0d070; }
.btn-chiusura { background: #1e1b4b; border-color: #4c1d95; color: #c4b5fd; font-weight: bold; }
.btn-menu-edit { background: #1a1008; border-color: #5a4020; color: #f5c06a; }
.btn-magazzino { background: #0c1a18; border-color: #1a5040; color: #5dcaa5; }
.btn-camerieri { background: #0c2218; border-color: #1a6040; color: #6ee7b7; }
.btn-radar { background: #1c0810; border-color: #5a1020; color: #f0997b; }
.btn-fatture { background: #0c1020; border-color: #1a3060; color: #85b7eb; }
.btn-backup { background: #1a1a0c; border-color: #505010; color: #d0d070; }
.btn-back { background: var(--nero3); border-color: var(--bordo); color: var(--crema); padding: 12px; }
.btn-logout { background: #110f16; border-color: var(--bordo2); color: var(--muted); padding: 16px; margin-bottom: 20px; }
.btn-arena { background: linear-gradient(135deg, #1a1030, #2a1848); border-color: #6a48a0; color: #c89aee; font-weight: bold; padding: 16px; margin-bottom: 20px; }
.btn-add { background: #2d1900; border-color: #92400e; color: #fbbf24; }
.btn-cucina-link { background: #0c1a38; border-color: #2a5090; color: #b8d0ff; text-decoration: none; padding: 12px; display: block; }
.btn-ok-green { background: #1a4a2e; border-color: #2a7a48; color: #6ee7b7; }

/* ── ADMIN HUB LAYOUT ─────────────────────────────────────── */
.admin-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 18px; }
.admin-section { font-family: 'Cormorant Garamond', serif; font-size: 0.95rem; color: var(--crema2); margin-bottom: 10px; padding-bottom: 4px; border-bottom: 1px solid rgba(58, 52, 72, 0.3); }

/* ── FORM COMPATTI (nei modal admin) ──────────────────────── */
.form-compact { font-size: 1rem; padding: 10px 12px; margin: 0; color: #fff; }
.form-grid { display: grid; gap: 8px; margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed var(--bordo); }
.form-grid-2 { grid-template-columns: 1fr 1fr; }
.form-grid-3 { grid-template-columns: 2fr 1fr; }
.form-span-2 { grid-column: span 2; }

/* ── SCROLL LIST (lista articoli nei modal) ───────────────── */
.scroll-list { max-height: 40vh; overflow-y: auto; text-align: left; }
.scroll-list-tall { max-height: 50vh; }

/* ── ADMIN TAB (tab interne ai modal) ─────────────────────── */
.admin-tab {
  padding: 8px 16px; border: 1px solid var(--bordo); border-radius: 6px;
  background: var(--nero3); color: var(--muted); cursor: pointer; font-size: 0.8rem;
  transition: all 0.2s;
}
.admin-tab.active { background: var(--bordo2); color: #fff; border-color: var(--bordo2); }
.admin-tab:hover:not(.active) { border-color: var(--bordo2); }

/* ── MAGAZZINO ITEM ───────────────────────────────────────── */
.mag-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 0; border-bottom: 1px solid rgba(58, 52, 72, 0.3);
}
.mag-item-name { font-size: 0.9rem; color: var(--crema); font-weight: 500; }
.mag-item-info { font-size: 0.72rem; color: var(--muted); margin-top: 2px; }
.mag-item-qty { font-size: 1.1rem; font-weight: 700; min-width: 60px; text-align: right; }
.mag-item-qty.low { color: #f87171; }
.mag-item-qty.ok { color: #4ade80; }
.mag-item-actions { display: flex; gap: 6px; align-items: center; }
.mag-btn-sm {
  padding: 6px 10px; border-radius: 4px; border: 1px solid; font-size: 0.7rem;
  cursor: pointer; background: var(--nero);
}
.mag-btn-edit { border-color: var(--bordo2); color: #a78bfa; }
.mag-btn-scarto { border-color: #92400e; color: #fbbf24; }
.mag-btn-del { border-color: #991b1b; color: #f87171; }

/* ── CATEGORIA ITEM ───────────────────────────────────────── */
.cat-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 0; border-bottom: 1px solid rgba(58, 52, 72, 0.3);
}
.cat-path { font-size: 0.85rem; color: var(--crema); }
.cat-path-sep { color: var(--bordo2); margin: 0 6px; }
.cat-del { background: none; border: none; color: #f87171; cursor: pointer; font-size: 0.9rem; padding: 4px 8px; }

/* ── LABELS COLORATE (form) ───────────────────────────────── */
.lbl-purple { color: #c4b5fd; }
.lbl-blue { color: #60a5fa; }
.lbl-green { color: #86efac; }
.lbl-amber { color: #fbbf24; }
.lbl-red { color: #f87171; }
.lbl-teal { color: #5dcaa5; }
