/* Libro prenotazioni: bianco, nero e grigi. Il colore compare solo per la capienza e per chi ha inserito. */
@font-face { font-family: "Instrument Sans"; font-weight: 400; font-display: swap; src: url(fonts/instrument-sans-latin-400-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 500; font-display: swap; src: url(fonts/instrument-sans-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 600; font-display: swap; src: url(fonts/instrument-sans-latin-600-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Sans"; font-weight: 700; font-display: swap; src: url(fonts/instrument-sans-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Instrument Serif"; font-weight: 400; font-display: swap; src: url(fonts/instrument-serif-latin-400-normal.woff2) format("woff2"); }

:root {
  color-scheme: light;
  --ground: #F1F1F0;
  --surface: #FFFFFF;
  --ink: #161616;
  --ink-2: #3A3A3A;
  --mute: #5E5E5E;
  --line: #DADAD8;
  --line-strong: #BDBDBB;
  --track: #E1E1DF;
  --warn-bg: #FFF3E2; --warn-bd: #E0A85C; --warn-ink: #8A3F00; --warn-bar: #D97A06; --warn-pill: #FFE7C4;
  --full-bg: #FDECEA; --full-bd: #DD9E97; --full-ink: #A8281E; --full-bar: #C8372C; --full-pill: #F9D5D1;
  --sans: "Instrument Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --gutter: 16px;
  --r: 10px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 400 15px/1.35 var(--sans); -webkit-font-smoothing: antialiased;
  overscroll-behavior-y: contain;
}
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
button:active:not(:disabled), a.btn:active { opacity: .72; }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }
a { color: var(--ink); }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }

.app { max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.screen { flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; padding-top: env(safe-area-inset-top, 0px); }
.body { flex: 1; padding: 0 var(--gutter) 12px; display: flex; flex-direction: column; gap: 10px; }
.loading { padding: 40px var(--gutter); color: var(--mute); }

/* ---------- testata ---------- */
.top { padding: 18px var(--gutter) 10px; display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.brand { font: 400 32px/1 var(--serif); margin: 0; }
.eyebrow { font-size: 12px; letter-spacing: .09em; text-transform: uppercase; color: var(--mute); margin: 6px 0 0; }
.userchip { display: flex; align-items: center; gap: 8px; border: 0; background: none; padding: 4px 0 4px 8px; min-height: 44px; text-align: right; }
.userchip small { display: block; color: var(--mute); font-size: 12px; line-height: 1.2; }
.userchip b { display: block; font-size: 13px; font-weight: 600; line-height: 1.2; }
.avatar { width: 34px; height: 34px; flex: none; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.avatar.sm { width: 22px; height: 22px; font-size: 9px; }

.nav { padding: 0 var(--gutter); display: flex; align-items: center; justify-content: space-between; min-height: 44px; }
.nav-title { font-size: 16px; font-weight: 600; text-align: center; }
.iconbtn { width: 44px; height: 44px; flex: none; border: 0; background: none; display: flex; align-items: center; justify-content: center; border-radius: var(--r); }
.nav .iconbtn:first-child { margin-left: -12px; } .nav .iconbtn:last-child { margin-right: -12px; }
.linkbtn { border: 0; background: none; min-height: 44px; padding: 0 2px; font-size: 14px; font-weight: 600; text-decoration: underline; }
.backbtn { border: 0; background: none; min-height: 44px; display: flex; align-items: center; gap: 2px; padding: 0 8px 0 0; margin-left: -6px; font-weight: 600; }
.subtop { padding: 8px var(--gutter) 0; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.title { font: 400 30px/1.05 var(--serif); margin: 0; padding: 0 var(--gutter) 10px; }
.title.sm { font-size: 26px; padding: 0; }
.icon { width: 22px; height: 22px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon.s { width: 18px; height: 18px; stroke-width: 1.8; } .icon.xs { width: 15px; height: 15px; stroke-width: 1.8; }

/* ---------- settimana ---------- */
.cols { padding: 0 var(--gutter) 4px; display: flex; gap: 6px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--mute); }
.cols span { flex: 1; } .cols span:first-child { flex: none; width: 40px; }
.week { padding: 0 var(--gutter) 10px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.dayrow { display: flex; gap: 6px; align-items: stretch; }
.daylbl { width: 40px; flex: none; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.daylbl .dow { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--mute); }
.daylbl .dn { min-width: 30px; height: 30px; align-self: flex-start; padding: 0 4px; border-radius: 8px; font-size: 18px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.daylbl.today .dn { background: var(--ink); color: #fff; }
.daylbl .dtag { font-size: 12px; font-weight: 600; height: 14px; line-height: 14px; }

.lv-ok { --bg: var(--surface); --bd: var(--line); --num: var(--ink); --st: var(--mute); --bar: var(--ink); --pill: #EDEDEB; }
.lv-warn { --bg: var(--warn-bg); --bd: var(--warn-bd); --num: var(--warn-ink); --st: var(--warn-ink); --bar: var(--warn-bar); --pill: var(--warn-pill); }
.lv-full { --bg: var(--full-bg); --bd: var(--full-bd); --num: var(--full-ink); --st: var(--full-ink); --bar: var(--full-bar); --pill: var(--full-pill); }
.lv-closed { --bg: #E7E7E5; --bd: #D2D2D0; --num: var(--mute); --st: #4A4A4A; --bar: #9A9A98; --pill: #DCDCDA; }

.cell { flex: 1; min-width: 0; min-height: 74px; display: flex; background: var(--bg); border: 1px solid var(--bd); border-radius: var(--r); overflow: hidden; }
.cell-main { flex: 1; min-width: 0; border: 0; background: none; text-align: left; padding: 8px 6px 8px 10px; display: flex; flex-direction: column; justify-content: space-between; gap: 4px; }
.cell-big { display: flex; align-items: baseline; gap: 4px; min-height: 26px; }
.cell-big b { font-size: 26px; font-weight: 700; line-height: 26px; color: var(--num); }
.cell-big b.txt { font-size: 16px; }
.cell-big small { font-size: 12px; color: var(--mute); }
.cell-st { font-size: 12px; font-weight: 600; color: var(--st); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-s { display: block; height: 4px; border-radius: 2px; background: #DCDCDA; }
.bar-s i { display: block; height: 4px; border-radius: 2px; background: var(--bar); }
.cell-add { width: 44px; flex: none; border: 0; border-left: 1px solid var(--bd); background: none; display: flex; align-items: center; justify-content: center; }

/* ---------- barra in basso e pulsanti ---------- */
.bar { position: sticky; bottom: 0; z-index: 5; padding: 10px var(--gutter) calc(14px + env(safe-area-inset-bottom, 0px)); background: var(--ground); border-top: 1px solid var(--line); display: flex; gap: 8px; }
.btn { flex: 1; min-height: 50px; border-radius: var(--r); border: 1px solid var(--ink); background: var(--surface); color: var(--ink); font-size: 16px; font-weight: 600; padding: 0 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-decoration: none; text-align: center; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-lg { min-height: 54px; font-size: 17px; border-radius: 12px; }
.btn-soft { border-color: var(--line-strong); font-size: 14px; min-height: 44px; }
.btn-danger { background: var(--full-ink); border-color: var(--full-ink); color: #fff; }
.btn-danger-o { border-color: var(--full-ink); color: var(--full-ink); }
.row { display: flex; gap: 8px; } .row > .fg { min-width: 0; } .row > .grow15 { flex: 1.5; } .row > .grow14 { flex: 1.4; }

.seg { display: flex; padding: 3px; background: var(--track); border-radius: var(--r); }
.seg button { flex: 1; min-height: 40px; border: 0; border-radius: 8px; background: none; font-weight: 600; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }
.pad { padding: 0 var(--gutter) 10px; }

/* ---------- turno ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sum-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.sum-head .n { font-size: 46px; font-weight: 700; line-height: .95; color: var(--num); }
.sum-head .of { font-size: 14px; color: var(--mute); margin-left: 6px; }
.pill { font-size: 13px; font-weight: 600; padding: 5px 10px; border-radius: 999px; background: var(--pill); color: var(--st); white-space: nowrap; }
.meter { position: relative; height: 8px; border-radius: 4px; background: #E6E6E4; }
.meter i { display: block; height: 8px; border-radius: 4px; background: var(--bar); max-width: 100%; }
.meter u { position: absolute; top: -3px; width: 2px; height: 14px; background: var(--ink); }
.small { font-size: 12px; color: var(--mute); margin: 0; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tag { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; padding: 4px 9px 4px 7px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface); }
.tag.strong { border-color: var(--ink); font-size: 14px; font-weight: 600; padding: 5px 10px 5px 8px; }
.banner { background: #E7E7E5; border: 1px solid #D2D2D0; border-radius: 12px; padding: 14px; font-size: 14px; color: var(--ink-2); }
.banner b { display: block; font-size: 16px; color: var(--ink); margin-bottom: 2px; }
.empty { padding: 20px 4px; font-size: 14px; color: var(--mute); margin: 0; }

.bk { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px; display: flex; gap: 10px; align-items: flex-start; }
.bk-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.bk-name { font-size: 19px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-meta { font-size: 13px; color: var(--mute); }
.bk-flags { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 13px; font-weight: 600; }
.bk-flags span { display: inline-flex; align-items: center; gap: 4px; }
.bk-note { font-size: 13px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bk-pax { flex: none; min-width: 40px; text-align: right; font-size: 30px; font-weight: 700; line-height: 1; }
.dot { width: 30px; height: 30px; flex: none; border-radius: 50%; border: 1.5px solid; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; margin-top: 1px; }
.dot.r0 { background: #fff; border-color: #9A9A98; color: var(--mute); }
.dot.r1 { background: #1A1A1A; border-color: #1A1A1A; color: #fff; }
.dot.r2 { background: #6B6B6B; border-color: #6B6B6B; color: #fff; }
.dot.r3 { background: #C9C9C7; border-color: #C9C9C7; color: var(--ink); }

/* ---------- foglio dal basso ---------- */
.sheet-wrap { position: fixed; inset: 0; z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.backdrop { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: rgba(0, 0, 0, .5); }
.sheet { position: relative; width: 100%; max-width: 560px; max-height: 90vh; max-height: 90dvh; overflow-y: auto; background: var(--surface); border-radius: 18px 18px 0 0; padding: 18px var(--gutter) calc(18px + env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 14px; }
.sh-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.sh-name { font-size: 26px; font-weight: 700; line-height: 1.1; margin: 0; overflow-wrap: anywhere; }
.sh-line { font-size: 14px; color: var(--mute); margin: 4px 0 0; }
.sh-pax { flex: none; text-align: right; } .sh-pax b { display: block; font-size: 44px; line-height: .95; } .sh-pax small { font-size: 12px; color: var(--mute); }
.notebox { background: var(--ground); border-radius: var(--r); padding: 12px; white-space: pre-line; overflow-wrap: anywhere; }
.tel { font-size: 18px; font-weight: 600; user-select: all; -webkit-user-select: all; }
.by { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--mute); }
.confirm { background: var(--full-bg); border: 1px solid var(--full-bd); border-radius: var(--r); padding: 12px; display: flex; flex-direction: column; gap: 10px; }
.confirm p { margin: 0; }
.hist { margin: 0; padding: 0; list-style: none; font-size: 13px; color: var(--mute); display: flex; flex-direction: column; gap: 4px; }
.sh-title { font-size: 19px; font-weight: 700; line-height: 1.2; margin: 0; }
.sh-big { display: flex; align-items: baseline; gap: 8px; } .sh-big b { font-size: 44px; line-height: 1; } .sh-big span { font-size: 14px; color: var(--mute); }
.menu { display: flex; flex-direction: column; gap: 8px; }

/* ---------- modulo ---------- */
.form { flex: 1; padding: 4px var(--gutter) 16px; display: flex; flex-direction: column; gap: 18px; }
.fg { display: flex; flex-direction: column; gap: 8px; }
.lbl { font-size: 13px; font-weight: 600; }
.lbl span, .opt { font-weight: 400; color: var(--mute); }
.field { width: 100%; min-width: 0; max-width: 100%; min-height: 50px; border: 1px solid var(--line-strong); border-radius: var(--r); padding: 0 14px; font-size: 18px; background: var(--surface); }
textarea.field { padding: 12px 14px; font-size: 16px; line-height: 1.4; min-height: 110px; resize: vertical; }
.field.lg { min-height: 56px; font-size: 22px; font-weight: 700; border: 1.5px solid var(--ink); }
.field.bad { border-color: var(--full-ink); }
.err { font-size: 13px; font-weight: 600; color: var(--full-ink); margin: 0; }
.stepper { display: flex; align-items: center; gap: 10px; }
.stepper button { width: 56px; height: 56px; flex: none; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--surface); display: flex; align-items: center; justify-content: center; }
.stepper button.plus { background: var(--ink); color: #fff; }
.stepper input { flex: 1; min-width: 0; height: 56px; text-align: center; border: 1.5px solid var(--ink); border-radius: 12px; background: var(--surface); font-size: 36px; font-weight: 700; padding: 0; }
.chips { display: flex; gap: 6px; }
.chip { flex: 1; min-width: 0; min-height: 44px; border: 1px solid var(--line-strong); border-radius: var(--r); background: var(--surface); font-size: 16px; font-weight: 600; padding: 0 4px; }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip.tall { min-height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.15; }
.chip.tall small { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 400; }
.chip.tall b { font-size: 17px; }
.chip.flag { min-height: 48px; display: flex; align-items: center; gap: 8px; padding: 0 12px; text-align: left; font-size: 15px; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
.grid4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
.daystrip { display: flex; align-items: center; gap: 4px; }
.daystrip .iconbtn { width: 32px; }
.preview { font-size: 13px; font-weight: 600; margin: 0; color: var(--mute); }
.preview.warn { color: var(--warn-ink); } .preview.full { color: var(--full-ink); }
.between { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
.h2 { font: 400 22px/1.15 var(--serif); margin: 14px 0 0; }
.hint { font-size: 13px; color: var(--mute); margin: 0; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch { width: 44px; height: 44px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--line-strong); }
.swatch[aria-pressed="true"] { box-shadow: 0 0 0 3px var(--ink); }
.restgrid { display: grid; grid-template-columns: auto repeat(2, minmax(0, 1fr)); gap: 6px; align-items: center; font-size: 14px; }
.urow { width: 100%; text-align: left; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 12px; display: flex; gap: 10px; align-items: center; }
.urow .grow { flex: 1; min-width: 0; } .urow small { display: block; color: var(--mute); font-size: 13px; }
.urow.off { opacity: .55; }

/* ---------- pagine semplici (accesso, installazione) ---------- */
.auth { max-width: 420px; margin: 0 auto; padding: calc(40px + env(safe-area-inset-top, 0px)) var(--gutter) 40px; display: flex; flex-direction: column; gap: 12px; }
.stack { display: flex; flex-direction: column; gap: 8px; }
.stack .btn { margin-top: 12px; flex: none; }
.alert { margin: 0; padding: 12px; border-radius: var(--r); background: var(--full-bg); border: 1px solid var(--full-bd); color: var(--full-ink); font-weight: 600; }
.note { margin: 0; padding: 12px; border-radius: var(--r); background: #E7E7E5; border: 1px solid #D2D2D0; }

/* ---------- avviso ---------- */
.toast { position: fixed; z-index: 40; left: 50%; transform: translateX(-50%); width: calc(100% - 32px); max-width: 528px; bottom: calc(92px + env(safe-area-inset-bottom, 0px)); background: var(--ink); color: #fff; border-radius: 12px; padding: 12px 14px; font-size: 14px; display: flex; align-items: center; gap: 10px; box-shadow: 0 6px 20px rgba(0, 0, 0, .25); }
.toast span { flex: 1; min-width: 0; }
.toast button { flex: none; min-height: 44px; border: 1px solid #fff; border-radius: 8px; background: none; color: #fff; font-size: 14px; font-weight: 600; padding: 0 12px; }

/* ---------- stampa ---------- */
.sheetpaper { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px; overflow-x: auto; }
.p-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; border-bottom: 2px solid #000; padding-bottom: 6px; }
.p-head h2 { font: 400 26px/1.1 var(--serif); margin: 0; }
.p-tot { font-size: 14px; margin: 8px 0 10px; }
table.p { width: 100%; border-collapse: collapse; font-size: 13px; }
table.p th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; border-bottom: 1px solid #000; padding: 4px 6px 4px 0; }
table.p td { border-bottom: 1px solid #CFCFCF; padding: 6px 6px 6px 0; vertical-align: top; }
table.p td.nm { font-weight: 700; font-size: 15px; } table.p td.px { font-weight: 700; font-size: 17px; text-align: right; padding-right: 12px; }
table.p th.px { text-align: right; padding-right: 12px; }
table.p td.nt { white-space: pre-line; }
.p-shift + .p-shift { margin-top: 22px; }

@media print {
  @page { margin: 12mm; }
  body { background: #fff; font-size: 11pt; }
  .app { max-width: none; border: 0; }
  .screen { min-height: 0; padding: 0; }
  .no-print, .toast, .bar { display: none !important; }
  .body { padding: 0; }
  .sheetpaper { border: 0; padding: 0; border-radius: 0; overflow: visible; }
  table.p tr { break-inside: avoid; }
}

@media (prefers-reduced-motion: no-preference) {
  button, .btn { transition: opacity .15s ease; }
}
@media (min-width: 600px) {
  .app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

input[type="date"].field { font-size: 16px; padding: 0 10px; -webkit-appearance: none; appearance: none; }
@media (max-width: 359px) {
  .chips.rooms { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form, .body { --gutter: 12px; }
}
