/* Vasca in Regola: pensato per il telefono, al sole, con le mani bagnate. */
/* Atkinson Hyperlegible (SIL Open Font License), servito dal nostro dominio: niente Google Fonts. */
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 400; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible"; font-style: normal; font-weight: 700; font-display: swap;
  src: url("/fonts/atkinson-hyperlegible-latin-700-normal.woff2") format("woff2"); }
:root {
  --ink: #0F3440;        /* acqua profonda */
  --ink-soft: #4A6670;
  --tile: #EEF5F6;       /* piastrella */
  --paper: #FFFFFF;
  --rule: #C9DADD;
  --phenol: #F2C200;     /* giallo del reagente: azioni principali */
  --phenol-ink: #3A2E00;
  --ok: #1F7A4D;
  --warn: #9A5B00;
  --bad: #B3123A;
  --radius-s: 6px;
  --radius-l: 14px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; background: var(--tile); }
body { min-height: 100vh; }
body {
  margin: 0; background: var(--tile); color: var(--ink);
  font: 18px/1.5 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-variant-numeric: tabular-nums;
}
a { color: var(--ink); }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; }

.top {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem 1rem;
  padding: calc(.75rem + env(safe-area-inset-top)) 1rem .75rem; background: var(--ink); color: #fff;
}
.brand { color: #fff; text-decoration: none; font-weight: 700; font-size: 1.1rem; display: flex; align-items: center; gap: .6rem; }
.brand-scale { display: inline-flex; height: 18px; border-radius: 3px; overflow: hidden; }
.brand-scale i { width: 6px; display: block; }
.brand-scale i:nth-child(1) { background: #F7E26B; }
.brand-scale i:nth-child(2) { background: #F2C200; }
.brand-scale i:nth-child(3) { background: #F28C28; }
.brand-scale i:nth-child(4) { background: #E0457B; }
.brand-scale i:nth-child(5) { background: #B5175E; }
.nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.nav a { color: #fff; text-decoration: none; padding: .25rem 0; border-bottom: 2px solid transparent; }
.nav a:hover { border-bottom-color: var(--phenol); }

.page { max-width: 40rem; margin: 0 auto; padding: 1.25rem 1rem 6rem; }
.page-wide { max-width: 68rem; }
.page-wide > form { max-width: 40rem; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .25rem 0 1rem; }
h2 { font-size: 1.2rem; margin: 2rem 0 .5rem; }
p { max-width: 36em; }
.muted { color: var(--ink-soft); }
.back { display: inline-block; margin-bottom: .5rem; color: var(--ink-soft); }

.notice { padding: .75rem 1rem; border-left: 5px solid var(--ok); background: var(--paper); border-radius: var(--radius-s); }
.notice-warn { border-left-color: var(--warn); }
.notice-error { border-left-color: var(--bad); }

/* Pulsanti */
.btn, button {
  display: inline-flex; align-items: center; justify-content: center; min-height: 52px; padding: .6rem 1.2rem;
  font: inherit; font-weight: 700; border-radius: var(--radius-s); border: 2px solid var(--ink);
  background: var(--paper); color: var(--ink); text-decoration: none; cursor: pointer;
}
.btn-primary, button[type=submit] { background: var(--phenol); color: var(--phenol-ink); border-color: var(--phenol); }
.btn-block { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }

/* Moduli */
form { margin: 0; }
.field { margin: 1rem 0; }
.field label { display: block; font-weight: 700; margin-bottom: .3rem; }
.field .hint { font-size: .9rem; color: var(--ink-soft); margin: .2rem 0 0; }
input, select, textarea {
  width: 100%; min-height: 52px; padding: .6rem .8rem; font: inherit; color: var(--ink);
  background: var(--paper); border: 2px solid var(--rule); border-radius: var(--radius-s);
}
input:focus, select:focus, textarea:focus { border-color: var(--ink); outline: none; }
textarea { min-height: 6rem; }
.row2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: .75rem; align-items: end; }
input[type=date], input[type=time] { min-width: 0; }

/* Parametro con la scala del kit */
.param { padding: 1rem 0; border-bottom: 1px solid var(--rule); }
.param label { display: flex; justify-content: space-between; gap: 1rem; align-items: baseline; margin-bottom: .4rem; }
.param-name { font-weight: 700; font-size: 1.1rem; }
.param-range { font-size: .9rem; color: var(--ink-soft); text-align: right; }
.param-opt { font-weight: 400; font-size: .9rem; color: var(--ink-soft); }
.param-row { display: flex; align-items: center; gap: .6rem; }
.param-row input { font-size: 1.6rem; font-weight: 700; max-width: 9rem; text-align: right; }
.param-unit { color: var(--ink-soft); }
.kit { position: relative; height: 14px; margin: .7rem 0 .2rem; border-radius: 7px;
  background: linear-gradient(90deg, #F7E26B, #F2C200 30%, #F28C28 55%, #E0457B 80%, #B5175E); opacity: .35; }
.kit-band { position: absolute; top: -3px; bottom: -3px; border: 3px solid var(--ok); border-radius: 8px; }
.kit-marker { position: absolute; top: -7px; width: 4px; height: 28px; margin-left: -2px; background: var(--ink); border-radius: 2px; }
.param.has-value .kit { opacity: 1; }
.param-state { min-height: 1.5em; margin: .2rem 0 0; font-weight: 700; }
.param.out .param-state { color: var(--bad); }
.param.in .param-state { color: var(--ok); }

/* Giornata: sequenza degli orari di misura */
.day { list-style: none; padding: 0; margin: .5rem 0 0; border-top: 1px solid var(--rule); }
.day li { display: grid; grid-template-columns: 4rem 1fr auto; gap: .75rem; align-items: center;
  padding: .7rem 0; border-bottom: 1px solid var(--rule); }
.day .time { font-weight: 700; font-size: 1.15rem; }
.day .what { color: var(--ink-soft); font-size: .95rem; }
.status { font-size: .85rem; font-weight: 700; padding: .2rem .55rem; border-radius: 999px; white-space: nowrap; }
.status-fatto { background: #DDF1E6; color: var(--ok); }
.status-da_fare { background: var(--paper); color: var(--ink); border: 1px solid var(--rule); }
.status-mancato { background: #FBE1E7; color: var(--bad); }
.status-in_scadenza { background: #FFF1CC; color: var(--warn); }
.deadline-actions { display: flex; align-items: center; gap: .6rem; }
button.btn-link { min-height: 0; padding: .2rem 0; border: 0; background: none; color: var(--ink-soft); font-weight: 400; text-decoration: underline; }

.pool { background: var(--paper); border-radius: var(--radius-l); padding: 1.1rem 1rem; margin: 1rem 0 1.5rem; }
.pool h2 { margin-top: 0; }
.alert-box { border: 2px solid var(--bad); background: #FFF5F7; border-radius: var(--radius-s); padding: .8rem 1rem; margin: .75rem 0; }
.alert-box strong { color: var(--bad); }
.alert-critical { background: var(--bad); border-color: var(--bad); color: #fff; }
.alert-critical strong, .alert-critical a { color: #fff; }
.param.crit .param-state { color: #fff; background: var(--bad); padding: .2rem .5rem; border-radius: var(--radius-s); display: inline-block; }
.alert-box p { margin: .2rem 0; }
.tick { display: flex; gap: .75rem; align-items: flex-start; margin: 1rem 0; font-weight: 700; cursor: pointer; }
.tick input { width: 1.5rem; height: 1.5rem; min-height: 0; margin: .1rem 0 0; accent-color: var(--ink); flex: none; }

/* Checklist */
.check { display: grid; grid-template-columns: 1fr auto; gap: .5rem; align-items: center; padding: .8rem 0; border-bottom: 1px solid var(--rule); }
.check-options { display: flex; gap: .4rem; }
.check-options label { display: inline-flex; align-items: center; justify-content: center; min-width: 4.2rem; min-height: 48px;
  border: 2px solid var(--rule); border-radius: var(--radius-s); background: var(--paper); font-weight: 700; cursor: pointer; }
.check-options input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check-options input:checked + span { color: #fff; }
.check-options label:has(input[value="1"]:checked) { background: var(--ok); border-color: var(--ok); color: #fff; }
.check-options label:has(input[value="0"]:checked) { background: var(--bad); border-color: var(--bad); color: #fff; }
.check-note { grid-column: 1 / -1; display: none; }
.check:has(input[value="0"]:checked) .check-note { display: block; }

/* Tabelle */
.table-wrap { overflow-x: auto; background: var(--paper); border-radius: var(--radius-s); }
table { border-collapse: collapse; width: 100%; font-size: .95rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--rule); white-space: nowrap; }
th.num, td.num { text-align: right; }
td.bad { color: var(--bad); font-weight: 700; }

.qr-sheet { background: #fff; padding: 2rem; text-align: center; border-radius: var(--radius-l); }
.qr-sheet svg { width: 260px; height: 260px; }
@media print { .top, .back, .actions, .offline { display: none !important; } body { background: #fff; } }

.offline { position: fixed; left: 0; right: 0; bottom: 0; padding: .8rem 1rem calc(.8rem + env(safe-area-inset-bottom));
  background: var(--warn); color: #fff; font-weight: 700; text-align: center; }
@media (prefers-reduced-motion: no-preference) { .kit-marker { transition: left .15s ease-out; } }

/* Pagina per gli ospiti */
.lang-switch { display: flex; gap: 1rem; justify-content: flex-end; font-size: .95rem; }
.guest-hours { font-size: 1.6rem; font-weight: 700; margin: 0; }
.guest-rules { padding-left: 1.2rem; }
.guest-rules li { margin: .3rem 0; }

/* Scadenze di persone e documenti */
.deadlines { list-style: none; padding: 0; margin: 0 0 1rem; }
.deadline { border-bottom: 1px solid var(--rule); padding: .8rem 0; }
.deadline-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.deadline-who { display: block; }
.deadline-meta { margin: .35rem 0; }
.deadline-done summary { cursor: pointer; font-weight: 700; padding: .4rem 0; }
.deadline-done form { margin-top: .5rem; }

/* Turni dei bagnini */
.week-nav { display: flex; justify-content: space-between; align-items: center; gap: .4rem .75rem; flex-wrap: wrap; margin: 1.5rem 0 .5rem; }
.week-nav strong { order: -1; flex-basis: 100%; }
.shift-list { list-style: none; padding: 0; margin: .25rem 0 .5rem; }
.shift-list li { padding: .45rem 0; border-bottom: 1px solid var(--rule); }
.shift-list li:last-child { border-bottom: 0; }
.shift-plan { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.shift-plan .time { font-variant-numeric: tabular-nums; font-weight: 700; }
.shift-missing { color: var(--bad); }
.shift-gap { color: var(--warn); font-weight: 700; }
.shift-today { border-color: var(--ink); }
.shift-day h3 { font-size: 1rem; margin: .75rem 0 0; }
.shift-end summary { cursor: pointer; padding: .3rem 0; color: var(--ink-soft); }

/* Prodotti chimici */
.storage-notes ul { margin: 0; padding-left: 1.2rem; }
.storage-notes li { margin: .3rem 0; }
.product h2 { margin-bottom: .25rem; }
.product-actions details { border-top: 1px solid var(--rule); }
.product-actions summary { cursor: pointer; font-weight: 700; padding: .55rem 0; }
.product-actions form { margin-bottom: .75rem; }

/* Lingua dello staff */
.lang-switch { margin: 1.5rem 0 .5rem; }

/* Ditte di manutenzione */
.client { border-left: 4px solid var(--rule); }
.client.urgency-1 { border-left-color: var(--warn); }
.client.urgency-2 { border-left-color: var(--bad); }
.client h2 a { color: inherit; }
.client-pools { padding-left: 1.1rem; margin: .4rem 0; }
.client-pools li { margin: .3rem 0; }
.bad { color: var(--bad); }
.link-code { font-size: 1.8rem; font-weight: 700; letter-spacing: .12em; font-variant-numeric: tabular-nums; margin: .25rem 0; }
fieldset.work { border: 1px solid var(--rule); border-radius: var(--radius-l, 12px); padding: .5rem .9rem .3rem; margin: 0 0 1rem; }
fieldset.work legend { font-weight: 700; padding: 0 .3rem; }
.confirm-form { margin-top: .5rem; }

/* Demo pubblica */
.demo-banner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .25rem 1rem;
  background: #FFF1CC; color: var(--ink); border-radius: 10px; padding: .6rem .9rem; margin: 0 0 1rem; font-size: .95rem; }
.demo-banner form { margin: 0; }
