/* Registro Elettronico Web — stesso tema di OfficeWorkSpace Web */
:root {
  --bg: #faf9f5;
  --surface: #ffffff;
  --sidebar: #f3f1ea;
  --hover: #eae7dd;
  --active: #e3dfd2;
  --border: #e5e2d8;
  --border-strong: #d4d0c3;
  --text: #1f1e1b;
  --muted: #6c6a62;
  --faint: #9a978d;
  --accent: #c96442;
  --accent-hover: #b4583a;
  --accent-soft: #f6e6de;
  --accent-text: #ffffff;
  --row-ok: #e8f2e3;
  --row-ok-hover: #dcebd5;
  --row-danger: #fbe4e0;
  --row-danger-hover: #f6d6d0;
  --danger: #b42318;
  --success: #2f7d4a;
  --shadow: 0 1px 2px rgba(31, 30, 27, .06), 0 4px 16px rgba(31, 30, 27, .06);
  --shadow-lg: 0 8px 40px rgba(31, 30, 27, .18);
  --radius: 10px;
  --radius-sm: 7px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --serif: ui-serif, "Iowan Old Style", Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #262624; --surface: #2d2d2a; --sidebar: #1f1e1c; --hover: #34332f; --active: #3d3c37;
    --border: #3a3935; --border-strong: #4a4943; --text: #ece9e1; --muted: #a7a399; --faint: #7e7b72;
    --accent: #d97757; --accent-hover: #e48a6c; --accent-soft: #46302a; --accent-text: #1f1e1c;
    --row-ok: #26332a; --row-ok-hover: #2d3c31; --row-danger: #3e2724; --row-danger-hover: #482d29;
    --danger: #f0776a; --success: #6fbf86;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-lg: 0 8px 40px rgba(0, 0, 0, .5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #262624; --surface: #2d2d2a; --sidebar: #1f1e1c; --hover: #34332f; --active: #3d3c37;
  --border: #3a3935; --border-strong: #4a4943; --text: #ece9e1; --muted: #a7a399; --faint: #7e7b72;
  --accent: #d97757; --accent-hover: #e48a6c; --accent-soft: #46302a; --accent-text: #1f1e1c;
  --row-ok: #26332a; --row-ok-hover: #2d3c31; --row-danger: #3e2724; --row-danger-hover: #482d29;
  --danger: #f0776a; --success: #6fbf86;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
  --shadow-lg: 0 8px 40px rgba(0, 0, 0, .5);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: 14px/1.45 var(--font); -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.serif { font-family: var(--serif); }

/* ---------- controlli ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; white-space: nowrap; font-size: 13px;
  transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--hover); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: default; transform: none; background: var(--surface); }
.btn .icon { width: 16px; height: 16px; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--hover); }
.btn.danger { color: var(--danger); }
.btn.icon-only { width: 32px; padding: 0; justify-content: center; }
.btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
kbd { font: 11px var(--mono); color: var(--faint); }

.input, select.input, textarea.input {
  height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--surface); outline: none; width: 100%; min-width: 0; transition: border-color .12s, box-shadow .12s;
}
textarea.input { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.45; }
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[readonly] { background: var(--bg); color: var(--muted); }
.ct-form.ro .input[readonly] { color: var(--text); }
.ct-form.ro input[type=checkbox]:disabled { opacity: 1; }
.input.changed { border-color: color-mix(in srgb, var(--accent) 65%, var(--border-strong)); background: color-mix(in srgb, var(--accent-soft) 45%, var(--surface)); }
.check { display: inline-flex; align-items: center; gap: 7px; cursor: pointer; user-select: none; font-size: 13px; white-space: nowrap; }
.check input { width: 16px; height: 16px; accent-color: var(--accent); margin: 0; }
.field { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.field > label { font-size: 11.5px; color: var(--muted); letter-spacing: .01em; }
.search { position: relative; }
.search .icon { position: absolute; left: 9px; top: 8px; width: 16px; height: 16px; color: var(--faint); }
.search .input { padding-left: 32px; }
.sep { width: 1px; align-self: stretch; background: var(--border); margin: 4px 4px; }
.spacer { flex: 1; }
.muted { color: var(--muted); }
.badge { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: 99px; background: var(--hover); color: var(--muted); font-size: 11px; }

/* ---------- login ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; }
.login-card { width: min(400px, 100%); }
.login-brand { text-align: center; margin-bottom: 26px; }
.logo { width: 46px; height: 46px; border-radius: 13px; background: var(--accent); color: var(--accent-text); display: inline-grid; place-items: center; font: 600 17px var(--serif); letter-spacing: .02em; box-shadow: var(--shadow); }
.login-brand h1 { font: 400 30px/1.15 var(--serif); margin: 16px 0 4px; letter-spacing: -.01em; }
.login-brand p { margin: 0; color: var(--muted); }
.login-form { background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 22px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.login-form .btn.primary { height: 38px; justify-content: center; font-size: 14px; }
.login-error { color: var(--danger); font-size: 13px; min-height: 18px; margin: -4px 0 -6px; }
.login-foot { margin-top: 18px; text-align: center; color: var(--faint); font-size: 12px; display: grid; gap: 6px; }
.login-foot button { background: none; border: 0; color: var(--muted); cursor: pointer; text-decoration: underline; text-underline-offset: 3px; font-size: 12px; }

/* ---------- dialog / toast ---------- */
dialog.dlg { border: 1px solid var(--border); border-radius: 16px; padding: 0; background: var(--surface); color: var(--text); box-shadow: var(--shadow-lg); width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 40px); }
dialog.dlg.wide { width: min(760px, calc(100vw - 32px)); }
dialog.dlg[open] { display: flex; flex-direction: column; }
dialog.dlg .dlg-body { overflow-y: auto; min-height: 0; flex: 1; }
dialog.dlg::backdrop { background: rgba(20, 20, 18, .35); backdrop-filter: blur(1.5px); }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 6px; }
.dlg-head h3 { font: 400 21px var(--serif); margin: 0; }
.dlg-head .btn { margin-left: auto; }
.dlg-body { padding: 10px 18px 6px; display: grid; gap: 12px; }
.dlg-body .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.dlg-foot { display: flex; align-items: center; gap: 8px; padding: 14px 18px 16px; }
.dlg-msg { margin: 0; color: var(--muted); }
.toasts { position: fixed; right: 16px; bottom: 16px; display: grid; gap: 8px; z-index: 1000; }
.toast { background: var(--text); color: var(--bg); padding: 9px 14px; border-radius: 10px; font-size: 13px; box-shadow: var(--shadow-lg); max-width: 380px; animation: toast-in .16s ease-out; }
.toast.err { background: var(--danger); color: #fff; }
@keyframes toast-in { from { transform: translateY(8px); opacity: 0; } }

/* ---------- shell ---------- */
body { overscroll-behavior-y: none; }
.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); height: 100%; height: 100dvh; }
.sidebar { background: var(--sidebar); border-right: 1px solid var(--border); display: flex; flex-direction: column; min-width: 0; overflow: hidden; padding-top: env(safe-area-inset-top); }
.sb-head { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; }
.sb-head .logo { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; box-shadow: none; flex: none; }
.sb-title-wrap { display: grid; min-width: 0; }
.sb-title { font: 500 17px var(--serif); white-space: nowrap; }
.sb-sub { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-nav { flex: 1; overflow-y: auto; padding: 6px 8px; }
.sb-section { font-size: 11.5px; color: var(--faint); padding: 14px 10px 6px; letter-spacing: .02em; }
.sb-item {
  display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 7px 10px; border: 0; border-radius: 8px;
  background: transparent; cursor: pointer; text-align: left; color: var(--text); font-size: 13.5px; line-height: 1.3;
}
.sb-item:hover { background: var(--hover); }
.sb-item.active { background: var(--active); font-weight: 500; }
.sb-item .icon { color: var(--muted); }
.sb-item.active .icon { color: var(--accent); }
.sb-label { flex: 1; min-width: 0; overflow-wrap: anywhere; } /* i titoli lunghi delle sezioni vanno a capo */
.sb-item > span:first-child { flex: none; display: flex; }
.sb-count { font-size: 11.5px; color: var(--faint); min-width: 18px; text-align: right; }
.sb-count.todo { color: var(--accent); font-weight: 600; }
.sb-foot { position: relative; padding: 8px; border-top: 1px solid var(--border); padding-bottom: calc(8px + env(safe-area-inset-bottom)); }
.user-btn { display: flex; align-items: center; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 9px; background: transparent; cursor: pointer; text-align: left; }
.user-btn:hover { background: var(--hover); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--text); color: var(--bg); display: grid; place-items: center; font-size: 12.5px; font-weight: 600; flex: none; }
.user-meta { display: grid; min-width: 0; font-size: 13px; }
.user-meta b { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta span { color: var(--muted); font-size: 11.5px; }
.menu { position: absolute; bottom: calc(100% - 4px); left: 8px; right: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 50; }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; height: 36px; padding: 0 10px; border: 0; border-radius: 7px; background: none; cursor: pointer; text-align: left; font-size: 13px; }
.menu button:hover { background: var(--hover); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 5px 4px; }
.scrim { display: none; }
.main { min-width: 0; height: 100%; overflow-y: auto; overscroll-behavior: contain; }

/* ---------- pagina ---------- */
.page { max-width: 920px; margin: 0 auto; padding: 0 20px 96px; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 6px; padding: 10px 20px; padding-top: calc(10px + env(safe-area-inset-top)); background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); }
.topbar .menu-btn { display: none; }
.topbar h2 { font: 400 19px var(--serif); margin: 0; }
.datebtn { position: relative; display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; cursor: pointer; }
.datebtn:hover, .datebtn[aria-expanded="true"] { background: var(--hover); }

/* calendario a comparsa */
.cal-pop { position: fixed; z-index: 70; width: 296px; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow-lg); padding: 10px; display: grid; gap: 6px; animation: cal-in .12s ease-out; }
@keyframes cal-in { from { opacity: 0; transform: translateY(-4px); } }
.cal-head { display: flex; align-items: center; gap: 4px; }
.cal-titolo { flex: 1; display: flex; justify-content: center; gap: 4px; }
.cal-sel { height: 30px; border: 1px solid transparent; border-radius: var(--radius-sm); background: transparent; color: var(--text); font-size: 14px; font-weight: 500; padding: 0 4px; cursor: pointer; }
.cal-sel:hover, .cal-sel:focus-visible { border-color: var(--border-strong); background: var(--surface); }
.cal-sett, .cal-riga { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal-sett span { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; text-transform: capitalize; }
.cal-griglia { display: grid; gap: 2px; }
.cal-g { position: relative; height: 36px; border: 0; border-radius: 9px; background: transparent; color: var(--text); font-size: 13px; cursor: pointer; font-variant-numeric: tabular-nums; }
.cal-g:hover { background: var(--hover); }
.cal-g:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.cal-g.festivo { color: var(--muted); }
.cal-g.fuori { color: var(--faint); }
.cal-g.oggi { box-shadow: inset 0 0 0 1px var(--accent); font-weight: 600; }
.cal-g.scelto { background: var(--accent); color: var(--accent-text); font-weight: 600; }
.cal-dot { position: absolute; left: 50%; bottom: 4px; width: 5px; height: 5px; margin-left: -2.5px; border-radius: 50%; background: var(--accent); }
.cal-dot.vuoto { background: transparent; box-shadow: inset 0 0 0 1.3px var(--accent); }
.cal-g.scelto .cal-dot { background: var(--accent-text); }
.cal-g.scelto .cal-dot.vuoto { background: transparent; box-shadow: inset 0 0 0 1.3px var(--accent-text); }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 6px; border-top: 1px solid var(--border); }
.cal-legenda { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); }
.cal-legenda .cal-dot { position: static; margin: 0 0 0 4px; display: inline-block; }
.cal-legenda .cal-dot:first-child { margin-left: 0; }
@media print { .cal-pop { display: none; } }
.day-head { padding: 18px 0 6px; display: grid; gap: 8px; }
.day-head h1 { font: 400 30px/1.15 var(--serif); margin: 0; letter-spacing: -.01em; }
.day-head h1::first-letter { text-transform: uppercase; }
.pills { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: 99px; font-size: 12px; background: var(--hover); color: var(--muted); white-space: nowrap; }
.pill .icon { width: 13px; height: 13px; }
.pill.ok { background: var(--row-ok); color: var(--success); }
.pill.warn { background: var(--row-danger); color: var(--danger); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }
.banner { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-soft); font-size: 13px; margin: 10px 0 0; }
.banner .icon { color: var(--accent); }
.banner span { flex: 1; min-width: 200px; }
.chips { display: none; }
.sec-head { display: flex; align-items: center; gap: 10px; margin: 22px 0 12px; }
.sec-head h2 { font: 400 22px var(--serif); margin: 0; }
.sec-head .count { color: var(--faint); font-size: 13px; }

/* ---------- schede ---------- */
.cards { display: grid; gap: 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; box-shadow: 0 1px 2px rgba(31, 30, 27, .04); }
.card.click { cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.card.click:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.card-top { display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-weight: 600; font-size: 14.5px; }
.card-title.placeholder { color: var(--faint); font-weight: 500; font-style: italic; }
.card-sub { color: var(--muted); font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.card-sub .icon { width: 13px; height: 13px; vertical-align: -2px; margin-right: 3px; }
.card-text { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13.5px; }
.card-text b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 500; margin-bottom: 1px; }
.card-meta { color: var(--faint); font-size: 11.5px; }
.firme { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 8px; }
.firma { border: 1px dashed var(--border-strong); border-radius: 10px; min-height: 76px; padding: 8px 10px; display: grid; gap: 4px; align-content: start; }
.firma.done { border-style: solid; border-color: var(--border); background: var(--bg); }
.firma-label { font-size: 11.5px; color: var(--muted); display: flex; justify-content: space-between; gap: 6px; }
.firma img { height: 46px; max-width: 100%; object-fit: contain; object-position: left; }
:root[data-theme="dark"] .firma img { filter: invert(1); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .firma img { filter: invert(1); } }
.firma .btn { justify-self: start; }
.empty-card { border: 1px dashed var(--border-strong); border-radius: 14px; padding: 26px 16px; text-align: center; color: var(--faint); display: grid; gap: 10px; justify-items: center; }
.empty { display: grid; place-items: center; min-height: 50vh; color: var(--faint); padding: 20px; text-align: center; }
.fab { display: none; }

/* ---------- mensa ---------- */
.mensa { display: grid; gap: 16px; }
.mensa-grid { display: grid; grid-template-columns: minmax(110px, 1.2fr) repeat(3, minmax(0, 1fr)); gap: 8px 10px; align-items: center; }
.mensa-grid .hd { font-size: 11.5px; color: var(--muted); }
.mensa-grid .tot { font-weight: 600; padding-left: 10px; }
.mensa .row3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.mensa .row2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- dialoghi e firma ---------- */
.form { display: grid; gap: 12px; }
.log { font: 11.5px/1.5 var(--mono); color: var(--muted); white-space: pre-wrap; max-height: 160px; overflow: auto; background: var(--bg); border-radius: 8px; padding: 8px 10px; margin: 6px 0 0; }
details summary { cursor: pointer; font-size: 12px; color: var(--muted); }

/* modifiche contemporanee: avviso in cima al modulo e campi cambiati da entrambi */
.avviso-conflitto { border: 1px solid var(--danger); border-left-width: 4px; border-radius: 8px; padding: 8px 10px; font-size: 13px; line-height: 1.45; color: var(--text); background: color-mix(in srgb, var(--danger) 8%, transparent); }
.avviso-conflitto[hidden] { display: none; }
.field.conflitto > .input, .input.conflitto { border-color: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.nota-conflitto { font-size: 12px; color: var(--danger); white-space: pre-wrap; overflow-wrap: anywhere; }
.pad-wrap { display: grid; gap: 6px; }
.pad { width: 100%; height: 240px; border: 1px solid var(--border-strong); border-radius: 12px; background: #fff; touch-action: none; cursor: crosshair; display: block; }
.pad-hint { font-size: 12px; color: var(--faint); text-align: center; }
.permesso { white-space: pre-wrap; font-size: 13.5px; }
.settings-form { display: grid; gap: 12px; }
.settings-form .row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.note-box { font-size: 12.5px; color: var(--muted); white-space: pre-line; }
.logo-anteprima { min-height: 64px; display: flex; align-items: center; padding: 10px; border: 1px dashed var(--border-strong); border-radius: 10px; background: #fff; }
.logo-anteprima img { max-height: 80px; max-width: 100%; object-fit: contain; }

/* ---------- smartphone ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%); transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .shell.drawer .sidebar { transform: none; }
  .shell.drawer .scrim { display: block; position: fixed; inset: 0; background: rgba(20, 20, 18, .35); z-index: 55; }
  .topbar { padding-left: 12px; padding-right: 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .topbar .hide-sm { display: none; }
  .page { padding: 0 14px 110px; }
  .day-head h1 { font-size: 25px; }
  .chips { display: flex; gap: 6px; overflow-x: auto; margin: 12px -14px 0; padding: 2px 14px 4px; scrollbar-width: none; }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: none; display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--border-strong); background: var(--surface); font-size: 13px; cursor: pointer; white-space: nowrap; }
  .chip.active { background: var(--text); color: var(--bg); border-color: var(--text); }
  .chip .n { font-size: 11px; opacity: .7; }
  .sec-head .add-btn { display: none; }
  .fab { display: inline-flex; position: fixed; right: 18px; bottom: calc(18px + env(safe-area-inset-bottom)); width: 56px; height: 56px; border-radius: 18px; border: 0; background: var(--accent); color: var(--accent-text); box-shadow: var(--shadow-lg); align-items: center; justify-content: center; z-index: 30; cursor: pointer; }
  .fab .icon { width: 24px; height: 24px; }
  .toasts { left: 16px; right: 16px; bottom: calc(86px + env(safe-area-inset-bottom)); }
  .toast { max-width: none; }
  dialog.dlg, dialog.dlg.wide { width: 100vw; max-width: 100vw; max-height: 100dvh; height: 100dvh; margin: 0; border-radius: 0; border: 0; }
  .dlg-head { padding-top: calc(14px + env(safe-area-inset-top)); }
  .dlg-foot { padding-bottom: calc(16px + env(safe-area-inset-bottom)); }
  .dlg-body .row, .settings-form .row, .mensa .row2 { grid-template-columns: 1fr; }
  .input, select.input { height: 40px; font-size: 16px; } /* 16px: iOS non ingrandisce la pagina sui campi */
  textarea.input { font-size: 16px; }
  .btn { height: 36px; }
  .btn.icon-only { width: 36px; }
  .pad { height: 46vh; }
}

/* ---------- stampa ---------- */
.print-area { display: none; }
@media print {
  html, body { background: #fff !important; }
  body > *:not(.print-area) { display: none !important; }
  .print-area { display: block; color: #000; font: 11pt/1.35 var(--font); }
  .print-area h1 { font: 400 18pt var(--serif); margin: 0 0 4pt; }
  .print-area h2 { font: 600 12pt var(--font); margin: 14pt 0 4pt; border-bottom: 1px solid #999; padding-bottom: 2pt; }
  .print-area table { width: 100%; border-collapse: collapse; }
  .print-area th, .print-area td { border: 1px solid #bbb; padding: 3pt 5pt; text-align: left; vertical-align: top; font-size: 9.5pt; }
  .print-area th { background: #eee; }
  .print-area img { height: 32pt; max-width: 120pt; object-fit: contain; }
  .print-area .pre { white-space: pre-wrap; }
  /* tabella esterna: il tfoot si ripete su ogni pagina e tiene libero lo spazio del logo */
  .print-area table.print-page, .print-area .print-page > tbody > tr > td, .print-area .print-page > tfoot > tr > td { border: 0; padding: 0; }
  .print-area .print-spacer { height: 10mm; }
  .print-area .print-spacer.con-logo { height: 24mm; }
  .print-area .print-foot { position: fixed; left: 0; right: 0; bottom: 0; min-height: 8mm; display: flex; align-items: center; justify-content: center; }
  .print-area .print-foot img { max-height: 18mm; max-width: 70mm; height: auto; object-fit: contain; }
  .print-area .print-by { position: absolute; right: 0; bottom: 0; font-size: 8pt; color: #777; }
  .print-area .print-head { border-bottom: 1px solid #999; padding-bottom: 6pt; margin-bottom: 10pt; font-size: 9.5pt; color: #333; line-height: 1.4; }
  .print-area .print-ist { font: 600 13pt var(--serif); color: #000; }
  .print-area .permesso-stampa { white-space: pre-wrap; font-size: 11pt; margin-bottom: 10pt; }
}

