/* Eatalo - app del personale: Sala (camerieri, cassa), Cucina e Bar (schermi per reparto), PC del locale.
   Pensate per il tocco: bottoni grandi, testo leggibile da lontano, stato della rete sempre in vista. */
:root {
  --bg: #F4F1EE;
  --surface: #FFFFFF;
  --surface-2: #F8F6F4;
  --ink: #1E1324;
  --muted: #645A68;
  --line: #E2DCDE;
  --accent: #E5482E;
  --accent-ink: #FFFFFF;
  --ok: #1E7A4C; --ok-soft: #E1F2E8;
  --warn: #8A5200; --warn-soft: #FFF0D2;
  --bad: #B42318; --bad-soft: #FCE9E7;
  --info: #1E5FB0; --info-soft: #E5EEFA;
  --libero: #FFFFFF; --occupato: #1E1324; --occupato-ink: #FFFFFF;
  --font: "Figtree", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, Consolas, monospace;
  --r: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111013; --surface: #1B191E; --surface-2: #232026; --ink: #F2EFF3; --muted: #A79FAA; --line: #343038;
    --accent: #FF6A4D; --accent-ink: #1A0C08; --ok: #4FC48A; --ok-soft: #16301F; --warn: #F2B65A; --warn-soft: #382A10;
    --bad: #FF8A7A; --bad-soft: #3A1A16; --info: #6AA6EE; --info-soft: #172A40; --libero: #1B191E; --occupato: #F2EFF3; --occupato-ink: #111013;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111013; --surface: #1B191E; --surface-2: #232026; --ink: #F2EFF3; --muted: #A79FAA; --line: #343038;
  --accent: #FF6A4D; --accent-ink: #1A0C08; --ok: #4FC48A; --ok-soft: #16301F; --warn: #F2B65A; --warn-soft: #382A10;
  --bad: #FF8A7A; --bad-soft: #3A1A16; --info: #6AA6EE; --info-soft: #172A40; --libero: #1B191E; --occupato: #F2EFF3; --occupato-ink: #111013;
  color-scheme: dark;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 500 16px/1.4 var(--font); -webkit-font-smoothing: antialiased; overscroll-behavior: none; }
h1, h2, h3, p { margin: 0; }
button { font: inherit; color: inherit; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.logo { font: 800 1.15rem var(--font); letter-spacing: -0.03em; }
.logo::first-letter { color: var(--accent); }

/* bottoni */
.b { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--line);
  background: var(--surface); font-weight: 800; font-size: 0.98rem; cursor: pointer; text-decoration: none; color: var(--ink); white-space: nowrap; }
.b:disabled { opacity: 0.45; cursor: not-allowed; }
.b.pri { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.b.ok { background: var(--ok); border-color: var(--ok); color: #FFFFFF; }
.b.scuro { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.b.dan { color: var(--bad); border-color: currentColor; background: transparent; }
.b.min { border-color: transparent; background: transparent; color: var(--muted); }
.b.grande { min-height: 56px; font-size: 1.08rem; width: 100%; }
.b:focus-visible, .chip:focus-visible, .tav:focus-visible, .pz:focus-visible, .key:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.ico { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 12px; border: 1.5px solid var(--line); background: var(--surface); cursor: pointer; font-size: 1.2rem; flex: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 700; font-size: 0.9rem; cursor: pointer; white-space: nowrap; }
.chip[aria-pressed="true"], .chip.on { background: var(--ink); border-color: var(--ink); color: var(--bg); }
.campo { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.campo label, .campo .lbl { font-weight: 700; font-size: 0.85rem; color: var(--muted); }
.campo input, .campo select, .campo textarea { width: 100%; min-height: 46px; font: 600 1rem var(--font); color: var(--ink); background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 11px; padding: 10px 12px; }
.campo input:focus-visible, .campo select:focus-visible, .campo textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.riga2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.seg { display: flex; background: var(--surface-2); border: 1.5px solid var(--line); border-radius: 12px; padding: 3px; gap: 3px; }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 9px; background: transparent; font-weight: 800; cursor: pointer; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(0, 0, 0, .15); }

/* barra in alto */
.top { position: sticky; top: 0; z-index: 20; background: var(--surface); border-bottom: 1px solid var(--line); padding: calc(8px + env(safe-area-inset-top, 0px)) max(12px, env(safe-area-inset-right, 0px)) 8px max(12px, env(safe-area-inset-left, 0px)); display: flex; align-items: center; gap: 10px; min-height: 60px; }
.top h1 { font-size: 1.15rem; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.top h1 small { display: block; font-size: 0.78rem; color: var(--muted); font-weight: 600; }
.rete { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 800; padding: 5px 10px; border-radius: 999px; background: var(--ok-soft); color: var(--ok); white-space: nowrap; }
.rete::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.rete.off { background: var(--warn-soft); color: var(--warn); }
.rete.giu { background: var(--bad-soft); color: var(--bad); }
.op { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 12px 0 6px; border-radius: 999px; border: 1.5px solid var(--line); background: var(--surface); font-weight: 800; cursor: pointer; }
.op i { width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; font-style: normal; font-size: 0.85rem; }
.banda { padding: 8px max(12px, env(safe-area-inset-left, 0px)); font-size: 0.88rem; font-weight: 700; background: var(--warn-soft); color: var(--ink); border-bottom: 1px solid var(--line); }

/* schermate di accesso */
.accesso { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.accesso-card { width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 26px 22px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 20px 50px rgba(0, 0, 0, .12); }
.accesso-card h1 { font-size: 1.35rem; font-weight: 800; }
.codice { font: 700 2rem var(--mono); letter-spacing: 0.3em; text-align: center; width: 100%; padding: 12px; border-radius: 14px; border: 2px solid var(--line); background: var(--surface-2); color: var(--ink); }
.codice:focus-visible { outline: 3px solid var(--accent); }
.persone { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.persone button { min-height: 72px; border-radius: 14px; border: 1.5px solid var(--line); background: var(--surface-2); font-weight: 800; font-size: 1.05rem; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; }
.persone button small { font-weight: 600; color: var(--muted); font-size: 0.78rem; }
.pin-dots { display: flex; justify-content: center; gap: 14px; height: 22px; }
.pin-dots i { width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.pin-dots i.on { background: var(--ink); }
.pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.key { min-height: 64px; border-radius: 16px; border: 1.5px solid var(--line); background: var(--surface-2); font: 800 1.5rem var(--font); cursor: pointer; }
.key:active { background: var(--line); }
.err { color: var(--bad); font-weight: 700; font-size: 0.92rem; }

/* avvisi brevi */
.toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 90; display: flex; flex-direction: column; gap: 8px; width: min(94vw, 460px); pointer-events: none; }
.toast { pointer-events: auto; background: var(--ink); color: var(--bg); border-radius: 12px; padding: 12px 14px; font-weight: 700; font-size: 0.95rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.toast.bad { background: var(--bad); color: #FFFFFF; }
.toast button { background: transparent; border: 1.5px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 10px; font-weight: 800; cursor: pointer; }

/* fogli a comparsa */
.foglio { width: min(560px, 100%); max-width: 100%; max-height: 92vh; margin: auto auto 0; padding: 0; border: 0; border-radius: 20px 20px 0 0; background: var(--surface); color: var(--ink); }
@media (min-width: 700px) { .foglio { margin: auto; border-radius: 20px; } }
.foglio::backdrop { background: rgba(10, 6, 12, .55); }
.foglio > div, .foglio > form { padding: 18px max(16px, env(safe-area-inset-right, 0px)) calc(18px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px)); display: flex; flex-direction: column; gap: 14px; }
.foglio-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.foglio-head h2 { font-size: 1.25rem; font-weight: 800; }
.foglio .azioni { display: flex; gap: 8px; flex-wrap: wrap; }
.foglio .azioni .b { flex: 1; }
@media (prefers-reduced-motion: no-preference) { .foglio[open] { animation: sale .2s ease-out; } }
@keyframes sale { from { transform: translateY(20px); opacity: 0.6; } }
