/* Meteo Pozzonovo – dashboard /modern
   Nessuna libreria esterna, nessun font esterno. Tema scuro/chiaro con variabili CSS. */

:root {
  color-scheme: dark;
  --bg: #0a1020; --bg2: #0e1629; --card: #111b30; --card2: #162340; --line: #22314f; --line2: #2d3f64;
  --txt: #e9eefb; --mut: #9fb0cf; --dim: #70829f;
  --acc: #38bdf8; --acc2: #818cf8; --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --info: #60a5fa;
  --c-temp: #fb923c; --c-dew: #38bdf8; --c-hum: #2dd4bf; --c-press: #a78bfa; --c-wind: #34d399; --c-gust: #f472b6; --c-rain: #60a5fa; --c-rain2: #fbbf24;
  --radius: 16px; --shadow: 0 10px 30px rgba(0, 0, 0, .28);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef3fa; --bg2: #e4ecf7; --card: #ffffff; --card2: #f3f7fd; --line: #d6e0ee; --line2: #c3d1e6;
  --txt: #0f1b33; --mut: #4b5f82; --dim: #6b7d9c;
  --acc: #0284c7; --acc2: #4f46e5; --ok: #059669; --warn: #b45309; --bad: #dc2626; --info: #2563eb;
  --c-temp: #ea580c; --c-dew: #0284c7; --c-hum: #0d9488; --c-press: #7c3aed; --c-wind: #059669; --c-gust: #db2777; --c-rain: #2563eb; --c-rain2: #b45309;
  --shadow: 0 8px 24px rgba(30, 50, 90, .10);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); background: var(--bg); color: var(--txt); line-height: 1.45; min-height: 100vh; display: flex; flex-direction: column;
  background-image: radial-gradient(1200px 500px at 85% -10%, color-mix(in srgb, var(--acc2) 14%, transparent), transparent 60%), radial-gradient(900px 420px at -10% -5%, color-mix(in srgb, var(--acc) 12%, transparent), transparent 60%);
  background-attachment: fixed; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; border-radius: 6px; }
.num, .mono { font-variant-numeric: tabular-nums; }
.wrap { width: 100%; max-width: 1240px; margin: 0 auto; padding: 0 16px; }
main.wrap { flex: 1; padding-top: 18px; padding-bottom: 36px; display: flex; flex-direction: column; gap: 18px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--mut); } .dim { color: var(--dim); }
.small { font-size: 12px; } .tiny { font-size: 11px; }
.right { text-align: right; } .center { text-align: center; }
.hidden { display: none !important; }

/* ---------- Header ---------- */
.topbar { position: sticky; top: 0; z-index: 50; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.topbar .wrap { display: flex; align-items: center; gap: 14px; padding-top: 10px; padding-bottom: 10px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--txt); min-width: 0; }
.brand:hover { text-decoration: none; }
.brand .logo { width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--acc), var(--acc2)); display: grid; place-items: center; color: #fff; flex: none; }
.brand b { font-size: 17px; letter-spacing: -.01em; display: block; line-height: 1.1; }
.brand small { color: var(--mut); font-size: 11px; display: block; }
.spacer { flex: 1; }
.pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; padding: 5px 10px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card); color: var(--mut); white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--dim); flex: none; }
.pill.on .dot { background: var(--ok); box-shadow: 0 0 0 0 color-mix(in srgb, var(--ok) 60%, transparent); animation: ping 2.2s infinite; }
.pill.off .dot { background: var(--bad); }
.pill.busy .dot { background: var(--acc); }
@keyframes ping { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.clock { font-variant-numeric: tabular-nums; font-size: 13px; color: var(--mut); text-align: right; line-height: 1.15; }
.clock b { color: var(--txt); font-size: 15px; display: block; }
.ctl { display: flex; gap: 8px; align-items: center; }
select, input[type=date], input[type=text] { font: inherit; font-size: 13px; color: var(--txt); background: var(--card); border: 1px solid var(--line2); border-radius: 10px; padding: 6px 9px; }
.btn { font: inherit; font-size: 13px; color: var(--txt); background: var(--card); border: 1px solid var(--line2); border-radius: 10px; padding: 6px 11px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px; }
.btn:hover { border-color: var(--acc); text-decoration: none; }
.btn.icon { padding: 6px 8px; }
.btn.primary { background: var(--acc); border-color: var(--acc); color: #04121f; font-weight: 600; }

.nav { border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg2) 70%, transparent); }
.nav .wrap { display: flex; gap: 6px; overflow-x: auto; padding-top: 8px; padding-bottom: 8px; scrollbar-width: none; }
.nav .wrap::-webkit-scrollbar { display: none; }
.nav a { color: var(--mut); font-size: 13px; padding: 7px 13px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.nav a:hover { color: var(--txt); text-decoration: none; background: var(--card); }
.nav a[aria-current="page"] { color: var(--txt); background: var(--card); border-color: var(--line2); font-weight: 600; }

/* ---------- Layout ---------- */
.grid { display: grid; gap: 16px; }
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow); min-width: 0; position: relative; }
.card > h2, .card-h { margin: 0 0 12px; font-size: 12px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--mut); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.card-h .tag { font-size: 11px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--dim); }
.section-title { margin: 6px 0 -4px; font-size: 20px; letter-spacing: -.01em; display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.section-title small { font-size: 12px; color: var(--mut); font-weight: 400; }

.big { font-size: 44px; font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.big small { font-size: 18px; font-weight: 600; color: var(--mut); letter-spacing: 0; margin-left: 3px; }
.kv { display: grid; gap: 7px; font-size: 13px; }
.kv > div { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-bottom: 1px dashed var(--line); padding-bottom: 6px; }
.kv > div:last-child { border-bottom: 0; padding-bottom: 0; }
.kv span { color: var(--mut); } .kv b { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line2); color: var(--mut); background: var(--card2); }
.badge.ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.badge.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); }
.badge.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 45%, transparent); background: color-mix(in srgb, var(--bad) 10%, transparent); }
.badge.info { color: var(--info); border-color: color-mix(in srgb, var(--info) 45%, transparent); background: color-mix(in srgb, var(--info) 10%, transparent); }
.up { color: var(--ok); } .down { color: var(--warn); } .hot { color: var(--c-temp); } .cold { color: var(--info); }

/* ---------- Hero ---------- */
.hero { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 20px; padding: 20px; background: linear-gradient(135deg, color-mix(in srgb, var(--card) 92%, var(--acc)) 0%, var(--card) 55%); }
.hero .temp { font-size: 76px; font-weight: 700; letter-spacing: -.04em; line-height: .95; font-variant-numeric: tabular-nums; }
.hero .temp small { font-size: 28px; color: var(--mut); font-weight: 600; margin-left: 4px; letter-spacing: 0; }
.hero .sum { margin: 10px 0 14px; font-size: 15px; color: var(--txt); }
.hero .stamp { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; font-size: 12px; color: var(--mut); margin-bottom: 10px; }
.hero .mini { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.hero .mini div { background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.hero .mini span { display: block; font-size: 11px; color: var(--mut); text-transform: uppercase; letter-spacing: .06em; }
.hero .mini b { font-size: 19px; font-variant-numeric: tabular-nums; }
.hero .mini em { font-style: normal; font-size: 12px; color: var(--mut); }
.hero-chart { display: flex; flex-direction: column; min-width: 0; }
.hero-chart .hc-h { display: flex; justify-content: space-between; font-size: 12px; color: var(--mut); margin-bottom: 4px; }
.hero-chart svg { width: 100%; height: 150px; display: block; }

/* ---------- Avvisi ---------- */
.alerts { display: grid; gap: 10px; }
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line2); background: var(--card); }
.alert .ic { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; flex: none; font-size: 15px; }
.alert b { display: block; font-size: 14px; } .alert span { font-size: 13px; color: var(--mut); }
.alert.info { border-color: color-mix(in srgb, var(--info) 45%, var(--line)); } .alert.info .ic { background: color-mix(in srgb, var(--info) 18%, transparent); color: var(--info); }
.alert.warn { border-color: color-mix(in srgb, var(--warn) 55%, var(--line)); } .alert.warn .ic { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.alert.alert { border-color: color-mix(in srgb, var(--bad) 65%, var(--line)); background: color-mix(in srgb, var(--bad) 8%, var(--card)); } .alert.alert .ic { background: color-mix(in srgb, var(--bad) 20%, transparent); color: var(--bad); }
.noalert { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--mut); padding: 4px 2px; flex-wrap: wrap; }

/* ---------- Strumenti (compass, anelli, archi) ---------- */
.compass { width: 132px; height: 132px; flex: none; }
.compass .ring { fill: none; stroke: var(--line2); stroke-width: 1.5; }
.compass .tick { stroke: var(--line2); stroke-width: 1; }
.compass text { fill: var(--mut); font-size: 11px; font-weight: 700; text-anchor: middle; dominant-baseline: central; }
.compass .needle { transition: transform .8s cubic-bezier(.2, .8, .2, 1); transform-origin: 66px 66px; }
.row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.row.top { align-items: flex-start; }
.ring { width: 96px; height: 96px; flex: none; }
.ring .bg { fill: none; stroke: var(--line2); stroke-width: 9; }
.ring .fg { fill: none; stroke: var(--c-hum); stroke-width: 9; stroke-linecap: round; transform: rotate(-90deg); transform-origin: 50% 50%; transition: stroke-dasharray .6s; }
.ring text { fill: var(--txt); font-size: 21px; font-weight: 700; text-anchor: middle; dominant-baseline: central; font-variant-numeric: tabular-nums; }
.sunarc { width: 100%; height: 92px; display: block; }
.sunarc .path { fill: none; stroke: var(--line2); stroke-width: 2; stroke-dasharray: 3 5; }
.sunarc .done { fill: none; stroke: var(--warn); stroke-width: 3; stroke-linecap: round; }
.moonsvg { width: 70px; height: 70px; flex: none; }
.spark { width: 100%; height: 46px; display: block; margin-top: 8px; }
.bar { height: 7px; border-radius: 99px; background: var(--card2); overflow: hidden; border: 1px solid var(--line); }
.bar > i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--acc), var(--acc2)); }

/* ---------- Tab ---------- */
.tabs { display: inline-flex; background: var(--card2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; gap: 2px; flex-wrap: wrap; }
.tabs button, .tabs a { font: inherit; font-size: 12px; font-weight: 600; color: var(--mut); background: transparent; border: 0; padding: 6px 12px; border-radius: 9px; cursor: pointer; }
.tabs a:hover { text-decoration: none; color: var(--txt); }
.tabs .on, .tabs [aria-selected="true"], .tabs a[aria-current] { background: var(--card); color: var(--txt); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }

/* ---------- Tabelle ---------- */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 9px 12px; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
th:first-child, td:first-child { text-align: left; }
thead th { position: sticky; top: 0; background: var(--card2); color: var(--mut); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; border-bottom: 1px solid var(--line); }
tbody tr { border-bottom: 1px solid var(--line); }
tbody tr:last-child { border-bottom: 0; }
tbody tr:hover { background: color-mix(in srgb, var(--acc) 6%, transparent); }
tfoot td { font-weight: 700; background: var(--card2); border-top: 1px solid var(--line2); }
td.hi { color: var(--c-temp); font-weight: 700; } td.lo { color: var(--info); font-weight: 700; } td.wet { color: var(--c-rain); font-weight: 700; }
.anom-pos { color: var(--c-temp); } .anom-neg { color: var(--info); }
.comfort-line { margin: 12px 0 0; }
.comfort-line .badge[hidden] { display: none; }
#anom-big.anom-pos span, #anom-big.anom-neg span { color: inherit; }

/* ---------- Grafici ---------- */
.chart { margin-top: 4px; }
.chart + .chart { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.chart-h { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; flex-wrap: wrap; margin-bottom: 4px; min-height: 26px; }
.chart-h .ttl { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--mut); }
.chart-h .chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line2); background: var(--card2); cursor: pointer; user-select: none; color: var(--txt); font-variant-numeric: tabular-nums; }
.chip i { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.chip b { font-weight: 700; } .chip em { font-style: normal; color: var(--mut); font-size: 11px; }
.chip.off { opacity: .4; text-decoration: line-through; }
.chart-time { font-size: 12px; color: var(--mut); font-variant-numeric: tabular-nums; }
.chart svg { width: 100%; display: block; touch-action: pan-y; overflow: visible; }
.chart .grid-l { stroke: var(--line); stroke-width: 1; }
.chart .axis-t { fill: var(--dim); font-size: 10.5px; font-variant-numeric: tabular-nums; }
.chart .cursor { stroke: var(--mut); stroke-width: 1; stroke-dasharray: 3 3; }
.chart .zero { stroke: var(--info); stroke-width: 1; stroke-dasharray: 4 4; opacity: .7; }
.chart-empty { padding: 36px 8px; text-align: center; color: var(--dim); font-size: 13px; }

/* ---------- Previsioni ---------- */
.days { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 12px 8px; text-align: center; display: flex; flex-direction: column; gap: 4px; align-items: center; }
.day.today { border-color: var(--acc); }
.day .dn { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--mut); }
.day .wi { width: 38px; height: 38px; } .day .tt { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; } .day .tt span { color: var(--mut); font-weight: 500; }
.day .pp { font-size: 12px; color: var(--c-rain); font-variant-numeric: tabular-nums; } .day .ww { font-size: 11px; color: var(--dim); }
.wi { color: var(--txt); } .wi .sun { color: var(--warn); } .wi .cl { color: var(--mut); } .wi .rn { color: var(--c-rain); } .wi .sn { color: #bfe3ff; } .wi .th { color: var(--warn); }

/* ---------- Varie ---------- */
.radar { position: relative; border-radius: 12px; overflow: hidden; background: var(--card2); border: 1px solid var(--line); min-height: 380px; display: grid; place-items: center; }
.radar iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.quake { display: flex; justify-content: space-between; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px dashed var(--line); font-size: 13px; }
.quake:last-child { border-bottom: 0; }
.quake .mag { font-weight: 700; color: var(--warn); border: 1px solid color-mix(in srgb, var(--warn) 45%, transparent); background: color-mix(in srgb, var(--warn) 10%, transparent); border-radius: 9px; padding: 2px 8px; font-variant-numeric: tabular-nums; flex: none; }
dialog { background: var(--card); color: var(--txt); border: 1px solid var(--line2); border-radius: 16px; padding: 0; width: min(560px, 92vw); box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(2, 8, 20, .6); }
dialog .dh { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
dialog .db { padding: 14px 16px; max-height: 60vh; overflow: auto; }
footer.site { border-top: 1px solid var(--line); background: color-mix(in srgb, var(--bg2) 75%, transparent); color: var(--mut); font-size: 12px; }
footer.site .wrap { padding-top: 18px; padding-bottom: 22px; display: flex; flex-wrap: wrap; gap: 8px 22px; justify-content: space-between; }
.skeleton { background: linear-gradient(90deg, var(--card2), var(--line), var(--card2)); background-size: 200% 100%; animation: sk 1.4s infinite; border-radius: 8px; color: transparent !important; }
@keyframes sk { to { background-position: -200% 0; } }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; justify-content: space-between; }
.form-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.checks { display: flex; gap: 8px; flex-wrap: wrap; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; padding: 5px 10px; border: 1px solid var(--line2); border-radius: 999px; background: var(--card2); cursor: pointer; }
.checks input { accent-color: var(--acc); }
.recgrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.rec { background: var(--card2); border: 1px solid var(--line); border-radius: 14px; padding: 13px 14px; }
.rec span { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--mut); font-weight: 700; display: block; }
.rec b { font-size: 26px; letter-spacing: -.02em; font-variant-numeric: tabular-nums; display: block; margin-top: 2px; }
.rec em { font-style: normal; font-size: 12px; color: var(--mut); }
.note { font-size: 12px; color: var(--dim); }
.print-only { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 860px) {
  .hero { grid-template-columns: 1fr; padding: 16px; }
  .hero .temp { font-size: 64px; }
  .days { grid-template-columns: repeat(auto-fit, minmax(92px, 1fr)); }
  .clock { display: none; }
}
@media (max-width: 520px) {
  .wrap { padding: 0 12px; }
  .brand small { display: none; }
  .big { font-size: 38px; }
  .hero .mini { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
  .hero .mini b { font-size: 16px; }
  .card { padding: 14px; }
  .chart-h .chips .chip { font-size: 11px; padding: 2px 7px; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } html { scroll-behavior: auto; } }
@media print {
  body { background: #fff; color: #000; display: block; }
  .topbar, .nav, footer.site, .no-print, .tabs, .toolbar { display: none !important; }
  .card { box-shadow: none; border: 1px solid #999; break-inside: avoid; background: #fff; }
  .print-only { display: block; }
  th, td { padding: 3px 6px; font-size: 10px; color: #000; } thead th { background: #eee !important; color: #000; position: static; }
  main.wrap { padding: 0; } a { color: #000; }
}

/* ---------- Correzioni, archivio esteso ---------- */
.warn-t { color: var(--warn); }
td.corr { position: relative; color: var(--warn); }
td.corr::after { content: "✎"; font-size: 9px; position: absolute; top: 3px; right: 3px; opacity: .8; }
.corr-dot { color: var(--warn); }
tr.excl td { opacity: .45; text-decoration: line-through; }
tr.excl td.ed-col { opacity: 1; text-decoration: none; }
.editbar { display: grid; gap: 10px; background: color-mix(in srgb, var(--warn) 10%, var(--card)); border: 1px solid color-mix(in srgb, var(--warn) 45%, var(--line)); border-radius: 14px; padding: 12px 14px; font-size: 13px; }
.editbar code { background: var(--card2); padding: 1px 5px; border-radius: 5px; }
.ed-msg { min-height: 1.2em; font-size: 12px; } .ed-msg.err { color: var(--bad); } .ed-msg.ok { color: var(--ok); }
.cell-in { width: 64px; font: inherit; font-variant-numeric: tabular-nums; text-align: right; background: var(--bg2); color: var(--txt); border: 1px solid var(--line2); border-radius: 7px; padding: 3px 5px; }
.cell-in.chg { border-color: var(--warn); box-shadow: 0 0 0 2px color-mix(in srgb, var(--warn) 25%, transparent); }
.ed-col label { white-space: nowrap; cursor: pointer; } .ed-reset { padding: 2px 7px; }

/* ---------- Calendari e matrici ---------- */
.cal-month { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-h { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); text-align: center; padding-bottom: 2px; }
.cal-d { display: flex; flex-direction: column; justify-content: space-between; min-height: 52px; padding: 4px 6px; border-radius: 9px; background: var(--card2); color: var(--txt); text-decoration: none !important; border: 1px solid transparent; }
a.cal-d:hover { border-color: var(--txt); }
.cal-d i { font-style: normal; font-size: 10px; opacity: .85; } .cal-d b { font-size: 14px; text-align: right; font-variant-numeric: tabular-nums; }
.cal-n { opacity: .4; } .cal-e { min-height: 0; }
.cal-leg { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; margin-top: 10px; font-size: 11px; color: var(--mut); }
.cal-leg span { display: inline-flex; align-items: center; gap: 4px; } .cal-leg i { width: 14px; height: 10px; border-radius: 3px; display: inline-block; } .cal-leg em { font-style: normal; color: var(--dim); }
table.mx td, table.mx th { text-align: center; padding: 6px 4px; font-size: 12px; min-width: 38px; }
table.mx td:first-child, table.mx th:first-child { text-align: left; padding-left: 10px; }
.mx-c { font-variant-numeric: tabular-nums; font-weight: 600; } .mx-c a { text-decoration: none !important; display: block; } .mx-n { color: var(--dim); }
#a-rose svg text { font-family: var(--font); }
@media (max-width: 520px) { .cal-d { min-height: 44px; padding: 3px 4px; } .cal-d b { font-size: 12px; } }
.radar-big { display: flex; height: clamp(420px, calc(100vh - 260px), 900px); background: var(--card2); }
.radar-big iframe { width: 100%; height: 100%; border: 0; display: block; }
.radar-big:fullscreen { height: 100vh; background: #000; }
.split-year { display: grid; gap: 16px; grid-template-columns: minmax(0, 1fr) 340px; }
@media (max-width: 1100px) { .split-year { grid-template-columns: minmax(0, 1fr); } }

/* ---------- Campi di testo (admin, setup) ---------- */
input[type=text], input[type=password], input[type=date], input[type=number] { font: inherit; font-size: 14px; color: var(--txt); background: var(--card2); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 11px; max-width: 100%; }
input[type=text]:focus, input[type=password]:focus, input[type=date]:focus { outline: 2px solid var(--acc); outline-offset: 1px; }
form.card label { font-size: 13px; line-height: 1.5; }

[hidden] { display: none !important; }

/* ---- pagina Confronti ---- */
.cmp { display: grid; gap: 16px; margin-top: 16px; }
.cmp .ctl { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.cmp svg { display: block; max-width: 100%; overflow: visible; }
.cmp svg text.ax { fill: var(--mut); font-size: 11px; font-variant-numeric: tabular-nums; }
.cmp .gridl line { stroke: var(--line); stroke-width: 1; }
.cmp .axl { stroke: var(--line2); stroke-width: 1; }
.cmp .normln { stroke: var(--mut); stroke-width: 1.5; stroke-dasharray: 5 4; }
.cmp .cursor { stroke: var(--mut); stroke-width: 1; stroke-dasharray: 3 3; }
.cmp .stripe { shape-rendering: crispEdges; }
.lgrow { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 8px; align-items: center; }
.lgrow .lg { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; color: var(--txt); background: var(--card2); border: 1px solid var(--line2); border-radius: 999px; padding: 3px 10px; cursor: pointer; font-variant-numeric: tabular-nums; }
.lgrow .lg i { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }
.lgrow .lg.off { opacity: .45; text-decoration: line-through; }
.lgrow .lgn { cursor: default; color: var(--mut); }
.lgrow .lgn i.dash { height: 0; border-top: 2px dashed var(--mut); background: none; border-radius: 0; }
.cmp .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 7px; vertical-align: -1px; }
.cmp .tag-h, .cmp .tag-c { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 1px 6px; border-radius: 999px; margin-left: 4px; }
.cmp .tag-h { color: var(--c-temp); border: 1px solid color-mix(in srgb, var(--c-temp) 45%, transparent); }
.cmp .tag-c { color: var(--info); border: 1px solid color-mix(in srgb, var(--info) 45%, transparent); }
.cmp-tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); color: var(--txt); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; font-size: 12px; box-shadow: 0 6px 24px rgba(0, 0, 0, .35); min-width: 150px; max-width: 260px; }
.cmp-tip[hidden] { display: none; }
.cmp-tip > b { display: block; margin-bottom: 4px; }
.cmp-tip div { display: flex; align-items: center; gap: 6px; justify-content: space-between; }
.cmp-tip div i { width: 10px; height: 4px; border-radius: 2px; flex: none; }
.cmp-tip div b { margin-left: auto; font-variant-numeric: tabular-nums; }
.cmp-tip .nn { color: var(--mut); border-top: 1px dashed var(--line2); margin-top: 3px; padding-top: 3px; }

/* ---- eventi e record recenti ---- */
.hl { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.hl li { display: grid; grid-template-columns: 92px 1fr; gap: 10px; align-items: start; font-size: 13px; border-bottom: 1px dashed var(--line); padding-bottom: 8px; }
.hl li:last-child { border-bottom: 0; padding-bottom: 0; }
.hl-when { color: var(--mut); font-variant-numeric: tabular-nums; font-size: 12px; padding-top: 1px; }
.hl em { display: block; font-style: normal; color: var(--mut); font-size: 12px; margin-top: 1px; }

th.l, td.l { text-align: left !important; }

/* ---- tema a tre stati e pulsante di installazione ---- */
#theme-toggle svg { display: none; }
#theme-toggle[data-mode="auto"] .ti-auto, #theme-toggle[data-mode="light"] .ti-light, #theme-toggle[data-mode="dark"] .ti-dark { display: inline; }
#theme-toggle:not([data-mode]) .ti-auto { display: inline; }
.linkbtn { font: inherit; color: var(--acc); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: none; }
.linkbtn:hover { text-decoration: underline; }
.linkbtn[hidden], #app-install-sep[hidden] { display: none; }

/* ---- widget da incorporare ---- */
.embed { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.embed-opts { display: grid; gap: 12px; }
.embed-opts label { display: grid; gap: 4px; font-size: 12px; color: var(--mut); font-weight: 600; }
.embed-opts textarea { font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; color: var(--txt); background: var(--card2); border: 1px solid var(--line2); border-radius: 10px; padding: 8px 10px; resize: vertical; width: 100%; }
.embed-prev { min-height: 240px; }
@media (max-width: 760px) { .embed { grid-template-columns: 1fr; } }

/* ---- modalità schermo (TV / monitor) ---- */
body.screen { margin: 0; min-height: 100vh; overflow: hidden; background: var(--bg); }
.scr { height: 100vh; height: 100dvh; padding: clamp(10px, 2vw, 32px); display: grid; grid-template-rows: auto auto 1fr auto; gap: clamp(8px, 1.4vw, 20px); transition: transform 2s; }
.scr-h { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; }
.scr-name b { display: block; font-size: clamp(18px, 2.4vw, 40px); letter-spacing: -.02em; }
.scr-name span, .scr-clock span { color: var(--mut); font-size: clamp(11px, 1.2vw, 20px); }
.scr-clock { text-align: center; } .scr-clock b { display: block; font-size: clamp(28px, 4.6vw, 80px); font-variant-numeric: tabular-nums; letter-spacing: -.02em; line-height: 1; }
.scr-st { display: flex; gap: 8px; justify-content: flex-end; align-items: center; transition: opacity .6s; }
body.idle .scr-st .btn { opacity: 0; pointer-events: none; } body.idle { cursor: none; }
.scr-alert { padding: 10px 16px; border-radius: 14px; font-size: clamp(14px, 1.6vw, 26px); border: 1px solid var(--line2); background: var(--card2); }
.scr-alert.warn { border-color: var(--warn); } .scr-alert.alert { border-color: var(--bad); background: color-mix(in srgb, var(--bad) 14%, var(--card)); } .scr-alert.info { border-color: var(--info); }
.scr-grid { overflow: hidden; display: grid; grid-template-columns: repeat(6, 1fr); grid-auto-rows: 1fr; gap: clamp(8px, 1.4vw, 20px); min-height: 0; }
.scr-card { overflow: hidden; background: var(--card); border: 1px solid var(--line); border-radius: clamp(14px, 1.6vw, 26px); padding: clamp(12px, 1.8vw, 28px); display: flex; flex-direction: column; gap: clamp(4px, .8vw, 12px); grid-column: span 2; min-width: 0; }
.scr-temp { grid-column: span 4; grid-row: span 2; }
.scr-lab { text-transform: uppercase; letter-spacing: .08em; color: var(--mut); font-size: clamp(11px, 1.2vw, 20px); font-weight: 700; }
.scr-lab em { font-style: normal; text-transform: none; letter-spacing: 0; font-weight: 500; margin-left: 6px; }
.scr-big { font-size: clamp(56px, min(13vw, 25vh), 240px); font-weight: 700; letter-spacing: -.04em; line-height: .95; font-variant-numeric: tabular-nums; }
.scr-big small { font-size: .3em; color: var(--mut); font-weight: 600; margin-left: .08em; letter-spacing: 0; }
.scr-sum { font-size: clamp(14px, min(2vw, 3.4vh), 34px); color: var(--mut); }
.scr-sub { display: flex; gap: clamp(14px, 3vw, 56px); flex-wrap: wrap; }
.scr-sub > div > span { display: block; color: var(--mut); font-size: clamp(11px, 1.2vw, 20px); } .scr-sub b { font-size: clamp(20px, 2.8vw, 48px); font-variant-numeric: tabular-nums; }
.scr-sub .hot { color: var(--c-temp); } .scr-sub .cold { color: var(--info); } .scr-sub i { font-style: normal; font-size: .6em; color: var(--mut); }
.scr-spark { flex: 1 1 0; min-height: 50px; overflow: hidden; }
.scr-mid { font-size: clamp(30px, min(5.4vw, 11vh), 110px); font-weight: 700; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.scr-mid small { font-size: .32em; color: var(--mut); font-weight: 600; margin-left: .1em; letter-spacing: 0; }
.scr-note { color: var(--mut); font-size: clamp(12px, 1.5vw, 26px); } .scr-note b { color: var(--txt); font-variant-numeric: tabular-nums; } .scr-note i { font-style: normal; }
.scr-note.big { display: flex; gap: 18px; flex-wrap: wrap; color: var(--txt); }
.scr-row { display: flex; align-items: center; gap: clamp(8px, 1.6vw, 24px); }
.scr-compass { width: clamp(70px, 9vw, 150px); flex: none; } .scr-compass text { fill: var(--mut); font-size: 14px; font-weight: 700; }
.scr-f { display: flex; justify-content: space-between; color: var(--mut); font-size: clamp(10px, 1vw, 16px); }
@media (max-width: 900px) { body.screen { overflow: auto; } .scr { height: auto; } .scr-big { font-size: 22vw; } .scr-mid { font-size: 11vw; } .scr-grid { grid-template-columns: 1fr 1fr; } .scr-card, .scr-temp { grid-column: span 2; grid-row: auto; } .scr-card:not(.scr-temp) { grid-column: span 1; } .scr-grid { grid-auto-rows: auto; overflow: visible; } .scr-card:nth-child(2), .scr-card:nth-child(6) { grid-column: span 2; } .scr-note { overflow-wrap: anywhere; } .scr-h { grid-template-columns: 1fr; text-align: center; } .scr-st { justify-content: center; } }

/* ---- immagine da condividere ---- */
#dlg-share { max-width: min(96vw, 560px); width: 100%; }
#dlg-share .db { display: grid; gap: 12px; justify-items: center; }
#share-canvas { width: 100%; max-width: 420px; height: auto; border-radius: 14px; border: 1px solid var(--line2); background: #0a1020; }
.share-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }

/* Area amministrazione: schede */
.adm-tabs { display: flex; gap: 4px; flex-wrap: wrap; margin: 4px 0 14px; border-bottom: 1px solid var(--line); }
.adm-tabs a { padding: 8px 14px; font-size: 14px; color: var(--mut); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.adm-tabs a:hover { color: var(--txt); }
.adm-tabs a.on { color: var(--txt); border-bottom-color: var(--acc); font-weight: 600; }
