/* BluRisto · palette e font BluCode (comune/brand.md) */
:root {
  --blu: #2340a8; --blu-scuro: #1a3185; --ink: #0b2147; --testo: #1b2b45; --testo2: #4a5b75;
  --cielo: #6ec1e4; --giallo: #ffc83d; --giallo-scuro: #f2b413; --carta: #f4f7fa; --linea: #c8d6e6; --bianco: #fff;
  --verde: #1f9d55; --verde-chiaro: #d8f3e4; --rosso: #d93025; --rosso-chiaro: #fde2df; --arancio: #ff7a00; --viola: #7a3fb0;
  --grigio: #e3e7ee; --card: #fff; --ombra: 0 1px 2px rgba(11, 33, 71, .08), 0 4px 14px rgba(11, 33, 71, .06);
  --r: 10px; --font: 'Source Sans 3', system-ui, sans-serif; --font-t: 'Archivo', system-ui, sans-serif; --mono: 'IBM Plex Mono', ui-monospace, monospace;
  --top-h: 64px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font); color: var(--testo); background: var(--carta); font-size: 15px; -webkit-tap-highlight-color: transparent; }
h1, h2, h3 { font-family: var(--font-t); color: var(--ink); margin: 0 0 .5em; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--blu); }
.muted { color: var(--testo2); }
.mono { font-family: var(--mono); }
.num { font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.hidden { display: none !important; }

/* ---------------- barra superiore e menu laterale ---------------- */
#top { position: fixed; inset: 0 0 auto 0; height: var(--top-h); display: flex; align-items: center; gap: 12px; padding: 0 12px;
  background: var(--bianco); border-bottom: 1px solid var(--linea); z-index: 20; }
.hamb { width: 44px; height: 44px; border: 0; background: none; display: grid; place-content: center; gap: 5px; cursor: pointer; border-radius: 8px; }
.hamb span { display: block; width: 22px; height: 2px; background: var(--ink); border-radius: 2px; }
.hamb:hover { background: var(--carta); }
.op-card { display: flex; align-items: center; gap: 10px; border: 1px solid var(--linea); border-radius: var(--r); padding: 6px 12px; min-width: 0; }
.op-card b { display: block; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.op-card small { color: var(--testo2); white-space: nowrap; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--blu); color: #fff; display: grid; place-items: center; font-weight: 700; flex: none; }
.top-logo { height: 30px; flex: none; }
@media (max-width: 760px) { .top-logo { display: none; } }
#top-slot { flex: 1; display: flex; gap: 10px; justify-content: flex-end; align-items: center; min-width: 0; }
#conn { width: 10px; height: 10px; border-radius: 50%; background: var(--verde); flex: none; }
#conn.off { background: var(--rosso); }
#nav { position: fixed; top: 0; bottom: 0; left: 0; width: 270px; background: var(--ink); color: #fff; z-index: 40; transform: translateX(-100%);
  transition: transform .2s; display: flex; flex-direction: column; padding: 14px; gap: 2px; overflow-y: auto; }
.nav-open #nav { transform: none; }
.scrim { position: fixed; inset: 0; background: rgba(11, 33, 71, .4); z-index: 30; display: none; }
.nav-open .scrim { display: block; }
#nav .brand { display: flex; align-items: center; gap: 10px; padding: 4px 4px 14px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 8px; }
#nav .brand img { width: 40px; height: 40px; }
#nav .brand b { font-family: var(--font-t); font-size: 1.2rem; display: block; }
#nav .brand small { color: var(--cielo); }
#nav a { color: #e8eefc; text-decoration: none; padding: 11px 12px; border-radius: 8px; }
#nav a:hover { background: rgba(255,255,255,.08); }
#nav a.on { background: var(--blu); color: #fff; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 12px; border-top: 1px solid rgba(255,255,255,.12); }
.nav-foot label { display: flex; flex-direction: column; gap: 4px; font-size: .85rem; color: var(--cielo); }
.nav-foot select { padding: 8px; border-radius: 8px; border: 0; color: var(--ink); }
.nav-foot .btn { color: #fff; border-color: rgba(255,255,255,.3); }
.nav-foot small { color: #9fb0cc; }
main { padding: calc(var(--top-h) + 14px) 14px 14px; min-height: 100%; }

/* ---------------- controlli ---------------- */
.btn { border: 1px solid var(--linea); background: var(--bianco); color: var(--ink); padding: 10px 16px; border-radius: 8px; cursor: pointer;
  font-weight: 600; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; text-decoration: none; }
.btn:hover { border-color: var(--blu); }
.btn.primary { background: var(--blu); border-color: var(--blu); color: #fff; }
.btn.primary:hover { background: var(--blu-scuro); }
.btn.accent { background: var(--giallo); border-color: var(--giallo); color: var(--ink); }
.btn.danger { background: var(--rosso); border-color: var(--rosso); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 34px; padding: 6px 10px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.field { display: flex; flex-direction: column; gap: 4px; font-weight: 600; color: var(--ink); font-size: .9rem; }
.field input, .field select, .field textarea, input.inp, select.inp { font-weight: 400; padding: 10px; border: 1px solid var(--linea); border-radius: 8px;
  background: #fff; min-height: 44px; width: 100%; }
.field textarea { min-height: 70px; }
.field input:focus, .field select:focus, .field textarea:focus, .inp:focus { outline: 2px solid var(--cielo); border-color: var(--blu); }
.field.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 500; }
.field.check input { width: 22px; height: 22px; min-height: 0; }
.field.wide { grid-column: 1 / -1; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--linea); border-radius: 20px; padding: 6px 10px; font-weight: 400; background: #fff; cursor: pointer; }
.chip input { width: 16px; height: 16px; min-height: 0; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 12px; font-size: .78rem; font-weight: 700; background: var(--grigio); color: var(--ink); }
.badge.ok { background: var(--verde-chiaro); color: #0f6b39; } .badge.err { background: var(--rosso-chiaro); color: #a1251c; }
.badge.warn { background: #fff1c7; color: #7a5600; } .badge.blu { background: #dfe6fb; color: var(--blu); }
.card { background: var(--card); border: 1px solid var(--linea); border-radius: var(--r); padding: 14px; box-shadow: var(--ombra); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; }
.toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 12px; }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.tab { border: 1px solid var(--linea); background: #fff; border-radius: 8px; padding: 10px 14px; cursor: pointer; font-weight: 600; min-height: 44px; }
.tab.on { background: var(--blu); color: #fff; border-color: var(--blu); }
table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: var(--r); overflow: hidden; }
table.list th, table.list td { padding: 9px 10px; border-bottom: 1px solid var(--grigio); text-align: left; vertical-align: middle; }
table.list th { background: #eef3f9; color: var(--ink); font-size: .85rem; position: sticky; top: 0; }
table.list tr.click { cursor: pointer; } table.list tr.click:hover td { background: #f6f9ff; }
.table-wrap { overflow-x: auto; border: 1px solid var(--linea); border-radius: var(--r); }
.empty { padding: 30px; text-align: center; color: var(--testo2); }

/* ---------------- avvisi e finestre ---------------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(92vw, 460px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: 8px; box-shadow: var(--ombra); }
.toast.err { background: var(--rosso); }
.modal-back { position: fixed; inset: 0; background: rgba(11, 33, 71, .45); z-index: 60; display: grid; place-items: center; padding: 12px; }
.modal { background: #fff; border-radius: 14px; width: min(560px, 100%); max-height: calc(100vh - 24px); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--grigio); }
.modal-head h2 { margin: 0; }
.modal-head .x { border: 0; background: none; font-size: 28px; line-height: 1; width: 44px; height: 44px; cursor: pointer; border-radius: 8px; }
.modal-body { padding: 16px; overflow-y: auto; }
.modal-foot { padding: 12px 16px; border-top: 1px solid var(--grigio); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.np-modal { width: min(360px, 100%); }
.np-display { font: 700 2rem var(--mono); text-align: right; padding: 10px 14px; background: var(--carta); border-radius: 8px; margin-bottom: 10px; color: var(--ink); }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.np-key { min-height: 58px; font-size: 1.4rem; font-weight: 700; border: 1px solid var(--linea); background: #fff; border-radius: 10px; cursor: pointer; }
.np-key:active { background: var(--carta); }
.pick-grid { display: grid; gap: 8px; }
.pick { min-height: 56px; border: 1px solid var(--linea); background: #fff; border-radius: 10px; padding: 8px; cursor: pointer; font-weight: 600; text-align: center; }
.pick:hover { border-color: var(--blu); background: #f6f9ff; }

/* ---------------- login ---------------- */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; background: linear-gradient(160deg, var(--ink), var(--blu)); }
.login .box { background: #fff; border-radius: 16px; padding: 24px; width: min(380px, 100%); text-align: center; }
.login .box img { height: 46px; margin-bottom: 6px; }
.login .pin { font: 700 2rem var(--mono); letter-spacing: .4em; padding: 10px; background: var(--carta); border-radius: 8px; margin: 10px 0 12px; min-height: 60px; }

/* ---------------- sale e tavoli ---------------- */
.rooms-bar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.room-tab { background: var(--arancio); color: #fff; border: 0; border-radius: 8px; padding: 12px 18px; font-weight: 700; min-height: 48px; cursor: pointer; }
.room-tab.on { background: var(--rosso); box-shadow: inset 0 -4px 0 rgba(0,0,0,.2); }
.room-tab.util { background: var(--blu); }
.room { position: relative; background: #fff; border: 1px solid var(--linea); border-radius: var(--r); min-height: 560px; overflow: auto; }
.room.list-mode { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; padding: 10px; min-height: 0; }
.tavolo { position: absolute; border-radius: 10px; color: #fff; border: 0; cursor: pointer; padding: 8px; text-align: left; display: flex; flex-direction: column;
  justify-content: space-between; font-weight: 700; box-shadow: var(--ombra); background: var(--verde); user-select: none; touch-action: none; }
.room.list-mode .tavolo { position: static; min-height: 100px; }
.tavolo.tondo { border-radius: 50%; align-items: center; justify-content: center; text-align: center; }
.tavolo .tn { font-size: 1.25rem; font-family: var(--font-t); }
.tavolo small { font-weight: 600; opacity: .95; font-size: .78rem; }
.tavolo.occupato { background: var(--rosso); }
.tavolo.conto { background: var(--giallo-scuro); color: var(--ink); }
.tavolo.prenotato { background: var(--arancio); }
.tavolo.lento { background: #7d8796; }
.tavolo.uscita { background: var(--blu); }
.tavolo.attesa::after { content: '***'; position: absolute; top: 4px; right: 8px; }
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 10px; font-size: .85rem; }
.legend span::before { content: ''; display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; background: var(--c); }

/* ---------------- vendita (layout a griglia come i POS da ristorazione) ---------------- */
.view-vendita, .view-ordine { padding-bottom: 8px; }
.pos { display: grid; grid-template-columns: minmax(280px, 31%) 1fr; gap: 10px; height: calc(100vh - var(--top-h) - 28px); }
.pos-left { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.pos-head { background: #fff; border: 1px solid var(--linea); border-radius: var(--r); padding: 8px 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pos-head b { font-family: var(--font-t); color: var(--ink); }
.lines { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 5px; min-height: 120px; }
.line { background: #fff; border: 1px solid var(--linea); border-radius: 8px; padding: 7px 8px; display: grid; grid-template-columns: 30px 1fr auto 30px; gap: 6px; align-items: center; cursor: pointer; }
.line.sel { outline: 2px solid var(--blu); }
.line.sent { border-left: 4px solid var(--verde); }
.line.paid { opacity: .5; }
.line.storno { text-decoration: line-through; opacity: .5; }
.line .q { font-weight: 700; color: var(--blu); text-align: center; }
.line .d { font-size: .92rem; line-height: 1.2; color: var(--ink); }
.line .d small { display: block; color: var(--testo2); font-size: .8rem; }
.line .p { font-weight: 700; }
.line .crs { width: 26px; height: 26px; border-radius: 50%; border: 1px solid var(--linea); background: var(--carta); font-size: .8rem; font-weight: 700; cursor: pointer; }
.course-sep { font-size: .78rem; font-weight: 700; color: var(--testo2); padding: 4px 2px 0; text-transform: uppercase; letter-spacing: .04em; }
.keypad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.keypad button { min-height: 50px; border-radius: 8px; border: 0; background: #e9ecf2; font-size: 1.15rem; font-weight: 700; cursor: pointer; color: var(--ink); }
.keypad .k-x { background: #fff1c7; } .keypad .k-c { background: var(--rosso); color: #fff; } .keypad .k-00 { background: #c9ced8; }
.keypad .k-cli { background: #fff1c7; font-size: .9rem; }
.kp-disp { background: var(--ink); color: #fff; font: 700 1.2rem var(--mono); text-align: right; padding: 8px 12px; border-radius: 8px; min-height: 42px; }
.total-tile { background: var(--blu); color: #fff; border-radius: var(--r); padding: 6px 14px; min-width: 160px; text-align: right; cursor: pointer; }
.total-tile small { display: block; font-size: .78rem; opacity: .85; }
.total-tile b { font: 700 1.6rem var(--font-t); color: #fff; }
.status-tile { border: 1px solid var(--linea); border-radius: var(--r); padding: 6px 10px; background: #fff; font-size: .82rem; line-height: 1.2; cursor: pointer; }
.status-tile b { display: block; color: var(--ink); }
.status-tile.live { background: var(--verde-chiaro); border-color: var(--verde); }
.keys-area { display: flex; flex-direction: column; min-height: 0; gap: 6px; }
.keys-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.keys { flex: 1; display: grid; gap: 6px; min-height: 0; }
.key { border: 0; border-radius: 8px; padding: 6px 8px; font-weight: 700; font-size: .86rem; line-height: 1.15; text-align: left; display: flex; flex-direction: column;
  justify-content: space-between; cursor: pointer; color: var(--ink); background: #e9ecf2; overflow: hidden; min-height: 0; position: relative; }
.key:active { filter: brightness(.92); }
.key small { font-weight: 600; opacity: .85; font-size: .78rem; }
.key.dark { color: #fff; }
.key.empty { background: transparent; border: 1px dashed transparent; cursor: default; }
.key.esaurito { opacity: .45; }
.key .tag { position: absolute; top: 4px; right: 6px; font-size: .7rem; }
.key.hl { outline: 3px solid var(--giallo); }
.kb-edit .key.empty { border-color: var(--linea); cursor: pointer; }
.kb-edit .key { outline: 1px dashed rgba(11,33,71,.35); }
.kb-edit .key.drag-over { outline: 3px solid var(--blu); }

/* finestra di pagamento */
.pay-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.pay-sum { background: var(--carta); border-radius: var(--r); padding: 12px; }
.pay-sum .row { display: flex; justify-content: space-between; padding: 3px 0; }
.pay-sum .big { font: 700 1.6rem var(--font-t); color: var(--ink); }
.pay-methods { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.pay-methods button { min-height: 58px; border-radius: 10px; border: 0; font-weight: 700; cursor: pointer; color: #fff; background: var(--blu); }
.pay-methods button.cash { background: var(--rosso); } .pay-methods button.card { background: var(--arancio); }
.pay-methods button.other { background: #5b6b86; } .pay-methods button.machine { background: var(--verde); }
.tenders .t { display: flex; justify-content: space-between; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grigio); gap: 6px; }
.wait-box { text-align: center; padding: 10px; }
.wait-box .amt { font: 700 2.2rem var(--font-t); color: var(--ink); }
.spinner { width: 46px; height: 46px; border: 5px solid var(--grigio); border-top-color: var(--blu); border-radius: 50%; animation: spin 1s linear infinite; margin: 10px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
.split-lines .sl { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--grigio); }
.qty-ctl { display: flex; align-items: center; gap: 4px; }
.qty-ctl button { width: 36px; height: 36px; border-radius: 8px; border: 1px solid var(--linea); background: #fff; font-weight: 700; cursor: pointer; }
.qty-ctl span { min-width: 34px; text-align: center; font-weight: 700; }

/* variazioni */
.var-groups { display: flex; flex-direction: column; gap: 12px; }
.var-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px; }
.var-btn { min-height: 48px; border: 1px solid var(--linea); border-radius: 8px; background: #fff; cursor: pointer; font-weight: 600; padding: 6px; }
.var-btn.on-plus { background: var(--verde-chiaro); border-color: var(--verde); }
.var-btn.on-minus { background: var(--rosso-chiaro); border-color: var(--rosso); }
.mod-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mod-row button { min-height: 40px; }
.mod-row button.on { background: var(--blu); color: #fff; border-color: var(--blu); }

/* ---------------- monitor cucina ---------------- */
.kds { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; align-items: start; }
.ticket { background: #fff; border-radius: var(--r); border: 1px solid var(--linea); overflow: hidden; box-shadow: var(--ombra); }
.ticket .th { padding: 10px 12px; color: #fff; background: var(--blu); display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.ticket .th b { font-family: var(--font-t); font-size: 1.1rem; color: #fff; }
.ticket.storno .th { background: var(--rosso); } .ticket.marcia .th { background: var(--verde); } .ticket.messaggio .th { background: var(--viola); }
.ticket.late .th { box-shadow: inset 0 -5px 0 var(--giallo); }
.ticket ul { list-style: none; margin: 0; padding: 6px 12px; }
.ticket li { padding: 7px 0; border-bottom: 1px dashed var(--grigio); cursor: pointer; font-size: 1.05rem; }
.ticket li.done { text-decoration: line-through; opacity: .45; }
.ticket li.wait { color: var(--testo2); }
.ticket li small { display: block; color: var(--rosso); font-size: .88rem; }
.ticket .tf { padding: 8px 12px; display: flex; gap: 6px; }
.ticket .tf .btn { flex: 1; }
.ticket.pronto { opacity: .7; } .ticket.pronto .th { background: var(--verde); }

/* ---------------- visore cliente ---------------- */
.visore { position: fixed; inset: 0; background: var(--ink); color: #fff; display: grid; grid-template-rows: auto 1fr auto; z-index: 50; }
.visore header { padding: 20px 30px; display: flex; justify-content: space-between; align-items: center; }
.visore header img { height: 50px; }
.visore .rows { padding: 10px 30px; overflow: hidden; font-size: 1.5rem; }
.visore .rows div { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.1); }
.visore footer { background: var(--blu); padding: 22px 30px; display: flex; justify-content: space-between; font: 700 2.6rem var(--font-t); }
.visore .idle { display: grid; place-items: center; text-align: center; font-size: 2rem; }

/* ---------------- cruscotto ---------------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--linea); border-radius: var(--r); padding: 12px 14px; }
.kpi small { color: var(--testo2); display: block; }
.kpi b { font: 700 1.5rem var(--font-t); color: var(--ink); }
.bars .bar { display: grid; grid-template-columns: 140px 1fr 90px; gap: 8px; align-items: center; padding: 4px 0; font-size: .9rem; }
.bars .bar i { display: block; height: 14px; background: var(--blu); border-radius: 3px; }

/* ---------------- ricevuta (stampa da browser, 80 mm) ---------------- */
.receipt { font: 13px/1.35 var(--mono); width: 300px; margin: 0 auto; color: #000; }
.receipt .c { text-align: center; } .receipt hr { border: 0; border-top: 1px dashed #000; }
.receipt .r { display: flex; justify-content: space-between; gap: 8px; }
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  #print-area { display: block !important; }
  @page { margin: 4mm; }
}

/* ---------------- telefono e tablet piccolo ---------------- */
@media (max-width: 900px) {
  .pos { grid-template-columns: 1fr; height: auto; }
  .keys { min-height: 360px; }
  .lines { max-height: 34vh; min-height: 60px; }
  .pay-grid { grid-template-columns: 1fr; }
  .op-card small { display: none; }
}
@media (max-width: 560px) {
  main { padding: calc(var(--top-h) + 10px) 10px 10px; }
  .op-card { display: none; }
  .total-tile { min-width: 0; }
  .total-tile b { font-size: 1.25rem; }
  .room-tab { padding: 10px 12px; }
  .bars .bar { grid-template-columns: 90px 1fr 70px; }
  .key { font-size: .9rem; }
  .keys { min-height: 0; }
  .line { grid-template-columns: 26px 1fr auto 28px; }
}

/* ---------------- palmare: schermate a tutta pagina su fondo inchiostro, tasti grandi per il pollice ---------------- */
body.palm { background: var(--ink); }
body.palm #top { display: none; }
body.palm main { padding: 0; min-height: 100vh; color: #fff; }
.view-palmare { max-width: 640px; margin: 0 auto; display: flex; flex-direction: column; min-height: 100vh; padding: env(safe-area-inset-top) 10px 10px !important; gap: 8px; }
.p-bar { display: flex; align-items: center; gap: 8px; padding: 8px 0; }
.p-bar b { flex: 1; font: 700 1.15rem var(--font-t); color: #fff; }
.p-back { width: 44px; height: 44px; border-radius: 10px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 1.8rem; line-height: 1; cursor: pointer; }
.p-mini { min-height: 40px; padding: 0 14px; border-radius: 10px; border: 0; background: var(--rosso); color: #fff; font-weight: 700; cursor: pointer; }
.p-empty { color: #c8d6e6; text-align: center; padding: 20px; }
.p-empty a { color: var(--cielo); }
/* home */
.p-home { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.p-head { display: flex; align-items: center; gap: 10px; padding: 10px 2px 4px; }
.p-head img { width: 42px; height: 42px; }
.p-head b { display: block; font: 700 1.15rem var(--font-t); color: #fff; }
.p-head small { color: var(--cielo); }
.p-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p-big { min-height: 76px; border-radius: 14px; border: 1px solid rgba(255,255,255,.18); background: var(--blu); color: #fff; font: 700 1.05rem var(--font); display: flex;
  align-items: center; gap: 12px; padding: 0 16px; cursor: pointer; text-align: left; }
.p-big.wide { min-height: 84px; }
.p-big:active { background: var(--blu-scuro); }
.p-ico { width: 40px; height: 40px; border-radius: 10px; background: var(--giallo); color: var(--ink); display: grid; place-items: center; font-size: 1.3rem; flex: none; }
.p-foot { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 10px; }
.p-icon { width: 52px; height: 52px; border-radius: 12px; border: 0; background: rgba(255,255,255,.1); color: #fff; font-size: 1.4rem; cursor: pointer; }
.p-batt { flex: 1; text-align: center; color: var(--giallo); font-weight: 600; }
.p-lock { position: fixed; inset: 0; background: var(--ink); z-index: 90; display: grid; place-content: center; text-align: center; color: #fff; gap: 8px; user-select: none; }
.p-lock img { width: 90px; margin: 0 auto; }
/* tavoli */
.p-tabs { display: flex; gap: 6px; overflow-x: auto; }
.p-tab { flex: none; min-height: 44px; padding: 0 16px; border-radius: 10px; border: 0; background: var(--giallo); color: var(--ink); font-weight: 700; cursor: pointer; }
.p-tab.on { background: var(--cielo); }
.p-tables { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; flex: 1; align-content: start; }
.p-table { min-height: 70px; border-radius: 12px; border: 0; color: #fff; font-weight: 700; cursor: pointer; background: var(--verde); display: flex; flex-direction: column; justify-content: center; gap: 2px; padding: 6px; }
.p-table small { font-weight: 600; font-size: .8rem; opacity: .95; }
.p-table.occupato { background: var(--rosso); } .p-table.conto { background: var(--giallo-scuro); color: var(--ink); } .p-table.prenotato { background: var(--arancio); }
.p-table.lento { background: #7d8796; } .p-table.uscita { background: var(--blu); border: 2px solid var(--cielo); }
.p-legend { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; padding: 8px; border: 2px solid rgba(255,255,255,.2); border-radius: 12px; }
.p-legend button { min-height: 36px; border: 0; border-radius: 8px; background: rgba(255,255,255,.08); color: #fff; font-weight: 600; cursor: pointer; display: flex; align-items: center; gap: 6px; padding: 0 8px; }
.p-legend button::before { content: ''; width: 14px; height: 14px; border-radius: 4px; background: var(--c); flex: none; }
.p-legend button.on { outline: 2px solid var(--giallo); }
/* scelta tavolo occupato */
.p-open { min-height: 64px; border: 0; border-radius: 12px; background: var(--verde); color: #fff; font: 700 1.1rem var(--font-t); cursor: pointer; }
.p-choices { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.p-choice { min-height: 60px; border: 0; border-radius: 12px; background: #dfe6fb; color: var(--ink); font-weight: 700; cursor: pointer; }
.p-choice.accent { background: var(--giallo); } .p-choice.soft { background: #f6c9dc; }
.p-totals { min-height: 140px; border: 0; border-radius: 12px; background: #eef3f9; color: var(--ink); font: 600 1.15rem var(--font); cursor: pointer; padding: 12px; line-height: 1.5; }
.p-infobox { font-size: 1.2rem; line-height: 1.6; color: var(--ink); }
/* comanda */
.p-otop { display: grid; grid-template-columns: 1.6fr 1fr 0.8fr 0.6fr; gap: 6px; padding-top: 6px; }
.p-otop button { min-height: 58px; border: 0; border-radius: 12px; color: #fff; font-weight: 700; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.p-tavbtn { background: var(--verde); } .p-tavbtn small { font-weight: 600; font-size: .78rem; }
.p-adv { background: var(--arancio); } .p-turno { background: var(--blu); } .p-turno b { font-size: 1.2rem; } .p-find { background: rgba(255,255,255,.12); font-size: 1.5rem; }
.p-lines { flex: 1; min-height: 120px; max-height: 46vh; overflow-y: auto; background: var(--blu); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 5px; }
.p-line { display: grid; grid-template-columns: 46px 1fr 40px 46px; gap: 5px; align-items: stretch; }
.p-line button { border: 0; border-radius: 20px; font-weight: 700; cursor: pointer; min-height: 40px; }
.p-qty { background: var(--rosso); color: #fff; }
.p-qty.on { background: var(--verde); }
.p-desc { background: #6a5be2; color: #fff; text-align: left; padding: 6px 12px; line-height: 1.2; }
.p-desc.sent { background: #3d4f9e; } .p-desc.var { background: #c03fc8; }
.p-desc small { display: block; font-weight: 500; font-size: .8rem; opacity: .95; }
.p-tool { background: rgba(255,255,255,.15); color: #fff; font-size: 1.1rem; }
.p-crs { background: var(--rosso); color: #fff; }
.p-crs.later { background: var(--blu-scuro); border: 2px solid var(--cielo) !important; }
.p-bottom { display: grid; grid-template-columns: 58px 1fr; gap: 6px; }
.p-pages { display: flex; flex-direction: column; gap: 6px; }
.p-page { min-height: 56px; border: 0; border-radius: 12px; background: rgba(255,255,255,.12); color: #fff; font: 700 1.2rem var(--font-t); cursor: pointer; }
.p-page.on { background: var(--giallo); color: var(--ink); } .p-page.fn { background: var(--arancio); }
.p-groups { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 64px; gap: 6px; }
.p-group { border: 0; border-radius: 12px; background: #dfe6fb; color: var(--ink); font-weight: 700; font-size: .92rem; cursor: pointer; padding: 4px; line-height: 1.15; }
.p-group.dark { color: #fff; }
/* fogli a tutto schermo sul telefono (gruppo, variazioni, funzioni) */
@media (max-width: 700px) {
  .modal.p-sheet { width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; }
  .modal-back:has(.p-sheet) { padding: 0; }
}
.p-gbody { display: flex; flex-direction: column; gap: 8px; }
.p-letters { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.p-letters button { min-height: 40px; border: 0; border-radius: 8px; background: #bfe6f5; color: var(--ink); font-weight: 700; cursor: pointer; }
.p-letters button.on { background: var(--blu); color: #fff; }
.p-letters button:first-child { grid-column: span 2; }
.p-alist { display: flex; flex-direction: column; gap: 6px; }
.p-arow { display: grid; grid-template-columns: 48px 1fr 44px; gap: 6px; }
.p-arow .p-qty { border: 0; border-radius: 10px; font-weight: 700; font-size: 1.1rem; min-height: 52px; background: #e3e7ee; color: var(--ink); cursor: pointer; }
.p-arow .p-qty.on { background: var(--rosso); color: #fff; }
.p-aname { border: 0; border-radius: 10px; background: var(--blu); color: #fff; text-align: left; padding: 8px 12px; font-weight: 700; cursor: pointer; min-height: 52px; }
.p-aname.on { background: var(--verde); } .p-aname.off { opacity: .45; }
.p-aname small { display: block; font-weight: 500; opacity: .9; }
.p-arow .p-tool { border: 0; border-radius: 10px; background: #e3e7ee; color: var(--ink); font-weight: 700; cursor: pointer; }
.p-vbody { display: flex; flex-direction: column; gap: 10px; }
.p-mods { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.p-mods button { min-height: 48px; border: 1px solid var(--linea); border-radius: 10px; background: #fff; font-weight: 700; cursor: pointer; }
.p-mods button.on { background: var(--blu); color: #fff; border-color: var(--blu); }
.p-vlist { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.p-vitem { min-height: 52px; border: 1px solid var(--linea); border-radius: 10px; background: #fff; font-weight: 600; cursor: pointer; padding: 6px; }
.p-vitem small { display: block; color: var(--testo2); }
.p-vitem.plus { background: var(--verde-chiaro); border-color: var(--verde); } .p-vitem.minus { background: var(--rosso-chiaro); border-color: var(--rosso); }
.p-fnlist { display: flex; flex-direction: column; gap: 6px; }
.p-fnlist button { min-height: 54px; border: 0; border-radius: 10px; background: #eef3f9; color: var(--ink); font-weight: 700; text-align: left; padding: 0 16px; cursor: pointer; }
