@font-face { font-family: "Lato"; font-weight: 300; font-style: normal; font-display: swap; src: url(/fonts/lato-300.woff2) format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 400; font-style: normal; font-display: swap; src: url(/fonts/lato-400.woff2) format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 700; font-style: normal; font-display: swap; src: url(/fonts/lato-700.woff2) format("woff2"); }
@font-face { font-family: "Lato"; font-weight: 900; font-style: normal; font-display: swap; src: url(/fonts/lato-900.woff2) format("woff2"); }

/* palette dal logo Bar/Bistrot Beddini: oro, marrone scuro, nero (stima da screenshot, da confermare col file originale) */
:root {
  --sfondo: #0d1117;
  --carta: #1b1510;
  --campo: #120e0a;
  --testo: #f3ebdd;
  --testo-2: #b9ad99;
  --linea: #3a2a1e;
  --linea-campo: #7a6a52;
  --oro: #d4af5a;
  --oro-testo: #1a1208;
  --verde: #7fd6a0;
  --verde-bg: #14301f;
  --giallo: #f0c060;
  --giallo-bg: #3a2c10;
  --rosso: #ff9a90;
  --rosso-bg: #4a1c18;
  --raggio: 4px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--sfondo); color: var(--testo);
  font: 400 17px/1.5 "Lato", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  padding: env(safe-area-inset-top) 14px calc(28px + env(safe-area-inset-bottom));
}
#app { max-width: 720px; margin: 0 auto; }
h1 { font-size: 1.25rem; margin: 0; }
h2 { font-size: 1rem; font-weight: 700; text-transform: uppercase; letter-spacing: .16em; margin: 26px 0 12px; padding-bottom: 8px; position: relative; color: var(--oro); }
h2::after { content: ""; position: absolute; left: 0; bottom: 0; width: 40px; height: 2px; background: var(--oro); }
h3 { font-size: 1rem; margin: 0 0 6px; }
p { margin: 0 0 10px; }
.piccolo { color: var(--testo-2); font-size: .9rem; }
.nojs { padding: 24px 0; }

/* testata */
.testata { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 0 12px; border-bottom: 1px solid var(--linea); }
.marchio { display: flex; align-items: center; gap: 12px; min-width: 0; }
.marchio img { width: 52px; height: 52px; border-radius: 50%; flex-shrink: 0; }
.titolo { display: flex; flex-direction: column; line-height: 1.1; }
.titolo .nome { font-weight: 900; font-size: 1.1rem; letter-spacing: .06em; text-transform: uppercase; color: var(--oro); }
.titolo .sotto { font-weight: 300; font-size: .8rem; letter-spacing: .2em; text-transform: uppercase; color: var(--testo-2); margin-top: 4px; }
.testata .chi { color: var(--testo-2); font-size: .85rem; text-align: right; }
.login .marchio { flex-direction: column; text-align: center; margin: 12px 0 8px; }
.login .marchio img { width: 120px; height: 120px; }
.login .titolo { align-items: center; }
.login .piccolo { text-align: center; }

/* pulsanti e campi (tocchi di almeno 44 px) */
button, select, input, textarea { font: inherit; color: inherit; }
.btn { min-height: 48px; padding: 0 18px; border-radius: var(--raggio); border: 1px solid var(--oro); background: var(--oro); color: var(--oro-testo); cursor: pointer; font-weight: 900; font-size: .9rem; letter-spacing: .1em; text-transform: uppercase; }
.btn.pieno { width: 100%; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.secondario { background: transparent; color: var(--testo); border-color: var(--linea-campo); font-weight: 700; }
.btn.pericolo { background: transparent; color: var(--rosso); border-color: var(--rosso); }
.btn.piccolo-btn { min-height: 44px; padding: 0 14px; }
.campo { display: block; margin: 0 0 14px; }
.campo > span { display: block; font-size: .8rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--testo-2); margin-bottom: 5px; }
.campo input, .campo select, .campo textarea { width: 100%; min-height: 48px; padding: 10px 12px; border-radius: var(--raggio); border: 1px solid var(--linea-campo); background: var(--campo); }
.campo textarea { min-height: 96px; resize: vertical; }
.coppia { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.coppia > * { min-width: 0; }
:focus-visible { outline: 3px solid var(--oro); outline-offset: 2px; }

/* schede di navigazione */
.schede { display: flex; gap: 6px; margin: 12px 0 6px; overflow-x: auto; padding-bottom: 2px; }
.schede button { flex: 1 0 auto; min-height: 48px; padding: 0 14px; border-radius: var(--raggio); border: 1px solid var(--linea); background: var(--carta); cursor: pointer; font-weight: 700; font-size: .82rem; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
.schede button[aria-selected="true"] { background: var(--oro); color: var(--oro-testo); border-color: var(--oro); }

/* carte e righe */
.carta { background: var(--carta); border: 1px solid var(--linea); border-radius: var(--raggio); padding: 14px; margin-bottom: 12px; }
.riga { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--linea); }
.riga:first-child { border-top: 0; }
.riga .corpo { flex: 1; min-width: 0; }
.riga .nome { font-weight: 700; overflow-wrap: anywhere; }
.riga .dx { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 700; }
.riga.fatta .nome { text-decoration: line-through; opacity: .65; }
.vuoto { color: var(--testo-2); padding: 8px 0; }
.categoria { font-size: .75rem; letter-spacing: .12em; text-transform: uppercase; color: var(--testo-2); }
.dettaglio { color: var(--testo-2); font-size: .9rem; overflow-wrap: anywhere; }
details > summary { min-height: 44px; display: flex; align-items: center; justify-content: space-between; gap: 12px; cursor: pointer; }
details > summary .corpo { flex: 1; min-width: 0; }
details > summary .dx { text-align: right; white-space: nowrap; font-weight: 900; font-variant-numeric: tabular-nums; }
.ordine-testa { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.ordine-testa .ora { font-weight: 900; font-size: 1.2rem; color: var(--oro); font-variant-numeric: tabular-nums; }
.ordine-testa .cliente { font-weight: 700; overflow-wrap: anywhere; }
.telefono a { color: var(--oro); }
.precedente { color: var(--giallo); font-size: .85rem; }

/* casella «fatto» grande */
.fatto { width: 44px; height: 44px; flex-shrink: 0; accent-color: var(--oro); cursor: pointer; }
.fatto-testo { font-size: .8rem; color: var(--verde); white-space: nowrap; }

/* selettore del giorno */
.giorno { display: grid; grid-template-columns: 48px minmax(0, 1fr) 48px; gap: 8px; align-items: center; margin: 14px 0 6px; }
.giorno button { min-height: 48px; border-radius: var(--raggio); border: 1px solid var(--linea-campo); background: var(--carta); font-size: 1.4rem; cursor: pointer; }
.giorno .data { text-align: center; }
.giorno .data input { width: 100%; min-height: 48px; text-align: center; font-weight: 700; border: 1px solid var(--linea-campo); border-radius: var(--raggio); background: var(--campo); padding: 0 8px; }
.giorno-rapidi { display: flex; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }

/* segnali (sempre con testo, non solo colore) */
.badge { display: inline-block; white-space: nowrap; padding: 3px 10px; border-radius: var(--raggio); font-size: .72rem; font-weight: 900; letter-spacing: .1em; text-transform: uppercase; }
.badge.verde { background: var(--verde-bg); color: var(--verde); }
.badge.giallo { background: var(--giallo-bg); color: var(--giallo); }
.badge.rosso { background: var(--rosso-bg); color: var(--rosso); box-shadow: inset 0 0 0 1px var(--rosso); }
.badge.oro { background: transparent; color: var(--oro); box-shadow: inset 0 0 0 1px var(--oro); }
.nota-avviso { background: var(--giallo-bg); color: var(--giallo); padding: 10px 12px; border-radius: var(--raggio); margin: 10px 0; }

/* messaggi */
.avvisi { position: fixed; left: 14px; right: 14px; bottom: calc(14px + env(safe-area-inset-bottom)); max-width: 692px; margin: 0 auto; z-index: 10; pointer-events: none; }
.toast { background: var(--oro); color: var(--oro-testo); padding: 12px 16px; border-radius: var(--raggio); margin-top: 8px; font-weight: 700; box-shadow: 0 4px 16px rgba(0,0,0,.5); }
.toast.errore { background: var(--rosso-bg); color: var(--rosso); box-shadow: inset 0 0 0 2px var(--rosso); }

/* accesso */
.login { padding-top: 16px; }
.pin-punti { display: flex; justify-content: center; gap: 14px; margin: 14px 0 18px; }
.pin-punti span { width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--oro); }
.pin-punti span.pieno { background: var(--oro); }
.tastierino { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 330px; margin: 0 auto; }
.tastierino button { min-height: 62px; font-size: 1.5rem; border-radius: var(--raggio); border: 1px solid var(--linea-campo); background: var(--carta); cursor: pointer; }
.tastierino button:active { background: var(--linea); }

/* righe del modulo ordine */
.riga-ordine { border: 1px solid var(--linea); border-radius: var(--raggio); padding: 12px; margin-bottom: 10px; background: var(--campo); }
.riga-ordine .coppia { margin-bottom: 8px; }
.azioni { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.azioni .btn { flex: 1 1 160px; }

/* aiuti per non usare stili nel codice (la CSP li blocca) */
.distanza { height: 14px; }
textarea.alto { min-height: 140px; }
.celle .intest.sx { text-align: left; }
button.riga-bottone { width: 100%; background: none; border: 0; border-top: 1px solid var(--linea); text-align: left; cursor: pointer; color: inherit; padding: 10px 0; min-height: 48px; }
.riga-ordine input.r-libero { width: 100%; min-height: 48px; padding: 10px 12px; margin-bottom: 8px; border-radius: var(--raggio); border: 1px solid var(--linea-campo); background: var(--campo); }

/* tabelle di modifica */
.celle { display: grid; grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(0, 1fr)); gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--linea); }
.celle:first-child { border-top: 0; }
.celle input { width: 100%; min-height: 48px; padding: 8px; border-radius: var(--raggio); border: 1px solid var(--linea-campo); background: var(--campo); text-align: right; }
.celle .intest { font-size: .75rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--testo-2); text-align: right; }
.celle input.cambiato { border-color: var(--oro); box-shadow: inset 0 0 0 1px var(--oro); }
.opzioni { display: flex; flex-direction: column; gap: 6px; margin: 10px 0; }
.opzioni label { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.opzioni input { width: 22px; height: 22px; accent-color: var(--oro); }

[hidden] { display: none !important; }

/* stampa: bianco e nero, compatta, solo il contenuto del giorno */
@media print {
  body { background: #fff; color: #000; font-size: 12pt; padding: 0; }
  .testata img, .schede, .giorno, .giorno-rapidi, .avvisi, .no-stampa, button, .fatto { display: none !important; }
  .carta { background: #fff; border: 0; border-bottom: 1px solid #999; border-radius: 0; padding: 4px 0; margin: 0; break-inside: avoid; }
  h2 { color: #000; }
  h2::after { background: #000; }
  .titolo .nome, .ordine-testa .ora, .telefono a { color: #000; }
  .dettaglio, .categoria, .piccolo, .precedente { color: #333; }
  details > summary { display: none; }
  details[open] > *, details > .dettaglio { display: block; }
}
