/* Eatalo - gestionale del locale e pannello admin.
   Layout: barra laterale scura (in alto su telefono), area di lavoro con intestazione per sezione;
   ordini come colonne di schede leggibili da lontano; impostazioni in schede con barra di salvataggio fissa. */
:root {
  --bg: #F5F3F1;
  --surface: #FFFFFF;
  --surface-2: #FAF8F6;
  --ink: #1E1324;
  --muted: #645A68;
  --line: #E3DDDF;
  --grid: #ECE7E9;
  --accent: #E5482E;
  --accent-ink: #FFFFFF;
  --side: #1E1324;
  --side-ink: #F3ECEF;
  --side-muted: #B9AABB;
  --ok: #1E7A4C;
  --ok-soft: #E3F3EA;
  --warn: #8A5200;
  --warn-soft: #FFF1D6;
  --bad: #B42318;
  --bad-soft: #FDECEA;
  --new: #FFE7DF;
  --serie: #2A78D6;
  --serie-hover: #1E5FB0;
  --font-body: "Figtree", "Segoe UI", "Helvetica Neue", Arial, system-ui, sans-serif;
  --font-logo: "Unbounded", "Arial Black", system-ui, sans-serif;
  --font-data: "JetBrains Mono", ui-monospace, Consolas, "SFMono-Regular", monospace;
  --r: 12px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #121014; --surface: #1C1A1F; --surface-2: #232026; --ink: #F2EFF3; --muted: #A79FAA; --line: #342F37; --grid: #2A262D;
    --accent: #FF6A4D; --accent-ink: #1A0C08; --side: #0B090C; --side-ink: #F3ECEF; --side-muted: #A99BAB;
    --ok: #4FC48A; --ok-soft: #173326; --warn: #F2B65A; --warn-soft: #3A2C12; --bad: #FF8A7A; --bad-soft: #3A1A16; --new: #3A1F18;
    --serie: #3987E5; --serie-hover: #6AA6EE;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #121014; --surface: #1C1A1F; --surface-2: #232026; --ink: #F2EFF3; --muted: #A79FAA; --line: #342F37; --grid: #2A262D;
  --accent: #FF6A4D; --accent-ink: #1A0C08; --side: #0B090C; --side-ink: #F3ECEF; --side-muted: #A99BAB;
  --ok: #4FC48A; --ok-soft: #173326; --warn: #F2B65A; --warn-soft: #3A2C12; --bad: #FF8A7A; --bad-soft: #3A1A16; --new: #3A1F18;
  --serie: #3987E5; --serie-hover: #6AA6EE;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 15px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; text-wrap: balance; }
h2 { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; }
a { color: inherit; }
.sub { color: var(--muted); font-size: 0.92rem; }
.hint { color: var(--muted); font-size: 0.85rem; }
.err { color: var(--bad); font-weight: 600; }
.logo { font-family: var(--font-logo); font-weight: 800; font-size: 1.3rem; letter-spacing: -0.03em; }
.logo::first-letter { color: var(--accent); }

/* controlli */
.btn, .btn-sec, .btn-danger { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: 700 0.93rem var(--font-body); border-radius: 10px; padding: 10px 16px; cursor: pointer; border: 1.5px solid transparent; text-decoration: none; white-space: nowrap; }
.btn { background: var(--accent); color: var(--accent-ink); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-sec { background: var(--surface); color: var(--ink); border-color: var(--line); }
.btn-sec:hover { border-color: var(--muted); }
.btn-sec:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-sec[aria-pressed="true"] { border-color: var(--ok); color: var(--ok); }
.btn-danger { background: transparent; color: var(--bad); border-color: currentColor; }
.btn:focus-visible, .btn-sec:focus-visible, .btn-danger:focus-visible, .linkbtn:focus-visible, .act:focus-visible, .nav a:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.linkbtn { background: none; border: 0; color: inherit; font: inherit; text-decoration: underline; cursor: pointer; padding: 0; }
.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field label, .lbl { font-weight: 700; font-size: 0.86rem; }
.field :where(input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), select, textarea), .inp-date, .copy-row input {
  width: 100%; font: 500 0.95rem var(--font-body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible, .inp-date:focus-visible, .zone-tbl input:focus-visible, .orari input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.field input[type="color"] { width: 64px; height: 38px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 3px; }
.inp-date { width: auto; }
.inp-u { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.inp-u:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .inp-u input { border: 0; background: transparent; border-radius: 0; font-family: var(--font-data); }
.field .inp-u input:focus-visible { outline: none; }
.inp-u span { padding: 0 10px; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.prefix { display: flex; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.prefix span { padding-left: 11px; color: var(--muted); font-family: var(--font-data); font-size: 0.9rem; }
.field .prefix input { border: 0; background: transparent; padding-left: 2px; font-family: var(--font-data); }
.prefix:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.field .prefix input:focus-visible { outline: none; }
.sw { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; user-select: none; }
.sw input { appearance: none; width: 40px; height: 24px; border-radius: 12px; background: var(--line); position: relative; cursor: pointer; flex: none; margin: 0; transition: background .15s; }
.sw input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); transition: transform .15s; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); }
.sw input:checked { background: var(--ok); }
.sw input:checked::after { transform: translateX(16px); }
.sw input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sw input:disabled { opacity: 0.45; cursor: not-allowed; }
.chk { display: flex; gap: 9px; align-items: flex-start; cursor: pointer; font-weight: 600; }
.chk input { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--accent); flex: none; }
.chk small { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; }
.segm { display: inline-flex; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 3px; gap: 2px; }
.segm input { position: absolute; opacity: 0; pointer-events: none; }
.segm label { padding: 7px 12px; border-radius: 7px; font-weight: 700; font-size: 0.88rem; cursor: pointer; color: var(--muted); }
.segm input:checked + label { background: var(--ink); color: var(--bg); }
.segm input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 1px; }
.banner { background: var(--surface); border: 1px solid var(--line); border-left: 4px solid var(--muted); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 0.92rem; }
.banner.warn { border-left-color: var(--warn); background: var(--warn-soft); color: var(--ink); }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; border-radius: 11px; padding: 0 7px; background: var(--accent); color: var(--accent-ink); font-size: 0.78rem; font-weight: 800; }
.count { display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 12px; background: var(--ink); color: var(--bg); font-size: 0.8rem; padding: 0 7px; font-variant-numeric: tabular-nums; }

/* accesso */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px max(16px, env(safe-area-inset-right, 0px)) 24px max(16px, env(safe-area-inset-left, 0px)); background: var(--side); }
.login-card { width: min(400px, 100%); background: var(--surface); border-radius: 18px; padding: 28px; display: flex; flex-direction: column; gap: 16px; box-shadow: 0 30px 60px rgba(0, 0, 0, .35); }
.login-card h1 { font-size: 1.3rem; }

/* struttura */
.app { display: grid; grid-template-columns: 230px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--side); color: var(--side-ink); display: flex; flex-direction: column; gap: 22px; padding: 22px 14px; position: sticky; top: 0; height: 100vh; }
.side-top { padding: 0 8px; display: flex; flex-direction: column; gap: 4px; }
.side-locale { color: var(--side-muted); font-weight: 600; font-size: 0.9rem; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; justify-content: space-between; align-items: center; gap: 8px; text-decoration: none; padding: 10px 10px; border-radius: 9px; font-weight: 700; color: var(--side-muted); }
.nav a:hover { color: var(--side-ink); background: rgba(255, 255, 255, .06); }
.nav a[aria-current="page"] { color: var(--side-ink); background: rgba(255, 255, 255, .12); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 0 10px; font-size: 0.9rem; color: var(--side-muted); }
.main { padding: 22px max(16px, env(safe-area-inset-right, 0px)) 60px 24px; min-width: 0; }
.vista { display: flex; flex-direction: column; gap: 16px; max-width: 1400px; }
.vh { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 20px; flex-wrap: wrap; }
.vh-act { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 6px 14px; padding: calc(10px + env(safe-area-inset-top, 0px)) max(14px, env(safe-area-inset-right, 0px)) 0 max(14px, env(safe-area-inset-left, 0px)); }
  .side-top { flex-direction: row; align-items: baseline; gap: 10px; padding: 0; }
  .side-foot { margin: 0 0 0 auto; flex-direction: row; gap: 14px; padding: 0; font-size: 0.85rem; }
  .nav { order: 3; flex-basis: 100%; flex-direction: row; overflow-x: auto; scrollbar-width: none; gap: 4px; padding-bottom: 8px; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 8px 12px; }
  .main { padding-left: max(14px, env(safe-area-inset-left, 0px)); padding-right: max(14px, env(safe-area-inset-right, 0px)); }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 18px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.form { gap: 14px; }
.card > .btn, .card > .btn-sec, .card > .btn-danger { align-self: flex-start; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.span2 { grid-column: 1 / -1; }
@media (max-width: 640px) { .grid2, .grid3 { grid-template-columns: minmax(0, 1fr); } }
.narrow { max-width: 320px; }
.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1000px) { .two-col { grid-template-columns: minmax(0, 1fr); } }
.tbl-wrap { overflow-x: auto; }

/* ordini */
.board { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
@media (max-width: 1100px) { .board { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); } }
@media (max-width: 700px) { .board { grid-template-columns: minmax(0, 1fr); } }
.col { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.col h2 { display: flex; align-items: center; gap: 8px; }
.cards { display: flex; flex-direction: column; gap: 10px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; margin-top: 10px; }
.vuoto { color: var(--muted); font-size: 0.9rem; padding: 16px; border: 1.5px dashed var(--line); border-radius: 12px; text-align: center; }
.ord { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 13px 14px; display: flex; flex-direction: column; gap: 9px; }
.ord.fresh { background: var(--new); border-color: var(--accent); }
.ord.chiuso { opacity: 0.72; }
.ord-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.ord-num { font: 500 1.05rem var(--font-data); }
.ord-mod { display: inline-block; margin-top: 3px; font-size: 0.72rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; border-radius: 5px; padding: 2px 7px; background: var(--surface-2); border: 1px solid var(--line); }
.ord-mod.consegna { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ord-ora { text-align: right; }
.ord-ora b { display: block; font: 500 1.7rem var(--font-data); line-height: 1; }
.ord-ora small { color: var(--muted); font-size: 0.8rem; }
.ord-ora small.tardi { color: var(--bad); font-weight: 700; }
.ord-chi { font-weight: 700; }
.ord-chi a { font-family: var(--font-data); font-weight: 500; font-size: 0.88rem; color: var(--muted); margin-left: 6px; }
.ord-dove { font-size: 0.9rem; }
.ord-dove a { color: var(--muted); }
.ord-righe { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 3px; font-size: 1rem; }
.ord-righe b { display: inline-block; min-width: 2.1em; font-variant-numeric: tabular-nums; }
.ord-righe small { display: block; margin-left: 2.1em; color: var(--warn); font-weight: 700; font-size: 0.86rem; }
.ord-note { background: var(--warn-soft); color: var(--warn); border-radius: 8px; padding: 7px 10px; font-weight: 700; font-size: 0.9rem; }
.ord-foot { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.pill { font-size: 0.74rem; font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; border-radius: 6px; padding: 3px 8px; }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.bad { background: var(--bad-soft); color: var(--bad); }
.ord-tot { font: 500 1rem var(--font-data); }
.acts { display: flex; gap: 6px; flex-wrap: wrap; }
.act { font: 800 0.92rem var(--font-body); border-radius: 9px; padding: 9px 13px; cursor: pointer; border: 1.5px solid var(--line); background: var(--surface); color: var(--ink); text-decoration: none; }
.act.go { background: var(--ok); border-color: var(--ok); color: var(--surface); }
.act.minor { border-color: transparent; color: var(--muted); padding-inline: 8px; }
.act.danger { color: var(--bad); }
.act:disabled { opacity: 0.5; cursor: progress; }
.annulla { display: flex; flex-direction: column; gap: 8px; border-top: 1px dashed var(--line); padding-top: 9px; }
.annulla select { font: 600 0.9rem var(--font-body); padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.chiusi summary { cursor: pointer; font-weight: 800; display: inline-flex; gap: 8px; align-items: center; }

/* menu */
.menu-lista { display: flex; flex-direction: column; gap: 14px; }
.cat-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.cat-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cat-head input { flex: 1; min-width: 140px; font: 800 1rem var(--font-body); color: var(--ink); background: transparent; border: 1px solid transparent; border-radius: 8px; padding: 6px 8px; }
.cat-head input:hover { border-color: var(--line); }
.cat-head input:focus-visible { outline: 2px solid var(--accent); }
.ico { width: 34px; height: 34px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); cursor: pointer; font-size: 1rem; }
.ico:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ico:disabled { opacity: 0.35; cursor: default; }
.piatto { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: 6px 14px; align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.piatto:last-child { border-bottom: 0; }
.piatto.off .p-nome { text-decoration: line-through; color: var(--muted); }
.p-nome { font-weight: 700; }
.p-desc { color: var(--muted); font-size: 0.85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.p-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 3px; }
.chip { font-size: 0.72rem; font-weight: 700; border-radius: 5px; padding: 1px 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--muted); }
.chip-gap { margin-left: 6px; }
.chip.warn { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.p-prezzo { font: 500 0.95rem var(--font-data); white-space: nowrap; }
.add-piatto { padding: 10px 14px; }
@media (max-width: 640px) { .piatto { grid-template-columns: minmax(0, 1fr) auto; } .piatto .sw span { display: none; } }

/* statistiche */
.stat-body { display: flex; flex-direction: column; gap: 16px; transition: opacity .2s; }
.stat-body.carica { opacity: 0.55; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
@media (max-width: 900px) { .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; }
.tile span { color: var(--muted); font-weight: 600; font-size: 0.86rem; }
.tile b { font-size: 1.7rem; font-weight: 800; letter-spacing: -0.02em; }
.tile small { color: var(--muted); font-size: 0.8rem; }
.chart { position: relative; width: 100%; min-height: 220px; }
.chart-small { min-height: 180px; }
.chart svg { display: block; width: 100%; overflow: visible; }
.chart .gl { stroke: var(--grid); stroke-width: 1; }
.chart .ax { fill: var(--muted); font: 400 11px var(--font-body); font-variant-numeric: tabular-nums; }
.chart .bar { fill: var(--serie); }
.chart .hit { fill: transparent; cursor: default; }
.chart .hit:focus { outline: none; }
.chart .hit:hover + .bar, .chart .hit:focus + .bar, .chart .bar.on { fill: var(--serie-hover); }
.chart .val { fill: var(--ink); font: 600 11px var(--font-body); }
.vuoto-chart { color: var(--muted); padding: 30px 0; text-align: center; }
.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--ink); color: var(--bg); border-radius: 8px; padding: 7px 10px; font-size: 0.82rem; box-shadow: 0 8px 20px rgba(0, 0, 0, .2); }
.tip b { display: block; font-size: 0.95rem; }
.tabella summary { cursor: pointer; color: var(--muted); font-size: 0.86rem; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tbl th { text-align: left; color: var(--muted); font-weight: 700; font-size: 0.8rem; padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 7px 8px; border-bottom: 1px solid var(--line); }
.tbl td.n, .tbl th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.split { display: flex; flex-direction: column; gap: 10px; }
.sp-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) 84px; gap: 10px; align-items: center; font-size: 0.9rem; }
.sp-track { height: 10px; border-radius: 5px; background: var(--grid); overflow: hidden; }
.sp-fill { height: 100%; border-radius: 0 4px 4px 0; background: var(--serie); }
.sp-row b { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }
.ai-card { border-color: var(--line); }
.ai-testo { white-space: pre-line; font-size: 0.95rem; line-height: 1.55; }
.ai-btn { font: 700 0.8rem var(--font-body); border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 4px 10px; cursor: pointer; }
.ai-btn::before { content: "✦ "; color: var(--accent); }
.ai-btn:disabled { opacity: 0.5; cursor: progress; }
.lbl-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }

/* marketing */
.mkt-out { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.mkt-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.mkt-card p { white-space: pre-line; }

/* QR */
.qr-wrap { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .qr-wrap { grid-template-columns: minmax(0, 1fr); } }
.copy-row { display: flex; gap: 8px; }
.copy-row input { flex: 1; min-width: 0; }
.qr-anteprima { display: grid; place-items: center; background: var(--surface-2); border: 1px dashed var(--line); border-radius: var(--r); padding: 24px; }
.biglietto { width: 105mm; max-width: 100%; aspect-ratio: 105 / 74; background: #FFFFFF; color: #1E1324; border-radius: 6px; box-shadow: 0 10px 30px rgba(0, 0, 0, .15); display: grid; grid-template-columns: 1fr auto; gap: 4mm; padding: 6mm; align-items: center; font-family: var(--font-body); }
.biglietto .b-loc { font-size: 9pt; font-weight: 700; color: #645A68; text-transform: uppercase; letter-spacing: 0.06em; }
.biglietto .b-tit { font-size: 17pt; font-weight: 800; line-height: 1.05; letter-spacing: -0.02em; margin-top: 2mm; }
.biglietto .b-txt { font-size: 10pt; margin-top: 2mm; }
.biglietto .b-url { font-family: var(--font-data); font-size: 8pt; margin-top: 3mm; color: #645A68; }
.biglietto .b-qr { width: 30mm; height: 30mm; }
.biglietto .b-qr svg { width: 100%; height: 100%; display: block; }
.foglio-stampa { display: none; }

/* impostazioni */
.imp { display: flex; flex-direction: column; gap: 16px; }
.orari { border-collapse: collapse; font-size: 0.9rem; }
.orari th { text-align: left; font-size: 0.78rem; color: var(--muted); padding: 4px 6px; font-weight: 700; }
.orari td { padding: 4px 6px; }
.orari td:first-child { font-weight: 700; padding-right: 14px; }
.orari input { font: 500 0.9rem var(--font-data); padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.zone-tbl { border-collapse: collapse; width: 100%; font-size: 0.9rem; }
.zone-tbl th { text-align: left; font-size: 0.78rem; color: var(--muted); padding: 4px 6px; font-weight: 700; }
.zone-tbl td { padding: 4px 6px; vertical-align: top; }
.zone-tbl input { width: 100%; min-width: 70px; font: 500 0.9rem var(--font-body); padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.zone-tbl td.cap input { min-width: 180px; font-family: var(--font-data); }
.checks { display: flex; flex-direction: column; gap: 10px; }
.savebar { position: sticky; bottom: 0; display: flex; justify-content: flex-end; align-items: center; gap: 14px; padding: 12px 0 calc(12px + env(safe-area-inset-bottom, 0px)); background: linear-gradient(to top, var(--bg) 75%, transparent); }
.savebar span { color: var(--muted); font-size: 0.9rem; }
.pw { margin-top: 20px; }

/* finestre */
.dlg { width: min(620px, calc(100% - 24px)); max-height: calc(100% - 24px); border: 0; border-radius: 16px; padding: 0; background: var(--surface); color: var(--ink); box-shadow: 0 30px 70px rgba(0, 0, 0, .35); }
.dlg::backdrop { background: rgba(15, 8, 18, .55); }
.dlg form, .dlg-in { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dlg-foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding-top: 6px; }
.spacer { flex: 1; }
.fs { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.fs legend { font-weight: 700; font-size: 0.86rem; padding: 0; margin-bottom: 4px; }
.all-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 6px 12px; }
.tag-grid { display: flex; flex-wrap: wrap; gap: 8px 16px; }
.warn-txt { color: var(--warn); font-weight: 700; }
.drop { display: grid; place-items: center; gap: 6px; border: 2px dashed var(--line); border-radius: 12px; padding: 26px; cursor: pointer; font-weight: 700; text-align: center; }
.drop:hover, .drop:focus-within { border-color: var(--accent); }
.drop input { font-size: 0.85rem; max-width: 100%; }
.file-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 0.88rem; color: var(--muted); }
.esito { font-weight: 800; font-size: 1.05rem; }
.anteprima { max-height: 45vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; display: flex; flex-direction: column; gap: 10px; }
.anteprima h3 { font-size: 0.95rem; }
.anteprima ul { margin: 4px 0 0; padding-left: 18px; color: var(--muted); font-size: 0.88rem; }

/* avvisi */
.toasts { position: fixed; right: max(16px, env(safe-area-inset-right, 0px)); bottom: calc(16px + env(safe-area-inset-bottom, 0px)); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { background: var(--ink); color: var(--bg); border-radius: 10px; padding: 10px 14px; font-weight: 600; font-size: 0.9rem; box-shadow: 0 10px 30px rgba(0, 0, 0, .25); max-width: min(420px, calc(100vw - 32px)); }
.toast.bad { background: var(--bad); color: #FFFFFF; }


/* ------------------------------------------------------------ v3: tempo reale, popup, opzioni, aspetto, regole, agente, notifiche */
.h3 { font-size: 0.95rem; font-weight: 800; margin-top: 6px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 0.82rem; font-weight: 700; color: var(--ok); }
.live::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; box-shadow: 0 0 0 0 currentColor; animation: battito 2s ease-out infinite; }
.live.off { color: var(--muted); }
.live.off::before { animation: none; }
@keyframes battito { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, currentColor 50%, transparent); } 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.banner-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.banner-row .btn-sec { padding: 6px 12px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.card-head .sub { max-width: 70ch; }

/* schede ordine: varianti, avvisi dell'agente, ritardi */
.ord-righe .var { display: block; margin-left: 2.1em; color: var(--muted); font-size: 0.86rem; font-weight: 600; }
.ord-avvisi { display: flex; flex-direction: column; gap: 4px; border-radius: 8px; padding: 8px 10px; background: var(--bad-soft); color: var(--ink); font-size: 0.88rem; }
.ord-avvisi.medio { background: var(--warn-soft); }
.ord-avvisi b { font-size: 0.72rem; letter-spacing: 0.05em; text-transform: uppercase; color: var(--bad); }
.ord-avvisi.medio b { color: var(--warn); }
.ord-cucina { font-size: 0.88rem; color: var(--muted); }
.ord-cucina b { color: var(--ink); }
.ord-ora .rit { display: block; color: var(--warn); font-weight: 700; font-size: 0.78rem; }
.ritardi { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; border-top: 1px dashed var(--line); padding-top: 9px; font-size: 0.86rem; color: var(--muted); }
.ritardi .act { padding: 7px 11px; }
.ord .da-agente { font-size: 0.78rem; color: var(--muted); }
.toast { display: flex; align-items: center; gap: 12px; }
.toast button { background: transparent; border: 1.5px solid currentColor; color: inherit; border-radius: 8px; padding: 4px 10px; font: 800 0.85rem var(--font-body); cursor: pointer; }

/* popup nuovo ordine */
.dlg-nuovo { width: min(560px, calc(100% - 24px)); border-top: 8px solid var(--accent); }
.dlg-nuovo[open] { animation: entra .25s ease-out; }
@keyframes entra { from { transform: scale(.96); opacity: 0.5; } }
.dn-coda { font-size: 0.8rem; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent); }
.dn-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.dn-top h2 { font-size: 1.6rem; }
.dn-ora { font: 500 1.6rem var(--font-data); }
#dnCorpo { display: flex; flex-direction: column; gap: 10px; }
#dnCorpo .ord-righe { font-size: 1.1rem; }
.btn-big { padding: 14px 22px; font-size: 1.05rem; }
.dlg-nuovo .dlg-foot { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dlg-nuovo .dlg-foot .spacer { display: none; }
.dlg-nuovo #dnAccetta { grid-column: 1 / -1; order: -1; }
@media (max-width: 480px) { .dlg-nuovo .dlg-foot { grid-template-columns: 1fr; } }

/* menu: gruppi, foto, categorie */
.gruppi-lista { display: flex; flex-wrap: wrap; gap: 8px; }
.gruppo-chip { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: var(--surface-2); border-radius: 10px; padding: 8px 12px; cursor: pointer; font: 700 0.9rem var(--font-body); color: var(--ink); text-align: left; }
.gruppo-chip small { color: var(--muted); font-weight: 500; }
.gruppo-chip:hover { border-color: var(--muted); }
.gruppo-chip:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat-info { flex-basis: 100%; display: flex; gap: 6px; flex-wrap: wrap; padding: 0 8px; }
.piatto.con-foto { grid-template-columns: 52px minmax(0, 1fr) auto auto auto; }
.p-thumb { width: 52px; height: 52px; border-radius: 9px; object-fit: cover; background: var(--surface-2); }
@media (max-width: 640px) { .piatto.con-foto { grid-template-columns: 52px minmax(0, 1fr) auto; } .piatto.con-foto > .btn-sec { grid-column: 2 / -1; justify-self: start; } }
.giorni-chk { display: flex; flex-wrap: wrap; gap: 6px; }
.giorni-chk label { display: inline-flex; }
.giorni-chk input { position: absolute; opacity: 0; pointer-events: none; }
.giorni-chk span { border: 1.5px solid var(--line); border-radius: 8px; padding: 6px 10px; font-weight: 700; font-size: 0.86rem; cursor: pointer; color: var(--muted); }
.giorni-chk input:checked + span { border-color: var(--ink); background: var(--ink); color: var(--bg); }
.giorni-chk input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }
.dc-limit { display: flex; flex-direction: column; gap: 10px; }

/* caricamento immagini */
.img-up { position: relative; display: grid; place-items: center; border: 2px dashed var(--line); border-radius: 12px; background: var(--surface-2); overflow: hidden; min-height: 120px; }
.img-up.quadra { width: 160px; height: 160px; min-height: 0; }
.img-up.larga { aspect-ratio: 16 / 7; width: 100%; min-height: 0; }
.img-up.piatto-foto { width: 160px; height: 120px; min-height: 0; }
.img-up img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-up .up-vuoto { display: flex; flex-direction: column; align-items: center; gap: 4px; color: var(--muted); font-size: 0.82rem; font-weight: 700; padding: 10px; text-align: center; }
.img-up input[type="file"] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.img-up:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.img-up .up-togli { position: absolute; top: 6px; right: 6px; z-index: 2; width: 30px; height: 30px; border-radius: 50%; border: 0; background: rgba(0, 0, 0, .65); color: #FFFFFF; font-size: 1rem; cursor: pointer; }
.img-up.carica::after { content: "Carico…"; position: absolute; inset: 0; display: grid; place-items: center; background: color-mix(in srgb, var(--surface) 80%, transparent); font-weight: 800; }

/* pagina e marchio */
.asp-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 20px; align-items: start; }
@media (max-width: 1150px) { .asp-wrap { grid-template-columns: minmax(0, 1fr); } .tel-wrap { display: none; } }
.tel-wrap { position: sticky; top: 20px; }
.tel { width: 360px; height: min(740px, calc(100vh - 60px)); border-radius: 36px; border: 10px solid var(--ink); background: var(--ink); overflow: hidden; box-shadow: 0 20px 50px rgba(0, 0, 0, .25); }
.tel iframe { width: 100%; height: 100%; border: 0; border-radius: 26px; background: #FFFFFF; }
.temi { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tema input { position: absolute; opacity: 0; pointer-events: none; }
.tema label { display: flex; flex-direction: column; gap: 8px; border: 2px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer; font-weight: 800; font-size: 0.9rem; }
.tema input:checked + label { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.tema input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.tema-mini { height: 86px; border-radius: 8px; overflow: hidden; display: flex; flex-direction: column; border: 1px solid var(--line); }
.tema-mini i { display: block; height: 30px; }
.tema-mini b { display: block; margin: 8px 8px 4px; height: 8px; width: 60%; border-radius: 2px; }
.tema-mini em { display: block; margin: 0 8px; height: 5px; width: 80%; border-radius: 2px; opacity: 0.4; }
.tema-mini.classico { background: #FFFDF9; } .tema-mini.classico i { background: var(--tema-col); } .tema-mini.classico b, .tema-mini.classico em { background: #221A16; }
.tema-mini.moderno { background: #FFFFFF; } .tema-mini.moderno i { background: #F4F4F6; border-bottom: 3px solid var(--tema-col); } .tema-mini.moderno b, .tema-mini.moderno em { background: #17171C; }
.tema-mini.rustico { background: #F7F0E1; } .tema-mini.rustico i { background: #2B2118; } .tema-mini.rustico b { background: var(--tema-col); margin-inline: auto; } .tema-mini.rustico em { background: #2B2118; margin-inline: auto; }
.tema-mini.elegante { background: #14110F; } .tema-mini.elegante i { background: #0E0C0A; border-bottom: 1px solid var(--tema-col); } .tema-mini.elegante b { background: #F2EBE3; margin-inline: auto; width: 45%; } .tema-mini.elegante em { background: var(--tema-col); margin-inline: auto; width: 20%; opacity: 1; }
.colori { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.colori label { display: inline-flex; }
.colori input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.colori span { width: 34px; height: 34px; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); cursor: pointer; }
.colori input:checked + span { box-shadow: 0 0 0 2.5px var(--ink); }
.colori input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 3px; }
.colori input[type="color"] { width: 46px; height: 36px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); padding: 3px; cursor: pointer; }

/* orari speciali e promozioni */
.ferie { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 12px; }
.ferie .grow { flex: 1; min-width: 200px; }
.ecc-lista, .promo-lista { display: flex; flex-direction: column; gap: 8px; }
.ecc { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line); }
.ecc > div:first-child { width: 160px; }
.ecc > select { width: 170px; }
.ecc :where(input:not([type="checkbox"]), select), .promo :where(input:not([type="checkbox"]):not([type="radio"]), select) { width: 100%; font: 500 0.9rem var(--font-body); padding: 7px 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); color: var(--ink); }
.ecc .fasce { display: flex; gap: 4px; align-items: center; flex-wrap: nowrap; font-size: 0.85rem; color: var(--muted); }
.ecc .fasce input { width: 112px; font-family: var(--font-data); }
.ecc .ecc-nota { flex: 1 1 220px; width: auto; }
.ecc > .ico { margin-left: auto; }
.ecc .passato { color: var(--muted); font-size: 0.78rem; }
@media (max-width: 700px) { .ecc .fasce { flex-wrap: wrap; } }
.promo { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface-2); }
.promo.spenta { opacity: 0.6; }
.promo-top { display: grid; grid-template-columns: minmax(0, 1fr) 110px auto 34px; gap: 10px; align-items: center; }
.promo-riga { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 0.86rem; color: var(--muted); }
.promo-riga input[type="time"], .promo-riga input[type="date"] { width: auto; font-family: var(--font-data); }
.promo-riga > span { font-weight: 700; color: var(--ink); min-width: 78px; }
.promo-anteprima { font-size: 0.86rem; font-weight: 700; color: var(--ok); }
.vuoto-lista { color: var(--muted); font-size: 0.9rem; padding: 6px 0; }

/* agente */
.ag-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start; }
@media (max-width: 1000px) { .ag-wrap { grid-template-columns: minmax(0, 1fr); } }
.chat-card { min-height: 460px; }
.chat { display: flex; flex-direction: column; gap: 10px; max-height: 58vh; min-height: 260px; overflow-y: auto; padding-right: 4px; }
.msg { max-width: 82%; border-radius: 14px; padding: 10px 13px; white-space: pre-line; font-size: 0.95rem; line-height: 1.45; }
.msg.utente { align-self: flex-end; background: var(--ink); color: var(--bg); border-bottom-right-radius: 4px; }
.msg.agente { align-self: flex-start; background: var(--surface-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.attesa { color: var(--muted); font-style: italic; }
.msg .fatto { display: block; margin-top: 8px; font-size: 0.82rem; font-weight: 700; color: var(--ok); }
.msg .conferma { margin-top: 10px; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: var(--bad-soft); border-radius: 10px; padding: 8px 10px; font-size: 0.88rem; }
.chat-vuota { color: var(--muted); font-size: 0.92rem; margin: auto 0; text-align: center; padding: 20px; }
.sugg { display: flex; gap: 6px; flex-wrap: wrap; }
.sugg button { border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 12px; font: 600 0.84rem var(--font-body); cursor: pointer; }
.sugg button:hover { border-color: var(--muted); }
.chat-form { display: flex; gap: 8px; }
.chat-form input { flex: 1; min-width: 0; font: 500 1rem var(--font-body); color: var(--ink); background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; }
.chat-form input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* notifiche */
.push-stato { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.push-stato::before { content: ""; width: 10px; height: 10px; border-radius: 50%; background: var(--muted); }
.push-stato.ok::before { background: var(--ok); }
.push-stato.bad::before { background: var(--bad); }
.disp-lista { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.disp-lista li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: 0.9rem; }
.disp-lista li small { color: var(--muted); }
input[type="range"] { accent-color: var(--accent); width: 100%; }

/* admin */
.admin-tbl td .acts { justify-content: flex-end; }
.pw-box { font-family: var(--font-data); background: var(--warn-soft); color: var(--ink); padding: 10px 12px; border-radius: 9px; user-select: all; }

/* stampa dei biglietti QR: 8 per foglio A4 */
@media print {
  @page { size: A4; margin: 0; }
  body { background: #FFFFFF; }
  .app, .login, .toasts, .tip, dialog { display: none !important; }
  .foglio-stampa { display: grid !important; grid-template-columns: 105mm 105mm; grid-auto-rows: 74.25mm; width: 210mm; }
  .foglio-stampa .biglietto { width: 105mm; height: 74.25mm; aspect-ratio: auto; border-radius: 0; box-shadow: none; outline: 0.2mm dashed #BBBBBB; outline-offset: -0.1mm; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } .live::before, .dlg-nuovo[open] { animation: none; } }
