/* App ordini del forno: pensata per il telefono (browser moderni), stessi colori della dashboard */
:root {
  --sfondo: #1b1510;
  --carta: #2a211a;
  --carta2: #33281f;
  --linea: #3a2e24;
  --testo: #f6ede1;
  --tenue: #a8977f;
  --oro: #ffc56b;
  --oro-scuro: #2a1c0b;
  --verde: #47c46b;
  --rosso: #e5533d;
  --barra-h: 64px;
  --testa-h: 56px;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--sfondo); color: var(--testo); }
body {
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding: calc(var(--testa-h) + env(safe-area-inset-top)) 0 calc(var(--barra-h) + 24px + env(safe-area-inset-bottom));
}
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--testo); }

/* ---------- testata con il giorno ---------- */
.testa {
  position: fixed; top: 0; left: 0; right: 0; z-index: 20;
  height: calc(var(--testa-h) + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 12px 0;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--sfondo); border-bottom: 1px solid var(--linea);
}
.testa-titolo { font-weight: 800; font-size: 1.15rem; }
.giorno { display: flex; align-items: center; }
.giorno-freccia { background: var(--carta); border: 0; border-radius: 10px; width: 38px; height: 38px; font-size: 1.4rem; }
.giorno-valore { background: none; border: 0; font-weight: 700; padding: 0 10px; min-width: 128px; text-align: center; }
.giorno.nascosto { visibility: hidden; }

/* ---------- viste ---------- */
.vista { display: none; padding: 12px; }
.vista.attiva { display: block; }

.riassunto { color: var(--tenue); margin: 4px 2px 12px; }
.vuoto { color: var(--tenue); text-align: center; padding: 32px 16px; }
.vuoto b { color: var(--oro); }

.carta {
  display: flex; align-items: center; gap: 12px;
  background: var(--carta); border-radius: 14px; padding: 12px; margin-bottom: 10px;
  border: 0; width: 100%; text-align: left;
}
.carta:active { background: var(--carta2); }
.miniatura {
  flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--carta2);
  display: grid; place-items: center; font-size: 1.8rem; overflow: hidden;
}
.miniatura img { width: 100%; height: 100%; object-fit: cover; }
.carta-testo { flex: 1; min-width: 0; }
.carta-titolo { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carta-sotto { color: var(--tenue); font-size: .88rem; }
.carta-destra { flex: none; font-weight: 800; font-size: 1.2rem; }
.segnale { color: var(--oro); font-size: .85rem; }

/* ---------- prodotti: indice delle categorie fisso in alto, come i menù delivery ---------- */
.indice {
  position: sticky; top: calc(var(--testa-h) + env(safe-area-inset-top)); z-index: 10;
  display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -12px -12px 8px; padding: 10px 12px; background: var(--sfondo); border-bottom: 1px solid var(--linea);
}
.indice::-webkit-scrollbar { display: none; }
.indice button {
  flex: none; border: 0; border-radius: 999px; padding: 7px 14px; background: var(--carta); white-space: nowrap;
}
.indice button.attiva { background: var(--oro); color: var(--oro-scuro); font-weight: 700; }
.categoria { scroll-margin-top: calc(var(--testa-h) + 64px); }
.categoria h3 { margin: 18px 2px 10px; font-size: 1.1rem; }

.cerca {
  width: 100%; background: var(--carta); border: 1px solid var(--linea); border-radius: 12px;
  padding: 11px 14px; margin-bottom: 12px;
}

/* ---------- riepilogo ---------- */
.sottoschede { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 12px; scrollbar-width: none; }
.sottoschede button { flex: none; border: 0; border-radius: 999px; padding: 7px 13px; background: var(--carta); }
.sottoschede button.attiva { background: var(--oro); color: var(--oro-scuro); font-weight: 700; }
.foglio-cliente { background: var(--carta); border-radius: 14px; padding: 12px 14px; margin-bottom: 12px; }
.foglio-cliente h3 { margin: 0 0 8px; display: flex; justify-content: space-between; }
.riga { display: flex; justify-content: space-between; gap: 10px; padding: 7px 0; border-top: 1px solid var(--linea); }
.riga:first-of-type { border-top: 0; }
.riga .q { font-weight: 800; white-space: nowrap; }
.riga .dett { color: var(--tenue); font-size: .85rem; }
.nota-ordine { color: var(--oro); font-size: .9rem; margin-top: 6px; }
.avviso-riga { background: #3a2a14; border-left: 4px solid var(--oro); border-radius: 10px; padding: 10px 12px; margin-bottom: 8px; }
.avviso-riga b { color: var(--oro); }
.tutto-ok { background: #1f3322; border-left: 4px solid var(--verde); border-radius: 10px; padding: 12px; }
.banner-avvisi { display: block; width: 100%; text-align: left; border: 0; background: #3a2a14; color: var(--oro); border-radius: 12px; padding: 10px 12px; margin-bottom: 12px; }
.stampa { margin-top: 8px; width: 100%; }

/* ---------- pulsante + e barra in basso ---------- */
.piu {
  position: fixed; right: 18px; bottom: calc(var(--barra-h) + 18px + env(safe-area-inset-bottom)); z-index: 25;
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--oro); color: var(--oro-scuro); font-size: 2.2rem; line-height: 1; font-weight: 700;
  box-shadow: 0 6px 18px rgba(0,0,0,.45);
}
.piu.nascosto { display: none; }
.barra {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  height: calc(var(--barra-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  display: flex; background: #211a14; border-top: 1px solid var(--linea);
}
.barra button { flex: 1; border: 0; background: none; color: var(--tenue); font-size: .72rem; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.barra button span { font-size: 1.35rem; }
.barra button.attiva { color: var(--oro); font-weight: 700; }

/* ---------- foglio (moduli) ---------- */
.velo { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 40; display: none; }
.velo.aperto { display: block; }
.foglio {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92vh;
  display: flex; flex-direction: column;
  background: var(--sfondo); border-radius: 18px 18px 0 0; border-top: 1px solid var(--linea);
  transform: translateY(105%); transition: transform .22s ease;
}
.foglio.aperto { transform: none; }
.foglio-testa { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--linea); }
.foglio-testa h2 { margin: 0; font-size: 1.15rem; }
.foglio-chiudi { border: 0; background: var(--carta); width: 36px; height: 36px; border-radius: 10px; }
.foglio-corpo { overflow-y: auto; padding: 14px; flex: 1; }
.foglio-piede { display: flex; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); border-top: 1px solid var(--linea); }
.foglio-piede button { flex: 1; }

.campo { margin-bottom: 14px; }
.campo label { display: block; color: var(--tenue); font-size: .88rem; margin-bottom: 5px; }
.campo label .obbl { color: var(--oro); }
.campo input, .campo select, .campo textarea {
  width: 100%; background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 11px 12px;
}
.campo textarea { min-height: 70px; resize: vertical; }
.campo .aiuto { color: var(--tenue); font-size: .8rem; margin-top: 4px; }
.fila { display: flex; gap: 10px; }
.fila > .campo { flex: 1; }
.segmenti { display: flex; gap: 6px; }
.segmenti button { flex: 1; border: 1px solid var(--linea); background: var(--carta); border-radius: 10px; padding: 10px 6px; font-size: .9rem; }
.segmenti button.attiva { background: var(--oro); color: var(--oro-scuro); border-color: var(--oro); font-weight: 700; }
.foto-campo { display: flex; align-items: center; gap: 12px; }
.foto-campo .miniatura { width: 64px; height: 64px; }

.bottone-primario, .bottone-secondario, .bottone-pericolo {
  border: 0; border-radius: 12px; padding: 13px 14px; font-weight: 700;
}
.bottone-primario { background: var(--oro); color: var(--oro-scuro); }
.bottone-secondario { background: var(--carta); }
.bottone-pericolo { background: #4a2620; color: #ffd2c9; }
.bottone-pericolo.conferma { background: var(--rosso); color: #fff; }

/* ricetta */
.ricetta-riga { display: flex; gap: 6px; align-items: center; margin-bottom: 8px; }
.ricetta-riga select { flex: 1; min-width: 0; background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 10px 8px; }
.ricetta-riga input { width: 88px; background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 10px 8px; text-align: right; }
.ricetta-riga .unita { width: 28px; color: var(--tenue); font-size: .85rem; }
.ricetta-riga .togli { border: 0; background: none; color: var(--tenue); font-size: 1.2rem; width: 30px; }
.aggiungi-riga { border: 1px dashed var(--linea); background: none; border-radius: 10px; padding: 10px; width: 100%; color: var(--oro); }

/* ordine: prodotti con + e − */
.scelta-cliente { display: flex; flex-wrap: wrap; gap: 8px; }
.scelta-cliente button { border: 1px solid var(--linea); background: var(--carta); border-radius: 999px; padding: 8px 14px; }
.scelta-cliente button.attiva { background: var(--oro); color: var(--oro-scuro); border-color: var(--oro); font-weight: 700; }
.passo-riga { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--linea); }
.passo-riga .nome { flex: 1; min-width: 0; }
.passo-riga .nome small { display: block; color: var(--tenue); }
.stepper { display: flex; align-items: center; gap: 6px; }
.stepper button { width: 38px; height: 38px; border-radius: 10px; border: 0; background: var(--carta2); font-size: 1.3rem; font-weight: 700; }
.stepper input { width: 56px; text-align: center; background: var(--carta); border: 1px solid var(--linea); border-radius: 10px; padding: 8px 4px; font-weight: 800; }
.stepper .rapida { position: relative; width: 30px; height: 38px; border-radius: 10px; background: var(--carta2); display: flex; align-items: center; justify-content: center; font-weight: 700; color: var(--tenue); }
.stepper .rapida select { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; }
.stepper.con-quantita input { border-color: var(--oro); color: var(--oro); }
.ordine-categoria { margin: 16px 0 4px; font-weight: 700; color: var(--oro); }

.avviso-toast {
  position: fixed; left: 50%; bottom: calc(var(--barra-h) + 90px); transform: translateX(-50%);
  background: #000c; color: #fff; padding: 10px 16px; border-radius: 999px; z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity .2s; max-width: 90vw; text-align: center;
}
.avviso-toast.visibile { opacity: 1; }

/* ---------- stampa: un foglio per cliente, poi totali e ingredienti ---------- */
@media print {
  :root { --sfondo: #fff; --carta: #fff; --carta2: #fff; --linea: #999; --testo: #000; --tenue: #444; --oro: #000; }
  body { padding: 0; background: #fff; color: #000; }
  .testa, .barra, .piu, .sottoschede, .stampa, .banner-avvisi { display: none !important; }
  .vista { display: none !important; }
  #vista-riepilogo { display: block !important; padding: 0; }
  .foglio-cliente { page-break-after: always; border: 1px solid #999; }
  .riga .dett { color: #444; }
  .stampa-sezione { page-break-before: always; }
}

/* ---------- impostazioni e accesso ---------- */
.ingranaggio { border: 0; background: var(--carta); width: 38px; height: 38px; border-radius: 10px; font-size: 1.1rem; margin-left: 6px; }
.titolo-vista { margin: 4px 2px 12px; }
.consiglio { display: block; width: 100%; text-align: left; border: 0; background: #3a2a14; color: var(--oro); border-radius: 12px; padding: 11px 12px; margin-bottom: 12px; }
.stato-sicurezza { font-weight: 700; margin: 4px 0 12px; }
.stato-sicurezza.ok { color: var(--verde); }
.stato-sicurezza.no { color: var(--oro); }
.accesso { position: fixed; inset: 0; z-index: 80; background: var(--sfondo); display: none; place-items: center; padding: 24px; }
.accesso.aperto { display: grid; }
.accesso-scatola { width: 100%; max-width: 340px; display: flex; flex-direction: column; gap: 12px; text-align: center; }
.accesso-logo { font-size: 3rem; }
.accesso-scatola h2 { margin: 0 0 8px; }
.accesso-scatola input { background: var(--carta); border: 1px solid var(--linea); border-radius: 12px; padding: 14px; font-size: 1.1rem; text-align: center; }
.accesso-errore { color: #ff8f7a; min-height: 1.2em; margin: 0; }
.testa-titolo { white-space: nowrap; }
.foglio-cliente .bottone-secondario { background: var(--carta2); border: 1px solid var(--linea); }

/* ---------- ordini dall'area clienti ---------- */
.barra button { position: relative; }
.pallino { position: absolute; top: 4px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--rosso); color: #fff; font-style: normal; font-size: .7rem; font-weight: 800; line-height: 18px; }
.pallino[hidden] { display: none; }
.da-approvare { background: #3a2a14; border-radius: 14px; padding: 10px; margin-bottom: 14px; color: var(--testo, inherit); }
.da-approvare-titolo { color: var(--oro); font-weight: 800; margin: 2px 4px 8px; }
.richiesta { margin-bottom: 10px; }
.richiesta .carta { margin-bottom: 6px; }
.richiesta-azioni { display: flex; gap: 6px; }
.richiesta-azioni button { flex: 1; padding: 10px 6px; }
.stato-ordine { display: inline-block; font-size: .7rem; font-weight: 700; border-radius: 999px; padding: 1px 8px; vertical-align: middle; }
.stato-ordine.in_attesa { background: #3a2a14; color: var(--oro); }
.stato-ordine.rifiutato { background: #3a1c18; color: #ff8f7a; }
.carta.non-contato { opacity: .7; }
.sezione-cliente { margin: 22px 0 10px; color: var(--oro); }
.fila-bottoni { display: flex; flex-wrap: wrap; gap: 8px; margin: 8px 0; }
.fila-bottoni button { flex: 1; padding: 10px 8px; }
.spunta { display: flex; align-items: center; gap: 10px; padding: 8px 2px; border-top: 1px solid var(--linea); }
.spunta input { width: 22px; height: 22px; accent-color: var(--oro); }
.password-nuova { background: #1f3322; border-radius: 12px; padding: 10px 12px; margin: 10px 0; font-size: 1.1rem; user-select: all; }
.password-nuova small { display: block; color: var(--tenue); font-size: .8rem; margin-top: 4px; user-select: none; }

/* ---------- foto e social ---------- */
.foto-intro { color: var(--tenue); margin: 0 2px 12px; }
.foto-post { width: 100%; margin-bottom: 14px; }
.foto-griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.foto-carta { background: var(--carta); border-radius: 14px; overflow: hidden; }
.foto-img { display: block; position: relative; width: 100%; aspect-ratio: 1; padding: 0; border: 0; background: #33281f; }
.foto-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.foto-da { position: absolute; left: 6px; bottom: 6px; background: #000b; color: var(--oro); font-size: .72rem; border-radius: 999px; padding: 2px 8px; }
.foto-interruttori { display: flex; gap: 4px; padding: 6px; }
.foto-interruttori button { flex: 1; border: 0; border-radius: 9px; background: var(--carta2); color: var(--tenue); font-size: .75rem; padding: 7px 2px; }
.foto-interruttori button.attiva { background: #1f3322; color: var(--verde); font-weight: 700; }
.foto-interruttori button[data-post] { flex: 0 0 36px; font-size: .95rem; }
.foto-grande img { width: 100%; border-radius: 12px; margin-bottom: 10px; }
.carta-sotto a { color: var(--oro); }

/* ---------- impasti ---------- */
.riassunto-impasto { background: var(--carta); border-radius: 12px; padding: 10px 12px; margin: -4px 0 14px; color: var(--tenue); }
.riassunto-impasto b { color: var(--oro); }
.pezzi-impasto { display: flex; flex-wrap: wrap; gap: 6px; }
.pezzi-impasto span { background: var(--carta); border-radius: 999px; padding: 4px 10px; font-size: .85rem; color: var(--tenue); }
.pezzi-impasto b { color: var(--oro); }
.campo select { width: 100%; }
.pezzi-dettaglio { margin-top: 6px; color: var(--tenue); }
.pezzi-dettaglio summary { cursor: pointer; padding: 4px 0; }
#sotto-impasti { margin-bottom: 12px; }
