/* Acqua: sobria, leggera, leggibile dal telefono. Solo blu acqua. */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: #123; background: #f4f9fc; line-height: 1.45;
}
.intestazione {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem;
  padding: 0.9rem 1.2rem 0.7rem; background: #0b3d6e; color: #fff;
}
.intestazione h1 { margin: 0; font-size: 1.5rem; letter-spacing: -0.01em; }
.intestazione p { margin: 0.2rem 0 0; color: #cfe8f5; font-size: 0.95rem; }
.intestazione nav a { color: #fff; font-weight: 600; }
.layout { display: flex; gap: 0; min-height: calc(100vh - 76px); }
.mappa-wrap { position: relative; flex: 1 1 auto; min-width: 0; }
#mappa { position: absolute; inset: 0; }
.colonna { width: 380px; flex: 0 0 auto; padding: 1rem; overflow-y: auto; background: #fff; border-left: 1px solid #d5e6f2; }
.selettore { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.8rem; }
.selettore select { display: block; width: 100%; margin-top: 0.3rem; padding: 0.5rem; font-size: 1rem; border: 1px solid #8ec8e8; border-radius: 6px; background: #fff; }
.pannello h2 { margin: 0.2rem 0 0.5rem; font-size: 1.35rem; color: #0b3d6e; }
.pannello h3 { margin: 1rem 0 0.4rem; font-size: 1rem; color: #0b3d6e; }
.pannello p { margin: 0.5rem 0; }
.numero-grande { font-size: 2.4rem; font-weight: 800; color: #0b3d6e; margin: 0.2rem 0 !important; }
.numero-grande.piccolo { font-size: 1.7rem; }
.sottotitolo { color: #4a6a85; }
.confronto { background: #eaf4fb; border-left: 4px solid #1f6fb4; padding: 0.5rem 0.7rem; }
.nota { font-size: 0.9rem; color: #4a6a85; }
/* Scheda facsimile: testata fissa con X, blocchi di confronto, scarica. */
.occhiello { font-size: 0.85rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: #1f6fb4; margin: 0.2rem 0 0 !important; }
.scheda-testa { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; background: #fff; padding: 0.3rem 0 0.5rem; }
.scheda-chiudi { cursor: pointer; border: none; background: #0b3d6e; color: #fff; font-size: 1.4rem; line-height: 1; width: 2.2rem; height: 2.2rem; border-radius: 50%; flex: 0 0 auto; }
.scheda-chiudi:hover { background: #1f6fb4; }
.scheda-ingrandisci { cursor: pointer; border: 1px solid #8ec8e8; background: #eaf4fb; color: #0b3d6e; border-radius: 6px; padding: 0.4rem 0.7rem; font-size: 0.9rem; }
.scheda-ingrandisci:hover { background: #cfe8f5; }
.blocco-confronti { margin: 0.7rem 0; }
.blocco-lettura { background: #f4f9fc; border: 1px solid #d5e6f2; border-radius: 8px; padding: 0.2rem 0.8rem; margin: 0.7rem 0; }
.blocco-fonte { font-size: 0.9rem; color: #4a6a85; border-top: 1px solid #d5e6f2; margin-top: 0.8rem; padding-top: 0.3rem; }
.blocco-fonte a { color: #1f6fb4; font-weight: 600; }
.scarica { display: block; width: 100%; cursor: pointer; border: none; background: #0b3d6e; color: #fff; border-radius: 6px; padding: 0.65rem 0.7rem; font-size: 1rem; font-weight: 700; margin: 0.7rem 0; }
.scarica:hover { background: #1f6fb4; }
.scheda-fine { display: flex; gap: 0.5rem; margin-top: 1rem; padding-top: 0.7rem; border-top: 1px solid #d5e6f2; }
.scheda-fine button { flex: 1 1 auto; cursor: pointer; border: 1px solid #8ec8e8; background: #eaf4fb; color: #0b3d6e; border-radius: 6px; padding: 0.5rem 0.4rem; font-size: 0.92rem; }
.scheda-fine button:hover { background: #cfe8f5; }
#pannello.scheda-grande { position: fixed; inset: 0; z-index: 40; overflow-y: auto; background: #fff; padding: 1rem 1.2rem; }
.chiudi, .voce-comune {
  display: block; width: 100%; text-align: left; cursor: pointer;
  border: 1px solid #8ec8e8; background: #eaf4fb; color: #0b3d6e;
  border-radius: 6px; padding: 0.5rem 0.7rem; font-size: 0.95rem; margin: 0.3rem 0;
}
.chiudi:hover, .voce-comune:hover { background: #cfe8f5; }
.voce-comune span { font-weight: 600; }
.voce-comune strong { float: right; }
.voce-comune small { display: block; color: #4a6a85; }
.lista-comuni { max-height: 46vh; overflow-y: auto; padding-right: 0.2rem; }
.legenda {
  position: absolute; left: 0.8rem; bottom: 0.8rem; z-index: 2;
  background: rgba(255, 255, 255, 0.94); border: 1px solid #d5e6f2; border-radius: 8px;
  padding: 0.5rem 0.8rem; font-size: 0.85rem; max-width: 250px;
  box-shadow: 0 2px 10px rgba(11, 61, 110, 0.15);
}
.legenda summary { cursor: pointer; font-weight: 700; color: #0b3d6e; }
.legenda ul { list-style: none; margin: 0.5rem 0; padding: 0; }
.legenda li { display: flex; align-items: center; gap: 0.5rem; margin: 0.25rem 0; }
.campione { display: inline-block; width: 18px; height: 12px; border: 1px solid #999; border-radius: 2px; flex: 0 0 auto; }
.pallino { display: inline-block; width: 13px; height: 13px; border-radius: 50%; background: #1f6fb4; border: 1.5px solid #fff; box-shadow: 0 0 0 1px #1f6fb4; flex: 0 0 auto; }
.onda { display: block; width: 100%; height: 34px; margin-top: 1rem; }
.onda path { fill: #eaf4fb; animation: onda 9s linear infinite; }
@keyframes onda {
  from { transform: translateX(0); }
  to { transform: translateX(-50%); }
}
/* Intro cinematografica: la vasca si riempie fino al 42,4 %, poi la mappa si rivela. */
#intro {
  position: fixed; inset: 0; z-index: 50; display: flex;
  align-items: center; justify-content: center; text-align: center;
  background: linear-gradient(180deg, #071f38 0%, #0b3d6e 55%, #1f6fb4 100%);
  color: #fff; padding: 1.5rem; cursor: pointer;
  transition: opacity 0.6s ease, transform 0.7s ease;
}
#intro.chiusa { opacity: 0; transform: translateY(-100%); }
.intro-contenuto { max-width: 36rem; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 0.7rem; }
.intro-occhiello { margin: 0; color: #8ec8e8; font-size: 0.9rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
#intro h2 { font-size: 2.4rem; margin: 0; line-height: 1.1; }
.intro-numero { margin: 0.2rem 0 !important; font-size: 3.4rem; font-weight: 800; font-variant-numeric: tabular-nums; color: #fff; }
.intro-vasca { position: relative; width: 100%; max-width: 30rem; height: 30px; border: 1px solid rgba(255, 255, 255, 0.55); border-radius: 999px; background: rgba(255, 255, 255, 0.12); }
.intro-livello { position: absolute; left: 0; top: 0; bottom: 0; width: 0; overflow: hidden; border-radius: 999px; background: linear-gradient(180deg, #4a9fd4, #1f6fb4); }
.intro-onda { position: absolute; left: 0; top: -9px; width: 200%; height: 14px; animation: onda 6s linear infinite; }
.intro-onda path { fill: #8ec8e8; }
.intro-sotto { margin: 0; color: #eaf4fb; font-size: 1rem; max-width: 32rem; }
#entra {
  margin-top: 0.6rem; cursor: pointer; border: 2px solid #fff; background: transparent; color: #fff;
  font-size: 1rem; font-weight: 700; padding: 0.55rem 1.3rem; border-radius: 999px;
}
#entra:hover { background: rgba(255, 255, 255, 0.2); }
@media (prefers-reduced-motion: reduce) {
  .onda path, .intro-onda { animation: none !important; }
  #intro { transition: none; }
}
@media (max-width: 700px) {
  .intestazione { padding: 0.7rem 0.9rem; }
  .intestazione h1 { font-size: 1.25rem; }
  .intestazione p { font-size: 0.85rem; }
  .layout { flex-direction: column; }
  .mappa-wrap { height: 52vh; flex: none; }
  .colonna { width: auto; border-left: none; border-top: 1px solid #d5e6f2; overflow-y: visible; }
  .legenda { max-width: 200px; font-size: 0.8rem; }
  #intro h2 { font-size: 1.7rem; }
  .intro-numero { font-size: 2.6rem; }
}

/* Struttura di navigazione: stessa impostazione del sito di riferimento. */
.vh { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.sito { display: flex; flex-wrap: wrap; align-items: center; gap: 0.6rem 1rem; background: #0b3d6e; color: #fff; padding: 0.7rem 1rem; }
.sito-marchio { color: #fff; text-decoration: none; line-height: 1.15; }
.sito-marchio b { display: block; font-size: 1.25rem; }
.sito-marchio span { font-size: 0.85rem; color: #cfe8f5; }
.sito-menu-tasto { display: none; margin-left: auto; cursor: pointer; border: 2px solid #fff; background: transparent; color: #fff; font-weight: 700; padding: 0.4rem 0.8rem; border-radius: 999px; }
.sito-icona { display: inline-flex; flex-direction: column; gap: 3px; margin-right: 0.4rem; vertical-align: middle; }
.sito-icona i { display: block; width: 18px; height: 2px; background: #fff; }
.sito-voci ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 0.9rem; }
.sito-voci a { color: #fff; text-decoration: none; font-weight: 600; }
.sito-voci a:hover { text-decoration: underline; }
.barra { padding: 0.7rem 1rem 0.4rem; background: #eaf4fb; border-bottom: 1px solid #d5e6f2; }
.cerca { position: relative; display: flex; gap: 0.5rem; max-width: 46rem; }
#q, #tabella-q { flex: 1; font-size: 1rem; padding: 0.55rem 0.8rem; border: 1px solid #8ec8e8; border-radius: 8px; background: #fff; }
.tasto { cursor: pointer; border: 1px solid #1f6fb4; background: #fff; color: #0b3d6e; font-weight: 700; padding: 0.55rem 0.9rem; border-radius: 999px; }
#risultati { position: absolute; top: 100%; left: 0; right: 0; z-index: 30; list-style: none; margin: 0.3rem 0 0; padding: 0.3rem 0; background: #fff; border: 1px solid #d5e6f2; border-radius: 8px; box-shadow: 0 4px 14px rgba(11, 61, 110, 0.18); }
#risultati li button { display: block; width: 100%; text-align: left; cursor: pointer; border: none; background: transparent; padding: 0.5rem 0.8rem; font-size: 0.95rem; }
#risultati li button:hover { background: #eaf4fb; }
#risultati small { color: #4a6a85; }
.menu-sito ul { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.2rem 1rem; }
.menu-sito a { color: #0b3d6e; font-weight: 600; text-decoration: none; }
.menu-sito a:hover { text-decoration: underline; }
.scelta-attiva { margin: 0.5rem 0 0; font-size: 0.9rem; color: #4a6a85; }
.citta-sezione, .tabella-sezione { max-width: 72rem; margin: 0 auto; padding: 1rem; }
.citta-nota { color: #4a6a85; }
#citta-elenco { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(15rem, 1fr)); gap: 0.4rem; }
#citta-elenco .voce-comune { width: 100%; display: flex; justify-content: space-between; gap: 0.5rem; cursor: pointer; border: 1px solid #d5e6f2; background: #fff; padding: 0.5rem 0.7rem; border-radius: 8px; }
.filtro-velo { position: fixed; inset: 0; z-index: 44; background: rgba(7, 31, 56, 0.55); }
.filtro { position: fixed; z-index: 45; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(92vw, 34rem); max-height: 86vh; overflow-y: auto; background: #fff; border: 1px solid #d5e6f2; border-radius: 12px; padding: 1rem 1.2rem; box-shadow: 0 8px 30px rgba(7, 31, 56, 0.35); }
.filtro-testa { display: flex; justify-content: space-between; align-items: center; }
.filtro-testa h2 { margin: 0; color: #0b3d6e; }
.filtro .chiudi { cursor: pointer; border: none; background: transparent; font-size: 1.6rem; line-height: 1; color: #0b3d6e; }
.filtro h3 { color: #0b3d6e; margin: 1rem 0 0.3rem; }
.tabella-sezione table { border-collapse: collapse; width: 100%; margin: 0.6rem 0 1.2rem; }
.tabella-sezione th, .tabella-sezione td { border: 1px solid #d5e6f2; padding: 0.4rem 0.6rem; text-align: left; }
.tabella-sezione th { background: #eaf4fb; color: #0b3d6e; }
.tabella-sezione tbody tr { cursor: pointer; }
.tabella-sezione tbody tr:hover { background: #eaf4fb; }
.tabella-cerca { display: flex; gap: 0.5rem; align-items: center; margin: 0.4rem 0; }
.tabella-cerca label { font-weight: 700; color: #0b3d6e; }
footer.fonte { padding: 1rem; background: #eaf4fb; border-top: 1px solid #d5e6f2; color: #234; }
footer.fonte .aggiornato { margin: 0.5rem 0; }
#intro.completa #entra { background: rgba(255, 255, 255, 0.25); }
.torna { display: inline-block; margin: 0 0 1rem; font-weight: 700; }
.nota-globale { background: #fffbe6; border: 1px solid #d9c36a; padding: 0.9rem 1.1rem; margin: 0 0 1.2rem; }
.cap { background: #fff; border: 1px solid #d5e6f2; padding: 1rem 1.2rem; margin: 0 0 1.2rem; border-radius: 8px; }
.cap h2 { margin-top: 0; color: #0b3d6e; }
.cap-sotto { color: #4a6a85; }
.cap-fonte { color: #4a6a85; font-size: 0.9rem; }
main.pagina-larga { max-width: 60rem; margin: 0 auto; padding: 1rem; }
@media (max-width: 900px) {
  .sito-menu-tasto { display: inline-block; }
  .sito-voci { display: none; width: 100%; }
  .sito-voci.aperta { display: block; }
  .sito-voci ul { flex-direction: column; gap: 0.4rem; }
  .cerca { flex-wrap: wrap; }
  #q { flex-basis: 100%; }
}

/* Interruttore serie M1b/ISTAT, vicino alla riga di stato. */
.serie-interruttore { display: flex; gap: 0.4rem; margin-top: 0.4rem; flex-wrap: wrap; }
.serie-interruttore[hidden] { display: none; }
.serie-tasto { cursor: pointer; border: 1.5px solid #0b3d6e; background: #fff; color: #0b3d6e; border-radius: 999px; padding: 0.35rem 0.8rem; font-size: 0.95rem; font-weight: 700; }
.serie-tasto.attiva { background: #0b3d6e; color: #fff; }
.serie-tasto:disabled { opacity: 0.45; cursor: not-allowed; }
.lista-gestori { max-height: 46vh; overflow-y: auto; padding-right: 0.2rem; margin: 0.5rem 0; }
.lista-gestori li { padding: 0.4rem 0; border-bottom: 1px solid #eaf4fb; }
.intro-serie { margin: 0; color: #eaf4fb; font-size: 0.95rem; }
