:root {
  --bg: #ffffff;
  --bg2: #f5f5f5;
  --card: #ffffff;
  --border: #53006c;
  --border-light: #d0bada;
  --text: #53006c;
  --muted: #7a3a8a;
  --accent: #53006c;
  --accent-dark: #35004a;
  --font: 'Inter', sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; border-radius: 0 !important; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ─── HEADER ─── */
header {
  padding: 0 32px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-bottom: 2px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.logo {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text);
}
.logo span {
  font-size: 10px;
  font-weight: 400;
  color: var(--muted);
  display: block;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
header .spacer { flex: 1; }
.badge {
  background: var(--bg);
  border: 1px solid var(--border);
  padding: 4px 12px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
  letter-spacing: 0.05em;
}

/* ─── LAYOUT ─── */
.app-body {
  flex: 1;
  display: grid;
  grid-template-columns: 300px 1fr;
  align-items: stretch;
  min-height: 0;
}

/* ─── SIDEBAR ─── */
.sidebar {
  background: var(--bg);
  border-right: 2px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  height: calc(100vh - 52px);
}
.sidebar::-webkit-scrollbar { width: 3px; }
.sidebar::-webkit-scrollbar-thumb { background: var(--border-light); }

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border-light);
}
.sidebar-section h3 {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 10px;
}
.sidebar-placeholder {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  padding: 12px;
  border: 1px dashed var(--border-light);
  text-align: center;
  letter-spacing: 0.04em;
}

/* ─── MAIN ─── */
.main-content {
  display: flex;
  flex-direction: column;
  background: var(--bg);
  --charts-h: 160px;
  height: calc(100vh - 52px);
  overflow-y: auto;
  overflow-x: hidden;
}
/* Quando il pannello grafici è nascosto (display:none sul #bottomPanel),
   azzero --charts-h così la mappa occupa tutto lo spazio verticale.
   Per riattivare: rimuovere display:none da #bottomPanel e questa regola
   smetterà di applicarsi automaticamente. */
.main-content:has(> #bottomPanel[style*="display:none"]),
.main-content:has(> #bottomPanel[style*="display: none"]) {
  --charts-h: 0px;
}
.main-content::-webkit-scrollbar { width: 8px; }
.main-content::-webkit-scrollbar-thumb { background: var(--border-light); }

#map {
  width: 100%;
  height: calc(100vh - 52px - var(--charts-h));
  min-height: 120px;
  flex-shrink: 0;
  position: relative;
}

/* ─── BOTTOM PANEL (charts area, vuota) ─── */
.bottom-panel {
  min-height: 60px;
  border-top: 2px solid var(--border);
  background: var(--bg);
  position: relative;
  flex-shrink: 0;
}
.charts-panel {
  background: var(--bg);
  display: flex;
  flex-direction: column;
}
.charts-resize-handle {
  position: absolute;
  top: -6px;
  left: 0;
  right: 0;
  height: 12px;
  cursor: ns-resize;
  z-index: 1005;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
}
.charts-resize-handle::before {
  content: '';
  width: 48px;
  height: 4px;
  background: var(--border);
  border-radius: 2px !important;
  opacity: 0.55;
  transition: opacity 0.15s, background 0.15s;
}
.charts-resize-handle:hover::before,
.charts-resize-handle.dragging::before {
  opacity: 1;
  background: var(--accent-dark);
}
body.charts-resizing { cursor: ns-resize !important; user-select: none !important; }
body.charts-resizing * { cursor: ns-resize !important; user-select: none !important; }

.charts-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-light);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
.charts-title {
  font-weight: 700;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text);
}
.charts-body {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100px;
  color: var(--muted);
  font-style: italic;
  font-size: 11px;
  letter-spacing: 0.04em;
}

/* ─── BASEMAP SWITCHER ─── (stile dashboard_parma.html, pulsante TONDO glass) */
.basemap-switcher {
  position: absolute;
  top: 16px;
  right: 16px;
  z-index: 1001;
  transition: opacity 0.15s ease;
}

/* PATCH-PERCORSI basemap-btn-round: pulsante tondo identico a dashboard_parma
   (border-radius 50%, 44x44, glass effect viola tenue). Tema CHIARO di default,
   classe --dark applicata sulle basemap satellitari. */
.basemap-btn {
  width: 44px;
  height: 44px;
  border-radius: 50% !important;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  user-select: none;
  padding: 0;
  pointer-events: auto;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    transform 0.12s ease,
    color 0.18s ease;
  /* Tema CHIARO (carto/OSM): bianco-crema caldo, icona viola scuro */
  background: rgba(250, 246, 252, 0.82);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  backdrop-filter: blur(12px) saturate(140%);
  border: 1px solid rgba(83, 0, 108, 0.20);
  color: #3a1a4a;
  box-shadow:
    0 1px 2px rgba(40, 0, 60, 0.06),
    0 6px 16px rgba(40, 0, 60, 0.10),
    0 14px 32px rgba(40, 0, 60, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

/* Tema SCURO per basemap satellitari/AGEA (palette viola scuro) */
.basemap-btn--dark {
  background: rgba(20, 12, 28, 0.42);
  border: 1px solid rgba(255, 255, 255, 0.22);
  color: #f3e8f7;
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.18),
    0 6px 18px rgba(0, 0, 0, 0.28),
    0 18px 38px rgba(0, 0, 0, 0.32),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.basemap-btn:hover {
  transform: translateY(-1px);
  background: rgba(250, 246, 252, 0.95);
  border-color: rgba(83, 0, 108, 0.38);
  box-shadow:
    0 2px 4px rgba(40, 0, 60, 0.08),
    0 10px 22px rgba(40, 0, 60, 0.14),
    0 18px 40px rgba(40, 0, 60, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.75);
}
.basemap-btn--dark:hover {
  background: rgba(20, 12, 28, 0.58);
  border-color: rgba(255, 255, 255, 0.35);
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.22),
    0 10px 24px rgba(0, 0, 0, 0.34),
    0 22px 44px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
}

/* SVG dell'icona "tre pannelli sovrapposti" identica a parma */
.basemap-btn svg { width: 28px; height: 26px; display: block; }

.basemap-dropdown {
  display: none;
  position: absolute;
  top: 52px;
  right: 0;
  background: #ffffff;
  border: 2px solid var(--border);
  box-shadow: 3px 3px 0 var(--border-light);
  min-width: 200px;
  z-index: 1002;
}
.basemap-dropdown.open { display: block; }

.basemap-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  cursor: pointer;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  border-bottom: 1px solid var(--border-light);
  user-select: none;
  transition: background 0.1s;
}
.basemap-option:last-child { border-bottom: none; }
.basemap-option:hover { background: var(--bg2); }
.basemap-option.active { background: #6b2a85; color: #fff; }
.basemap-option.active .basemap-thumb { border-color: rgba(255,255,255,0.5); }

.basemap-thumb {
  width: 28px;
  height: 20px;
  border: 1px solid var(--border-light);
  flex-shrink: 0;
}

/* Thumb basemap stile parma originale (gradienti più sofisticati) */
.basemap-thumb-light {
  background: linear-gradient(135deg, #e8e8e8 0%, #f5f5f5 40%, #d0d0d0 100%);
}

.basemap-thumb-ortofoto {
  background: linear-gradient(135deg, #4a6741 0%, #3d5c38 30%, #8a7a5a 55%, #6b6b5a 80%, #a09080 100%);
  position: relative;
  overflow: hidden;
}
.basemap-thumb-ortofoto::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(45deg, transparent, transparent 2px, rgba(255,255,255,0.04) 2px, rgba(255,255,255,0.04) 4px),
    repeating-linear-gradient(-45deg, transparent, transparent 3px, rgba(0,0,0,0.05) 3px, rgba(0,0,0,0.05) 5px);
}

.basemap-thumb-agea {
  background: linear-gradient(135deg, #6b8e3d 0%, #8fa84a 25%, #c9a85a 55%, #a8884a 80%, #6b5a3a 100%);
  position: relative;
  overflow: hidden;
}
.basemap-thumb-agea::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 3px, rgba(0,0,0,0.08) 3px, rgba(0,0,0,0.08) 4px),
    repeating-linear-gradient(90deg, transparent, transparent 4px, rgba(255,255,255,0.06) 4px, rgba(255,255,255,0.06) 5px);
}

/* ─── POI PANEL nel dropdown basemap (stile poi-layer-row di parma) ─── */
.basemap-section-title {
  padding: 6px 12px 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  border-top: 1px solid var(--border-light);
  margin-top: 2px;
  user-select: none;
}

.poi-layer-list {
  max-height: 280px;
  overflow-y: auto;
}
.poi-layer-list::-webkit-scrollbar { width: 3px; }
.poi-layer-list::-webkit-scrollbar-thumb { background: var(--border-light); }

.poi-layer-row {
  display: flex;
  align-items: center;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  cursor: default;
}
.poi-layer-row:last-child { border-bottom: none; }

    /* PATCH-LUCA rifugi-2026: 3 checkbox custom (Tutti / Indoor / Outdoor).
       Quadratini colorati (blu Indoor, verde Outdoor, sfumato Tutti) con segno di
       spunta bianco quando attivo. Nessun riquadro attorno al pulsante. */
    .clim-shel-btnbar {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 6px 8px 8px;
    }
    .clim-shel-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 3px 2px;
      border: none;
      background: transparent;
      color: var(--text);
      font-size: 12px;
      font-weight: 500;
      letter-spacing: 0.01em;
      cursor: pointer;
      transition: opacity 0.15s ease;
      user-select: none;
      text-align: left;
    }
    .clim-shel-btn:hover { opacity: 0.75; }
    .clim-shel-btn:active { transform: translateY(1px); }
    .clim-shel-btn.is-active { font-weight: 600; }

    /* Quadratino checkbox: vuoto a riposo, colorato + ✓ bianco quando attivo */
    .clim-shel-btn-dot {
      width: 14px; height: 14px;
      flex: 0 0 auto;
      border-radius: 0 !important;
      border: 1.5px solid rgba(83, 0, 108, 0.45);
      background: #fff;
      position: relative;
      transition: background 0.15s ease, border-color 0.15s ease;
    }
    /* Stato attivo: riempimento colorato per modalita */
    .clim-shel-btn[data-mode="indoor"].is-active .clim-shel-btn-dot {
      background: #1d4ed8;
      border-color: #1d4ed8;
    }
    .clim-shel-btn[data-mode="outdoor"].is-active .clim-shel-btn-dot {
      background: #15803d;
      border-color: #15803d;
    }
    .clim-shel-btn[data-mode="all"].is-active .clim-shel-btn-dot {
      background: linear-gradient(135deg, #1d4ed8 0 50%, #15803d 50% 100%);
      border-color: #6b2a85;
    }
    /* Segno di spunta bianco quando attivo */
    .clim-shel-btn.is-active .clim-shel-btn-dot::after {
      content: "";
      position: absolute;
      left: 3px;
      top: 0px;
      width: 4px;
      height: 8px;
      border-right: 2px solid #fff;
      border-bottom: 2px solid #fff;
      transform: rotate(45deg);
    }
    .clim-shel-btn-label { line-height: 1; }

    /* PATCH-LUCA census-2026: pulsante "Celle censimento" nel pannello
       "POPOLAZIONE ISTAT" del dropdown basemap. Stessa struttura visiva dei
       pulsanti rifugi (clim-shel-btn) ma con quadratino viola/grigio +
       icona-griglia 2x2 stampata sopra (per richiamare la "cella").
       Quando attivo: riempimento viola dashboard (#6b2a85) + segno di spunta. */
    .census-btnbar {
      display: flex;
      flex-direction: column;
      gap: 4px;
      padding: 6px 8px 8px;
    }
    .census-btn {
      display: flex;
      align-items: center;
      gap: 8px;
      padding: 3px 2px;
      border: none;
      background: transparent;
      color: var(--text);
      font-size: 12px;
      font-weight: 500;
      letter-spacing: 0.01em;
      cursor: pointer;
      transition: opacity 0.15s ease;
      user-select: none;
      text-align: left;
    }
    .census-btn:hover { opacity: 0.75; }
    .census-btn:active { transform: translateY(1px); }
    .census-btn.is-active { font-weight: 600; }

    /* PATCH-LUCA census-btn-voronoi-2026-06-29: il quadratino a riposo mostra
       una micro-mappa "Voronoi" di 3 tasselli irregolari, ciascuno colorato
       con una tinta della legenda coropleta ISTAT. Da' l'idea di una sezione
       di censimento gia' dal pulsante. Quando attivo i tasselli si nascondono
       e il dot diventa viola pieno con spunta bianca. */
    .census-btn-dot {
      width: 18px; height: 18px;
      flex: 0 0 auto;
      border-radius: 0 !important;
      border: 1.5px solid rgba(83, 0, 108, 0.55);
      background: #fff;
      position: relative;
      overflow: hidden;
      transition: background 0.15s ease, border-color 0.15s ease;
    }
    /* I 3 tasselli irregolari: poligoni in clip-path che tassellano il dot.
       I bordi tra i poligoni si "vedono" perche' coincidono esattamente, ma
       per dare il senso di confini amministrativi disegniamo sottili linee
       bianche con un overlay (vedi ::before piu' sotto).
       I colori sono presi dalla palette census (3 classi rappresentative). */
    .census-tile {
      position: absolute;
      left: 0; top: 0;
      width: 100%; height: 100%;
      pointer-events: none;
    }
    .census-tile-1 {
      background: rgba(191,214,232,1);   /* azzurro chiaro (classe 34-94) */
      clip-path: polygon(0% 0%, 55% 0%, 40% 45%, 0% 60%);
    }
    .census-tile-2 {
      background: rgba(138,124,186,1);   /* lilla-viola (classe 186-276) */
      clip-path: polygon(55% 0%, 100% 0%, 100% 55%, 70% 70%, 40% 45%);
    }
    .census-tile-3 {
      background: rgba(129,15,124,1);    /* viola scuro (classe >=448) */
      clip-path: polygon(0% 60%, 40% 45%, 70% 70%, 100% 55%, 100% 100%, 0% 100%);
    }
    /* Confini bianchi sottili tra i tasselli (simulano i bordi delle sezioni
       censuarie). Disegnati con due linee in ::before ruotate/posizionate. */
    .census-btn-dot::before {
      content: "";
      position: absolute;
      left: 0; top: 0;
      width: 100%; height: 100%;
      pointer-events: none;
      background:
        /* linea 1: dal vertice (55%,0) verso (40%,45%) circa */
        linear-gradient(155deg, transparent 47%, rgba(255,255,255,0.85) 47%, rgba(255,255,255,0.85) 53%, transparent 53%) no-repeat 47% -10% / 18% 60%,
        /* linea 2: dal punto centrale (40%,45%) verso (70%,70%) */
        linear-gradient(40deg, transparent 47%, rgba(255,255,255,0.85) 47%, rgba(255,255,255,0.85) 53%, transparent 53%) no-repeat 55% 55% / 38% 32%,
        /* linea 3: dal punto centrale verso (0,60%) -- bordo basso-sx */
        linear-gradient(75deg, transparent 47%, rgba(255,255,255,0.85) 47%, rgba(255,255,255,0.85) 53%, transparent 53%) no-repeat 0% 50% / 42% 18%,
        /* linea 4: dal punto (70%,70%) verso (100%,55%) -- bordo dx */
        linear-gradient(110deg, transparent 47%, rgba(255,255,255,0.85) 47%, rgba(255,255,255,0.85) 53%, transparent 53%) no-repeat 75% 60% / 30% 18%;
      z-index: 1;
    }
    /* Quando il pulsante e' attivo: nascondi i tasselli e il bordo bianco,
       cosi' resta solo il viola pieno + spunta bianca (::after). */
    .census-btn.is-active .census-btn-dot .census-tile,
    .census-btn.is-active .census-btn-dot::before {
      display: none;
    }
    .census-btn.is-active .census-btn-dot {
      background: #6b2a85;
      border-color: #6b2a85;
    }
    .census-btn.is-active .census-btn-dot::after {
      content: "";
      position: absolute;
      left: 5px;
      top: 1px;
      width: 5px;
      height: 10px;
      border-right: 2px solid #fff;
      border-bottom: 2px solid #fff;
      transform: rotate(45deg);
      z-index: 2;
    }
    .census-btn-label { line-height: 1; }

    /* PATCH-LUCA census-legend-2026: mini-legenda della scala coropleta delle
       celle ISTAT 2021. E' inserita DENTRO .census-btnbar subito sotto il
       bottone "Celle censimento". A riposo e' nascosta (display:none); si
       mostra solo quando il bottone padre ha la classe .is-active, sfruttando
       il selettore :has(). Layout verticale compatto con swatch quadrato
       (12px) + range numerico, font piccolo per non rubare spazio. */
    .census-legend {
      display: none;
      flex-direction: column;
      gap: 3px;
      margin: 6px 2px 2px 22px;   /* allineato col testo del bottone (dot 14 + gap 8) */
      padding: 6px 8px 7px;
      border-left: 2px solid rgba(107, 42, 133, 0.25); /* filetto viola per ancorare al bottone */
      background: rgba(107, 42, 133, 0.04);            /* tinta viola tenuissima */
      border-radius: 0 4px 4px 0;
    }
    .census-btnbar:has(.census-btn.is-active) .census-legend {
      display: flex;
    }
    .census-legend-title {
      font-size: 10px;
      font-weight: 600;
      letter-spacing: 0.04em;
      text-transform: uppercase;
      color: var(--muted, #6b7280);
      margin-bottom: 3px;
      line-height: 1.1;
    }
    .census-legend-list {
      display: flex;
      flex-direction: column;
      gap: 2px;
    }
    .census-legend-item {
      display: flex;
      align-items: center;
      gap: 7px;
      font-size: 11px;
      line-height: 1.25;
      color: var(--text);
    }
    .census-legend-sw {
      width: 12px; height: 12px;
      flex: 0 0 auto;
      border: 1px solid rgba(0, 0, 0, 0.18);
      border-radius: 2px;
      box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.35); /* leggera lucidatura */
    }
    /* Classe "non residenziale" (POP21<=0): sfondo bianco con linee tratteggiate
       che richiamano l'assenza di riempimento sulla mappa (trasparente). */
    .census-legend-sw--none {
      background:
        repeating-linear-gradient(
          45deg,
          rgba(107, 42, 133, 0.35) 0 1px,
          transparent 1px 4px
        ),
        #fff;
      border-color: rgba(107, 42, 133, 0.35);
    }
    .census-legend-lbl {
      font-variant-numeric: tabular-nums;
      white-space: nowrap;
    }

/* PATCH-LUCA clim-shel-legend: legenda orizzontale icone Indoor/Outdoor.
   Mostrata solo quando il pulsante master "Rifugi climatici" e' attivo
   (input:checked dentro #climShelSidebarRow). I due item sono CENTRATI
   nella riga, con una piccola distanza e separati da una barretta "|"
   poco evidente (color border-light). */
.clim-shel-legend {
  display: none;             /* default: nascosta */
  justify-content: center;
  align-items: center;
  gap: 14px;                  /* distanza tra i due item (non attaccati) */
  padding: 6px 4px 2px 4px;
  margin-top: 4px;
}
/* Mostra la legenda solo quando il pulsante master e' attivo */
#climShelSidebarRow:has(input[type="checkbox"]:checked) ~ .clim-shel-legend,
#climShelSidebarList:has(#climShelSidebarChk:checked) .clim-shel-legend {
  display: flex;
}
/* Separatore verticale "|" poco evidente tra i due item */
.clim-shel-legend-item + .clim-shel-legend-item::before {
  content: '|';
  color: var(--border-light);
  font-weight: 400;
  margin-right: 14px;
  opacity: 0.7;
  user-select: none;
}
.clim-shel-legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  color: var(--text);
  font-weight: 500;
  letter-spacing: 0.02em;
}
.clim-shel-legend-item svg { display: block; flex-shrink: 0; }
/* PATCH-LUCA cat-colors-2026-06-24: nascondi la legenda Indoor/Outdoor
   quando la categoria corrente NON e' un rifugio climatico. La classe
   'cat-non-shelter' viene messa su <body> in switchCategory(). */
body.cat-non-shelter .clim-shel-legend { display: none !important; }
/* PATCH-LUCA hide-indoor-outdoor-legend-allcat-2026-06-24:
   L'utente ha richiesto di TOGLIERE la legenda Indoor/Outdoor da
   "POI TUTTE LE CATEGORIE" (e in generale da tutte le categorie non
   shelter). La regola sopra (cat-non-shelter) gia' dovrebbe coprirlo,
   ma non e' attiva al primo caricamento (switchCategory non viene
   chiamata fino al primo cambio). Quindi adottiamo un'inversione di
   default: la legenda e' NASCOSTA per default, e viene mostrata solo
   se <body> ha la classe 'cat-is-shelter' (settata da switchCategory). */
.clim-shel-legend { display: none !important; }
body.cat-is-shelter .clim-shel-legend { display: flex !important; }

/* PATCH-LUCA hide-poi-layer-icon-2026-06-29 (v3 - SOSTITUZIONE ICONA):
   L'icona del pulsante #climShelSidebarRow NON viene piu' nascosta con CSS,
   ma viene SOSTITUITA dinamicamente dal JS _updateCategoryLabels():
     - cat = clim_shel_2026  -> icona scudo+fiocco di neve (originale)
     - cat = all_categories  -> pin con bande verticali multicolore
     - cat = qualsiasi POI   -> pin colorato del colore della categoria
   La sostituzione avviene in JS scrivendo dentro #climShelSidebarRow .layer-icon.
   Nessuna regola CSS qui: l'icona resta SEMPRE visibile.
*/


.poi-layer-check {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 32px;
  flex-shrink: 0;
  cursor: pointer;
  border-right: 1px solid var(--border-light);
}
.poi-layer-check input[type=checkbox] {
  width: 12px;
  height: 12px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
  border-radius: 0 !important;
}

.poi-layer-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
  margin: 0 6px 0 8px;
}

.poi-layer-label {
  flex: 1;
  font-size: 11px;
  font-weight: 500;
  color: var(--text);
  padding: 0 4px 0 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 32px;
}

.poi-layer-expand {
  width: 28px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  border-left: 1px solid var(--border-light);
  color: var(--muted);
  font-size: 10px;
  transition: transform 0.15s;
  user-select: none;
}
.poi-layer-expand.open { transform: rotate(180deg); }

.poi-subtype-list {
  display: none;
  background: var(--bg2);
  border-bottom: 1px solid var(--border-light);
}
.poi-subtype-list.open { display: block; }

.poi-subtype-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px 5px 36px;
  border-bottom: 1px solid rgba(208,186,218,0.4);
  cursor: pointer;
}
.poi-subtype-row:last-child { border-bottom: none; }
.poi-subtype-row:hover { background: rgba(83,0,108,0.06); }

.poi-subtype-row input[type=checkbox] {
  width: 11px;
  height: 11px;
  accent-color: var(--accent);
  cursor: pointer;
  margin: 0;
  flex-shrink: 0;
}

.poi-subtype-label {
  font-size: 10px;
  color: var(--muted);
  flex: 1;
}

/* dot colorato a fianco di ogni sotto-categoria */
.poi-subtype-dot {
  width: 8px;
  height: 8px;
  flex-shrink: 0;
}

/* ─── Marker climate shelter sulla mappa (goccia stile parma) ─── */
.clim-shel-divicon { background: transparent; border: none; }
.clim-shel-divicon svg { display: block; }
.clim-shel-divicon .year-ring { display: none; }
/* Regola .year-2027 storica rimossa (dataset solo 2026). */

/* ─── POPUP / TOOLTIP STILI ─── */
/* PATCH-LUCA popup-v2: redesign completo del popup con header colorato,
   icona SVG, badge categoria, valore grande con unità, righe attributo con
   icone. Mantenuti i nomi delle classi esistenti per non rompere il JS,
   ma aggiunti nuovi hook (.popup-header, .popup-icon, .popup-badge,
   .popup-value, .popup-unit, .popup-rowlist, .popup-row .ico). */
.leaflet-popup-content-wrapper {
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 10px 32px rgba(83, 0, 108, 0.22),
              0 4px 10px rgba(83, 0, 108, 0.12);
  padding: 0;
  overflow: hidden;
  border-radius: 10px !important;
}
.leaflet-popup-tip {
  background: var(--bg);
  border: 1px solid var(--border);
}
.leaflet-popup-close-button {
  color: rgba(255,255,255,0.85) !important;
  font-size: 18px !important;
  padding: 6px 8px !important;
  right: 4px !important;
  top: 4px !important;
  text-shadow: 0 1px 2px rgba(0,0,0,0.3);
  transition: color 0.15s;
}
.leaflet-popup-close-button:hover { color: #fff !important; }
.leaflet-popup-content {
  margin: 0 !important;
  font-family: var(--font);
  font-size: 12px;
  color: var(--text);
  width: 260px !important;
}

/* Header viola con icona + titolo + sottotitolo */
.popup-header {
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  color: #fff;
  padding: 12px 14px 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  position: relative;
}
.popup-icon {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255,255,255,0.15);
  border-radius: 8px !important;
  border: 1px solid rgba(255,255,255,0.22);
}
.popup-icon svg { width: 18px; height: 18px; }
.popup-head-text { flex: 1; min-width: 0; padding-right: 18px; }
.popup-title {
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.02em;
  color: #fff;
  margin: 0;
  padding: 0;
  border: none;
  text-transform: none;
  line-height: 1.25;
  word-wrap: break-word;
}
.popup-subtitle {
  font-size: 10px;
  color: rgba(255,255,255,0.75);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-top: 2px;
  font-weight: 500;
}

/* Body bianco con valore principale e righe attributo */
.popup-body { padding: 12px 14px 12px 14px; background: var(--bg); }

/* Hero value (numero grande con etichetta sopra e unità a fianco) */
.popup-hero {
  text-align: center;
  padding: 6px 0 10px 0;
  border-bottom: 1px dashed var(--border-light);
  margin-bottom: 10px;
}
.popup-big-label {
  font-size: 9px;
  color: var(--muted);
  text-align: center;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  margin-bottom: 4px;
  font-weight: 600;
}
.popup-big {
  font-size: 30px;
  font-weight: 800;
  color: var(--accent-dark);
  text-align: center;
  margin: 0;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
}
.popup-unit {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Badge colorato (categoria distanza, tipo strada, ecc.) */
/* PATCH-LUCA badge-block: il badge deve SEMPRE andare a capo sotto al numero
   hero, non a fianco. Forzo display:block (non inline-block) e centro
   col margin auto, cosi' resta sotto a prescindere dalla larghezza. */
.popup-badge {
  display: block;
  width: max-content;
  max-width: 100%;
  margin: 8px auto 0 auto;
  padding: 3px 9px;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-radius: 999px !important;
  border: 1px solid transparent;
}
.popup-badge--green  { background: rgba(34,197,94,0.15);  color: #15803d; border-color: rgba(34,197,94,0.4); }
.popup-badge--yellow { background: rgba(253,224,71,0.22); color: #a16207; border-color: rgba(202,138,4,0.45); }
.popup-badge--red    { background: rgba(248,113,113,0.18); color: #b91c1c; border-color: rgba(220,38,38,0.45); }
.popup-badge--dark   { background: rgba(127,29,29,0.15);  color: #7f1d1d; border-color: rgba(127,29,29,0.5); }
.popup-badge--purple { background: rgba(83,0,108,0.12);   color: var(--accent); border-color: rgba(83,0,108,0.35); }
.popup-badge--blue   { background: rgba(14,165,233,0.15); color: #0369a1; border-color: rgba(14,165,233,0.4); }

/* Badge "frequenza d'uso" — palette VIOLA monocroma (chiaro → scuro).
   Soglie: <25 / 25-75 / 75-150 / 150-250 / >250. */
.popup-badge--usage-1 { background: rgba(184,141,204,0.45); color: #ffffff; border-color: rgba(155,108,184,0.55); } /* utilizzo raro     <4     #b88dcc */
.popup-badge--usage-2 { background: rgba(170,120,194,0.40); color: #ffffff; border-color: rgba(160,107,184,0.55); } /* utilizzo basso   4-10    #aa78c2 */
.popup-badge--usage-3 { background: rgba(160,107,184,0.30); color: #ffffff; border-color: rgba(122,46,150,0.65); } /* utilizzo medio   75-150  #a06bb8 */
.popup-badge--usage-4 { background: rgba(122,46,150,0.85);  color: #ffffff; border-color: rgba(83,0,108,0.85);   } /* utilizzo alto   150-250  #7a2e96 */
.popup-badge--usage-5 { background: rgba(107,31,135,0.90);  color: #ffffff; border-color: rgba(60,10,80,1);       } /* molto utilizzato >250   #6b1f87 */

/* Lista attributi (chiave a sinistra, valore a destra, icona piccola) */
.popup-rowlist {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(208, 186, 218, 0.35);
}
.popup-row:last-child { border-bottom: none; }
.popup-row .ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex-shrink: 0;
  margin-right: 5px;
}
.popup-row .ico svg { width: 12px; height: 12px; }
.popup-row .k-wrap {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.popup-row .k {
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  font-weight: 600;
}
.popup-row .v {
  color: var(--text);
  font-weight: 700;
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-size: 11.5px;
  max-width: 60%;
  word-break: break-word;
}

/* PATCH-LUCA climshel-popup-v3: varianti header per i POI Climate Shelter
   - .popup-header--indoor  : gradient azzurrino (blu cielo -> blu)
   - .popup-header--outdoor : gradient verdino  (lime/menta -> verde)
   - Quando il popup ha className 'popup-clim-indoor' / 'popup-clim-outdoor'
     viene aggiunto un EFFETTO GLASS sull'intero wrapper (background semi-
     trasparente + blur + bordo tinta del kind). Resta tutto coerente con il
     resto della UI ma in chiave "fresca". */
.popup-header--indoor {
  background: linear-gradient(135deg, #4fa9d4 0%, #2563a8 100%);
}
.popup-header--outdoor {
  background: linear-gradient(135deg, #6fbf73 0%, #2f8a4a 100%);
}
.popup-header--indoor .popup-icon,
.popup-header--outdoor .popup-icon {
  background: rgba(255,255,255,0.20);
  border-color: rgba(255,255,255,0.30);
}

/* Wrapper glass per i popup POI: vetro smerigliato + bordo tinta */
.leaflet-popup.popup-clim-indoor .leaflet-popup-content-wrapper,
.leaflet-popup.popup-clim-outdoor .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}
.leaflet-popup.popup-clim-indoor .leaflet-popup-content-wrapper {
  border-color: #2563a8;
  box-shadow: 0 10px 32px rgba(37, 99, 168, 0.28),
              0 4px 10px rgba(37, 99, 168, 0.15);
}
.leaflet-popup.popup-clim-outdoor .leaflet-popup-content-wrapper {
  border-color: #2f8a4a;
  box-shadow: 0 10px 32px rgba(47, 138, 74, 0.28),
              0 4px 10px rgba(47, 138, 74, 0.15);
}
.leaflet-popup.popup-clim-indoor .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #2563a8;
}
.leaflet-popup.popup-clim-outdoor .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #2f8a4a;
}
/* Body trasparente per far vedere il glass anche sotto le righe */
.leaflet-popup.popup-clim-indoor .popup-body,
.leaflet-popup.popup-clim-outdoor .popup-body {
  background: transparent;
}
/* Hero glass (riquadrino "stat" sotto l'header): leggera tinta + bordo soft */
.popup-clim-hero {
  text-align: center;
  padding: 10px 8px 10px 8px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.leaflet-popup.popup-clim-indoor .popup-clim-hero {
  background: linear-gradient(180deg, rgba(79,169,212,0.16) 0%, rgba(79,169,212,0.06) 100%);
  border-color: rgba(37,99,168,0.30);
}
.leaflet-popup.popup-clim-outdoor .popup-clim-hero {
  background: linear-gradient(180deg, rgba(111,191,115,0.16) 0%, rgba(111,191,115,0.06) 100%);
  border-color: rgba(47,138,74,0.30);
}
.popup-clim-kind {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}
.leaflet-popup.popup-clim-indoor  .popup-clim-kind { color: #1d4f85; }
.leaflet-popup.popup-clim-outdoor .popup-clim-kind { color: #226b39; }
.popup-clim-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
/* Badge anno coerente con il kind */
.popup-clim-yearbadge {
  display: inline-block;
  margin-top: 8px;
  padding: 3px 9px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  border-radius: 999px !important;
  border: 1px solid transparent;
}
.leaflet-popup.popup-clim-indoor .popup-clim-yearbadge {
  background: rgba(37,99,168,0.12); color: #1d4f85; border-color: rgba(37,99,168,0.40);
}
.leaflet-popup.popup-clim-outdoor .popup-clim-yearbadge {
  background: rgba(47,138,74,0.12); color: #226b39; border-color: rgba(47,138,74,0.40);
}

/* ============================================================
   PATCH-LUCA scuole-popup-v1 (2026-07-02): stile popup POI scuola
   ============================================================ */
.leaflet-popup.popup-scuola .leaflet-popup-content-wrapper {
  background: #ffffff;
  color: var(--text);
  border: 1.5px solid var(--border);
  box-shadow: 0 4px 14px rgba(83, 0, 108, 0.18);
}
.leaflet-popup.popup-scuola .leaflet-popup-tip {
  background: #ffffff;
  border: 1.5px solid var(--border);
}
.leaflet-popup.popup-scuola .popup-header--scuola {
  background: linear-gradient(135deg, #53006c 0%, #7a2e96 100%);
  color: #ffffff;
}
.leaflet-popup.popup-scuola .popup-header--scuola .popup-title,
.leaflet-popup.popup-scuola .popup-header--scuola .popup-subtitle {
  color: #ffffff;
}
.rifugi-bacino {
  /* PATCH-LUCA scuole-popup-v4 (2026-07-02): niente riquadro grigio,
     il contenuto vive nel corpo bianco del popup. */
  margin: 10px 0 6px;
  padding: 0;
  background: transparent;
  border: 0;
}
.rifugi-bacino-title {
  font-size: 10.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--muted);
  margin-bottom: 10px;
}
/* PATCH-LUCA scuole-popup-v3 (2026-07-02): layout "tabellare senza tabella":
   header (n edifici / n residenti) + due righe icona-casetta verde/rossa.
   Uso una grid 3 colonne (icona | valore-edifici | valore-residenti). */
.rifugi-bacino-grid {
  display: grid;
  grid-template-columns: 28px 1fr 1fr;
  column-gap: 14px;
  row-gap: 8px;
  align-items: center;
}
.rifugi-bacino-head {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  color: var(--muted);
  text-align: center;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(83,0,108,0.18);
}
.rifugi-bacino-house {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.rifugi-bacino-house svg { width: 22px; height: 22px; display: block; }
.rifugi-bacino-house--green svg path { fill: #22c55e; stroke: #166534; }
.rifugi-bacino-house--red   svg path { fill: #ef4444; stroke: #7f1d1d; }
.rifugi-bacino-house--gray  svg path { fill: #9ca3af; stroke: #4b5563; }
.rifugi-bacino-val {
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  text-align: center;
  white-space: nowrap;
}
.rifugi-bacino-val small {
  display: block;
  font-size: 9.5px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-top: 1px;
}
/* Riga link "Sito" col chip cliccabile */
.popup-clim-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px !important;
  font-size: 10.5px;
  font-weight: 700;
  text-decoration: none;
  border: 1px solid transparent;
  transition: filter 0.15s;
}
.popup-clim-link:hover { filter: brightness(1.1); text-decoration: none; }
/* PATCH-LUCA clim-link-inline (2026-06-19): forza il chip "Sito → apri" a
   restare su UNA SOLA RIGA, orizzontale, ben formattato.
   - white-space:nowrap   -> "apri" non va a capo sotto l'icona
   - SVG dimensionato     -> non collassa in verticale
   - .v che lo contiene   -> niente max-width restrittivo, cosi' il chip
                             non viene "spinto a capo" dal padre flex. */
.popup-clim-link { white-space: nowrap; line-height: 1; }
.popup-clim-link svg {
  width: 12px;
  height: 12px;
  flex-shrink: 0;
  display: inline-block;
  vertical-align: middle;
}
.popup-clim-link span {
  display: inline-block;
  vertical-align: middle;
  white-space: nowrap;
}
.popup-row .v:has(.popup-clim-link) {
  max-width: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.leaflet-popup.popup-clim-indoor .popup-clim-link {
  background: rgba(37,99,168,0.10); color: #1d4f85; border-color: rgba(37,99,168,0.35);
}
.leaflet-popup.popup-clim-outdoor .popup-clim-link {
  background: rgba(47,138,74,0.10); color: #226b39; border-color: rgba(47,138,74,0.35);
}
/* Anche le icone delle righe e i K si tingono nel kind, per coerenza */
.leaflet-popup.popup-clim-indoor .popup-row .ico  { color: #2563a8; }
.leaflet-popup.popup-clim-outdoor .popup-row .ico { color: #2f8a4a; }
.leaflet-popup.popup-clim-indoor .popup-row .k,
.leaflet-popup.popup-clim-outdoor .popup-row .k {
  color: #555;
}
.leaflet-popup.popup-clim-indoor .popup-row .v,
.leaflet-popup.popup-clim-outdoor .popup-row .v {
  color: #1f1f1f;
}
.leaflet-popup.popup-clim-indoor .popup-row,
.leaflet-popup.popup-clim-outdoor .popup-row {
  border-bottom-color: rgba(0,0,0,0.08);
}

/* PATCH-LUCA popup-cat-style (2026-06-24): varianti POPUP POI per CATEGORIA
   ---------------------------------------------------------------------
   Sull'esempio dello stile clim shel (gradiente 135 deg + glass wrapper):
   ogni categoria POI (cultural, education, entertainment, health,
   mobility, park, drinking_fountain) ha la sua palette coerente.
   Le classi vengono assegnate a leaflet-popup via className passato a
   bindPopup (es. 'popup-cat-cultural'). Il dispatcher in addFeatureBehavior
   legge window.__currentCategory per scegliere la classe giusta.
   ------------------------------------------------------------------- */

/* --- CULTURAL: viola/ametista --- */
.popup-header--cat-cultural { background: linear-gradient(135deg, #a86fdc 0%, #6a3aa8 100%); }
.leaflet-popup.popup-cat-cultural .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #6a3aa8;
  box-shadow: 0 10px 32px rgba(106,58,168,0.28), 0 4px 10px rgba(106,58,168,0.15);
}
.leaflet-popup.popup-cat-cultural .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #6a3aa8;
}
.leaflet-popup.popup-cat-cultural .popup-cat-hero {
  background: linear-gradient(180deg, rgba(168,111,220,0.16) 0%, rgba(168,111,220,0.06) 100%);
  border-color: rgba(106,58,168,0.30);
}
.leaflet-popup.popup-cat-cultural .popup-cat-kind { color: #4a266e; }
.leaflet-popup.popup-cat-cultural .popup-row .ico  { color: #6a3aa8; }

/* --- EDUCATION: rosso ciliegia --- */
.popup-header--cat-education { background: linear-gradient(135deg, #e07a7a 0%, #b03030 100%); }
.leaflet-popup.popup-cat-education .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #b03030;
  box-shadow: 0 10px 32px rgba(176,48,48,0.28), 0 4px 10px rgba(176,48,48,0.15);
}
.leaflet-popup.popup-cat-education .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #b03030;
}
.leaflet-popup.popup-cat-education .popup-cat-hero {
  background: linear-gradient(180deg, rgba(224,122,122,0.16) 0%, rgba(224,122,122,0.06) 100%);
  border-color: rgba(176,48,48,0.30);
}
.leaflet-popup.popup-cat-education .popup-cat-kind { color: #7a1f1f; }
.leaflet-popup.popup-cat-education .popup-row .ico  { color: #b03030; }

/* --- ENTERTAINMENT: rosa magenta --- */
.popup-header--cat-entertainment { background: linear-gradient(135deg, #e773b4 0%, #b32e7e 100%); }
.leaflet-popup.popup-cat-entertainment .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #b32e7e;
  box-shadow: 0 10px 32px rgba(179,46,126,0.28), 0 4px 10px rgba(179,46,126,0.15);
}
.leaflet-popup.popup-cat-entertainment .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #b32e7e;
}
.leaflet-popup.popup-cat-entertainment .popup-cat-hero {
  background: linear-gradient(180deg, rgba(231,115,180,0.16) 0%, rgba(231,115,180,0.06) 100%);
  border-color: rgba(179,46,126,0.30);
}
.leaflet-popup.popup-cat-entertainment .popup-cat-kind { color: #7a1f56; }
.leaflet-popup.popup-cat-entertainment .popup-row .ico  { color: #b32e7e; }

/* --- HEALTH: rosa salmone --- */
.popup-header--cat-health { background: linear-gradient(135deg, #f08a8a 0%, #c94545 100%); }
.leaflet-popup.popup-cat-health .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #c94545;
  box-shadow: 0 10px 32px rgba(201,69,69,0.28), 0 4px 10px rgba(201,69,69,0.15);
}
.leaflet-popup.popup-cat-health .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #c94545;
}
.leaflet-popup.popup-cat-health .popup-cat-hero {
  background: linear-gradient(180deg, rgba(240,138,138,0.16) 0%, rgba(240,138,138,0.06) 100%);
  border-color: rgba(201,69,69,0.30);
}
.leaflet-popup.popup-cat-health .popup-cat-kind { color: #8a2828; }
.leaflet-popup.popup-cat-health .popup-row .ico  { color: #c94545; }

/* --- MOBILITY: arancione --- */
.popup-header--cat-mobility { background: linear-gradient(135deg, #f4a258 0%, #cc6a16 100%); }
.leaflet-popup.popup-cat-mobility .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #cc6a16;
  box-shadow: 0 10px 32px rgba(204,106,22,0.28), 0 4px 10px rgba(204,106,22,0.15);
}
.leaflet-popup.popup-cat-mobility .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #cc6a16;
}
.leaflet-popup.popup-cat-mobility .popup-cat-hero {
  background: linear-gradient(180deg, rgba(244,162,88,0.16) 0%, rgba(244,162,88,0.06) 100%);
  border-color: rgba(204,106,22,0.30);
}
.leaflet-popup.popup-cat-mobility .popup-cat-kind { color: #8a4710; }
.leaflet-popup.popup-cat-mobility .popup-row .ico  { color: #cc6a16; }

/* --- PARK: verde foresta (piu' scuro del clim outdoor) --- */
.popup-header--cat-park { background: linear-gradient(135deg, #5fb858 0%, #2f7a2f 100%); }
.leaflet-popup.popup-cat-park .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #2f7a2f;
  box-shadow: 0 10px 32px rgba(47,122,47,0.28), 0 4px 10px rgba(47,122,47,0.15);
}
.leaflet-popup.popup-cat-park .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #2f7a2f;
}
.leaflet-popup.popup-cat-park .popup-cat-hero {
  background: linear-gradient(180deg, rgba(95,184,88,0.16) 0%, rgba(95,184,88,0.06) 100%);
  border-color: rgba(47,122,47,0.30);
}
.leaflet-popup.popup-cat-park .popup-cat-kind { color: #1f5520; }
.leaflet-popup.popup-cat-park .popup-row .ico  { color: #2f7a2f; }

/* --- DRINKING FOUNTAIN: ciano/acqua --- */
.popup-header--cat-drinking_fountain { background: linear-gradient(135deg, #5fd0d0 0%, #1d7a8c 100%); }
.leaflet-popup.popup-cat-drinking_fountain .leaflet-popup-content-wrapper {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #1d7a8c;
  box-shadow: 0 10px 32px rgba(29,122,140,0.28), 0 4px 10px rgba(29,122,140,0.15);
}
.leaflet-popup.popup-cat-drinking_fountain .leaflet-popup-tip {
  background: rgba(255,255,255,0.72);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  border-color: #1d7a8c;
}
.leaflet-popup.popup-cat-drinking_fountain .popup-cat-hero {
  background: linear-gradient(180deg, rgba(95,208,208,0.16) 0%, rgba(95,208,208,0.06) 100%);
  border-color: rgba(29,122,140,0.30);
}
.leaflet-popup.popup-cat-drinking_fountain .popup-cat-kind { color: #115560; }
.leaflet-popup.popup-cat-drinking_fountain .popup-row .ico  { color: #1d7a8c; }

/* Comuni: body trasparente per far vedere il glass, hero glass */
.leaflet-popup[class*="popup-cat-"] .popup-body { background: transparent; }
.popup-cat-hero {
  text-align: center;
  padding: 10px 8px 10px 8px;
  margin-bottom: 10px;
  border: 1px solid transparent;
  border-radius: 10px !important;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.popup-cat-kind {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin: 0;
}
.popup-cat-sub {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 600;
}
/* fine PATCH-LUCA popup-cat-style */


/* Tooltip al hover (invariato) */
.leaflet-tooltip {
  background: var(--accent-dark);
  color: #fff;
  border: none;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.leaflet-tooltip-top:before { border-top-color: var(--accent-dark); }

/* ─── LAYER PANEL (toggle eleganti, look "pill button") ───
   PATCH-LUCA pulsanti-v2:
   - I 4 pulsanti dei layer sono dei veri "toggle button" (non checkbox).
   - L'input checkbox resta nel DOM (per compatibilità con la logica esistente)
     ma è visualmente nascosto: lo stato ON/OFF si legge dal genitore via :has().
   - Stato OFF: sfondo bianco, bordo sottile, label in grigio scuro, icona soft.
   - Stato ON : alone viola sottile + bordo viola + barra accent a sinistra +
     icona a piena saturazione. NIENTE riempimento totale, come richiesto.
   - Tutti i pulsanti hanno la stessa altezza fissa, indipendentemente
     dalla lunghezza dell'etichetta (testo su 2 righe consentito).
*/
.layer-list { display: flex; flex-direction: column; gap: 8px; }

.layer-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px 8px 14px;
  border: 1px solid var(--border-light);
  background: var(--bg);
  cursor: pointer;
  border-radius: 8px !important;
  /* Altezza FISSA identica per tutti i 4 pulsanti */
  height: 46px;
  box-sizing: border-box;
  overflow: hidden;
  transition: background 0.15s ease, border-color 0.15s ease,
              box-shadow 0.15s ease, transform 0.05s ease;
}
.layer-row:hover {
  background: var(--bg2);
  border-color: var(--border);
}
.layer-row:active { transform: translateY(1px); }

/* Checkbox nativa nascosta (solo per accessibilità + logica JS invariata) */
.layer-row input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 0;
  height: 0;
  margin: 0;
}

/* Stato ATTIVO: bordo accent + alone tenue (NIENTE barra laterale) */
.layer-row:has(input[type="checkbox"]:checked) {
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 1px var(--accent) inset,
              0 2px 6px rgba(124, 58, 237, 0.10);
}

/* Focus visibile per accessibilità tastiera */
.layer-row:has(input[type="checkbox"]:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Contenitore icona (24×24) */
.layer-icon {
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0.55;
  transition: opacity 0.15s ease, transform 0.15s ease;
}
.layer-icon svg { width: 24px; height: 24px; display: block; }
.layer-row:has(input[type="checkbox"]:checked) .layer-icon {
  opacity: 1;
  transform: scale(1.05);
}

/* Etichetta su 1 o 2 righe, sempre verticalmente centrata */
.layer-name {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text);
  flex: 1;
  line-height: 1.25;
  /* consente max 2 righe senza far crescere il pulsante */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.layer-row:has(input[type="checkbox"]:checked) .layer-name {
  color: var(--accent-dark);
}

/* Indicatore ON/OFF discreto a destra (pallino) */
.layer-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.layer-row:has(input[type="checkbox"]:checked) .layer-dot {
  background: var(--accent);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.18);
}

/* ─── LEGENDA MAPPA ─── */
.map-legend {
  position: absolute;
  bottom: 16px;
  right: 16px;
  z-index: 800;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px rgba(83, 0, 108, 0.18);
  font-family: var(--font);
  font-size: 11px;
  color: var(--text);
  max-width: 260px;
  user-select: none;
}
.map-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-size: 10px;
}
.map-legend-header .legend-toggle {
  font-size: 13px;
  line-height: 1;
  transition: transform 0.2s ease;
}
.map-legend.collapsed .legend-toggle { transform: rotate(-90deg); }
.map-legend.collapsed .map-legend-body { display: none; }
.map-legend-body {
  padding: 8px 10px 10px 10px;
  max-height: 60vh;
  overflow-y: auto;
}
.legend-section { margin-bottom: 10px; }
.legend-section:last-child { margin-bottom: 0; }
.legend-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-dark);
  margin-bottom: 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border-light);
}
.legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 2px 0;
  line-height: 1.3;
}
.legend-swatch {
  width: 18px;
  height: 12px;
  border: 1px solid rgba(0, 0, 0, 0.18);
  flex-shrink: 0;
}
.legend-swatch-line {
  width: 22px;
  flex-shrink: 0;
  display: inline-block;
}
.legend-swatch-dot {
  width: 12px;
  height: 12px;
  border-radius: 50% !important;
  flex-shrink: 0;
  border: 1.5px solid #fff;
  box-shadow: 0 0 0 1.5px var(--accent-dark);
}
.legend-label { flex: 1; }
.legend-note {
  font-size: 10px;
  color: var(--muted);
  font-style: italic;
  margin-top: 3px;
  line-height: 1.35;
}

/* ─── LEGENDA NELLA SIDEBAR (minimal) ─── */
.sb-legend {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.sb-legend-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sb-legend-title {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  padding-bottom: 4px;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: 2px;
}

/* PATCH-LUCA dist-unit-toggle-v1: pill toggle MIN/MET inline accanto al titolo
   "Distanza pedonale". Stesso linguaggio visivo del .steps-pill di dashboard_parma
   (liquid glass + thumb scorrevole), ma in versione MINI per stare in linea col
   titolo. Il titolo diventa una flex-row col pill allineato a destra. */
.sb-legend-title--with-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.sb-legend-title--with-toggle .sb-legend-title-text {
  flex: 1;
  min-width: 0;
}

.dist-unit-pill {
  display: inline-flex;
  position: relative;
  background: linear-gradient(180deg,
              rgba(83, 0, 108, 0.06) 0%,
              rgba(83, 0, 108, 0.10) 100%);
  border: 1px solid rgba(83, 0, 108, 0.18);
  padding: 2px;
  user-select: none;
  border-radius: 999px !important;
  overflow: hidden;
  -webkit-backdrop-filter: blur(8px) saturate(140%);
  backdrop-filter: blur(8px) saturate(140%);
  box-shadow:
    inset 0 1px 2px rgba(83, 0, 108, 0.08),
    inset 0 -1px 0 rgba(255, 255, 255, 0.5);
  /* MINI: leggermente piu' alto del testo del titolo (titolo 9px, pill ~18px) */
  height: 18px;
  flex-shrink: 0;
}
/* Thumb scorrevole (::before) identico in spirito al .steps-pill::before */
.dist-unit-pill::before {
  content: '';
  position: absolute;
  top: 2px;
  bottom: 2px;
  left: 2px;
  width: calc(50% - 2px);
  background:
    linear-gradient(180deg,
      rgba(140, 80, 175, 0.92) 0%,
      rgba(105, 50, 140, 0.92) 50%,
      rgba(95, 40, 130, 0.94) 100%);
  border-radius: 999px !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.45),
    inset 0 -1px 0 rgba(60, 0, 90, 0.35),
    0 1px 2px rgba(60, 0, 90, 0.18),
    0 2px 6px rgba(83, 0, 108, 0.22);
  transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
  transform: translateX(0%);
  z-index: 0;
  pointer-events: none;
}
.dist-unit-pill[data-pos="1"]::before {
  transform: translateX(100%);
}
.dist-unit-pill-opt {
  position: relative;
  z-index: 1;
  padding: 0 10px;
  font-size: 8.5px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  cursor: pointer;
  color: var(--muted);
  background: transparent;
  border-radius: 999px !important;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 28px;
  transition: color 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.dist-unit-pill-opt:hover:not(.active) {
  color: var(--accent);
}
.dist-unit-pill-opt.active {
  color: #fff;
  text-shadow: 0 1px 0 rgba(40, 0, 60, 0.25);
}
/* /PATCH-LUCA dist-unit-toggle-v1 */
.sb-legend-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.3;
}
.sb-sw {
  flex-shrink: 0;
  display: inline-block;
}
.sb-sw-square {
  width: 16px;
  height: 11px;
  border: 1px solid rgba(0,0,0,0.15);
}
.sb-sw-line {
  width: 22px;
  height: 6px;
  flex-shrink: 0;
  display: inline-block;
}
/* ─── PATCH-LUCA road-legend-v2: legende "Frequenza d'uso" e "Percorsi"
   ridisegnate. Ogni riga e' un "binario stradale": linea piu' lunga (40px),
   leggermente curva, con stroke arrotondato e ombra morbida che richiama
   l'aspetto reale di una strada sulla mappa. Il valore numerico e'
   incapsulato in un piccolo chip allineato a destra. ─── */
.sb-road-row {
  display: grid;
  grid-template-columns: 52px 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
  border-bottom: 1px dashed rgba(208, 186, 218, 0.45);
}
.sb-road-row:last-child { border-bottom: none; }
.sb-road-svg {
  width: 52px;
  height: 14px;
  display: block;
  overflow: visible;
}
.sb-road-svg .road-glow {
  /* alone esterno per simulare la "strada vista dall'alto" */
  opacity: 0.18;
  filter: blur(0.6px);
}
.sb-road-label {
  font-size: 11px;
  color: var(--text);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: 0.01em;
}
.sb-road-count {
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.02em;
  font-variant-numeric: tabular-nums;
  display: block;
  margin-bottom: 2px;
  text-align: center;
  min-width: 52px;
}
.sb-road-svg-wrap {
  display: flex;
  flex-direction: column;
  align-items: stretch;
}
.sb-road-chip {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--muted);
  background: rgba(83, 0, 108, 0.06);
  border: 1px solid rgba(83, 0, 108, 0.15);
  padding: 2px 7px;
  border-radius: 999px !important;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  white-space: nowrap;
}
/* Mini-header esplicativo (es. "Spessore proporzionale al traffico") */
.sb-road-hint {
  font-size: 9.5px;
  color: var(--muted);
  font-style: italic;
  margin: -2px 0 6px 0;
  line-height: 1.3;
  letter-spacing: 0.01em;
}
/* PATCH-LUCA legend-bar-v2: stile copiato 1:1 da dashboard_parma.html
   (".legend-bar" Accessibility legend). Liquid glass + pill 999px +
   inset shadow + riflesso superiore. L'altezza è 18px come parma.
   I colori del gradient li mantengono i singoli <span> inline (verde,
   giallo, rosso chiaro, rosso scuro) tramite background custom: qui
   sotto definiamo solo CONTENITORE (.sb-scale-bar) e GLOSS (::after). */
.sb-scale-bar {
  display: flex;
  height: 18px;
  width: 100%;
  border: 1px solid rgba(83, 0, 108, 0.18);
  border-radius: 999px !important;
  overflow: hidden;
  position: relative;
  box-shadow:
    inset 0 1px 2px rgba(83, 0, 108, 0.10),
    inset 0 -1px 0 rgba(255, 255, 255, 0.35),
    0 1px 2px rgba(83, 0, 108, 0.05);
}
.sb-scale-bar > span {
  flex: 1;
  height: 100%;
  display: block;
}
/* Riflesso lucido superiore (effetto vetro) sovrapposto al gradient,
   identico a dashboard_parma.html ".legend-bar::after". */
.sb-scale-bar::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg,
              rgba(255, 255, 255, 0.18) 0%,
              rgba(255, 255, 255, 0.04) 45%,
              rgba(255, 255, 255, 0) 60%,
              rgba(0, 0, 0, 0.04) 100%);
  pointer-events: none;
  border-radius: 999px !important;
}
/* PATCH-LUCA dist-ticks-aligned-v2: solo 3 tick (10/15/30) posizionati sui
   CONFINI delle bande di colore (25% / 50% / 75%). Font-size ripristinato a
   9.5px come originale. Niente piu' tick agli estremi (<10 / >30). */
.sb-scale-ticks {
  position: relative;
  height: 14px;                    /* spazio per il testo a 9.5px */
  font-size: 9.5px;                /* dimensione originale */
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  margin-top: 2px;
  letter-spacing: 0.02em;
}
.sb-scale-ticks > span {
  position: absolute;
  top: 0;
  white-space: nowrap;
  line-height: 1;
  transform: translateX(-50%);     /* centra il testo sul punto-confine */
}
.sb-scale-ticks > span:nth-child(1) { left: 25%; }   /* 10 min -> verde|giallo */
.sb-scale-ticks > span:nth-child(2) { left: 50%; }   /* 15 min -> giallo|rosso */
.sb-scale-ticks > span:nth-child(3) { left: 75%; }   /* 30 min -> rosso|bordeaux */
.sb-legend-scale {
  margin-bottom: 8px;              /* un filo piu' di respiro sotto i tick */
}
/* ── PATCH-LUCA: stile "info area" identico a dashboard_parma.html ── */
.city-info {
  display: flex;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--border);
  padding: 12px;
  background: var(--bg);
}
.city-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
}
/* PATCH-LUCA multi-category-2026: stile del <select> categoria che
   sostituisce il vecchio titolo statico "Parma - San Leonardo". */
.city-select {
  width: 100%;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 6px 8px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  /* PATCH-LUCA select-no-uppercase-2026-07-03: rimosso text-transform:
     uppercase per rispettare esattamente le label scritte in
     CATEGORY_LABELS (es. 'Scuole 0-6' invece di 'SCUOLE 0-6'). */
  letter-spacing: 0.02em;
  cursor: pointer;
  outline: none;
}
.city-select:focus { border-color: var(--accent-dark); }
.city-select option { font-weight: 600; text-transform: none; }
.city-meta { font-size: 10px; color: var(--muted); margin-top: 2px; }
</style>
<style>
  /* ===================================================================
     PATCH-LUCA rifugi-removed (patch scuole 2026-07-02):
     Cintura di sicurezza CSS che nasconde OGNI residuo dei Rifugi
     Climatici che il JS dormiente potrebbe generare dinamicamente
     (marker Leaflet, popup, dropdown POI sulla mappa, section-title,
     btnbar, legenda indoor/outdoor).
     Nella dashboard scuole i Rifugi climatici non servono.
     =================================================================== */
  #climShelSidebarList,
  #climShelSidebarRow,
  #climShelSectionTitle,
  #climShelBtnBar,
  #climShelBtnIndoor,
  #climShelBtnOutdoor,
  .clim-shel-legend,
  .clim-shel-btnbar,
  .clim-shel-btn,
  .clim-shel-dropdown,
  .clim-shel-popup,
  .leaflet-marker-icon.clim-shel-marker { display: none !important; }
  
  
<!-- PATCH-LUCA speed-panel-v3 CSS (palette viola scuole #53006c) -->

.speed-panel-group {
  padding: 12px 8px 10px 8px;
  border-top: 1px solid var(--border-light);
  margin-top: 12px;
}
.speed-panel-group .sb-legend-title-text {
  font-size: 11px;
  font-weight: 600;
  color: var(--text);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.speed-display {
  display: flex;
  align-items: baseline;
  gap: 6px;
  margin: 8px 0 6px 0;
}
.speed-val-big {
  font-size: 32px;
  font-weight: 700;
  color: var(--accent);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.speed-unit {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}
.speed-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: var(--border-light);
  outline: none;
  cursor: pointer;
  margin: 6px 0 4px 0;
}
.speed-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.speed-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--accent);
  cursor: pointer;
  border: 2px solid var(--bg);
  box-shadow: 0 0 0 1px var(--accent);
}
.speed-range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--muted);
  margin-bottom: 12px;
  letter-spacing: 0.04em;
}
.param-boxes {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.param-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}
.param-label {
  flex: 0 0 60px;
  color: var(--muted);
  font-weight: 500;
}
.param-input-wrap {
  flex: 1;
  min-width: 0;
}
.param-input {
  width: 100%;
  padding: 4px 8px;
  border: 1px solid var(--border-light);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  text-align: right;
  outline: none;
  font-variant-numeric: tabular-nums;
}
.param-input:focus {
  border-color: var(--accent);
}
.param-input:disabled {
  background: var(--bg2);
  color: var(--muted);
  cursor: not-allowed;
}
.param-unit {
  flex: 0 0 26px;
  font-size: 11px;
  color: var(--muted);
}
/* PATCH-LUCA lock-style-align-v1 (2026-07-02): stile lucchetti IDENTICO a
   dashboard_parma_tempo.html. Nessun bordo, nessun riquadro, nessun fondo
   pieno: solo l'icona SVG che cambia opacita' e colore in base allo stato.
   - default:            opacity 0.5, colore --text
   - .locked (chiuso):   opacity 1,   colore --accent (viola)
   - :not(.locked)(aperto): opacity 0.3, colore --muted
   NB: la logica JS (renderLocks) deve mettere .locked sul lucchetto CHIUSO,
       cioe' quello del parametro NON attivo (=quello che l'utente vede come
       "da cliccare per sbloccare l'altro"). */
.param-lock {
  width: 24px;
  height: 24px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  opacity: 0.5;
  transition: opacity 0.15s;
  background: none;
  border: none;
  padding: 0;
  color: var(--text);
}
.param-lock:hover { opacity: 0.8; }
.param-lock.locked { opacity: 1; color: var(--accent); }
.param-lock:not(.locked) { opacity: 0.3; color: var(--muted); }
.param-lock:focus { outline: none; }
.param-lock:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
