:root {
  --bg: #f4f2ee; --panel: #ffffff; --line: #e6e1d9; --ink: #1f1b17; --muted: #7b736a;
  --accent: #a0462b; --accent-ink: #fff; --ok: #2e9b57; --warn: #c98a00; --bad: #d23b2f;
  --add-bg: rgba(46, 155, 87, .14); --rem-bg: rgba(210, 59, 47, .10); --mod-bg: rgba(255, 196, 0, .45);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
html { background: var(--bg, #f4f2ee); }
body { background: var(--bg); color: var(--ink); font: 14px/1.45 Inter, system-ui, sans-serif; overflow: hidden; }
/* Su schermo grande scorrono solo i pannelli: la pagina intera non deve mai spostarsi (focus su campi nascosti) */
@media (min-width: 901px) { html:has(body[data-screen]), body[data-screen] { overflow: clip; } }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd { font: 11px Inter; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: #faf9f7; }

/* Topbar */
.topbar { height: 58px; display: flex; align-items: center; gap: 16px; padding: 0 18px; background: var(--panel); border-bottom: 1px solid var(--line); }
.brand { font-weight: 600; display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.logo { width: 28px; height: 28px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; font-family: 'Cormorant Garamond', serif; font-size: 20px; font-weight: 700; }
.proto { font-size: 11px; font-weight: 500; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 1px 8px; }
.restaurant-pill { display: flex; align-items: center; gap: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; min-width: 0; }
.restaurant-pill select { border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; background: #fff; font-weight: 600; color: var(--ink); max-width: 280px; }
#menu-label { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.status-chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); margin-right: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.dot.ok { background: var(--ok); } .dot.warn { background: var(--warn); }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 8px; padding: 7px 12px; font-weight: 500; white-space: nowrap; }
.btn:hover:not(:disabled) { background: #f7f5f1; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover:not(:disabled) { background: #8b3b23; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn.danger { color: var(--bad); }
.dropdown { position: relative; }
.dropdown-menu { display: none; position: absolute; right: 0; top: calc(100% + 6px); background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.12); padding: 6px; z-index: 30; min-width: 220px; }
.dropdown-menu.open { display: block; }
.dropdown-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 6px; }
.dropdown-menu button:hover { background: #f4f1ec; }

/* Layout */
.layout { display: grid; grid-template-columns: minmax(420px, 34%) 1fr; height: calc(100vh - 58px); }
.editor-panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.panel-head { padding: 16px 22px 10px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0 0 2px; font-size: 16px; }
.panel-head p { margin: 0; color: var(--muted); font-size: 12.5px; }
.mini-drag { color: var(--muted); }
.editor { flex: 1; overflow-y: auto; padding: 12px 18px 40px; }

/* Editor */
.ed-header-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin-bottom: 14px; background: #fcfbf9; }
.ed-header-box summary { cursor: pointer; font-weight: 500; color: var(--muted); font-size: 13px; }
.ed-header-box label { display: block; font-size: 12px; color: var(--muted); margin-top: 8px; }
.ed-header-box input, .ed-header-box textarea { display: block; width: 100%; margin-top: 3px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: #fff; resize: none; }
.ed-section { margin-bottom: 18px; border-radius: 10px; }
.ed-section.drop-into { outline: 2px dashed var(--accent); outline-offset: 4px; }
.ed-section-head { display: flex; align-items: center; gap: 6px; border-bottom: 2px solid var(--ink); padding: 4px 0; margin-bottom: 4px; }
.ed-section-name { flex: 1; border: 0; background: none; font-family: Jost, sans-serif; font-size: 13px; font-weight: 500; letter-spacing: .22em; text-transform: uppercase; padding: 4px 2px; outline: none; }
.mark-sec-added .ed-section-name, .mark-sec-renamed .ed-section-name { background: var(--mod-bg); border-radius: 4px; }
/* la stessa sezione che continua nella pagina dopo: niente secondo titolo, solo un richiamo discreto */
.ed-section.is-cont { margin-top: -10px; }
.ed-section.is-cont .ed-section-name { display: none; }
.ed-cont { flex: 1; color: var(--muted); font-size: 12px; padding: 4px 2px; }
.ed-count { color: var(--muted); font-size: 12px; white-space: nowrap; }
.ed-section-head button { border: 0; background: none; color: var(--muted); width: 24px; height: 24px; border-radius: 6px; }
.ed-section-head button:hover:not(:disabled) { background: #f1ede7; color: var(--ink); }
.ed-section-head button:disabled { opacity: .3; }

.ed-item { display: flex; gap: 6px; padding: 8px 6px 8px 4px; border-radius: 8px; border-left: 3px solid transparent; position: relative; }
.ed-item:hover { background: #faf8f5; }
.ed-item:focus-within { background: #f8f5f0; }
.ed-item.mark-added { border-left-color: var(--ok); background: rgba(46,155,87,.05); }
.ed-item.mark-modified { border-left-color: var(--warn); }
.ed-item.mark-removed { border-left-color: var(--bad); }
.ed-item.is-paused { opacity: .55; }
.ed-item.is-paused .ed-name, .ed-item.is-paused .ed-desc { text-decoration: line-through; }
.ed-item.dragging { opacity: .35; }
.ed-item.drop-before { box-shadow: inset 0 3px 0 var(--accent); }
.ed-item.drop-after { box-shadow: inset 0 -3px 0 var(--accent); }
.ed-drag { cursor: grab; color: #bdb5ab; padding-top: 4px; user-select: none; font-size: 16px; line-height: 1; }
.ed-drag:hover { color: var(--ink); }
.ed-main { flex: 1; min-width: 0; }
.ed-line { display: flex; align-items: baseline; gap: 6px; }
.ed-name { flex: 0 1 auto; min-width: 60px; width: 100%; border: 0; background: none; font-family: 'Cormorant Garamond', serif; font-size: 19px; font-weight: 600; padding: 0; outline: none; }
.ed-leader { flex: 1; min-width: 12px; border-bottom: 1px dotted #c4bcb1; transform: translateY(-4px); }
.ed-price { width: 52px; text-align: right; border: 0; border-bottom: 1px solid transparent; background: none; font-family: Jost, sans-serif; font-weight: 500; font-size: 15px; outline: none; padding: 0; }
.ed-price:focus, .ed-name:focus, .ed-desc:focus { border-bottom-color: var(--accent); }
.ed-eur { font-family: Jost; color: var(--muted); }
.ed-desc { display: block; width: 100%; border: 0; border-bottom: 1px solid transparent; background: none; resize: none; font-family: 'Cormorant Garamond', serif; font-style: italic; font-size: 16px; color: #5b4c42; padding: 0; margin-top: 1px; outline: none; overflow: hidden; line-height: 1.25; }
.ed-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 6px; }
.chip { font-size: 11.5px; border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 2px 9px; color: var(--ink); }
.chip-empty { color: var(--muted); border-style: dashed; }
.chip-select { appearance: none; -webkit-appearance: none; padding-right: 9px; }
.chip-select.photo-pending { background: #fff4d6; border-color: #f0d48a; color: #7a5600; }
.chip-select.photo-ok { background: #e7f5ec; border-color: #b9e0c6; color: #1f6b3d; }
.ed-thumb { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.paused-label { font-size: 11.5px; color: var(--bad); }
.ed-actions { display: flex; flex-direction: column; gap: 2px; opacity: 0; transition: opacity .12s; }
.ed-item:hover .ed-actions, .ed-item:focus-within .ed-actions { opacity: 1; }
.ed-actions button { border: 0; background: none; width: 26px; height: 24px; border-radius: 6px; color: var(--muted); }
.ed-actions button:hover { background: #efe9e1; color: var(--ink); }
.ed-add-item { border: 0; background: none; color: var(--accent); font-weight: 500; padding: 6px 8px; border-radius: 6px; font-size: 13px; }
.ed-add-item:hover { background: #f8eee9; }
.ed-add-section { width: 100%; border: 1.5px dashed var(--line); background: none; border-radius: 10px; padding: 12px; color: var(--muted); font-weight: 500; }
.ed-add-section:hover { border-color: var(--accent); color: var(--accent); }

/* Barra modifiche */
.changes-bar { border-top: 1px solid var(--line); padding: 10px 18px; background: #fcfbf9; max-height: 40%; overflow-y: auto; }
.cb-row { display: flex; align-items: center; gap: 8px; font-size: 13px; }
.cb-count { background: var(--warn); color: #fff; border-radius: 99px; min-width: 22px; height: 22px; display: grid; place-items: center; font-weight: 600; font-size: 12px; padding: 0 6px; }
.cb-ok { color: var(--ok); font-weight: 500; }
.link { border: 0; background: none; color: var(--accent); margin-left: auto; font-weight: 500; }
.cb-list { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.cb-list li { padding: 4px 0 4px 18px; position: relative; }
.cb-list li::before { content: ''; position: absolute; left: 4px; top: 10px; width: 7px; height: 7px; border-radius: 50%; }
.cb-list .t-add::before { background: var(--ok); } .cb-list .t-mod::before { background: var(--warn); } .cb-list .t-remove::before { background: var(--bad); }
.cb-list.big { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; font-size: 13px; }

/* Anteprima */
.preview-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.preview-toolbar { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.seg { display: inline-flex; background: #f1ede7; border-radius: 9px; padding: 3px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 7px; font-size: 13px; color: var(--muted); font-weight: 500; white-space: nowrap; }
.seg button.active { background: #fff; color: var(--ink); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.fit-status { margin-left: auto; font-size: 12.5px; }
.fit { padding: 4px 10px; border-radius: 99px; font-weight: 500; }
.fit.ok { color: var(--ok); background: #e9f6ee; } .fit.warn { color: #7a5600; background: #fff4d6; } .fit.bad { color: var(--bad); background: #fde9e7; }
.preview-area { flex: 1; overflow: auto; padding: 20px 24px; min-height: 0; }
.pages { display: flex; justify-content: center; gap: 28px; }
.frame-wrap { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.frame-label { font-size: 12px; color: var(--muted); font-weight: 500; height: 20px; }
.frame-label.split { display: flex; justify-content: space-between; width: 100%; gap: 12px; }
.frame { position: relative; box-shadow: 0 2px 4px rgba(0,0,0,.06), 0 12px 40px rgba(60,40,20,.16); overflow: hidden; background: #f6efe2; }
.scaler { position: absolute; top: 0; left: 0; transform-origin: 0 0; }
.slider-frame { cursor: ew-resize; touch-action: none; user-select: none; }
.slider-line { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); transform: translateX(-1px); pointer-events: none; }
.slider-line span { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background: var(--accent); color: #fff; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-size: 16px; box-shadow: 0 2px 8px rgba(0,0,0,.25); }

/* ===== Template del menù (impaginazione "del grafico") ===== */
.menu-page { --fs: 1; width: 794px; height: 1123px; background: #f6efe2; color: #2a221d; padding: 62px 72px 44px; display: flex; flex-direction: column; font-family: 'Cormorant Garamond', serif; font-size: calc(18px * var(--fs)); position: relative; }
.menu-page::before { content: ''; position: absolute; inset: 22px; border: 1px solid rgba(160,70,43,.35); pointer-events: none; }
.menu-page::after { content: ''; position: absolute; inset: 27px; border: .5px solid rgba(160,70,43,.2); pointer-events: none; }
.menu-page.is-overflow { box-shadow: inset 0 0 0 4px var(--bad); }
.mp-head { text-align: center; margin-bottom: 30px; }
.mp-orn { font-family: Jost, sans-serif; color: #a0462b; letter-spacing: .5em; font-size: 12px; }
.mp-head h1 { font-size: 56px; font-weight: 600; margin: 8px 0 6px; line-height: 1; letter-spacing: .01em; }
.mp-tagline { font-family: Jost, sans-serif; text-transform: uppercase; letter-spacing: .34em; font-size: 10.5px; color: #7a6a5e; margin: 0; }
.mp-body { flex: 1; min-height: 0; overflow: hidden; column-count: 2; column-gap: 54px; column-fill: balance; column-rule: 1px solid rgba(160,70,43,.16); }
.mp-sec { margin-bottom: 1.5em; }
.mp-sec h2 { font-family: Jost, sans-serif; font-weight: 500; font-size: .74em; letter-spacing: .36em; text-transform: uppercase; color: #a0462b; margin: 0 0 1em; display: flex; align-items: center; gap: .9em; break-after: avoid; }
.mp-sec h2::before, .mp-sec h2::after { content: ''; flex: 1; height: 1px; background: rgba(160,70,43,.35); }
.mp-item { break-inside: avoid; display: flex; gap: .75em; align-items: center; margin: 0 -.35em .95em; padding: .2em .35em; border-radius: 4px; }
.mp-photo { width: 3.6em; height: 3.6em; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.18); }
.mp-txt { flex: 1; min-width: 0; }
.mp-line { display: flex; align-items: baseline; gap: .4em; }
.mp-name { font-size: 1.2em; font-weight: 600; line-height: 1.15; }
.mp-name sup { font-family: Jost, sans-serif; font-size: .48em; color: #a0462b; font-weight: 500; margin-left: .3em; letter-spacing: .06em; }
.mp-dots { flex: 1; min-width: 1em; border-bottom: 1px dotted rgba(42,34,29,.45); transform: translateY(-.28em); }
.mp-price { font-family: Jost, sans-serif; font-size: .95em; font-weight: 500; white-space: nowrap; }
.mp-old { opacity: .55; margin-right: .35em; font-weight: 400; }
.mp-desc { margin: .18em 0 0; font-style: italic; font-size: 1em; line-height: 1.25; color: #5b4c42; }
.mp-foot { text-align: center; font-family: Jost, sans-serif; font-size: 10px; color: #7a6a5e; letter-spacing: .03em; border-top: 1px solid rgba(160,70,43,.3); padding-top: 12px; margin-top: 14px; }
.mp-foot p { margin: 0 0 4px; }
.mp-legend { font-size: 8.5px; opacity: .85; }
/* Evidenziazioni prima/dopo */
.hl { background: var(--mod-bg); border-radius: 2px; box-shadow: 0 0 0 2px var(--mod-bg); }
.hl-ring { box-shadow: 0 0 0 3px #ffc400; }
.mp-item.chg-added { background: var(--add-bg); box-shadow: inset 3px 0 0 var(--ok); }
.mp-item.chg-removed { background: var(--rem-bg); box-shadow: inset 3px 0 0 var(--bad); opacity: .7; }
.mp-item.chg-removed .mp-name, .mp-item.chg-removed .mp-desc, .mp-item.chg-removed .mp-price { text-decoration: line-through; }
.mp-sec.chg-removed h2 { text-decoration: line-through; }
.mp-tag-pending { display: inline-block; font-family: Jost, sans-serif; font-size: 8.5px; letter-spacing: .08em; text-transform: uppercase; color: #7a5600; background: #ffe9b0; padding: 1px 6px; border-radius: 3px; margin-top: 4px; }

/* Vista sito / QR */
.web-view { display: flex; gap: 32px; justify-content: center; align-items: flex-start; padding-top: 6px; flex-wrap: wrap; }
.phone { width: 340px; height: 690px; border-radius: 44px; background: #111; padding: 12px; position: relative; box-shadow: 0 20px 50px rgba(0,0,0,.25); flex: none; }
.phone-notch { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); width: 110px; height: 26px; background: #111; border-radius: 0 0 16px 16px; z-index: 2; }
.phone-screen { width: 100%; height: 100%; border-radius: 33px; background: #f6efe2; overflow-y: auto; font-family: 'Cormorant Garamond', serif; color: #2a221d; scroll-behavior: smooth; }
.phone-screen::-webkit-scrollbar { display: none; }
.m-head { text-align: center; padding: 48px 20px 14px; }
.m-head h1 { margin: 0; font-size: 32px; font-weight: 600; }
.m-head p { margin: 4px 0 0; font-family: Jost; font-size: 9.5px; letter-spacing: .3em; text-transform: uppercase; color: #7a6a5e; }
.m-nav { position: sticky; top: 0; z-index: 1; display: flex; gap: 6px; overflow-x: auto; padding: 10px 14px; background: rgba(246,239,226,.95); backdrop-filter: blur(6px); border-bottom: 1px solid rgba(160,70,43,.2); }
.m-nav button { border: 1px solid rgba(160,70,43,.4); background: none; color: #a0462b; border-radius: 99px; padding: 3px 12px; font-family: Jost; font-size: 12px; white-space: nowrap; }
.m-sec { padding: 14px 18px 4px; }
.m-sec h2 { font-family: Jost; font-weight: 500; font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: #a0462b; margin: 0 0 10px; }
.m-item { display: flex; gap: 10px; padding: 10px 0; border-bottom: 1px solid rgba(42,34,29,.08); }
.m-item img { width: 58px; height: 58px; border-radius: 10px; object-fit: cover; flex: none; }
.m-txt { flex: 1; min-width: 0; }
.m-line { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.m-line strong { font-size: 17px; font-weight: 600; line-height: 1.15; }
.m-line span { font-family: Jost; font-size: 13px; white-space: nowrap; }
.m-txt p { margin: 2px 0 0; font-style: italic; font-size: 14.5px; color: #5b4c42; line-height: 1.2; }
.m-al { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px; }
.m-al span { font-family: Jost; font-size: 9.5px; background: rgba(160,70,43,.1); color: #8b3b23; padding: 1px 6px; border-radius: 99px; }
.m-foot { padding: 18px 20px 36px; text-align: center; font-family: Jost; font-size: 10px; color: #7a6a5e; }
.web-side { width: 380px; max-width: 100%; display: flex; flex-direction: column; gap: 14px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; }
.card p { margin: 4px 0 8px; color: var(--muted); font-size: 13px; }
.card code { font-size: 11.5px; background: #f4f1ec; padding: 2px 6px; border-radius: 5px; word-break: break-all; }
.card code.block { display: block; padding: 8px 10px; }
.card.status.ok { border-color: #b9e0c6; background: #f1faf4; }
.card.status.warn { border-color: #f0d48a; background: #fffaeb; }
.card.status.info { border-color: #d9d2c8; background: #fcfbf9; }
.qr-card { display: flex; gap: 14px; align-items: center; }
.qr svg { display: block; width: 128px; height: 128px; }
.muted { color: var(--muted); font-size: 12px; }

/* Popover allergeni */
.allergen-pop { position: fixed; z-index: 40; width: 330px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 14px 40px rgba(0,0,0,.16); padding: 12px; }
.pop-title { font-weight: 600; font-size: 13px; margin-bottom: 8px; }
.pop-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.pop-grid button { text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 5px 8px; font-size: 12.5px; }
.pop-grid button b { display: inline-block; width: 18px; color: var(--muted); }
.pop-grid button.on { background: #f8eee9; border-color: var(--accent); color: #7a3018; }

/* Modale, drawer, toast */
.modal-back { position: fixed; inset: 0; background: rgba(30,20,10,.35); display: grid; place-items: center; z-index: 50; }
.modal { background: #fff; border-radius: 16px; width: min(520px, calc(100vw - 32px)); padding: 22px; box-shadow: 0 20px 60px rgba(0,0,0,.25); }
.modal h3 { margin: 0 0 4px; }
.field { display: block; margin-top: 14px; font-size: 12.5px; color: var(--muted); }
.field input { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink); }
.check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-size: 13.5px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }
.drawer { position: fixed; right: 0; top: 0; bottom: 0; width: 400px; max-width: 100vw; background: #fff; z-index: 45; box-shadow: -12px 0 40px rgba(0,0,0,.15); display: flex; flex-direction: column; }
.drawer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.drawer-head h3 { margin: 0; }
.drawer-body { overflow-y: auto; padding: 14px 18px; display: flex; flex-direction: column; gap: 12px; }
.version { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.version.current { border-color: var(--accent); }
.v-top { display: flex; justify-content: space-between; gap: 8px; }
.badge { font-size: 11px; background: var(--accent); color: #fff; border-radius: 99px; padding: 1px 8px; height: fit-content; }
.v-sum { margin: 6px 0; padding-left: 18px; font-size: 12.5px; color: #4f4740; }
.v-actions { display: flex; gap: 6px; margin-top: 6px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #2a221d; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13.5px; z-index: 60; max-width: min(620px, calc(100vw - 32px)); box-shadow: 0 10px 30px rgba(0,0,0,.25); }

/* Nodo per la stampa: fuori schermo ma misurabile */
#print-root { position: fixed; left: -100000px; top: 0; }
@media print {
  html, body { overflow: visible; height: auto; background: none; }
  body > *:not(#print-root) { display: none !important; }
  #print-root { position: static; }
  .print-page { break-after: page; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-page > * { box-shadow: none !important; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .layout { grid-template-columns: 1fr; height: auto; }
  .editor-panel { max-height: none; }
  .preview-area { min-height: 80vh; }
  .topbar { flex-wrap: wrap; height: auto; padding: 10px 16px; }
  .top-actions { flex-wrap: wrap; }
}

/* Editor: controlli aggiuntivi */
.ed-search { display: block; width: 100%; margin-top: 10px; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; background: #fcfbf9; }
.ed-fixed { font-size: 10.5px; color: #7a5600; background: #fff4d6; border-radius: 99px; padding: 1px 7px; white-space: nowrap; cursor: help; }
.ed-section-name[readonly] { cursor: default; }
.ed-hint { color: var(--muted); font-size: 12.5px; text-align: center; padding: 6px 12px; }
.chip-on { background: #e8f1fb; border-color: #b7d0ee; color: #1d4f8a; }
input.chip.ed-note { width: 150px; outline: none; }
input.chip.ed-note:focus { border-style: solid; border-color: var(--accent); }
.ed-unit { color: var(--muted); }
.ed-vars { margin-top: 4px; padding-left: 10px; border-left: 2px solid #eee6dc; }
.ed-var { display: flex; align-items: baseline; gap: 6px; padding: 2px 0; }
.ed-vlabel { flex: 0 1 auto; width: 100%; min-width: 60px; border: 0; border-bottom: 1px solid transparent; background: none; font-size: 13.5px; outline: none; padding: 0; }
.ed-vlabel:focus { border-bottom-color: var(--accent); }
.ed-var .ed-unit { font-size: 11px; padding: 1px 6px; }
.ed-x { border: 0; background: none; color: var(--muted); border-radius: 5px; width: 22px; }
.ed-x:hover { background: #efe9e1; color: var(--ink); }
.ed-link { border: 0; background: none; color: var(--accent); font-size: 12.5px; padding: 2px 0; font-weight: 500; }
.ed-item.flash { animation: flash 1.4s ease-out; }
@keyframes flash { 0%, 30% { background: #ffe9a8; } 100% { background: transparent; } }
.m-line small { font-weight: 400; font-size: 12px; }
.m-vars { font-style: normal !important; font-family: Jost; font-size: 12px !important; }
.frame { flex: none; }
.pages { margin-bottom: 22px; }
.preview-area .pages:not(.side) { justify-content: safe center; }
.pages.side { justify-content: safe center; }

/* ===== Template Toccaferro (unità: punti PDF) ===== */
.tf-page { position: relative; width: 1683.75pt; height: 1190.25pt; background-size: 100% 100%; background-repeat: no-repeat; overflow: hidden; }
.tf-item { position: absolute; font-family: 'Archivo', sans-serif; font-stretch: 106%; line-height: 1.12; --zs: 1; cursor: pointer; }
.tf-name { font-family: 'PT Serif', serif; font-weight: 700; font-size: calc(var(--ns) * var(--zs)); line-height: 0.98; }
.tf-name.tf-label { font-family: 'Archivo', sans-serif; font-stretch: 86%; font-weight: 500; text-transform: uppercase; color: var(--lc); font-size: calc(14pt * var(--zs) * var(--ls, 1)); letter-spacing: .02em; white-space: nowrap; overflow: hidden; line-height: 1.05; }
.tf-note { font-size: calc(9.5pt * var(--zs)); }
.tf-star { font-family: 'Archivo', sans-serif; font-size: calc(6pt * var(--zs)); vertical-align: super; margin-left: 1pt; }
.tf-desc { font-size: calc(var(--ds) * var(--zs)); line-height: 1.14; }
.tf-price { text-align: right; font-size: calc(13.1pt * var(--zs)); white-space: nowrap; line-height: 1; }
.tf-price b { font-weight: 700; }
.tf-old { opacity: .55; font-weight: 400; font-size: .85em; }
.tf-row { display: flex; align-items: baseline; }
.tf-row .tf-price { margin-top: 0 !important; }
.tf-fill { flex: 1; }
.tf-formats { font-size: calc(9.1pt * var(--zs)); white-space: nowrap; }
.tf-formats b { font-weight: 700; }
.tf-sep { margin: 0 2pt; }
.tf-vars { position: absolute; left: 0; right: 0; font-size: calc(11.8pt * var(--zs)); }
.tf-var { display: grid; grid-template-columns: var(--vx) auto; margin-bottom: 3.6pt; white-space: nowrap; }
.tf-vlabel { text-align: right; padding-right: 3pt; }
.tf-unplaced { display: none; }
/* evidenziazioni prima/dopo */
.tf-item .hl { background: #ffd54a; color: #2a1b10; border-radius: 2px; box-shadow: 0 0 0 1.5pt #ffd54a; }
.tf-item .hl-box { background: rgba(255, 213, 74, .55); border-radius: 2px; }
.tf-item.chg-added { background: rgba(60, 190, 110, .28); box-shadow: 0 0 0 3pt rgba(60, 190, 110, .28); border-radius: 3pt; }
.tf-item.chg-removed, .tf-ghost { background: rgba(220, 60, 50, .2); box-shadow: 0 0 0 3pt rgba(220, 60, 50, .2); border-radius: 3pt; text-decoration: line-through; opacity: .85; }
.tf-item.tf-overflow { outline: 2pt dashed #e0352b; outline-offset: 2pt; }
.tf-page.is-overflow { box-shadow: inset 0 0 0 6px var(--bad); }
.tf-item:hover { outline: 1.5pt solid rgba(160, 70, 43, .55); outline-offset: 2pt; border-radius: 2pt; }

/* ===== Template generico a due livelli (Lievita, Lido, Shabu) ===== */
.sl-page { position: relative; background-size: 100% 100%; background-repeat: no-repeat; overflow: hidden; }
.sl-item { position: absolute; --zs: 1; line-height: 1.15; cursor: pointer; }
.sl-item:hover { outline: 1.5pt solid rgba(200, 160, 60, .7); outline-offset: 2pt; border-radius: 2pt; }
.sl-name { line-height: 1.05; }
.sl-code { line-height: 1.1; }
.sl-desc { line-height: 1.2; }
.sl-al { font-size: .6em !important; margin-left: 2pt; vertical-align: super; line-height: 0; }
.sl-price { text-align: right; white-space: nowrap; line-height: 1.1; }
.sl-price { position: relative; }
.sl-price.abs { position: absolute; }
.sl-item { z-index: 0; } /* contesto di sovrapposizione: le decorazioni stanno sotto al testo */
.sl-deco { display: block; z-index: -1; pointer-events: none; }
.sl-ptxt { position: relative; }
.sl-name.nowrap { white-space: nowrap; }
.sl-name.keep, .sl-desc.keep { height: 0; }
.sl-line { position: absolute; white-space: nowrap; line-height: normal; }
.sl-fit { display: inline-block; transform-origin: 0 50%; }
.sl-bl { display: inline-block; width: 0; height: 0; vertical-align: baseline; }
.sl-abs { position: absolute; }
.sl-abs { position: absolute; white-space: nowrap; line-height: 1.1; }
.sl-old { opacity: .55; font-size: .8em; }
.sl-item .hl { background: #ffd54a; color: #2a1b10 !important; border-radius: 2px; box-shadow: 0 0 0 1.5pt #ffd54a; }
.sl-item .hl-box, .sl-item.hl-box { background: rgba(255, 213, 74, .6); }
.sl-item.chg-added { background: rgba(60, 190, 110, .3); box-shadow: 0 0 0 3pt rgba(60, 190, 110, .3); border-radius: 3pt; }
.sl-item.chg-removed, .sl-ghost { background: rgba(220, 60, 50, .25); box-shadow: 0 0 0 3pt rgba(220, 60, 50, .25); border-radius: 3pt; text-decoration: line-through; }
.sl-item.tf-overflow { outline: 2pt dashed #e0352b; outline-offset: 2pt; }
.sl-page.is-overflow { box-shadow: inset 0 0 0 6px var(--bad); }
.ed-code { width: 46px; flex: none; border: 1px solid var(--line); border-radius: 6px; padding: 0 4px; margin-right: 6px; font-size: 12px; color: var(--muted); background: #fcfbf9; }
.sl-star { position: relative; top: -0.45em; margin-left: 0.5pt; }
.sl-item.tf-clash { outline: 2pt dashed #e0352b; outline-offset: 2pt; }

/* ===== Schermate: accesso, admin, editor ===== */
#screen-editor:not([hidden]) { display: flex; flex-direction: column; height: 100vh; }
#screen-editor .layout { flex: 1; height: auto; min-height: 0; }
.as-admin-bar { background: #2a221d; color: #f4efe8; font-size: 12.5px; padding: 6px 18px; }
.as-admin-bar a { color: #ffd08a; }
.restaurant-pill strong { color: var(--ink); }
#screen-login, #screen-admin { height: 100vh; height: 100dvh; overflow-y: auto; }
.login { max-width: 860px; margin: 0 auto; padding: 60px 20px; }
.login-brand { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 600; margin-bottom: 28px; }
.login-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 16px; }
.login-card h2 { margin: 0 0 4px; font-size: 18px; }
.login-list { display: flex; flex-direction: column; gap: 8px; }
.login-list .btn, .login-card > .btn { text-decoration: none; text-align: left; display: block; }
a.btn { text-decoration: none; color: inherit; display: inline-block; }
a.btn.primary { color: var(--accent-ink); }
.center { text-align: center; margin-top: 22px; }
.admin-wrap { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }
.admin-wrap h1 { margin: 6px 0; font-size: 24px; }
.admin-wrap h3 { margin: 0 0 6px; font-size: 15px; }
.back { color: var(--accent); text-decoration: none; font-size: 13px; }
.adm-title { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.adm-title .v-actions { margin-left: auto; margin-top: 0; }
.admin-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; }
.admin-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 14px; margin: 14px 0; align-items: start; }
.adm-perms { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 6px; }
.adm-perms .check { margin-top: 6px; }
.adm-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-top: 6px; }
.adm-table td, .adm-table th { padding: 4px 4px; border-bottom: 1px solid var(--line); text-align: left; font-weight: 500; }
.adm-table th { color: var(--muted); font-size: 12px; }
.adm-table select, .adm-table input { width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; background: #fff; }
.field textarea { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; color: var(--ink); resize: vertical; }
.badge-warn { background: #fff4d6; color: #7a5600; border-radius: 99px; padding: 2px 8px; font-weight: 500; }
.adm-req-item { border-top: 1px solid var(--line); padding: 8px 0; font-size: 13px; }
.adm-req-item summary { cursor: pointer; }

/* ===== Editor: aggiunte ===== */
.head-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.head-row .ed-search { margin-top: 0; flex: 1; }
.btn-add-big { flex: none; border: 0; background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; padding: 9px 14px; border-radius: 10px; box-shadow: 0 2px 8px rgba(160,70,43,.35); }
.btn-add-big:hover { background: #8b3b23; }
.ed-add-item { display: flex; align-items: center; gap: 8px; width: 100%; margin-top: 6px; border: 2px dashed rgba(160,70,43,.45); background: #fdf6f2; color: var(--accent); font-weight: 600; font-size: 14px; padding: 10px 12px; border-radius: 10px; text-align: left; flex-wrap: wrap; }
.ed-add-item:hover { background: #f8eee9; border-color: var(--accent); }
.ed-add-item .plus { display: inline-grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 15px; }
.ed-add-item small { width: 100%; font-weight: 400; color: #7a5600; font-size: 11.5px; padding-left: 32px; }
.ed-add-item.is-fixed { border-color: #e6cf8f; background: #fffaeb; }
.chip-ro { background: #f4f1ec; color: var(--muted); }
.ed-item.is-readonly input, .ed-item.is-readonly textarea, .ed-item input[readonly], .ed-item textarea[readonly] { cursor: default; }
.ed-section.is-readonly { opacity: .8; }
.ed-ro { background: #eeeae4; color: var(--muted); }
.ed-drag-off { width: 10px; }
.pop-help { margin: 0 0 8px; font-size: 12.5px; color: var(--muted); }
.pop-words { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 10px; }
.pop-words button, .pop-row button, .pop-secs button { border: 1px solid var(--line); background: #fff; border-radius: 99px; padding: 4px 10px; font-size: 12.5px; }
.pop-words button.on, .pop-row button.on { background: #e8f1fb; border-color: #7ea9dc; color: #1d4f8a; font-weight: 600; }
.pop-row { display: flex; flex-wrap: wrap; gap: 5px; border-top: 1px solid var(--line); padding-top: 8px; }
.pop-secs { display: flex; flex-direction: column; gap: 5px; max-height: 50vh; overflow-y: auto; }
.pop-secs button { text-align: left; border-radius: 8px; padding: 7px 10px; font-weight: 500; }
.pop-secs button:hover { border-color: var(--accent); background: #fdf6f2; }
.pop-secs small { color: #7a5600; font-weight: 400; }
.fit-status { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fit.block { display: block; border-radius: 10px; padding: 8px 12px; margin: 10px 0; }
.cb-online { margin-top: 6px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--muted); font-size: 12.5px; }
.cb-online.warn { color: #7a5600; }
.small-note { margin-top: 10px; }
.imp-list { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: 8px; padding: 2px 10px 8px; }
.imp-list .check { font-size: 13px; margin-top: 6px; align-items: flex-start; }
.dropdown-menu small { display: block; color: var(--muted); font-size: 11.5px; }
.btn.small.ghost#btn-logout { margin-left: 4px; }

/* =====================================================================
   Tema "vetro" (leggero): sfondo caldo con pattern di piatti quasi invisibile,
   pannelli semitrasparenti sfocati. Il testo resta sempre scuro e pieno.
   ===================================================================== */
:root {
  --glass: rgba(255, 252, 248, .62);
  --glass-strong: rgba(255, 252, 248, .86);
  --glass-soft: rgba(255, 252, 248, .45);
  --glass-border: rgba(255, 255, 255, .7);
  --glass-edge: rgba(107, 58, 36, .12);
  --glass-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 10px 30px rgba(80, 45, 25, .10);
  --blur: blur(18px) saturate(1.35);
  --line: rgba(107, 58, 36, .14);
}
body {
  background-color: #efe4d8;
  background-image:
    url(sfondo-pattern.svg),
    radial-gradient(1200px 700px at 12% -10%, rgba(255, 246, 236, .95), transparent 60%),
    radial-gradient(900px 700px at 100% 110%, rgba(160, 70, 43, .16), transparent 60%),
    radial-gradient(700px 500px at 85% 10%, rgba(196, 140, 92, .18), transparent 60%),
    linear-gradient(160deg, #f6eee5 0%, #ecdfd1 55%, #e6d5c3 100%);
  background-size: 360px 360px, auto, auto, auto, auto;
  background-attachment: fixed;
}
.glass, .topbar, .editor-panel, .preview-toolbar, .card, .changes-bar {
  background: var(--glass);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
}
.topbar { border-bottom: 1px solid var(--glass-edge); box-shadow: 0 1px 0 rgba(255,255,255,.6) inset; position: relative; z-index: 5; }
.editor-panel { border-right: 1px solid var(--glass-edge); }
.panel-head { border-bottom-color: var(--glass-edge); }
.preview-toolbar { background: var(--glass-soft); border-bottom: 1px solid var(--glass-edge); }
.preview-area { background: transparent; }
.changes-bar { background: rgba(255, 252, 248, .55); border-top-color: var(--glass-edge); }
.card { border: 1px solid var(--glass-border); box-shadow: var(--glass-shadow); border-radius: 18px; }
.card.status.ok { background: rgba(232, 246, 237, .75); border-color: rgba(46,155,87,.25); }
.card.status.warn { background: rgba(255, 246, 220, .8); border-color: rgba(201,138,0,.3); }
.card.status.info { background: var(--glass); }
.btn { background: rgba(255, 255, 255, .62); border-color: var(--glass-edge); border-radius: 10px; }
.btn:hover:not(:disabled) { background: rgba(255, 255, 255, .9); }
.btn.primary { background: linear-gradient(180deg, #a9512f, #8b3b23); border-color: #7d3420; box-shadow: 0 1px 0 rgba(255,255,255,.25) inset, 0 4px 12px rgba(139, 59, 35, .25); }
.btn.primary:hover:not(:disabled) { background: linear-gradient(180deg, #9c4729, #7d3420); }
.seg { background: rgba(107, 58, 36, .08); border-radius: 11px; }
.seg button { border-radius: 8px; }
.seg button.active { background: rgba(255, 255, 255, .92); }
.ed-search, .restaurant-pill select { background: rgba(255, 255, 255, .7); border-color: var(--glass-edge); }
.ed-item:hover { background: rgba(255, 255, 255, .5); }
.ed-item:focus-within { background: rgba(255, 255, 255, .72); }
.chip { background: rgba(255, 255, 255, .75); }
.modal-back { background: rgba(60, 35, 20, .28); -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
.modal, .drawer, .dropdown-menu, .allergen-pop {
  background: var(--glass-strong);
  -webkit-backdrop-filter: var(--blur); backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
}
.modal { border-radius: 22px; box-shadow: 0 1px 0 rgba(255,255,255,.8) inset, 0 30px 70px rgba(60, 35, 20, .25); }
.drawer { border-left: 1px solid var(--glass-edge); }
.version { background: rgba(255,255,255,.55); border-color: var(--glass-edge); }
.toast { background: rgba(42, 28, 20, .88); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.as-admin-bar { background: rgba(42, 28, 20, .86); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); }
.adm-table select, .adm-table input, .field input, .field textarea { background: rgba(255, 255, 255, .75); border-color: var(--glass-edge); }
.ed-add-item { background: rgba(253, 246, 242, .7); }
.frame { box-shadow: 0 2px 4px rgba(60,35,20,.08), 0 18px 50px rgba(60,35,20,.22); }

/* ===== Accesso ===== */
#screen-login { background: transparent; }
.lg-wrap { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 90px 16px 40px; position: relative; overflow: hidden; }
.lg-wrap::before { /* archi concentrici molto leggeri dietro la card */
  content: ''; position: absolute; left: 50%; top: 52%; width: 1300px; height: 1300px; transform: translate(-50%, -50%); border-radius: 50%; pointer-events: none;
  background: repeating-radial-gradient(circle, transparent 0 199px, rgba(255,255,255,.55) 199px 200.5px, transparent 200.5px 300px);
  -webkit-mask-image: radial-gradient(circle, #000 30%, transparent 70%); mask-image: radial-gradient(circle, #000 30%, transparent 70%);
}
.lg-brand { position: absolute; top: 26px; left: 32px; display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 18px; color: var(--ink); }
.lg-card {
  position: relative; width: min(440px, 100%); padding: 36px 38px 30px; border-radius: 30px; text-align: center;
  background: linear-gradient(180deg, rgba(255, 244, 232, .78), rgba(255, 252, 248, .66) 40%, rgba(255, 252, 248, .6));
  border: 1px solid rgba(255, 255, 255, .8);
  box-shadow: 0 1px 0 rgba(255,255,255,.9) inset, 0 30px 80px rgba(80, 45, 25, .18), 0 0 0 1px rgba(107,58,36,.05);
}
.lg-icon { width: 62px; height: 62px; margin: 0 auto 18px; border-radius: 18px; display: grid; place-items: center; color: #4a2a1a;
  background: linear-gradient(180deg, #fff, #f7efe7); box-shadow: 0 1px 0 #fff inset, 0 8px 22px rgba(80, 45, 25, .16); }
.lg-title { margin: 0; font-size: 30px; font-weight: 650; letter-spacing: -.01em; color: #24160e; }
.lg-title.small { font-size: 23px; }
.lg-sub { margin: 8px 0 26px; color: #7b6a5d; font-size: 15px; line-height: 1.45; }
.lg-choices, .lg-list { display: flex; flex-direction: column; gap: 10px; text-align: left; }
.lg-choice, .lg-item {
  display: flex; align-items: center; gap: 14px; width: 100%; padding: 14px 16px; border-radius: 16px; text-decoration: none; color: var(--ink);
  background: rgba(255, 255, 255, .72); border: 1px solid rgba(107, 58, 36, .1); box-shadow: 0 1px 0 #fff inset, 0 2px 8px rgba(80,45,25,.05);
  transition: transform .12s, box-shadow .12s, background .12s; font: inherit; text-align: left; cursor: pointer;
}
.lg-choice:hover, .lg-item:hover { background: rgba(255, 255, 255, .95); transform: translateY(-1px); box-shadow: 0 1px 0 #fff inset, 0 8px 20px rgba(80,45,25,.12); }
.lg-choice b, .lg-item b { display: block; font-size: 16px; font-weight: 600; }
.lg-choice small, .lg-item small { display: block; color: #85756a; font-size: 12.5px; margin-top: 1px; }
.lg-choice > span:nth-child(2), .lg-item > span:first-child { flex: 1; min-width: 0; }
.lg-ic { flex: none; width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: rgba(160, 70, 43, .1); color: var(--accent); }
.lg-arrow { font-size: 24px; color: #b3a194; line-height: 1; }
.lg-choice.primary { background: linear-gradient(180deg, #3a2418, #24160e); color: #fff; border-color: #1c110a; box-shadow: 0 1px 0 rgba(255,255,255,.18) inset, 0 10px 24px rgba(36, 22, 14, .3); }
.lg-choice.primary:hover { background: linear-gradient(180deg, #452b1d, #2b1a10); }
.lg-choice.primary small { color: rgba(255, 255, 255, .68); }
.lg-choice.primary .lg-ic { background: rgba(255, 255, 255, .12); color: #ffd9bf; }
.lg-choice.primary .lg-arrow { color: rgba(255, 255, 255, .55); }
.lg-back { margin-top: 18px; border: 0; background: none; color: var(--accent); font-weight: 500; font-size: 14px; }
.lg-foot { margin-top: 22px; color: #9a887b; font-size: 12.5px; position: relative; }
@media (max-width: 520px) { .lg-card { padding: 28px 20px 22px; border-radius: 24px; } .lg-brand { left: 16px; top: 18px; } }

/* ===== Admin in vetro ===== */
#screen-admin, #screen-login { background: transparent; }
#screen-admin .topbar { position: sticky; top: 0; }
.adm-client { transition: transform .12s, box-shadow .12s; }
.adm-client:hover { transform: translateY(-1px); box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 16px 36px rgba(80, 45, 25, .14); }

/* ===== Admin: diciture ===== */
.dic-pick { display: flex; gap: 8px; align-items: center; margin: 8px 0 4px; }
.dic-pick select { flex: 1; border: 1px solid var(--glass-edge); border-radius: 10px; padding: 8px 10px; background: rgba(255,255,255,.85); font-weight: 600; }
.field select { display: block; width: 100%; margin-top: 4px; border: 1px solid var(--glass-edge); border-radius: 8px; padding: 7px 8px; background: rgba(255,255,255,.8); color: var(--ink); }
.dic-two { display: flex; gap: 10px; }
.dic-two .field:first-child { flex: 1; }
.dic-segno { width: 80px; }
.dic-segno input { text-align: center; font-weight: 700; }
.dic-ex { margin-top: 12px; padding: 10px 12px; border-radius: 12px; background: rgba(246, 239, 226, .9); border: 1px dashed rgba(107,58,36,.25); }
.dic-ex > div { margin-top: 4px; font-family: 'PT Serif', serif; font-size: 14px; line-height: 1.45; color: #342515; }
.dic-ex i { font-family: Inter, sans-serif; font-style: normal; font-size: 12.5px; color: #5b4c42; }
.dic-ex sup { font-size: .65em; color: var(--accent); }
.dic-mark { color: var(--accent); }
.dic-mark.sup { font-size: .7em; vertical-align: super; }
.dic-icons { letter-spacing: 2px; color: var(--accent); }
.sl-sup-mark { font-size: .6em; vertical-align: super; line-height: 0; margin-left: .5pt; }
.m-foot p { margin: 0 0 4px; }
.dic-pick { flex-wrap: wrap; }
.dic-pick select { min-width: 0; flex: 1 1 180px; }
.dic-pick .btn { flex: none; }
.adm-dic { min-width: 0; overflow: hidden; }
.adm-dic textarea { min-height: 64px; field-sizing: content; }
/* admin: tre colonne indipendenti, così le card corte non lasciano buchi */
.admin-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; align-items: start; }
.adm-col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
@media (max-width: 1100px) { .admin-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 720px) { .admin-cols { grid-template-columns: 1fr; } }

/* Piatto su cui stai scrivendo, riquadrato nell'anteprima */
.active-ring { position: absolute; pointer-events: none; z-index: 5; border-radius: 6px;
  border: 2px solid var(--accent); box-shadow: 0 0 0 4px rgba(160, 70, 43, .18), 0 0 18px rgba(160, 70, 43, .25);
  animation: ring-in .35s ease-out; }
@keyframes ring-in { from { opacity: 0; transform: scale(1.06); } to { opacity: 1; transform: none; } }
.m-item.is-active-item { background: rgba(160, 70, 43, .08); box-shadow: inset 3px 0 0 var(--accent); border-radius: 8px; }
.m-item { cursor: pointer; }

/* =====================================================================
   Stile "app di consegna" (struttura familiare ai ristoratori):
   categorie a pillole, schede piatto bianche, prezzo sotto il nome, foto a destra,
   interruttore Disponibile. Colori e sfondo restano quelli di Cambiomenu.
   ===================================================================== */
:root { --card: #ffffff; --card-line: rgba(31, 27, 23, .09); --soft: #f5f1ec; --text-2: #6f655c; }
.btn, .btn.small, .seg, .seg button, .chip, .restaurant-pill select, .ed-search, .btn-add-big { border-radius: 999px; }
.btn { font-weight: 600; padding: 8px 16px; }
.btn.small { padding: 5px 12px; }
.panel-head h2 { font-size: 19px; font-weight: 800; letter-spacing: -.01em; }
.ed-search { padding: 9px 14px; }
.btn-add-big { padding: 10px 16px; font-weight: 700; }

/* categorie */
.cat-tabs { display: flex; gap: 6px; overflow-x: auto; margin: 12px -22px 0; padding: 0 22px 2px; scrollbar-width: none; scroll-behavior: smooth; }
.cat-tabs::-webkit-scrollbar { display: none; }
.cat-tabs button { flex: none; border: 1px solid var(--card-line); background: rgba(255,255,255,.85); color: var(--ink); border-radius: 999px; padding: 6px 13px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.cat-tabs button:hover { background: #fff; }
.cat-tabs button.active { background: #1f1b17; border-color: #1f1b17; color: #fff; }

/* elenco */
.editor { padding: 14px 16px 60px; background: rgba(247, 243, 238, .55); }
.ed-section { margin-bottom: 26px; }
.ed-section-head { border-bottom: 0; padding: 6px 2px 8px; margin-bottom: 4px; }
.ed-section-name { font-family: Inter, system-ui, sans-serif; font-size: 20px; font-weight: 800; letter-spacing: -.01em; text-transform: none; padding: 0; }
.ed-count { font-size: 12.5px; }

/* scheda piatto */
.ed-item.dish { display: block; background: var(--card); border: 1px solid var(--card-line); border-left: 1px solid var(--card-line); border-radius: 16px; padding: 14px 14px 10px; margin-bottom: 10px; box-shadow: 0 1px 2px rgba(31,27,23,.04); transition: box-shadow .15s, border-color .15s; }
.ed-item.dish:hover { background: var(--card); box-shadow: 0 6px 18px rgba(31,27,23,.08); }
.ed-item.dish:focus-within { background: var(--card); border-color: rgba(160, 70, 43, .45); box-shadow: 0 0 0 3px rgba(160, 70, 43, .12); }
.ed-item.dish.mark-added { border-color: rgba(46, 155, 87, .45); background: var(--card); }
.ed-item.dish.mark-modified { border-color: rgba(201, 138, 0, .5); }
.ed-item.dish.is-paused { opacity: .6; }
.ed-item.dish.is-paused .ed-name, .ed-item.dish.is-paused .ed-desc { text-decoration: none; }
.dish-row { display: flex; gap: 12px; align-items: flex-start; }
.dish .ed-drag { padding-top: 2px; font-size: 15px; opacity: 0; transition: opacity .12s; margin-left: -4px; }
.dish:hover .ed-drag { opacity: 1; }
.dish .ed-main { flex: 1; min-width: 0; }
.dish .ed-line { align-items: center; gap: 8px; }
.dish .ed-name { font-family: Inter, system-ui, sans-serif; font-size: 16px; font-weight: 700; letter-spacing: -.005em; line-height: 1.3; }
.dish .ed-code { border-radius: 8px; }
.dish-badge { flex: none; font-size: 10.5px; font-weight: 700; border-radius: 999px; padding: 2px 8px; text-transform: uppercase; letter-spacing: .03em; }
.dish-badge.new { background: #e3f4ea; color: #1f7a45; }
.dish-badge.mod { background: #fff1cf; color: #7a5600; }
.dish-price { display: flex; align-items: baseline; gap: 3px; margin-top: 3px; font-family: Inter, system-ui, sans-serif; font-size: 14.5px; font-weight: 600; color: var(--ink); }
.dish-price .ed-eur { font-family: inherit; color: var(--ink); }
.dish-price .ed-price { width: 80px; text-align: left; font-family: inherit; font-size: inherit; font-weight: inherit; }
.dish .ed-desc { font-family: Inter, system-ui, sans-serif; font-style: normal; font-size: 13.5px; line-height: 1.45; color: var(--text-2); margin-top: 4px; }
.dish .ed-vars { margin-top: 6px; border-left: 0; padding-left: 0; }
.dish .ed-var { font-family: Inter, sans-serif; font-size: 13.5px; }
.dish .ed-var .ed-price { width: 54px; font-family: Inter, sans-serif; font-size: 14px; font-weight: 600; }
.dish .ed-vlabel { font-family: Inter, sans-serif; }

/* lato destro: foto + disponibile */
.dish-side { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.dish-photo { width: 78px; height: 78px; border-radius: 12px; border: 1.5px dashed rgba(107, 58, 36, .25); background: var(--soft); color: #a3948a; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: 11px; font-weight: 600; overflow: hidden; padding: 0; }
.dish-photo:hover:not(:disabled) { border-color: var(--accent); color: var(--accent); }
.dish-photo.has { border: 0; }
.dish-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dish-photo.pending { background: #fff6dc; border-color: #e6cf8f; color: #8a6500; }
.dish-photo:disabled { cursor: default; }
.switch { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; font-size: 11.5px; font-weight: 600; color: var(--text-2); }
.switch i { position: relative; width: 34px; height: 20px; border-radius: 999px; background: #cfc6bd; transition: background .15s; flex: none; }
.switch i::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.switch.on i { background: var(--ok); }
.switch.on i::after { transform: translateX(14px); }
.switch.on { color: #1f7a45; }

/* etichette in fondo alla scheda */
.dish .ed-meta { margin-top: 10px; padding-top: 9px; border-top: 1px solid #f1ece6; gap: 6px; }
.dish .chip { font-size: 12px; font-weight: 500; border: 1px solid transparent; background: var(--soft); padding: 3px 10px; }
.dish .chip-empty { background: transparent; border: 1px dashed rgba(107, 58, 36, .25); color: var(--text-2); }
.dish .chip-on { background: #e8f1fb; color: #1d4f8a; }
.dish input.chip.ed-note { width: 140px; }
.dish-del { margin-left: auto; width: 30px; height: 30px; border-radius: 50%; border: 0; background: none; color: #a89a8f; display: grid; place-items: center; }
.dish-del:hover { background: #fde9e7; color: var(--bad); }

/* aggiungi piatto: scheda tratteggiata */
.ed-add-item { border-radius: 16px; background: rgba(255,255,255,.6); }
.ed-add-section { border-radius: 16px; }
.dish .ed-name { display: block; resize: none; overflow: hidden; border: 0; background: none; outline: none; padding: 0; width: 100%; min-width: 0; }

/* ===== Admin in stile app di consegna ===== */
.admin-wrap .card { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; box-shadow: 0 1px 2px rgba(31,27,23,.04); -webkit-backdrop-filter: none; backdrop-filter: none; }
.admin-wrap h1 { font-size: 26px; font-weight: 800; letter-spacing: -.015em; }
.admin-wrap h3 { font-size: 16px; font-weight: 800; letter-spacing: -.005em; margin-bottom: 8px; }
.adm-list-head { display: flex; align-items: baseline; gap: 10px; margin: 8px 0 14px; }
/* schede locale */
.admin-grid { grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.adm-client { background: var(--card); border: 1px solid var(--card-line); border-radius: 18px; overflow: hidden; box-shadow: 0 1px 2px rgba(31,27,23,.04); transition: transform .15s, box-shadow .15s; }
.adm-client:hover { transform: translateY(-2px); box-shadow: 0 12px 28px rgba(31,27,23,.12); }
.adm-cover { position: relative; display: block; height: 140px; background: linear-gradient(135deg, #e9d7c6, #c99a7a) center / cover no-repeat; background-size: cover; background-position: center 30%; }
.adm-logo { position: absolute; left: 14px; bottom: -22px; width: 48px; height: 48px; border-radius: 14px; background: #fff; display: grid; place-items: center; font-weight: 800; font-size: 20px; color: var(--accent); box-shadow: 0 4px 12px rgba(31,27,23,.18); border: 2px solid #fff; }
.adm-body { padding: 30px 16px 16px; }
.adm-name { display: block; font-size: 17px; font-weight: 800; color: var(--ink); text-decoration: none; letter-spacing: -.01em; }
.adm-sub { margin: 2px 0 0; color: var(--text-2); font-size: 13px; }
.adm-req { margin: 10px 0 12px; font-size: 12.5px; }
.badge-ok { background: #e8f5ed; color: #1f7a45; border-radius: 999px; padding: 3px 10px; font-weight: 600; }
.badge-warn { padding: 3px 10px; font-weight: 600; }
/* pagina del cliente */
.adm-hero { height: 150px; border-radius: 20px; margin-top: 10px; background: linear-gradient(135deg, #e9d7c6, #c99a7a); background-size: cover; background-position: center 30%; }
.adm-title { align-items: flex-end; gap: 14px; margin: -30px 0 18px; padding: 0 18px; }
.adm-title h1 { margin: 0; }
.adm-title .adm-logo { position: static; flex: none; }
.adm-logo.big { width: 72px; height: 72px; border-radius: 20px; font-size: 30px; }
.adm-title .adm-sub { margin-bottom: 4px; }
.adm-title .v-actions { margin-bottom: 6px; }
#adm-saved { color: #1f7a45; font-weight: 600; margin-left: 6px; }
/* permessi a interruttori */
.adm-perms { gap: 0; margin-top: 4px; }
.perm-row { position: relative; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 2px; border-bottom: 1px solid #f1ece6; font-size: 14px; cursor: pointer; }
.perm-row:last-child { border-bottom: 0; }
.sw-input { position: absolute; opacity: 0; pointer-events: none; }
.sw { position: relative; flex: none; width: 38px; height: 22px; border-radius: 999px; background: #cfc6bd; transition: background .15s; }
.sw::after { content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: transform .15s; }
.sw-input:checked + .sw { background: var(--ok); }
.sw-input:checked + .sw::after { transform: translateX(16px); }
.sw-input:focus-visible + .sw { outline: 2px solid var(--accent); outline-offset: 2px; }
.adm-table select, .dic-pick select, .field select { border-radius: 999px; padding-left: 12px; }
.adm-table td { padding: 7px 4px; border-bottom-color: #f1ece6; }
.adm-dic .dic-ex { border-radius: 14px; }
@media (max-width: 720px) { .adm-title { flex-wrap: wrap; } }
.adm-body .v-actions, .adm-title .v-actions { flex-wrap: wrap; }
.adm-title { margin: 12px 0 18px; align-items: center; }
.adm-title .adm-logo.big { margin-top: -52px; align-self: flex-start; }

/* i telefoni ingrandiscono da soli i testi che credono piccoli: sulle pagine del menù sfaserebbe le righe */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

/* "Annulla" ben visibile (riunione 11/11): scuro quando c'è qualcosa da annullare */
#btn-undo { background: var(--ink); color: #fff; border-color: var(--ink); }
#btn-undo:hover:not(:disabled) { background: #000; }
#btn-undo:disabled { background: transparent; color: var(--muted); border-color: var(--line); opacity: .7; cursor: default; }
.dish-restore { flex: none; border: 1px solid #e8d49a; background: #fffaf0; color: #7a5600; font: 600 11.5px Inter, system-ui, sans-serif; border-radius: 999px; padding: 2px 9px; cursor: pointer; white-space: nowrap; }
.dish-restore:hover { background: #fff1cf; }
.dish-restore[hidden] { display: none; }

/* ── Pagina iniziale del ristoratore (riunione 11/11: funzioni meno frequenti fuori dall'editor) ── */
#screen-home { height: 100vh; height: 100dvh; overflow-y: auto; }
.home-wrap { max-width: 640px; margin: 0 auto; padding: 14px 16px 50px; }
.home-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.home-top .brand { display: flex; align-items: center; gap: 8px; font-weight: 800; }
.home-hero { height: 130px; border-radius: 20px; background: linear-gradient(135deg, #e9d7c6, #c99a7a) center 30% / cover no-repeat; }
.home-wrap h1 { margin: 14px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -.015em; }
.home-sub { margin: 2px 0 12px; color: var(--muted); }
.home-state { border-radius: 12px; padding: 10px 14px; font-size: 13.5px; margin-bottom: 14px; }
.home-state.ok { background: #e3f4ea; color: #1f5f3a; }
.home-state.warn { background: #fff1cf; color: #6b4b00; }
.home-card { display: flex; align-items: center; gap: 14px; background: var(--card, #fff); border: 1px solid var(--card-line, var(--line)); border-radius: 16px; padding: 16px; color: var(--ink); text-decoration: none; box-shadow: 0 1px 2px rgba(31,27,23,.04); }
.home-card:hover { box-shadow: 0 8px 22px rgba(31,27,23,.1); }
.home-card b { display: block; font-size: 15.5px; }
.home-card small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.home-card > span:nth-child(2) { flex: 1; min-width: 0; }
.home-ico { flex: none; width: 42px; height: 42px; border-radius: 12px; background: var(--soft, #f3ede6); display: grid; place-items: center; font-weight: 800; font-size: 18px; }
.home-go { color: var(--muted); font-size: 22px; }
.home-card.primary { background: var(--ink); color: #fff; border-color: var(--ink); padding: 20px 16px; margin-bottom: 12px; }
.home-card.primary small, .home-card.primary .home-go { color: rgba(255,255,255,.75); }
.home-card.primary .home-ico { background: rgba(255,255,255,.14); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .home-grid { grid-template-columns: 1fr; } }
.home-help { color: var(--muted); font-size: 12.5px; margin-top: 18px; }

/* ── Editor web: più spazio ai piatti (12/11) ── */
.panel-head { padding: 14px 22px 10px; }
.panel-head h2 { margin: 0; }
.cat-row { display: flex; align-items: center; gap: 8px; margin: 10px -22px 0; padding: 0 22px; }
.cat-row .cat-tabs { flex: 1; min-width: 0; margin: 0; padding: 0 0 2px; }
.search-dot { flex: none; width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--card-line, var(--line)); background: #fff; color: var(--ink); display: grid; place-items: center; cursor: pointer; padding: 0; }
.search-dot:hover { background: #f4efe9; }
.cat-row .ed-search { display: none; flex: 1; min-width: 0; margin: 0; }
.cat-row.searching .ed-search { display: block; }
.cat-row.searching .cat-tabs { display: none; }
.cat-row.searching .search-dot { background: var(--ink); color: #fff; border-color: var(--ink); }
.ed-section-head .sec-add { width: auto; height: auto; flex: none; border: 0; background: var(--ink); color: #fff; font: 700 12.5px Inter, system-ui, sans-serif; border-radius: 999px; padding: 6px 12px; cursor: pointer; white-space: nowrap; }
.ed-section-head .sec-add:hover { background: #000; }
.ed-section-head .sec-add.is-fixed { background: transparent; color: var(--muted); border: 1px dashed var(--line); }
.changes-bar[hidden] { display: none; }
.status-chip .link { margin-left: 4px; }

/* Telefono: accesso, admin e pagina iniziale scorrono dentro la loro schermata; la pagina intera non si sposta mai */
@media (max-width: 900px) {
  html:has(body[data-screen]:not([data-screen="editor"])), body[data-screen]:not([data-screen="editor"]) { overflow: clip; }
}

/* Foto della grafica come livelli sopra lo sfondo (sotto i testi) */
.sl-photo { position: absolute; display: block; pointer-events: none; max-width: none; }

/* Admin: foto del menù */
.adm-foto { margin-top: 14px; }
.adm-foto p { color: var(--text-2, #6b625a); font-size: 13px; }
.foto-page { margin: 14px 0 8px; font-size: 13px; color: var(--muted); font-weight: 700; }
.foto-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.foto-item { display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--card-line, var(--line)); border-radius: 12px; padding: 8px; background: #fff; }
.foto-item.is-dish { border-color: #d85a30; box-shadow: 0 0 0 2px rgba(216,90,48,.15); }
.foto-th { height: 96px; display: grid; place-items: center; background: repeating-conic-gradient(#f3eee8 0 25%, #fff 0 50%) 0 0 / 14px 14px; border-radius: 8px; overflow: hidden; }
.foto-th img { max-width: 100%; max-height: 96px; object-fit: contain; }
.foto-item select { width: 100%; font-size: 12px; border: 1px solid var(--line); border-radius: 8px; padding: 5px 6px; background: #fff; }
.foto-prop { color: #b0532e; font-size: 11px; font-weight: 600; }

/* iPhone (anche come app sulla schermata Home): niente sotto ora/batteria né sotto la barretta in basso */
body[data-screen] { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); box-sizing: border-box; }
#screen-login, #screen-admin, #screen-home { height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
#screen-editor:not([hidden]) { height: calc(100dvh - env(safe-area-inset-top) - env(safe-area-inset-bottom)); }
