/* =====================================================================
   AQUA — Smart Water Management
   Interfaccia mobile-first, ad alto contrasto per l'uso all'aperto.
   Elemento distintivo: il quadrante a rulli del contatore (.dial).
   ===================================================================== */

@font-face {
    font-family: "Public Sans";
    src: url("../fonts/public-sans.woff2") format("woff2");
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    --lake: #0B3954;        /* blu lago: marchio, barra, azioni primarie */
    --lake-deep: #072A3E;
    --lake-tint: #E7F0F5;
    --current: #087E8B;     /* acqua corrente: link e focus */
    --current-ink: #06646E;
    --ink: #13232D;         /* testo */
    --ink-2: #4A5A64;       /* testo secondario (contrasto AA su bianco) */
    --paper: #F2F5F6;       /* fondo pagina, freddo */
    --surface: #FFFFFF;
    --line: #CFD9DE;
    --line-soft: #E3EAED;
    --roller: #15232B;      /* rulli del quadrante */
    --roller-red: #B42318;  /* decimali */

    --ok: #1C6B44;   --ok-bg: #E2F3E9;
    --info: #0B4F86; --info-bg: #E5EFF9;
    --warn: #8A4B00; --warn-bg: #FFF1D6;
    --danger: #B42318; --danger-bg: #FDEBE9;
    --muted-bg: #ECEFF1;

    --r-sm: 6px;
    --r: 10px;
    --font: "Public Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --tap: 48px;
    --tabbar-h: 64px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--ink);
    background: var(--paper);
    font-variant-numeric: tabular-nums;
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--current-ink); text-underline-offset: 2px; }
a:hover { color: var(--lake); }
code { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: .9em; }
:focus-visible { outline: 3px solid var(--current); outline-offset: 2px; border-radius: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 0; background: var(--surface); padding: .5rem 1rem; z-index: 100; }
.skip:focus { left: .5rem; top: .5rem; }
.muted { color: var(--ink-2); }
.small { font-size: .875rem; }
.prewrap { white-space: pre-wrap; }
.num { text-align: right; white-space: nowrap; }
.mono-num { font-variant-numeric: tabular-nums slashed-zero; letter-spacing: .02em; font-weight: 600; white-space: nowrap; }

/* ---------- Barra superiore ---------- */
.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between; gap: 1rem;
    padding: .5rem 1rem; padding-top: calc(.5rem + env(safe-area-inset-top));
    background: var(--lake); color: #fff;
}
.brand { display: flex; align-items: center; gap: .6rem; color: #fff; text-decoration: none; }
.brand:hover { color: #fff; }
.brand__text { display: flex; flex-direction: column; line-height: 1.1; }
.brand__text strong { font-size: 1.15rem; letter-spacing: .12em; }
.brand__text span { font-size: .72rem; opacity: .8; }
.logo { flex: none; }
.topbar__muni { text-align: right; line-height: 1.2; min-width: 0; }
.muni-name { display: block; font-weight: 600; font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 48vw; }
.muni-switch { color: #CFE6EE; font-size: .8rem; }
.muni-switch:hover { color: #fff; }

/* ---------- Struttura ---------- */
.shell { display: block; }
.main { padding: 1rem; max-width: 1120px; margin: 0 auto; outline: none; }

.sidebar {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 86vw); z-index: 50;
    background: var(--surface); padding: 1rem; overflow-y: auto;
    transform: translateX(100%); transition: transform .2s ease-out;
    box-shadow: -8px 0 32px rgba(7, 42, 62, .18);
    visibility: hidden;
}
.sidebar:target, .sidebar.is-open { transform: none; visibility: visible; }
.sidebar__head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; font-weight: 700; }
.sidebar__cta { margin-bottom: 1rem; }
.nav { list-style: none; margin: 0; padding: 0; }
.nav a {
    display: flex; align-items: center; gap: .75rem; min-height: var(--tap);
    padding: 0 .75rem; border-radius: var(--r-sm); color: var(--ink); text-decoration: none; font-weight: 500;
}
.nav a:hover { background: var(--lake-tint); }
.nav a[aria-current="page"] { background: var(--lake-tint); color: var(--lake); font-weight: 700; box-shadow: inset 3px 0 0 var(--lake); }
.nav .icon { color: var(--lake); flex: none; }
.nav--small a { min-height: 40px; font-size: .95rem; }
.nav__group { margin: 1.25rem .75rem .25rem; font-size: .8rem; color: var(--ink-2); font-weight: 600; }
.account { margin-top: 1.5rem; padding: 1rem .75rem 0; border-top: 1px solid var(--line-soft); }
.account__name { font-weight: 700; margin: 0; }
.account__role { color: var(--ink-2); font-size: .875rem; }
.account a, .account .linklike { display: inline-block; margin: .25rem 1rem .25rem 0; }

/* Barra di navigazione inferiore (smartphone) */
.tabbar {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    display: flex; justify-content: space-around; align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--surface); border-top: 1px solid var(--line);
}
.tabbar a {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-2); text-decoration: none; font-size: .72rem; font-weight: 600;
}
.tabbar a[aria-current="page"] { color: var(--lake); }
.tabbar__main .icon {
    width: 44px; height: 44px; padding: 10px; border-radius: 50%;
    background: var(--lake); color: #fff; margin-top: -18px; box-shadow: 0 4px 12px rgba(11, 57, 84, .35);
}
.tabbar__main { color: var(--lake) !important; }

@media (min-width: 960px) {
    body { padding-bottom: 0; }
    .tabbar, .sidebar__head { display: none; }
    .shell { display: grid; grid-template-columns: 248px 1fr; min-height: calc(100vh - 57px); background: linear-gradient(to right, var(--surface) 247px, var(--line) 247px, var(--line) 248px, transparent 248px); }
    .sidebar {
        position: sticky; top: 57px; height: calc(100vh - 57px); width: auto; transform: none; visibility: visible;
        box-shadow: none; border-right: 1px solid var(--line); background: var(--surface);
    }
    .main { padding: 1.75rem 2rem 3rem; width: 100%; }
    h1 { font-size: 1.85rem; }
}

/* ---------- Intestazioni pagina ---------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: .75rem 1rem; margin-bottom: 1.25rem; }
.page-head h1 { margin: 0; }
.lead { color: var(--ink-2); margin: .35rem 0 0; max-width: 62ch; }
.crumb { margin: 0 0 .25rem; font-size: .875rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.section { margin-top: 2rem; }
.section__head { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; margin-bottom: .75rem; }
.section__head h2 { margin: 0; }

/* ---------- Pulsanti ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
    min-height: var(--tap); padding: 0 1.1rem; border-radius: var(--r-sm);
    border: 2px solid transparent; font: inherit; font-weight: 700; font-size: .98rem;
    text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
.btn--primary { background: var(--lake); color: #fff; }
.btn--primary:hover { background: var(--lake-deep); color: #fff; }
.btn--secondary { background: var(--surface); color: var(--lake); border-color: var(--lake); }
.btn--secondary:hover { background: var(--lake-tint); color: var(--lake); }
.btn--ghost { background: transparent; color: var(--current-ink); border-color: var(--line); }
.btn--ghost:hover { border-color: var(--current); color: var(--lake); }
.btn--danger { background: var(--danger); color: #fff; }
.btn--danger:hover { background: #8F1B12; color: #fff; }
.btn--danger-ghost { background: transparent; color: var(--danger); border-color: #EDB4AE; }
.btn--danger-ghost:hover { background: var(--danger-bg); }
.btn--block { display: flex; width: 100%; }
.btn--lg { min-height: 54px; font-size: 1.05rem; padding: 0 1.4rem; }
.btn--xl { min-height: 62px; font-size: 1.15rem; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--current-ink); text-decoration: underline; cursor: pointer; }

/* ---------- Superfici ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; }
.card--soft { background: #F7FAFB; border-style: dashed; }
@media (min-width: 640px) { .card { padding: 1.25rem 1.5rem; } }
.narrow { max-width: 560px; }

.notice { padding: .8rem 1rem; border-radius: var(--r-sm); margin-bottom: 1rem; border-left: 4px solid; font-weight: 500; }
.notice--success { background: var(--ok-bg); border-color: var(--ok); color: #124B2F; }
.notice--info { background: var(--info-bg); border-color: var(--info); color: #0A3B63; }
.notice--warn { background: var(--warn-bg); border-color: #C77700; color: #5E3400; }
.notice--error { background: var(--danger-bg); border-color: var(--danger); color: #7A160E; }
.notice--link { display: block; text-decoration: none; }
.notice--link:hover { filter: brightness(.97); }

.badge {
    display: inline-block; padding: .15rem .55rem; border-radius: 999px;
    font-size: .8rem; font-weight: 700; line-height: 1.4; white-space: nowrap; vertical-align: middle;
}
.badge--ok { background: var(--ok-bg); color: var(--ok); }
.badge--info { background: var(--info-bg); color: var(--info); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--danger { background: var(--danger-bg); color: var(--danger); }
.badge--muted { background: var(--muted-bg); color: var(--ink-2); }

.empty { background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r); padding: 1.5rem; text-align: center; color: var(--ink-2); }
.empty .btn { margin-top: .5rem; }

/* ---------- Quadrante a rulli (elemento distintivo) ---------- */
.dial { display: inline-flex; align-items: stretch; gap: 3px; padding: 5px; background: #0E181E; border-radius: 6px; box-shadow: inset 0 1px 3px rgba(0,0,0,.6); }
.dial__d {
    display: inline-flex; align-items: center; justify-content: center;
    width: 1.55rem; height: 2.15rem; border-radius: 3px;
    background: linear-gradient(#26343C, var(--roller) 35%, var(--roller) 65%, #26343C);
    color: #F4F7F8; font-weight: 700; font-size: 1.25rem; font-variant-numeric: tabular-nums;
}
.dial__d--red { background: linear-gradient(#D23A2E, var(--roller-red) 35%, var(--roller-red) 65%, #D23A2E); }
.dial__sep { color: #9FB3BD; align-self: flex-end; font-weight: 700; padding: 0 1px; }
.dial--lg .dial__d { width: 2rem; height: 2.8rem; font-size: 1.65rem; }
@media (max-width: 380px) { .dial--lg .dial__d { width: 1.7rem; height: 2.4rem; font-size: 1.4rem; } }

/* ---------- Dashboard ---------- */
.dash-head h1 { font-size: 1.75rem; }
.field-panel {
    display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem;
    background: var(--lake); color: #fff; border-radius: var(--r); padding: 1.25rem; margin-bottom: 1rem;
    background-image: linear-gradient(120deg, transparent 60%, rgba(8, 126, 139, .45));
}
.field-panel h2 { margin: 0 0 .25rem; }
.field-panel p { margin: 0; color: #D6E7EE; }
.field-panel .btn--primary { background: #fff; color: var(--lake); flex: 1 1 220px; max-width: 320px; }
.field-panel .btn--primary:hover { background: var(--lake-tint); }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-top: 1rem; }
@media (min-width: 720px) { .stats { grid-template-columns: repeat(3, 1fr); } }
@media (min-width: 1100px) { .stats { grid-template-columns: repeat(6, 1fr); } }
.stat {
    display: flex; flex-direction: column; gap: .1rem;
    background: var(--surface); border: 1px solid var(--line); border-radius: var(--r);
    padding: .9rem 1rem; text-decoration: none; color: var(--ink); border-top: 4px solid var(--lake);
}
.stat:hover { border-color: var(--current); color: var(--ink); }
.stat__label { font-weight: 600; font-size: .9rem; color: var(--ink-2); }
.stat__value { font-size: 1.9rem; font-weight: 800; color: var(--lake); line-height: 1.15; }
.stat__sub { font-size: .85rem; color: var(--ink-2); }
.stat--anomalies { border-top-color: var(--line); }
.stat--alert { border-top-color: var(--danger); }
.stat--alert .stat__value { color: var(--danger); }

.feed { list-style: none; margin: 0; padding: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); }
.feed li + li { border-top: 1px solid var(--line-soft); }
.feed__item { display: flex; justify-content: space-between; gap: 1rem; padding: .8rem 1rem; text-decoration: none; color: var(--ink); }
.feed__item:hover { background: #F7FAFB; color: var(--ink); }
.feed__main { display: flex; flex-direction: column; min-width: 0; }
.feed__main span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed__side { display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; flex: none; }

/* ---------- Ricerca e filtri ---------- */
.searchbar, .filters__main { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.searchbar__input { position: relative; flex: 1 1 260px; display: flex; }
.searchbar__input .icon { position: absolute; left: .8rem; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.searchbar__input input[type="search"] { padding-left: 2.6rem; }
.searchbar select { flex: 0 1 200px; }
.filters { margin-bottom: 1rem; }
.filters__more summary, .more summary, .history summary { cursor: pointer; font-weight: 600; color: var(--current-ink); min-height: 40px; display: flex; align-items: center; }
.chips { display: flex; flex-wrap: wrap; gap: .5rem; margin: .5rem 0 1rem; }
.chip { display: inline-flex; align-items: center; min-height: 36px; padding: 0 .9rem; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--ink); font-weight: 600; font-size: .9rem; }
.chip:hover, .chip--on { border-color: var(--lake); color: var(--lake); background: var(--lake-tint); }

/* ---------- Tabelle (diventano schede su smartphone) ---------- */
.table { width: 100%; border-collapse: collapse; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.table th { text-align: left; font-size: .82rem; font-weight: 700; color: var(--ink-2); padding: .65rem .8rem; background: #F6F9FA; border-bottom: 1px solid var(--line); }
.table td { padding: .7rem .8rem; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table th.num { text-align: right; }
.table tr.is-past td { color: var(--ink-2); }
.table tr.is-past td a { color: var(--ink-2); }
.table--dense td { padding: .45rem .8rem; }
.table--dense td:first-child { white-space: nowrap; }
.rowlink { font-weight: 600; }
.table td .muted.small { display: block; }
.diff-old { color: #7A160E; background: #FFF7F6; }
.diff-new { color: #124B2F; background: #F4FBF7; }
.action { display: inline-block; padding: .1rem .4rem; border-radius: 4px; background: var(--muted-bg); font-size: .8rem; }
.action--warn { background: var(--warn-bg); color: var(--warn); }

@media (max-width: 719px) {
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table { border: 0; background: transparent; }
    .table thead { display: none; }
    .table tr { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .6rem; padding: .5rem .9rem; }
    .table td { border: 0; padding: .3rem 0; text-align: right; overflow-wrap: anywhere; }
    .table td::after { content: ""; display: block; clear: both; }
    .table td::before { content: attr(data-label); float: left; margin-right: 1rem; font-weight: 600; color: var(--ink-2); font-size: .85rem; text-align: left; }
    .table td:first-child { text-align: left; font-size: 1.05rem; padding-bottom: .4rem; border-bottom: 1px solid var(--line-soft); margin-bottom: .2rem; display: block; }
    .table td:first-child::before { content: none; }
    .table td.num { text-align: right; }
    .table td:not([data-label]):empty { display: none; }
    .table td .muted.small { display: inline; }
}

.pager { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .75rem; margin: 1rem 0; }
.pager__info, .pager__page { color: var(--ink-2); font-size: .9rem; }
.pager__links { display: flex; align-items: center; gap: .75rem; }

/* ---------- Moduli ---------- */
.form { max-width: 920px; }
.field { display: flex; flex-direction: column; gap: .3rem; margin-bottom: 1rem; min-width: 0; }
.field label, .finder__label { font-weight: 600; font-size: .95rem; }
.req { color: var(--danger); }
input[type="text"], input[type="email"], input[type="password"], input[type="search"], input[type="tel"],
input[type="date"], input[type="datetime-local"], input[type="number"], select, textarea {
    width: 100%; min-height: var(--tap); padding: .55rem .8rem;
    font: inherit; font-size: 1rem; color: var(--ink);
    background: var(--surface); border: 1.5px solid #9DB0B9; border-radius: var(--r-sm);
}
textarea { min-height: 5rem; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--current); outline: 3px solid rgba(8, 126, 139, .25); outline-offset: 0; }
[aria-invalid="true"] { border-color: var(--danger) !important; background: #FFFBFA; }
.hint { margin: 0; font-size: .85rem; color: var(--ink-2); }
.error { margin: 0; font-size: .9rem; color: var(--danger); font-weight: 600; }
.field--mono input { font-variant-numeric: tabular-nums slashed-zero; letter-spacing: .04em; font-weight: 600; text-transform: uppercase; }
.field--big input { font-size: 1.4rem; font-weight: 700; }
.field--check label { flex-direction: row; display: flex; gap: .5rem; align-items: center; font-weight: 500; margin-top: 1.9rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1rem; }
legend { font-weight: 700; margin-bottom: .5rem; padding: 0; }
.form__section { font-size: 1rem; margin: 1.5rem 0 .75rem; padding-top: 1rem; border-top: 1px solid var(--line-soft); }
.form__actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: .5rem; }
.grid-2, .grid-3, .grid-4, .grid-addr { display: grid; gap: 0 1rem; grid-template-columns: 1fr; }
@media (min-width: 640px) {
    .grid-2 { grid-template-columns: 1fr 1fr; }
    .grid-3 { grid-template-columns: repeat(3, 1fr); }
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-addr { grid-template-columns: 3fr 1fr; }
}
@media (min-width: 960px) { .grid-4 { grid-template-columns: repeat(4, 1fr); } }

.segmented { display: flex; flex-wrap: wrap; gap: .5rem; }
.segmented legend { width: 100%; }
.segmented__opt { flex: 1 1 160px; }
.segmented__opt input { position: absolute; opacity: 0; }
.segmented__opt span {
    display: flex; align-items: center; justify-content: center; min-height: var(--tap);
    border: 1.5px solid #9DB0B9; border-radius: var(--r-sm); font-weight: 600; cursor: pointer; background: var(--surface);
}
.segmented__opt input:checked + span { border-color: var(--lake); background: var(--lake-tint); color: var(--lake); box-shadow: inset 0 0 0 1px var(--lake); }
.segmented__opt input:focus-visible + span { outline: 3px solid var(--current); outline-offset: 2px; }

.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.inline-form input, .inline-form select { width: auto; flex: 1 1 140px; }

/* ---------- Schede e fatti ---------- */
.facts { display: grid; grid-template-columns: 1fr; gap: .9rem 1.5rem; margin: 0; }
@media (min-width: 640px) { .facts { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 960px) { .facts { grid-template-columns: repeat(3, 1fr); } }
.facts dt { font-size: .82rem; font-weight: 600; color: var(--ink-2); }
.facts dd { margin: .1rem 0 0; overflow-wrap: anywhere; }
.facts__wide { grid-column: 1 / -1; }
.record-foot { margin-top: 2rem; padding-top: 1rem; border-top: 1px solid var(--line); display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 1rem; }
.rows { list-style: none; margin: 0 0 1rem; padding: 0; }
.rows__item { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1rem; padding: .75rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); margin-bottom: .5rem; }
.rows__item p { margin: 0; }
.rows--cards .card { margin-bottom: .75rem; }
.link-box h3 { margin-bottom: .75rem; }
.history { margin-top: .5rem; }
.summary-line { font-size: 1.05rem; }

/* ---------- Contatore e lettura ---------- */
.meter-hero { display: grid; gap: 1.25rem; grid-template-columns: 1fr; align-items: center; }
@media (min-width: 720px) { .meter-hero { grid-template-columns: auto 1fr; } .meter-hero__where { border-left: 1px solid var(--line-soft); padding-left: 1.5rem; } }
.meter-hero__label { font-size: .85rem; font-weight: 700; color: var(--ink-2); margin-bottom: .4rem; }
.meter-hero__dial .muted { margin-top: .4rem; }
.meter-hero__where p { margin-bottom: .35rem; }

.finder { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r); padding: 1rem; margin-bottom: 1rem; }
.finder__label { display: block; margin-bottom: .5rem; }
.finder__row { display: flex; gap: .5rem; flex-wrap: wrap; }
.finder__input { flex: 1 1 220px; min-height: 58px !important; font-size: 1.3rem !important; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
.pick-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.pick {
    display: grid; grid-template-columns: 1fr auto; gap: .1rem .75rem; padding: .9rem 1rem;
    background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r); text-decoration: none; color: var(--ink);
}
.pick:hover { border-color: var(--lake); color: var(--ink); }
.pick__serial { font-size: 1.2rem; color: var(--lake); }
.pick__code { grid-row: 1; grid-column: 2; align-self: center; color: var(--ink-2); font-size: .9rem; }
.pick__who { font-weight: 600; grid-column: 1 / -1; }
.pick__where { color: var(--ink-2); grid-column: 1 / -1; }

.meter-card { border-left: 4px solid var(--lake); padding: .25rem 0 .25rem 1rem; margin-bottom: 1.25rem; }
.meter-card p { margin: 0; }
.meter-card__who { font-weight: 700; font-size: 1.1rem; }
.meter-card__where { color: var(--ink-2); }
.meter-card__meta { margin-top: .25rem !important; font-size: .9rem; }

.reading-form { max-width: 520px; }
.prev-reading { margin-bottom: 1.25rem; }
.prev-reading__label { font-size: .9rem; font-weight: 600; color: var(--ink-2); margin-bottom: .4rem; }
.field--reading label { font-size: 1.05rem; }
.field--reading input {
    min-height: 72px; font-size: 2.2rem; font-weight: 800; letter-spacing: .08em;
    border-width: 2px; border-color: var(--lake); text-align: center; color: var(--lake);
}
.consumption {
    display: flex; justify-content: space-between; align-items: baseline;
    padding: .9rem 1rem; margin-bottom: 1rem; border-radius: var(--r);
    background: var(--lake-tint); border: 1px solid #C7DAE4;
}
.consumption__label { font-weight: 700; color: var(--lake); }
.consumption__value { font-size: 1.5rem; font-weight: 800; color: var(--lake); }
.consumption.is-negative { background: var(--warn-bg); border-color: #E9C47E; }
.consumption.is-negative .consumption__label, .consumption.is-negative .consumption__value { color: var(--warn); }
.more { margin-bottom: 1rem; }
.more > summary { margin-bottom: .5rem; }

.saved {
    text-align: center; background: var(--surface); border: 2px solid var(--ok); border-radius: var(--r);
    padding: 1.5rem 1rem; margin-bottom: 1.5rem;
}
.saved__title { font-weight: 800; color: var(--ok); font-size: 1.1rem; margin-bottom: .25rem; }
.saved__consumption { margin: 0; font-size: 1.3rem; font-weight: 700; color: var(--lake); }
.saved__num { font-size: 3rem; font-weight: 800; line-height: 1.1; }
.saved__sub { color: var(--ink-2); }
.saved__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .75rem; margin-top: 1rem; }
.saved .notice { text-align: left; }

.reading-sheet { display: grid; gap: 1.25rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .reading-sheet { grid-template-columns: auto auto 1fr; align-items: end; } }
.big-num { font-size: 2.4rem; font-weight: 800; color: var(--lake); margin: 0; line-height: 1; }
.big-num span { font-size: 1.1rem; font-weight: 700; }
.reading-sheet__consumption.is-negative .big-num { color: var(--warn); }
.review-grid { display: grid; gap: .75rem; grid-template-columns: 1fr; }
@media (min-width: 720px) { .review-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .review-grid { grid-template-columns: repeat(4, 1fr); } }
.review { display: flex; flex-direction: column; gap: .5rem; margin: 0; }
.review h3 { margin: 0; }
.review p { margin: 0; }
.review .btn { margin-top: auto; }
.notes-form { margin-top: .75rem; }

.anomaly__head { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; margin-bottom: .4rem; }
.anomaly__desc { font-weight: 600; }

/* ---------- Scelta Comune ---------- */
.choice-list { list-style: none; padding: 0; margin: 0 0 1rem; display: grid; gap: .6rem; max-width: 640px; }
.choice {
    width: 100%; text-align: left; font: inherit; color: var(--ink); cursor: pointer;
    display: flex; flex-direction: column; gap: .2rem; padding: 1rem 1.1rem;
    background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r);
}
.choice:hover { border-color: var(--lake); }
.choice--current { border-color: var(--lake); box-shadow: inset 4px 0 0 var(--lake); }
.choice__title { font-weight: 700; font-size: 1.05rem; }
.choice__meta { color: var(--ink-2); font-size: .9rem; }

/* ---------- Pagine senza sessione ---------- */
body.auth {
    padding: 0; min-height: 100vh; display: flex; align-items: flex-start; justify-content: center;
    background: var(--lake);
    background-image:
        repeating-linear-gradient(180deg, rgba(255,255,255,.035) 0 2px, transparent 2px 22px),
        linear-gradient(170deg, var(--lake) 40%, #0A5465);
}
.auth__main { width: 100%; max-width: 420px; padding: 2.5rem 1rem; }
.auth__brand { text-align: center; color: #fff; margin-bottom: 1.5rem; }
.auth__brand .logo { width: 64px; height: 64px; }
.auth__name { font-size: 2rem; font-weight: 800; letter-spacing: .2em; margin: .5rem 0 0; padding-left: .2em; }
.auth__tag { color: #CFE6EE; margin: 0; }
.auth__card { padding: 1.5rem; box-shadow: 0 18px 48px rgba(0, 20, 32, .35); border: 0; }
.auth__card--wide { max-width: none; }
.auth__title { font-size: 1.35rem; margin-bottom: 1rem; }
.auth__foot { color: #CFE6EE; font-size: .85rem; text-align: center; margin-top: 1rem; }
.auth .main { padding: 0; }
.auth__main .error-page { text-align: center; }
.error-page__code { font-size: 3rem; font-weight: 800; color: var(--lake); margin: 0; line-height: 1; }
@media (min-width: 640px) { .auth__main:has(.auth__card--wide) { max-width: 640px; } }

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
@media print {
    .topbar, .sidebar, .tabbar, .actions, .review-grid, .notes-form, .record-foot form { display: none !important; }
    body { background: #fff; padding: 0; }
    .card, .table { border-color: #999; }
}
