@font-face {
  font-family: "Archivo";
  src: url("/fonts/archivo-latin-wdth-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-stretch: 62% 125%;
  font-display: swap;
}

/* The sky is the page. Content sits on dark smoked glass tinted by the sky
   (sky.js sets --glass-a and --glass-b, never lighter than 46 a channel), so
   light text keeps AA contrast over noon, sunset, snow and night alike. */
:root {
  --glass-a: 16 34 66;
  --glass-b: 13 18 30;
  --ink: #f0ebe3;
  --label: #cfc9be;
  --mint: #8db89e;
  --ochre: #e7ae3c;
  --bad: #f0705f;
  --blue: #7f9fcc;
  --rain: #8fb6f0;
  /* Lighter steps of the same hues, for small coloured text. */
  --rain-text: #b3cff7;
  --bad-text: #ffb3a6;
  --ochre-text: #f2c263;
  --track: rgba(240, 235, 227, 0.18);
  --hair: rgba(240, 235, 227, 0.13);
  --gap: 10px;
  --pad: 16px;
  --radius: 22px;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='96' height='96'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='1.15' numOctaves='2' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.07 0'/%3E%3C/filter%3E%3Crect width='96' height='96' filter='url(%23n)'/%3E%3C/svg%3E");
  --frost: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 46%), var(--grain), linear-gradient(135deg, rgb(var(--glass-a) / 0.92), rgb(var(--glass-b) / 0.95));
  --edge: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.07);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { min-width: 320px; -webkit-text-size-adjust: 100%; background: #1a56c8; }
body {
  margin: 0;
  min-height: 100dvh;
  color: var(--ink);
  font: 440 1rem/1.4 "Archivo", system-ui, sans-serif;
  font-synthesis: none;
  font-variant-numeric: tabular-nums;
  -webkit-font-smoothing: antialiased;
}
[hidden] { display: none !important; }
h1, h2, h3, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
small { font-size: 0.74rem; font-weight: 480; color: var(--label); font-stretch: 84%; }
code { font: inherit; font-stretch: 80%; background: var(--track); padding: 1px 6px; border-radius: 6px; }
abbr { text-decoration: none; }
.defs { position: absolute; }

a[href], button, summary, select, label[for] { cursor: pointer; }
button:disabled { cursor: not-allowed; }
:focus-visible { outline: 3px solid var(--ink); outline-offset: 2px; border-radius: 10px; }
#main:focus { outline: none; }
a, button, input { -webkit-tap-highlight-color: transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

#sky, #sky-fx { position: fixed; inset: 0; width: 100%; height: 100%; z-index: -1; pointer-events: none; }
#sky-bodies { position: absolute; top: 0; left: 0; width: 100%; z-index: -1; pointer-events: none; }

/* Smoked glass: tinted dark gradient, fine grain, light from above, hairline edge. */
.panel, .glass { position: relative; min-width: 0; border-radius: var(--radius); background: var(--frost); box-shadow: var(--edge); }
.panel { padding: var(--pad); }

/* ---------------------------------------------------------------- shell */

.app { padding: var(--gap); padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
/* Smoke rises from the bottom edge so nothing reads under the bar. */
.app::after { content: ""; position: fixed; z-index: 19; left: 0; right: 0; bottom: 0; height: calc(96px + env(safe-area-inset-bottom)); pointer-events: none; background: linear-gradient(180deg, rgba(9, 10, 13, 0), rgba(9, 10, 13, 0.9) 45%, rgb(9, 10, 13) 78%); }
.skip { position: absolute; left: 12px; top: -80px; z-index: 30; padding: 12px 16px; background: #0d0e11; border-radius: 12px; font-weight: 650; }
.skip:focus { top: 12px; }
.top { display: none; }
.brand { display: inline-flex; align-items: baseline; gap: 0.3em; min-height: 44px; font-weight: 800; font-stretch: 74%; font-size: 1.7rem; text-decoration: none; letter-spacing: -0.01em; }
.brand span, .login-card h1 span { font-weight: 440; color: var(--label); }
.status { font-size: 0.8rem; color: var(--label); font-stretch: 86%; }

.nav {
  position: fixed; z-index: 20; left: var(--gap); right: var(--gap); bottom: calc(var(--gap) + env(safe-area-inset-bottom));
  display: grid; grid-template-columns: repeat(5, 1fr); gap: 2px; padding: 5px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0) 60%), var(--grain), linear-gradient(135deg, rgb(var(--glass-a)), rgb(var(--glass-b)));
}
.nav a, .nav button {
  position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  min-height: 54px; padding: 4px 2px; border: 0; border-radius: 17px; background: none; color: var(--label);
  font-size: 0.7rem; font-weight: 560; font-stretch: 80%; text-decoration: none; white-space: nowrap;
  transition: background-color 0.18s ease, color 0.18s ease;
}
.nav a:hover, .nav button:not(:disabled):hover { background: var(--hair); color: var(--ink); }
.nav a:active, .nav button:not(:disabled):active { background: var(--track); }
.nav a[aria-current="page"], .nav-more-btn.is-current { background: var(--ink); color: #121315; font-weight: 720; }
.nav button:disabled { opacity: 0.6; }
.count { min-width: 1.5em; padding: 0 5px; border-radius: 9px; background: var(--bad); color: #1c0b08; font-size: 0.7rem; font-weight: 800; line-height: 1.5; text-align: center; }
.nav-more-btn[data-count]:not([data-count=""])::after { content: attr(data-count); position: absolute; top: 5px; left: calc(50% + 7px); min-width: 1.5em; padding: 0 4px; border-radius: 9px; background: var(--bad); color: #1c0b08; font-size: 0.66rem; font-weight: 800; line-height: 1.45; }
.nav-extra {
  display: none; position: absolute; right: 0; bottom: calc(100% + 8px); width: min(250px, 100%); padding: 6px; border-radius: var(--radius);
  background: var(--grain), linear-gradient(135deg, rgb(var(--glass-a)), rgb(var(--glass-b)));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), inset 0 0 0 1px rgba(255, 255, 255, 0.09);
}
.nav-extra.open { display: grid; gap: 2px; }
.nav-extra a, .nav-extra button { flex-direction: row; justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; font-size: 0.98rem; font-stretch: 88%; }
.nav-extra .count { margin-left: auto; }
.nav-tools { display: grid; gap: 2px; margin-top: 4px; padding-top: 4px; border-top: 1px solid var(--hair); }

.alert-band {
  display: flex; align-items: center; gap: 10px; min-height: 46px; padding: 8px 14px; border-radius: 16px;
  color: #17100a; font-weight: 680; font-stretch: 86%; font-size: 0.95rem; line-height: 1.2; text-decoration: none; background: var(--blue);
}
.alert-band.lvl-warn { background: var(--ochre); }
.alert-band.lvl-alert { background: var(--bad); }
.alert-band:hover { filter: brightness(1.07); }
.alert-band:active { filter: brightness(0.94); }
.alert-band b { flex: none; font-weight: 820; }
.alert-band span { flex: 1; min-width: 0; }
.alert-band i { flex: none; font-style: normal; font-weight: 800; padding: 1px 8px; border-radius: 10px; background: rgba(23, 16, 10, 0.16); }

.sky-window { height: 84px; }
.app[data-view="adesso"] .sky-window { height: max(132px, 21vh); }
.app[data-view="cielo"] .sky-window { height: max(150px, 24vh); }
.view, .stack { display: grid; gap: var(--gap); min-width: 0; }
.now-grid { display: contents; }
.split { display: grid; gap: var(--gap); }

/* A new view arrives from below, once: it marks the change of section. */
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }
.view > *, .stack > *, .now-grid > * { animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) backwards; }
.view > :nth-child(2), .stack > :nth-child(2), .now-grid > :nth-child(2) { animation-delay: 0.05s; }
.view > :nth-child(3), .stack > :nth-child(3), .now-grid > :nth-child(3) { animation-delay: 0.1s; }
.view > :nth-child(n + 4), .stack > :nth-child(n + 4), .now-grid > :nth-child(n + 4) { animation-delay: 0.15s; }

/* ---------------------------------------------------------------- type */

h1 { font-size: 2.6rem; line-height: 0.95; font-weight: 820; font-stretch: 68%; letter-spacing: -0.012em; }
h2 { font-size: 0.8rem; line-height: 1.2; font-weight: 620; font-stretch: 80%; color: var(--label); margin-bottom: 8px; }
h3 { font-size: 0.8rem; font-weight: 620; font-stretch: 80%; color: var(--label); margin: 20px 0 6px; }
.fig { font-stretch: 68%; font-weight: 780; letter-spacing: -0.01em; line-height: 0.95; }
.unit { margin-left: 5px; font-size: 0.86rem; color: var(--label); font-weight: 560; font-stretch: 80%; }
.sub, .note, .lead { font-size: 0.82rem; color: var(--label); font-stretch: 88%; }
.note { margin-top: 10px; }
.lead:empty, .sub:empty { display: none; }
.lead { margin-bottom: 8px; color: var(--ink); font-size: 0.95rem; font-weight: 560; }
.na { color: var(--label); }
.big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 0 4px; margin-bottom: 12px; }
.big .fig { font-size: 3.1rem; }
.big-word .fig { font-size: 2.1rem; }

.view-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px; padding: 14px var(--pad); }
.view-head .seg, .view-head .range-form { flex-basis: 100%; margin-top: 8px; }
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.head-row h2 { margin: 0; }

/* Figures in a tight grid: small label, heavy number. */
.figs { display: grid; grid-template-columns: repeat(auto-fit, minmax(5.4rem, 1fr)); gap: 12px; }
.figs > div { min-width: 0; }
.figs dt { font-size: 0.72rem; font-weight: 560; font-stretch: 80%; color: var(--label); margin-bottom: 2px; }
.figs dd { font-size: 1.3rem; font-weight: 760; font-stretch: 70%; line-height: 1.05; }
.figs dd small { display: block; margin-top: 2px; }
.figs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.figs-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.figs-line { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--hair); }

.state-slot:empty { display: none; }
.state-slot { padding: var(--pad); border-radius: var(--radius); background: var(--frost); box-shadow: var(--edge); }
.state { color: var(--label); font-size: 0.92rem; max-width: 60ch; }
.state-error { display: grid; gap: 10px; justify-items: start; color: var(--ink); }
.state-error p { font-weight: 620; }
.form-error { color: var(--bad-text); font-weight: 650; font-size: 0.9rem; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 16px;
  border: 1px solid var(--track); border-radius: 14px; background: none; font-weight: 640; font-stretch: 86%; font-size: 0.9rem;
  transition: background-color 0.18s ease;
}
.btn:hover { background: var(--hair); }
.btn:active { background: var(--track); transform: translateY(1px); }
.btn:disabled { opacity: 0.55; }
.btn-main, .btn[aria-pressed="true"] { background: var(--ink); color: #121315; border-color: var(--ink); }
.btn-main:hover, .btn[aria-pressed="true"]:hover { background: #fffaf2; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 8px; font-size: 0.72rem; font-weight: 800; font-stretch: 82%; line-height: 1.5; color: #17100a; background: var(--blue); }
.tag-warn { background: var(--ochre); }
.tag-alert { background: var(--bad); }
.tag-ok { background: var(--mint); }
.tag-off { background: var(--track); color: var(--ink); }

/* ---------------------------------------------------------------- Adesso */

.hero { padding: 18px var(--pad) var(--pad); overflow: hidden; }
/* The glow carries the temperature's colour, as on the widgets. */
.hero::before { content: ""; position: absolute; inset: 0; border-radius: inherit; pointer-events: none; background: radial-gradient(120% 90% at 92% 0%, color-mix(in srgb, var(--glow, transparent) 28%, transparent), transparent 62%); }
.hero > * { position: relative; }
.hero-place { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 10px; font-size: 0.86rem; color: var(--label); font-stretch: 86%; }
.hero-place b { font-size: 1.15rem; font-weight: 800; font-stretch: 74%; color: var(--ink); }
.hero-place .hero-status { margin-left: auto; }
.hero-main { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin: 8px 0 2px; }
.hero-temp { display: flex; align-items: flex-start; min-width: 0; }
.hero-temp .fig { font-size: clamp(7.6rem, 40vw, 10rem); line-height: 0.82; font-weight: 820; font-stretch: 62%; letter-spacing: -0.03em; margin-left: -0.03em; }
.hero-temp[data-len="5"] .fig { font-size: clamp(6.4rem, 33vw, 9rem); }
.hero-temp[data-len="6"] .fig { font-size: clamp(5.4rem, 28vw, 8rem); }
.hero-temp .deg { margin: 0.04em 0 0 0.04em; font-size: 3.4rem; line-height: 1; font-weight: 720; font-stretch: 62%; color: var(--label); }
.hero-icon { flex: none; width: clamp(80px, 26vw, 128px); }
.hero-icon svg { display: block; width: 100%; height: auto; }
.hero-cond { font-size: 1.5rem; font-weight: 760; font-stretch: 72%; margin: 14px 0 14px; }
.hero .figs dd { font-size: 1.55rem; }

.strip { padding: 12px 0 10px; }
.hours { display: flex; overflow-x: auto; padding: 0 8px 2px; scroll-snap-type: x proximity; scrollbar-width: none; overscroll-behavior-x: contain; border-radius: 12px; }
.hours::-webkit-scrollbar { display: none; }
.hours li { flex: 0 0 58px; display: grid; justify-items: center; gap: 3px; padding: 4px 0; scroll-snap-align: start; }
.hours li.is-new-day { border-left: 1px solid var(--track); }
.h-time { font-size: 0.74rem; color: var(--label); font-weight: 560; font-stretch: 82%; }
.h-temp { font-size: 1.32rem; font-weight: 780; font-stretch: 68%; line-height: 1; }
.h-rain { min-height: 1.15em; font-size: 0.72rem; font-weight: 700; font-stretch: 80%; color: var(--rain-text); }

.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.tile-wide { grid-column: 1 / -1; }
.tile-fig { display: flex; align-items: baseline; flex-wrap: wrap; margin-bottom: 4px; }
.tile-fig .fig { font-size: 2.7rem; }
.tile .figs { grid-template-columns: repeat(auto-fit, minmax(4.4rem, 1fr)); }
.tile .figs-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.tile-word { display: flex; align-items: center; flex-wrap: wrap; gap: 4px 6px; font-size: 0.86rem; font-weight: 560; font-stretch: 84%; }
.tile-src { margin-top: 8px; font-size: 0.72rem; color: var(--label); font-stretch: 84%; }
.tile-note p { font-size: 0.9rem; color: var(--label); }
.wind-body { display: flex; align-items: center; gap: 16px; }
.wind-body > div { min-width: 0; }
.rose { flex: none; width: 124px; height: 124px; }
.rose-ring { fill: rgba(240, 235, 227, 0.05); stroke: var(--track); stroke-width: 1.5; }
.rose-tick { stroke: var(--label); stroke-width: 1; opacity: 0.7; }
.rose-main { stroke: var(--ink); stroke-width: 2; opacity: 1; }
.rose-letter { fill: var(--label); font-size: 12px; font-weight: 720; font-stretch: 80%; }
.rose-needle, .rose-hub { fill: var(--mint); }
.rose-line { stroke: var(--mint); stroke-width: 3; stroke-linecap: round; }
.rose-calm { fill: none; stroke: var(--label); stroke-width: 1.5; }
.trend { flex: none; }
.trend path { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.pair-row { display: grid; grid-template-columns: 1fr auto 1fr; gap: 10px; align-items: end; }
.pair-row p { display: grid; gap: 2px; min-width: 0; }
.pair-row p:last-child { text-align: right; }
.pair-row .pair-delta { text-align: center; }
.pair-row .lbl, .pair-row .sub { font-size: 0.72rem; font-weight: 560; color: var(--label); font-stretch: 80%; }
.pair-row .fig { font-size: 1.9rem; }
.pair-delta .fig { font-size: 2.5rem; color: var(--mint); }

/* ---------------------------------------------------------------- charts */

.chart { min-width: 0; }
.chart svg { display: block; max-width: 100%; touch-action: pan-y; border-radius: 8px; }
.chart-read { min-height: 2.6em; margin-top: 4px; font-size: 0.84rem; font-weight: 560; font-stretch: 86%; }
.ch-grid, .ch-xtick { stroke: var(--hair); }
.ch-zero, .ch-major { stroke: var(--track); }
.ch-tick, .ch-unit, .ch-note { fill: var(--label); font-size: 11px; font-weight: 520; font-stretch: 80%; }
.ch-night { fill: #000; opacity: 0.2; }
.ch-line { fill: none; stroke: var(--ink); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.ch-band { stroke: none; }
.ch-bar { fill: var(--label); }
.ln-temp { stroke: var(--ochre); stroke-width: 2.8; }
.ln-wall { stroke: var(--mint); stroke-width: 2; stroke-dasharray: 5 4; }
.ln-dew { stroke: var(--blue); stroke-width: 1.8; stroke-dasharray: 1.5 4; }
.ln-hum { stroke: var(--blue); stroke-width: 2.4; }
.ln-model { stroke: var(--label); stroke-width: 1; opacity: 0.6; }
.bd-temp { fill: var(--ochre); opacity: 0.2; }
.br-rain { fill: var(--rain); }
.br-temp { fill: var(--ochre); }
.br-grad { fill: var(--mint); }
.ln-prob { stroke: var(--ink); stroke-width: 1.8; stroke-dasharray: 1.5 4; }
.ln-wind { stroke: var(--mint); stroke-width: 2.4; }
.ln-gust { stroke: var(--ink); stroke-width: 1.6; stroke-dasharray: 5 4; }
.ln-pres { stroke: var(--ink); stroke-width: 2.4; }
.ln-sun { stroke: var(--ochre); stroke-width: 2.8; }
.ln-uv { stroke: var(--bad); stroke-width: 1.8; stroke-dasharray: 5 4; }
.ln-moon { stroke: var(--ink); stroke-width: 2; stroke-dasharray: 5 4; }
.ch-hline { stroke: var(--bad); stroke-width: 1.4; stroke-dasharray: 6 4; }
.ch-normal { stroke: var(--ink); stroke-width: 2.4; stroke-linecap: round; }
.ch-now { stroke: var(--ink); stroke-width: 1.5; }
.ch-now-label { fill: var(--ink); font-size: 11px; font-weight: 760; font-stretch: 80%; }
.ch-cursor line { stroke: var(--ink); stroke-width: 1; }
.ch-dot { fill: #121315; stroke: var(--ink); stroke-width: 2.2; stroke-dasharray: none; }
.ch-dot.ln-temp, .ch-dot.ln-sun { stroke: var(--ochre); }
.ch-dot.ln-hum, .ch-dot.ln-dew { stroke: var(--blue); }
.ch-dot.ln-wall, .ch-dot.ln-wind { stroke: var(--mint); }
.ch-arrow { fill: var(--label); }
.legend { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-bottom: 4px; font-size: 0.76rem; font-weight: 520; font-stretch: 84%; color: var(--label); }
.legend li { display: inline-flex; align-items: center; gap: 6px; }
.legend-key { flex: none; }
.note .legend-key { vertical-align: middle; margin-right: 6px; }

/* ---------------------------------------------------------------- Previsioni */

.reading { display: grid; gap: 10px; }
.reading li { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px; font-size: 1.02rem; font-weight: 620; font-stretch: 84%; line-height: 1.25; }
.day { display: grid; grid-template-columns: 3.3rem 36px minmax(0, 1fr) 4.2rem; grid-template-areas: "name icon temp rain" "name icon wall wind"; gap: 2px 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--hair); }
.day:first-child { border-top: 0; padding-top: 2px; }
.d-name { grid-area: name; font-size: 1.15rem; font-weight: 800; font-stretch: 70%; line-height: 1.05; }
.d-name small { display: block; }
.d-icon { grid-area: icon; }
.d-icon svg { display: block; }
.d-temp { grid-area: temp; display: flex; align-items: center; gap: 8px; min-width: 0; }
.d-temp b { min-width: 1.9em; font-size: 1.3rem; font-weight: 780; font-stretch: 68%; }
.d-min { text-align: right; }
.d-rain { grid-area: rain; text-align: right; color: var(--rain-text); font-weight: 760; font-stretch: 72%; font-size: 1.02rem; white-space: nowrap; }
.d-rain small { color: inherit; display: block; }
.d-wind { grid-area: wind; display: inline-flex; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; font-size: 0.76rem; color: var(--label); font-weight: 560; font-stretch: 80%; }
.d-wall { grid-area: wall; font-size: 0.74rem; color: var(--label); font-stretch: 84%; }
.d-cond, .d-uv { display: none; }
.rng { position: relative; flex: 1; min-width: 30px; height: 8px; border-radius: 4px; background: var(--track); }
.rng i { position: absolute; top: 0; bottom: 0; border-radius: 4px; }
.rng-soft { background: var(--ink); opacity: 0.2; }
.rng .rng-wall { top: -4px; bottom: -4px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--ink); }

.leads li { display: grid; grid-template-columns: 4.2rem repeat(3, minmax(0, 1fr)); gap: 8px; align-items: end; padding: 9px 0; border-top: 1px solid var(--hair); }
.leads li:first-child { border-top: 0; }
.leads b { font-size: 1.05rem; font-weight: 800; font-stretch: 70%; }
.leads span { display: grid; font-size: 1.05rem; font-weight: 760; font-stretch: 70%; }
.leads span small { order: -1; }
.weights { display: grid; gap: 6px; }
.weights li { display: grid; grid-template-columns: 4.4rem 1fr 2.8rem; gap: 10px; align-items: center; font-size: 0.86rem; font-weight: 620; font-stretch: 84%; }
.w-bar, .vs-bar { position: relative; display: block; height: 8px; border-radius: 4px; background: var(--track); }
.w-bar i, .vs-bar i { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--mint); }
.w-val { text-align: right; font-weight: 780; font-stretch: 72%; }
.w-run { display: none; color: var(--label); font-weight: 480; }

/* ---------------------------------------------------------------- Storico */

.seg { display: flex; flex-wrap: wrap; gap: 5px; }
.seg a, .seg button { display: inline-flex; align-items: center; justify-content: center; flex: 1 0 auto; min-height: 44px; padding: 0 8px; border: 1px solid var(--track); border-radius: 14px; background: none; font-size: 0.86rem; font-weight: 640; font-stretch: 80%; white-space: nowrap; text-decoration: none; transition: background-color 0.18s ease; }
.seg a:hover, .seg button:hover { background: var(--hair); }
.seg a:active, .seg button:active { background: var(--track); }
.seg [aria-current="true"] { background: var(--ink); border-color: var(--ink); color: #121315; font-weight: 760; }
.range-form { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; }
.range-form label { display: grid; gap: 3px; font-size: 0.74rem; font-weight: 560; color: var(--label); }
input[type="date"], input[type="text"], input[type="password"] {
  min-height: 48px; padding: 0 12px; border: 1px solid var(--track); border-radius: 14px; background: rgba(0, 0, 0, 0.28); font-size: 1rem; color: var(--ink);
}
input:hover { border-color: var(--label); }
.range-form .form-error { flex-basis: 100%; }

/* ---------------------------------------------------------------- Statistiche */

.totals { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.vs-top { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; font-size: 0.72rem; font-weight: 560; font-stretch: 80%; color: var(--label); margin-bottom: 6px; }
.vs-top b { font-size: 1.45rem; font-weight: 780; font-stretch: 68%; color: var(--ink); }
.vs-bar i { background: var(--rain); }
.vs-bar u { position: absolute; top: -4px; bottom: -4px; width: 2px; margin-left: -1px; background: var(--ink); }
.vs-note { margin-top: 6px; font-size: 0.72rem; color: var(--label); font-stretch: 84%; }
.records { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.record { padding: 14px; }
.record:last-child:nth-child(odd) { grid-column: 1 / -1; }
.record .fig { display: block; font-size: 2.2rem; margin-bottom: 2px; }
.record .figs { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--hair); }
.record .figs dd { font-size: 1.05rem; }
.month-charts { display: grid; gap: 14px; }
.month-charts figcaption { font-size: 0.8rem; font-weight: 620; font-stretch: 80%; color: var(--label); margin-bottom: 2px; }
.month-chart { display: block; width: 100%; max-width: 560px; height: auto; }
.months { display: grid; margin-top: 12px; }
.months li { display: grid; grid-template-columns: 2.4rem 3rem 3rem minmax(0, 1fr) 3.6rem; gap: 8px; align-items: center; padding: 7px 0; border-top: 1px solid var(--hair); }
.months b { font-size: 1.02rem; font-weight: 800; font-stretch: 70%; }
.months span { font-size: 1.02rem; font-weight: 760; font-stretch: 70%; text-align: right; white-space: nowrap; }
.months .up { color: var(--ochre-text); }
.months .down { color: var(--rain-text); }
.months .m-rain { color: var(--rain-text); }
.tbl-wrap { display: none; }
.tbl { width: 100%; border-collapse: collapse; font-size: 0.9rem; font-stretch: 80%; }
.tbl th, .tbl td { padding: 8px 6px; text-align: right; border-top: 1px solid var(--hair); font-weight: 620; }
.tbl thead th { border-top: 0; font-size: 0.74rem; color: var(--label); font-weight: 560; }
.tbl th:first-child { text-align: left; padding-left: 0; }
.tbl tbody th { font-weight: 800; }
.tbl .up { color: var(--ochre-text); }
.tbl .down { color: var(--rain-text); }
.cal-svg { display: block; width: 100%; height: auto; border-radius: 8px; touch-action: pan-y; }
.cal { fill: var(--rain); }
.cal.c0 { fill: var(--track); opacity: 0.7; }
.cal.c1 { opacity: 0.34; }
.cal.c2 { opacity: 0.52; }
.cal.c3 { opacity: 0.7; }
.cal.c4 { opacity: 0.86; }
.cal.cx { fill: none; stroke: var(--track); }
.cal-cursor { fill: none; stroke: var(--ink); stroke-width: 1.8; pointer-events: none; }
.legend-cal { margin-top: 8px; }

/* ---------------------------------------------------------------- Cielo */

.arcs svg { display: block; max-width: 100%; }
.tw { fill: #000; }
.tw1 { opacity: 0.1; }
.tw2 { opacity: 0.18; }
.tw3 { opacity: 0.26; }
.tw4 { opacity: 0.34; }
.arc-day { fill: var(--ochre); opacity: 0.2; }
.arc-sun { fill: var(--ochre); stroke: #121315; stroke-width: 2; }
.arc-moon { fill: var(--ink); stroke: #121315; stroke-width: 2; }
.moon-row { display: flex; align-items: center; gap: 16px; margin-bottom: 14px; }
.moon-row .wx { flex: none; filter: drop-shadow(0 0 18px rgba(237, 230, 211, 0.22)); }
.moon-row > div { min-width: 0; }
.phases { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; text-align: center; }
.phases li { display: grid; justify-items: center; gap: 2px; min-width: 0; }
.phases span { font-size: 0.7rem; font-weight: 560; font-stretch: 76%; color: var(--label); line-height: 1.15; }
.phases b { font-size: 1.05rem; font-weight: 780; font-stretch: 70%; }
.eclipses { display: grid; gap: var(--gap); }
.eclipse { display: grid; grid-template-columns: 72px minmax(0, 1fr); gap: 4px 14px; align-items: center; padding: 14px; }
.eclipse .wx { grid-row: span 4; align-self: start; }
.e-look { font-size: 1rem; font-weight: 700; font-stretch: 80%; line-height: 1.15; }
.eclipse.is-far .wx { opacity: 0.45; }
.e-kind { font-size: 0.76rem; font-weight: 620; font-stretch: 80%; color: var(--label); }
.e-date { font-size: 1.5rem; font-weight: 800; font-stretch: 68%; line-height: 1; }
.e-facts { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 0.8rem; font-weight: 560; font-stretch: 84%; color: var(--label); }
.e-facts b { color: var(--ink); font-weight: 760; }
.eclipse-now { box-shadow: var(--edge), inset 0 0 0 2px var(--ochre); }

/* ---------------------------------------------------------------- Stazione */

.sensor-list li { display: flex; flex-wrap: wrap; gap: 2px 14px; padding: 9px 0; border-top: 1px solid var(--hair); font-size: 0.84rem; font-stretch: 86%; }
.sensor-list li:first-child { border-top: 0; }
.sensor-list b { font-weight: 760; flex-basis: 100%; font-size: 1rem; font-stretch: 80%; }
.sensor-list span { color: var(--label); }
.cals { display: grid; gap: var(--gap); }
.cal-card { padding: 14px; display: grid; gap: 8px; align-content: start; }
.cal-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-head b { font-size: 1.2rem; font-weight: 800; font-stretch: 70%; }
.mae-row { display: grid; grid-template-columns: 3.4rem minmax(0, 1fr) 4.8rem; gap: 8px; align-items: center; font-size: 0.76rem; font-weight: 560; font-stretch: 80%; color: var(--label); }
.mae-row b { text-align: right; font-size: 1rem; font-weight: 780; font-stretch: 70%; color: var(--ink); white-space: nowrap; }
.mae { display: block; height: 8px; border-radius: 4px; background: var(--track); overflow: hidden; }
.mae i { display: block; height: 100%; border-radius: 4px; background: var(--label); }
.mae .mae-good { background: var(--mint); }
.cal-foot { font-size: 0.72rem; color: var(--label); font-stretch: 84%; }

/* ---------------------------------------------------------------- Avvisi */

.alert { padding: 12px 0; border-top: 1px solid var(--hair); }
.alert:first-child { border-top: 0; padding-top: 2px; }
.alert-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 0.78rem; font-weight: 560; font-stretch: 84%; color: var(--label); }
.alert-when { margin-left: auto; }
.alert-title { margin-top: 6px; font-size: 1.45rem; font-weight: 800; font-stretch: 70%; line-height: 1.05; }
.alert-detail, .alert-plants { margin-top: 4px; font-size: 0.9rem; color: var(--label); max-width: 60ch; }
.alert-past .alert-title { font-size: 1.1rem; font-weight: 700; }

/* ---------------------------------------------------------------- login */

.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: grid; gap: 8px; padding: 26px 22px 22px; }
.login-card h1 { font-size: 3.4rem; margin-bottom: 12px; }
.login-card label { font-size: 0.78rem; font-weight: 620; font-stretch: 84%; color: var(--label); margin-top: 4px; }
.login-card .btn { margin-top: 12px; min-height: 50px; font-size: 1rem; }
.noscript { margin: 20vh auto; max-width: 30ch; padding: 16px; background: #121315; color: #f0ebe3; border-radius: 16px; }

/* ---------------------------------------------------------------- wider */

@media (min-width: 520px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-wide { grid-column: span 2; }
  .totals { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .weights li { grid-template-columns: 4.4rem 1fr 2.8rem 8.5rem; }
  .w-run { display: block; }
  .records { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .record:last-child:nth-child(odd) { grid-column: auto; }
  .eclipses, .cals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hours li { flex-basis: 64px; }
}

@media (min-width: 720px) {
  :root { --gap: 12px; --pad: 20px; }
  .app { padding: var(--gap) max(var(--gap), calc((100vw - 1040px) / 2)) 32px; display: grid; grid-template-columns: auto 1fr; gap: var(--gap); align-items: center; }
  .top { display: flex; align-items: baseline; gap: 14px; padding: 6px var(--pad); min-height: 60px; }
  .nav { position: static; display: flex; flex-wrap: wrap; gap: 2px; min-width: 0; background: var(--frost); }
  .nav a, .nav button, .nav-extra a, .nav-extra button { flex-direction: row; gap: 7px; width: auto; min-height: 50px; padding: 0 11px; font-size: 0.86rem; font-stretch: 84%; }
  .nav-more-btn { display: none !important; }
  .nav-extra, .nav-tools { display: contents; }
  .nav-tools button:first-child { margin-left: auto; }
  .nav-tools button span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .app::after { display: none; }
  main#main { grid-column: 1 / -1; min-width: 0; }
  .sky-window { height: 110px; }
  .app[data-view="adesso"] .sky-window { height: max(170px, 24vh); }
  .now-grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: var(--gap); align-items: start; }
  .now-grid > .strip, .now-grid > .next { grid-column: 1 / -1; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tile-wide { grid-column: 1 / -1; }
  .hero-temp .fig { font-size: clamp(7rem, 13vw, 12rem); }
  .hero-icon { width: clamp(72px, 9vw, 128px); }
  .hours li { flex: 1 0 60px; }
  .day { grid-template-columns: 5rem 40px 7rem minmax(8rem, 1fr) 6rem 6rem 3.4rem; grid-template-areas: "name icon cond temp rain wind uv" "name icon cond wall rain wind uv"; gap: 2px 14px; }
  .d-cond { display: block; grid-area: cond; font-size: 0.9rem; font-weight: 560; font-stretch: 84%; color: var(--label); }
  .d-uv { display: block; grid-area: uv; font-size: 0.8rem; color: var(--label); font-stretch: 84%; text-align: right; }
  .d-rain small { display: inline; margin-left: 4px; }
  .phases { gap: 12px; }
}

@media (min-width: 900px) {
  .split { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .month-charts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .months { display: none; }
  .tbl-wrap { display: block; margin-top: 12px; }
  .records { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .eclipses, .cals { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1100px) {
  :root { --gap: 14px; --pad: 22px; }
  .app { display: block; padding: var(--gap) max(var(--gap), calc((100vw - 1560px) / 2)) 40px; padding-left: calc(232px + max(var(--gap), (100vw - 1560px) / 2)); }
  .top, .nav { position: fixed; left: max(var(--gap), calc((100vw - 1560px) / 2)); width: 218px; }
  .top { top: var(--gap); display: grid; gap: 0; padding: 14px var(--pad) 16px; }
  .brand { font-size: 2.2rem; min-height: 44px; }
  .nav { top: calc(var(--gap) + 110px); bottom: var(--gap); display: flex; flex-direction: column; flex-wrap: nowrap; gap: 2px; padding: 8px; overflow-y: auto; }
  .nav a, .nav button, .nav-extra a, .nav-extra button { justify-content: flex-start; gap: 12px; width: 100%; min-height: 48px; padding: 0 14px; font-size: 1.02rem; font-stretch: 84%; }
  .nav-extra .count { margin-left: auto; }
  .nav-tools { display: grid; margin-top: auto; border-top: 1px solid var(--hair); padding-top: 6px; }
  .nav-tools button:first-child { margin-left: 0; }
  .nav-tools button span { position: static; width: auto; height: auto; clip-path: none; }
  .sky-window { height: 120px; }
  .app[data-view="adesso"] .sky-window { height: max(190px, 25vh); }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tile-wide { grid-column: span 2; }
  #hs-body { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  #hs-body > .state, #hs-body > .note { grid-column: 1 / -1; }
  h1 { font-size: 3.4rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}
