/* ====================================================================== *
 * AquaMente vNext — design system. Offline, zero dipendenze.
 * Estetica "greenhouse command center": verde/teal, calmo, leggibile.
 * Tokens ported from docs/mockups/aquamente-mobile-preview.html (Task 1).
 * ====================================================================== */

/* ===== §1 Design Tokens (:root) ===================================== */
:root {
  /* Background layers */
  --bg:  #0a1512;
  --bg2: #0b1a15;

  /* Panel layers */
  --panel:  #102019;
  --panel2: #13271f;
  --panel3: #163026;

  /* Borders / dividers */
  --line:  #1d3a2f;
  --line2: #26493b;

  /* Typography */
  --text:  #e9f5ef;
  --muted: #8aa79a;
  --dim:   #5e7a6e;

  /* Accent / brand */
  --accent:      #2ee6a6;
  --accent2:     #22d3ee;
  --accent-deep: #0f6f54;

  /* Status (canonical — must not change) */
  --ok:      #34d399;
  --warn:    #f5c451;
  --susp:    #f59e42;
  --crit:    #f4685f;
  --offline: #8b9aa0;

  /* Shape */
  --radius:    18px;
  --radius-sm: 12px;

  /* Elevation / glow */
  --shadow: 0 10px 30px rgba(0,0,0,.45);
  --glow:   0 0 0 1px rgba(46,230,166,.12), 0 0 24px rgba(46,230,166,.18);

  /* Typography */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* Easing */
  --ease: cubic-bezier(.22,.61,.36,1);

  /* ── Backward-compat aliases (pre-Task-1 names used by templates) ── */
  --bg-soft:   var(--bg2);
  --panel-2:   var(--panel2);
  --accent-dim: var(--accent-deep);
}

/* ===== §2 Reset / Base ============================================== */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  background: radial-gradient(1200px 600px at 80% -10%, #1a2a22 0%, var(--bg) 55%);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { font-weight: 650; letter-spacing: -.01em; margin: 0 0 .4em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ===== §3 Layout (desktop shell) ==================================== */
.topbar {
  display: flex; align-items: center; gap: 1.2rem;
  padding: .8rem 1.4rem; border-bottom: 1px solid var(--line);
  background: rgba(10,21,18,.7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: .55rem; font-weight: 750; font-size: 1.12rem; }
.brand .leaf { color: var(--accent); font-size: 1.3rem; }
.nav { display: flex; gap: .3rem; flex-wrap: wrap; }
.nav a {
  color: var(--muted); padding: .35rem .7rem; border-radius: 9px; font-size: .92rem;
}
.nav a:hover { background: var(--panel); color: var(--text); text-decoration: none; }
.nav a.active { background: var(--accent-deep); color: #eafff5; }
.topbar .spacer { flex: 1; }
.who { font-size: .85rem; color: var(--muted); }
.who b { color: var(--text); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 1.6rem 1.4rem 4rem; }

/* ===== §4 Semaphore banner ========================================== */
.semaphore {
  display: flex; align-items: center; gap: 1.1rem;
  padding: 1.1rem 1.3rem; border-radius: var(--radius);
  background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow);
  margin-bottom: 1.4rem;
}
.semaphore .dot {
  width: 54px; height: 54px; border-radius: 50%; flex: 0 0 auto;
  box-shadow: 0 0 0 6px rgba(255,255,255,.04), 0 0 22px var(--g, var(--ok));
  background: var(--g, var(--ok));
}
.semaphore .txt h2 { margin: 0; font-size: 1.35rem; }
.semaphore .meta { color: var(--muted); font-size: .92rem; }

/* Semaphore color modifiers */
.g-verde     { --g: var(--ok); }
.g-giallo    { --g: var(--warn); }
.g-arancione { --g: var(--susp); }
.g-grigio    { --g: var(--offline); }
.g-rosso     { --g: var(--crit); }

/* ===== §5 Cards grid ================================================ */
.grid { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }

/* .card — merged: keeps desktop styles, gains premium gradient from mockup */
.card {
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1rem 1.05rem;
  position: relative; overflow: hidden;
  transition: transform .12s var(--ease), border-color .12s;
}
.card::before {
  content: ""; position: absolute; inset: 0 0 auto 0; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(46,230,166,.4), transparent);
}
.card.link:hover { transform: translateY(-2px); border-color: var(--accent-deep); }
.card .head  { display: flex; align-items: center; justify-content: space-between; gap: .5rem; }
.card .label { font-weight: 600; }
.card .zone  { font-size: .78rem; color: var(--muted); }
.card .value { font-size: 2rem; font-weight: 700; margin: .3rem 0 .1rem; }
.card .unit  { font-size: 1rem; color: var(--muted); font-weight: 500; }
.card .sub   { font-size: .82rem; color: var(--muted); }

/* ===== §6 Status pills ============================================== */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .66rem; font-weight: 700; padding: .16rem .5rem;
  border-radius: 999px; text-transform: uppercase; letter-spacing: .04em;
  flex: 0 0 auto;
}
.pill::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: currentColor; box-shadow: 0 0 6px currentColor;
}

/* Mockup pill variants (mobile) */
.p-ok   { color: var(--ok);      background: rgba(52,211,153,.12); }
.p-warn { color: var(--warn);    background: rgba(245,196,81,.12); }
.p-crit { color: var(--crit);    background: rgba(244,104,95,.14); }
.p-off  { color: var(--offline); background: rgba(139,154,160,.14); }

/* Desktop pill variants (keep existing templates working) */
.lv-ok         { color: var(--ok);      background: rgba(52,211,153,.12); }
.lv-attenzione { color: var(--warn);    background: rgba(245,196,81,.12); }
.lv-sospetto   { color: var(--susp);    background: rgba(245,158,66,.12); }
.lv-offline    { color: var(--offline); background: rgba(139,154,160,.14); }
.lv-critico    { color: var(--crit);    background: rgba(244,104,95,.14); }

/* ===== §7 Sections / panels ========================================= */
.section { margin-top: 1.8rem; }
.section > h3 { display: flex; align-items: center; gap: .5rem; }
.panel {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem 1.2rem; box-shadow: var(--shadow);
}

/* ===== §8 Buttons =================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: .4rem; cursor: pointer; font-family: inherit;
  background: var(--panel3); color: var(--text); border: 1px solid var(--line2);
  padding: .6rem .95rem; border-radius: 11px;
  font-size: .85rem; font-weight: 650;
  transition: transform .1s var(--ease), background .2s, border-color .12s;
}
.btn:hover  { background: var(--panel2); border-color: var(--accent-deep); text-decoration: none; }
.btn:active { transform: scale(.95); }
.btn.primary {
  background: linear-gradient(180deg, #1aa37a, var(--accent-deep));
  border-color: transparent; color: #eafff6; box-shadow: var(--glow);
}
.btn.primary:hover { background: linear-gradient(180deg, #1bb882, #126050); }
.btn.ghost  { background: transparent; }
.btn.block  { width: 100%; padding: .85rem; }
.btn.danger { color: #ffd9d6; background: #5a2521; border-color: #7a352f; }
.btn-row    { display: flex; gap: .5rem; flex-wrap: wrap; }

/* ===== §9 Tables ==================================================== */
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: .5rem .6rem; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: 600; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; }
tr:hover td { background: rgba(255,255,255,.02); }

/* ===== §10 Alerts list ============================================== */
.alert-item { display: flex; gap: .8rem; padding: .7rem 0; border-bottom: 1px solid var(--line); }
.alert-item:last-child { border-bottom: 0; }
.alert-item .bar { width: 4px; border-radius: 3px; flex: 0 0 auto; background: var(--muted); }
.alert-item.l-critico    .bar { background: var(--crit); }
.alert-item.l-attenzione .bar { background: var(--warn); }
.alert-item.l-offline    .bar { background: var(--offline); }
.alert-item.l-sospetto   .bar { background: var(--susp); }
.alert-item .msg { font-weight: 600; }
.alert-item .exp { color: var(--muted); font-size: .86rem; }
.alert-item .act { color: var(--accent); font-size: .84rem; margin-top: .15rem; }

/* ===== §11 Charts =================================================== */
.chart-box { position: relative; }
canvas.chart { width: 100%; height: 260px; display: block; }

/* ===== §12 Forms ==================================================== */
.field { margin-bottom: .9rem; }
.field label { display: block; font-size: .82rem; color: var(--muted); margin-bottom: .25rem; }
.field input, .field select {
  width: 100%; padding: .55rem .7rem; border-radius: 9px;
  background: var(--bg2); border: 1px solid var(--line2);
  color: var(--text); font-size: .95rem; font-family: inherit;
}
.field input:focus, .field select:focus {
  outline: none; border-color: var(--accent-deep); box-shadow: var(--glow);
}
.notice { padding: .7rem .9rem; border-radius: 10px; font-size: .88rem; border: 1px solid var(--line); }
.notice.warn   { background: rgba(245,196,81,.08);  border-color: #5a4d24; }
.notice.danger { background: rgba(244,104,95,.08);  border-color: #6e302b; }
.notice.ok     { background: rgba(52,211,153,.07);  border-color: var(--accent-deep); }

/* ===== §13 Misc helpers ============================================= */
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv .k { color: var(--muted); }
.flex { display: flex; gap: 1rem; flex-wrap: wrap; }
.flex > * { flex: 1 1 320px; }
.tag { font-size: .72rem; padding: .12rem .45rem; border-radius: 6px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
footer.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 2rem 0 1rem; }

/* ===== §14 Stagger animation container ============================== */
.stagger > * { opacity: 0; animation: cardIn .5s var(--ease) forwards; }
.stagger > *:nth-child(1) { animation-delay: .04s; }
.stagger > *:nth-child(2) { animation-delay: .10s; }
.stagger > *:nth-child(3) { animation-delay: .16s; }
.stagger > *:nth-child(4) { animation-delay: .22s; }
.stagger > *:nth-child(5) { animation-delay: .28s; }
.stagger > *:nth-child(6) { animation-delay: .34s; }

/* ===== §15 Skeleton loader ========================================== */
.skel {
  background: linear-gradient(90deg, var(--panel) 25%, var(--panel3) 37%, var(--panel) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.3s infinite;
  border-radius: 8px;
}

/* ===== §16 Chip (inline meta badge) ================================= */
.chip {
  display: inline-flex; align-items: center; gap: .3rem;
  font-size: .68rem; font-weight: 650; color: var(--muted);
}
.chip svg { width: 13px; height: 13px; }

/* ===== §17 Keyframes ================================================ */
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: .5; transform: scale(1.25); }
}
@keyframes breathe {
  0%, 100% { opacity: .5; }
  50%       { opacity: 1; }
}
@keyframes shimmer {
  to { background-position: -135% 0; }
}
@keyframes cardIn {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: none; }
}
@keyframes screenIn {
  from { opacity: 0; transform: translateY(10px) scale(.99); }
  to   { opacity: 1; transform: none; }
}
@keyframes draw {
  to { stroke-dashoffset: 0; }
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: none; }
}
@keyframes load {
  to { width: 100%; }
}

/* ===== §18 Responsive =============================================== */
@media (max-width: 640px) {
  .semaphore .dot { width: 42px; height: 42px; }
  .nav a { padding: .3rem .5rem; }
}

/* ====================================================================== *
 * §18b Responsive app-shell (Task 3)
 * Desktop (>=861px): existing .topbar + normal .wrap flow.
 * Mobile (<=860px): compact header.app + scrollable main + IN-FLOW
 * bottom nav (nav.tabs) + drawer/scrim. The .device-style flex column
 * is applied to <body> ONLY inside the mobile media query so desktop
 * page scrolling is never broken.
 * ====================================================================== */

/* Visibility helpers — desktop is the default (mobile toggled in MQ) */
.mobile-only { display: none; }
.desktop-only { display: flex; }

/* ===== Mobile compact header (markup present, shown only on mobile) ===== */
header.app {
  align-items: center; gap: .7rem; padding: .7rem 1rem;
  padding-top: max(.7rem, env(safe-area-inset-top));
  background: linear-gradient(180deg, rgba(10,21,18,.92), rgba(10,21,18,.62));
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line); position: relative; z-index: 5;
}
header.app .logo { display: flex; align-items: center; gap: .55rem; min-width: 0; }
header.app .logo svg { width: 30px; height: 30px; filter: drop-shadow(0 0 6px rgba(46,230,166,.45)); }
header.app .logo .wm { font-weight: 750; font-size: 1.06rem; letter-spacing: -.02em; white-space: nowrap; }
header.app .logo .wm b { color: var(--text); }
header.app .logo .wm i {
  font-style: normal;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
header.app .sys {
  margin-left: auto; display: flex; align-items: center; gap: .45rem;
  background: rgba(52,211,153,.10); border: 1px solid rgba(52,211,153,.25);
  padding: .32rem .6rem; border-radius: 999px; font-size: .74rem; font-weight: 650; color: #bdf3df;
}
header.app .sys .led {
  width: 9px; height: 9px; border-radius: 50%; background: var(--ok);
  box-shadow: 0 0 8px var(--ok); animation: pulse 2.4s var(--ease) infinite;
}

/* ===== Bottom nav — IN-FLOW (last flex child of <body>), never clipped ===== */
nav.tabs {
  flex: 0 0 auto; align-items: stretch; gap: .18rem;
  padding: .4rem .4rem calc(.4rem + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, rgba(8,18,15,.98), rgba(8,18,15,.92));
  border-top: 1px solid var(--line); position: relative; z-index: 6;
}
nav.tabs a, nav.tabs button {
  flex: 1 1 0; min-width: 0; min-height: 60px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .26rem;
  padding: .4rem 2px; background: none; border: 0; border-radius: 14px; color: var(--dim); cursor: pointer;
  font-family: inherit; font-weight: 650; letter-spacing: .01em; position: relative; text-decoration: none;
  transition: color .2s, background .2s, transform .12s var(--ease);
}
nav.tabs a:hover, nav.tabs button:hover { text-decoration: none; color: var(--text); }
nav.tabs svg { width: 26px; height: 26px; display: block; flex: 0 0 auto; transition: transform .25s var(--ease); }
nav.tabs .lbl { font-size: .66rem; line-height: 1; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
nav.tabs .on { color: var(--accent); background: rgba(46,230,166,.08); }
nav.tabs .on svg { transform: translateY(-1px); }
nav.tabs .on::after { content: ""; position: absolute; top: 6px; width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
nav.tabs a:active, nav.tabs button:active { transform: scale(.92); }
@media (max-width: 340px) {
  nav.tabs a, nav.tabs button { min-height: 54px; }
  nav.tabs svg { width: 24px; height: 24px; }
  nav.tabs .lbl { font-size: .6rem; letter-spacing: 0; }
}

/* ===== Drawer (bottom sheet) + scrim ===== */
.scrim {
  position: fixed; inset: 0; background: rgba(4,10,8,.6);
  backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px);
  opacity: 0; pointer-events: none; transition: opacity .3s; z-index: 8;
}
.scrim.on { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; left: 0; right: 0; bottom: 0; max-width: 440px; margin: 0 auto;
  background: linear-gradient(180deg, var(--panel2), var(--panel));
  border-top: 1px solid var(--line2); border-radius: 22px 22px 0 0;
  padding: 1rem 1rem calc(1.4rem + env(safe-area-inset-bottom));
  transform: translateY(110%); transition: transform .34s var(--ease);
  z-index: 9; box-shadow: 0 -10px 40px rgba(0,0,0,.5);
}
.drawer.on { transform: none; }
.drawer .grab { width: 38px; height: 4px; border-radius: 3px; background: var(--line2); margin: .1rem auto 1rem; }
.drawer a {
  display: flex; align-items: center; gap: .8rem; padding: .9rem .6rem; border-radius: 12px;
  color: var(--text); text-decoration: none; font-weight: 600; font-size: .95rem; cursor: pointer;
}
.drawer a:hover { text-decoration: none; }
.drawer a:active { background: var(--panel3); }
.drawer a svg { width: 21px; height: 21px; color: var(--accent); flex: 0 0 auto; }
.drawer a small { margin-left: auto; color: var(--dim); font-weight: 500; font-size: .72rem; }

/* ===== Splash / init overlay ===== */
#splash {
  position: fixed; inset: 0; z-index: 20;
  background: radial-gradient(circle at 50% 42%, #12281f, var(--bg) 60%);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 1.1rem; transition: opacity .6s var(--ease);
}
#splash.gone { opacity: 0; pointer-events: none; }
#splash .mark { width: 96px; height: 96px; filter: drop-shadow(0 0 16px rgba(46,230,166,.55)); }
#splash .mark path, #splash .mark circle, #splash .mark line { stroke-dasharray: 240; stroke-dashoffset: 240; animation: draw 1.3s var(--ease) forwards; }
#splash .wm { font-weight: 800; font-size: 1.5rem; letter-spacing: -.02em; opacity: 0; animation: fadeUp .5s .8s forwards; }
#splash .wm i { font-style: normal; background: linear-gradient(90deg, var(--accent), var(--accent2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
#splash .boot { font-size: .7rem; letter-spacing: .28em; color: var(--dim); text-transform: uppercase; opacity: 0; animation: fadeUp .5s 1s forwards; }
#splash .bar { width: 140px; height: 3px; border-radius: 3px; background: var(--line2); overflow: hidden; opacity: 0; animation: fadeUp .4s 1s forwards; }
#splash .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); animation: load 1.1s .95s var(--ease) forwards; }

/* ===== Breakpoint: <=860px = mobile app-shell ===== */
@media (max-width: 860px) {
  .desktop-only { display: none !important; }
  .mobile-only { display: flex; }

  /* Body becomes the device flex column (mobile only) */
  body {
    display: flex; flex-direction: column;
    height: 100vh;   /* fallback */
    height: 100dvh;  /* real dynamic viewport — wins where supported */
    min-height: 0; overflow: hidden;
  }
  /* Content scrolls; nav stays in-flow below it */
  main.wrap {
    flex: 1 1 auto; min-height: 0; max-width: none; margin: 0;
    overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
    padding: 1rem 1rem 1.4rem; scroll-behavior: smooth;
  }
  .nav { flex-wrap: nowrap; }
}

/* ===== §19 Reduced motion =========================================== */
@media (prefers-reduced-motion: reduce) {
  * { animation: none !important; transition: none !important; }
  .stagger > * { opacity: 1 !important; }
  #splash { display: none; }
}

/* ===== §20 Home control-room: hero / ring / quick / zone ============
 * Ported from docs/mockups/aquamente-mobile-preview.html (Task 4).
 * Desktop: centred column, max 540px; mobile inherits naturally.
 * ====================================================================== */

/* ── Hero ─────────────────────────────────────────────────────────────── */
.hero {
  position: relative;
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding: 1.8rem 1rem 1.4rem;
}
.hero::before {
  content: "";
  position: absolute; inset: -1rem -1rem auto; height: 280px; pointer-events: none;
  background-image:
    linear-gradient(rgba(46,230,166,.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46,230,166,.05) 1px, transparent 1px);
  background-size: 26px 26px;
  -webkit-mask-image: radial-gradient(circle at 50% 34%, #000 0%, transparent 68%);
  mask-image: radial-gradient(circle at 50% 34%, #000 0%, transparent 68%);
}
.hero .head { font-size: 1.4rem; font-weight: 750; margin: .9rem 0 .25rem; letter-spacing: -.02em; }
.hero .sub  { color: var(--muted); font-size: .9rem; max-width: 32ch; }

/* ── Ring ─────────────────────────────────────────────────────────────── */
.ring {
  width: 214px; height: 214px; border-radius: 50%;
  display: grid; place-items: center; position: relative; z-index: 1;
  background: radial-gradient(circle at 50% 40%, rgba(52,211,153,.18), transparent 60%);
  /* color token drives the progress stroke + glyph via currentColor */
  color: var(--g, var(--ok));
}
.ring svg.prog { position: absolute; inset: 0; width: 100%; height: 100%; transform: rotate(-90deg); }
.ring::before {
  content: "";
  position: absolute; width: 240px; height: 240px; border-radius: 50%;
  border: 1px solid rgba(46,230,166,.12);
}
.ring::after {
  content: "";
  position: absolute; width: 214px; height: 214px; border-radius: 50%;
  box-shadow: 0 0 50px rgba(52,211,153,.28);
  animation: breathe 4s var(--ease) infinite;
}
.ring .face {
  display: flex; flex-direction: column; align-items: center; gap: .05rem; z-index: 2;
}
.ring .glyph {
  width: 50px; height: 50px;
  filter: drop-shadow(0 0 12px rgba(46,230,166,.65));
  margin-bottom: .35rem;
}
.ring .state {
  font-size: 1.72rem; font-weight: 850; letter-spacing: -.03em; line-height: 1;
}
.ring .pct {
  font-size: .72rem; color: var(--muted); letter-spacing: .12em;
  text-transform: uppercase; margin-top: .35rem;
}

/* Live badge */
.live {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .62rem; font-weight: 700; letter-spacing: .16em;
  color: var(--accent); margin-top: .7rem;
}
.live::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px var(--accent);
  animation: pulse 1.8s infinite;
}

/* Semaphore color on .ring (reuse existing g-* variables) */
.ring.g-verde     { --g: var(--ok); }
.ring.g-giallo    { --g: var(--warn); }
.ring.g-arancione { --g: var(--susp); }
.ring.g-grigio    { --g: var(--offline); }
.ring.g-rosso     { --g: var(--crit); }

/* Section heading */
h2.t {
  font-size: .78rem; text-transform: uppercase; letter-spacing: .14em;
  color: var(--muted); font-weight: 700; margin: 1.4rem .2rem .7rem;
  display: flex; align-items: center; gap: .5rem;
}
h2.t:first-child { margin-top: .2rem; }

/* ── Quick counts ─────────────────────────────────────────────────────── */
.quick {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; margin-top: 1.2rem;
}
.quick .q, .quick a.q {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .8rem .5rem; text-align: center; cursor: pointer;
  text-decoration: none; color: var(--text);
  transition: transform .12s var(--ease), border-color .2s, background .2s;
  display: block;
}
.quick a.q:hover { text-decoration: none; }
.quick .q:active, .quick a.q:active { transform: scale(.95); }
.quick .q.ok,   .quick a.q.ok   { border-color: rgba(52,211,153,.25); }
.quick .q.warn, .quick a.q.warn { border-color: rgba(245,196,81,.3); }
.quick .q.crit, .quick a.q.crit { border-color: rgba(244,104,95,.25); }
.quick .q .n {
  font-size: 1.7rem; font-weight: 850; font-variant-numeric: tabular-nums; line-height: 1;
}
.quick .q .l {
  font-size: .66rem; color: var(--muted); text-transform: uppercase;
  letter-spacing: .07em; margin-top: .35rem;
}
.quick .q.ok   .n, .quick a.q.ok   .n { color: var(--ok); }
.quick .q.warn .n, .quick a.q.warn .n { color: var(--warn); }
.quick .q.crit .n, .quick a.q.crit .n { color: var(--crit); }
.quick .q .go { font-size: .6rem; color: var(--dim); margin-top: .2rem; }

/* ── Zone cards ───────────────────────────────────────────────────────── */
.zone {
  margin-bottom: .7rem;
  display: flex; align-items: center; gap: .8rem;
  color: var(--text); text-decoration: none;
  cursor: pointer; transition: transform .12s var(--ease), border-color .2s;
}
.zone:last-child { margin-bottom: 0; }
.zone:hover { text-decoration: none; }
.zone:active { transform: scale(.98); }
.zone .zt { min-width: 0; flex: 1; }
.zone .zt b { display: block; }
.zone .zt .why { font-size: .76rem; color: var(--warn); margin-top: .1rem; }
.zone .zt .why.ok         { color: var(--muted); }
.zone .zt .why.l-ok       { color: var(--muted); }
.zone .zt .why.l-attenzione { color: var(--warn); }
.zone .zt .why.l-sospetto { color: var(--susp); }
.zone .zt .why.l-offline  { color: var(--offline); }
.zone .zt .why.l-critico  { color: var(--crit); }
.zone .arr { margin-left: auto; color: var(--dim); flex: 0 0 auto; }

/* Desktop: constrain hero to comfortable width */
@media (min-width: 861px) {
  .hero { max-width: 540px; margin-left: auto; margin-right: auto; }
  .quick { max-width: 420px; margin-left: auto; margin-right: auto; }
  #zone-list { max-width: 640px; }
  h2.t { max-width: 640px; }
}
