.panel-parameter-bubbles {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.panel-parameter-bubbles button {
  background: #fff;
  border: 1px solid #cbd8d4;
  border-radius: 999px;
  color: #41534e;
  cursor: pointer;
  font: 650 12px Inter, "Segoe UI", sans-serif;
  min-height: 32px;
  padding: 6px 10px;
}

.panel-parameter-bubbles button:hover,
.panel-parameter-bubbles button:focus-visible,
.panel-parameter-bubbles button.active {
  background: #e6f3ef;
  border-color: #087b68;
  color: #075e52;
  outline: none;
}

.panel-parameter-bubbles button.active {
  background: #087b68;
  color: #fff;
}

#panel-chart { margin-top: 4px; }
.matrix-map-nav { width:260px;max-width:calc(100% - 28px);max-height:calc(100% - 95px);overflow:auto; }
.matrix-map-nav details { border-bottom:1px solid #e0e8e4; }
.matrix-map-nav details:last-child { border-bottom:0; }
.matrix-map-nav summary { display:flex;align-items:center;gap:9px;padding:12px 8px;cursor:pointer;font-size:14px;font-weight:650;list-style:none; }
.matrix-map-nav summary::-webkit-details-marker { display:none; }
.matrix-chevron{font-size:19px;transition:transform .2s ease}
.matrix-map-nav details[open] .matrix-chevron{transform:rotate(180deg)}
.material-symbols-outlined{font-variation-settings:'FILL' 0,'wght' 400,'GRAD' 0,'opsz' 24;line-height:1}
.status-text{display:inline-flex;align-items:center;gap:5px}.status-text .material-symbols-outlined,.chart-insight .material-symbols-outlined{font-size:18px}
#custom-period-toggle .material-symbols-outlined{font-size:18px;vertical-align:middle}
#geometry-detail>button{display:inline-flex;align-items:center;gap:7px}
.matrix-map-nav details[open]>summary::after { transform:rotate(180deg); }
.matrix-map-nav summary>i { width:8px;height:8px;border-radius:50%;flex:none; }
.matrix-map-nav summary>span { flex:1; }
.matrix-map-nav summary>small { font-size:11px;font-weight:500;color:#637970; }
.matrix-layer-list { padding:0 6px 8px; }
.matrix-layer-list>p { font-size:12px;color:#65796f;padding:8px; }
.matrix-layer-row { display:flex;align-items:center;justify-content:space-between;gap:10px;padding:9px 3px;font-size:12px;line-height:1.4;cursor:pointer; }
.matrix-layer-row>span { min-width:0;overflow-wrap:anywhere; }
.matrix-layer-row small { display:block;font-size:10px;color:#65796f; }
.matrix-layer-row input { appearance:none;width:30px;height:18px;flex:none;background:#c8d4cf;border-radius:12px;position:relative;cursor:pointer;transition:background .15s; }
.matrix-layer-row input::after { content:'';position:absolute;top:3px;left:3px;width:12px;height:12px;border-radius:50%;background:white;transition:transform .15s; }
.matrix-layer-row input:checked { background:#21846e; }
.matrix-layer-row input:checked::after { transform:translateX(12px); }
.matrix-layer-row input:focus-visible { outline:2px solid #172f28;outline-offset:3px; }
footer .developer-credit { display:flex;flex-direction:row;align-items:center;gap:14px; }
footer .developer-credit>img { width:95px;height:auto;max-height:55px;object-fit:contain; }
footer>a { display:inline-flex;align-items:center;gap:4px; }
footer>a .material-symbols-outlined { font-size:20px; }
#mappa:fullscreen,#mappa.map-fullscreen-fallback { background:#f4f8f6;padding:16px;width:100vw;height:100dvh;display:flex;flex-direction:column;box-sizing:border-box;margin:0; }
#mappa.map-fullscreen-fallback { position:fixed;inset:0;z-index:9999; }
#mappa:fullscreen>.section-heading,#mappa.map-fullscreen-fallback>.section-heading { flex:0 0 auto;margin:0 0 12px; }
#mappa:fullscreen>.map-dashboard,#mappa.map-fullscreen-fallback>.map-dashboard { flex:1;min-height:0;height:auto; }
#mappa:fullscreen .map-wrap,#mappa.map-fullscreen-fallback .map-wrap { height:100%;min-height:0; }
#mappa:fullscreen #territory-map,#mappa.map-fullscreen-fallback #territory-map { height:100%!important;max-height:none;min-height:0; }
#map-detail-panel.geometry-mode > :not(#geometry-detail){display:none!important}
#geometry-detail{display:none;padding:24px;overflow-wrap:anywhere}
#map-detail-panel.geometry-mode #geometry-detail{display:block}
#geometry-detail h3{font-size:24px;margin:20px 0}
#geometry-detail p{padding:12px 0;border-bottom:1px solid #e1e9e6;line-height:1.5}
#geometry-detail a{display:block;margin:16px 0;color:#227e70}
.matrix-group-toggle{appearance:none;width:30px;height:18px;flex:none;background:#cbd5d1;border-radius:20px;position:relative;cursor:pointer}
.matrix-group-toggle:before{content:'';position:absolute;width:12px;height:12px;left:3px;top:3px;background:white;border-radius:50%}
.matrix-group-toggle:checked{background:#277e6d}
.matrix-group-toggle:checked:before{left:15px}
.matrix-group-toggle:indeterminate{background:#8baba2}
.matrix-group-toggle:indeterminate:before{left:9px}
#gisquick-map{position:absolute;inset:0;width:100%;height:100%;border:0;display:block;background:#eef3f0}
.legacy-map{display:none}
.matrix-map-nav{z-index:60;background:#fffffff5}
.matrix-map-nav summary>i{background:var(--matrix-color,#087b68)}
.matrix-map-nav details[open]>summary{background:#eaf5f1;color:#065f50}
.matrix-map-nav .matrix-layer-list{max-height:200px;overflow:auto;border-top:1px solid #e0e8e4}
.matrix-map-nav .matrix-layer-row{padding:7px 9px;cursor:default}
.matrix-filter-title{padding:9px 8px 7px;color:#376458;font-size:11px;font-weight:800;letter-spacing:.04em;text-transform:uppercase}

/* TOC, mappa e scheda della dashboard occupano colonne separate. */
.map-dashboard{display:grid;grid-template-columns:245px minmax(0,1fr);gap:0;overflow:hidden}
.map-dashboard:has(#map-detail-panel.open){grid-template-columns:245px minmax(0,1fr) minmax(310px,365px)}
.map-dashboard>.matrix-map-nav{position:static!important;inset:auto!important;width:auto;max-width:none;max-height:640px;height:100%;padding:10px;overflow:auto;background:#fff;border-right:1px solid #dce3e0;box-shadow:none!important;border-radius:0!important}
.map-dashboard>.map-wrap{height:640px;min-height:0}
.map-dashboard>#map-detail-panel{position:static!important;inset:auto!important;display:none;width:auto!important;height:640px;max-height:none;overflow-y:auto;visibility:visible!important;transform:none!important;transition:none!important;box-shadow:none;border-left:1px solid #dce3e0;border-radius:0;padding:22px}
.map-dashboard>#map-detail-panel.open{display:flex}
#point-specifications{border-top:1px solid #dce3e0;padding-top:16px;margin:8px 0 18px}
#point-specifications:empty{display:none}
#point-specifications h4{margin:0 0 8px;font-size:17px}
.point-spec-row{display:flex;justify-content:space-between;gap:12px;padding:8px 0;border-bottom:1px solid #e8eeea;font-size:13px}
.point-spec-row span{color:#596c65}
.point-spec-row strong{text-align:right;overflow-wrap:anywhere}
#parameter-public-description,#panel-parameter-description{color:#42594f;background:#eef6f3;padding:12px 14px;border-radius:8px;line-height:1.5}
#parameter-public-description[hidden],#panel-parameter-description[hidden]{display:none}
@media(max-width:1100px){
  .map-dashboard,.map-dashboard:has(#map-detail-panel.open){grid-template-columns:minmax(0,1fr)}
  .map-dashboard>.matrix-map-nav{max-height:185px;height:auto;border-right:0;border-bottom:1px solid #dce3e0}
  .map-dashboard>.map-wrap{height:540px}
  .map-dashboard>#map-detail-panel{height:auto;max-height:550px;border-left:0;border-top:1px solid #dce3e0}
}
@media(max-width:700px){.map-dashboard>.map-wrap{height:480px}.map-dashboard>.matrix-map-nav{max-height:155px}}
#mappa:fullscreen .map-dashboard,#mappa.map-fullscreen-fallback .map-dashboard{min-height:0}
#mappa:fullscreen .map-dashboard>.map-wrap,#mappa.map-fullscreen-fallback .map-dashboard>.map-wrap{height:100%}
#mappa:fullscreen .map-dashboard>.matrix-map-nav,#mappa.map-fullscreen-fallback .map-dashboard>.matrix-map-nav,#mappa:fullscreen .map-dashboard>#map-detail-panel,#mappa.map-fullscreen-fallback .map-dashboard>#map-detail-panel{height:100%;max-height:none}

/* Cartografia GISQuick nel visualizzatore della dashboard. */
#gisquick-map{display:none!important}
.map-dashboard>.map-wrap>.legacy-map{display:block!important;position:relative;width:100%;height:100%}
.map-dashboard #territory-map{position:absolute;inset:0;width:100%;height:100%}
.map-dashboard .basemap-switch{z-index:5;max-width:calc(100% - 20px)}
.map-dashboard .map-tools,.map-dashboard .map-key{z-index:5}
.toc-help{margin:0 8px 10px;color:#60736b;font-size:12px;line-height:1.4}
.gis-toc-group{border-bottom:1px solid #e0e8e4}
.gis-toc-group>summary{display:flex;justify-content:space-between;gap:8px;cursor:pointer;padding:11px 8px;font-size:13px;font-weight:750;color:#23463b}
.gis-toc-group>summary small{font-weight:500;color:#71847c}
.matrix-map-nav .matrix-layer-row,.matrix-map-nav .toc-all{display:flex;justify-content:flex-start;align-items:flex-start;gap:8px;padding:7px 9px;font-size:12px;line-height:1.35;cursor:pointer}
.matrix-map-nav .toc-all{font-weight:700;background:#f1f6f3}
.matrix-map-nav input[type=checkbox]{accent-color:#087b68;margin:1px 0 0;flex:none}
.map-dashboard>.matrix-map-nav{max-height:640px}
.point-doc-empty{color:#697870;font-size:13px;margin:4px 0 14px}
.point-doc-link{display:block;margin:8px 0;padding:9px 11px;border-radius:7px;background:#edf6f2;color:#096c58;text-decoration:none;font-weight:650;font-size:13px}
.point-doc-link:hover{text-decoration:underline}

.map-dashboard .panel-close{width:34px;height:34px;min-width:34px;display:grid;place-items:center;font-family:Arial,sans-serif!important;font-size:0!important;border-radius:50%;overflow:hidden}
.map-dashboard .panel-close::after{content:"×";font-size:25px;line-height:1;color:#42564e}

/* Mappa a pieno browser; i pannelli Material UI galleggiano sopra la cartografia. */
html,body{overflow-x:clip}
html:has(#mappa:target){scroll-padding-top:0}
#mappa{position:relative;width:100%;height:100dvh;min-height:0;margin:48px 0 0;scroll-margin-top:0;overflow:hidden;background:#e8efec;border-radius:16px;box-shadow:0 12px 34px rgba(22,48,42,.08)}
#mappa.material-map-ready>.section-heading{display:none}
#mappa>.section-heading{position:absolute;z-index:50;top:16px;left:16px;right:16px;margin:0;pointer-events:none}
#mappa>.section-heading>*{pointer-events:auto}
#mappa .map-dashboard{display:block;position:absolute;inset:0;width:100%;height:100%;min-height:0;border-radius:16px;box-shadow:none;background:#e8efec}
#mappa .map-dashboard>.map-wrap{position:absolute;inset:0;width:100%;height:100%!important;min-height:0!important}
#mappa .map-dashboard>.map-wrap>.legacy-map,#mappa #territory-map{width:100%;height:100%!important}
#mappa .map-dashboard>.matrix-map-nav{position:absolute!important;top:86px!important;bottom:16px!important;left:16px!important;right:auto!important;width:320px!important;height:auto!important;max-height:none!important;z-index:32}
#mappa.material-map-ready .map-dashboard>.matrix-map-nav,#mappa.material-map-ready .basemap-switch,#mappa.material-map-ready .map-tools,#mappa .map-key{display:none!important}
#mappa .map-dashboard>#map-detail-panel{position:absolute!important;top:86px!important;right:16px!important;bottom:16px!important;left:auto!important;width:min(390px,calc(100vw - 32px))!important;height:auto!important;max-height:none!important;border:1px solid #dce6e0;border-radius:16px!important;box-shadow:0 16px 52px rgba(17,52,42,.18);background:#fff;z-index:85;padding:24px!important}
#mappa .map-dashboard>#map-detail-panel.open{display:flex!important}
#mappa .summary-measure{background:#edf6f2;border-radius:12px;padding:16px}
#mappa .summary-measure strong{font-size:clamp(24px,2.5vw,34px)}
#mappa .panel-heading h3{font-size:23px;line-height:1.2;margin:8px 0 4px}
#mappa .point-spec-row{align-items:flex-start}
#mappa:has(#map-detail-panel.open) .ol-zoom{right:422px}
#material-map-controls{position:absolute;inset:0;z-index:80;pointer-events:none}
.mui-map-shell{position:absolute;inset:0;pointer-events:none}
.mui-map-toolbar{position:absolute;top:16px;left:16px;right:16px;min-height:60px;padding:8px 10px 8px 14px;display:flex;align-items:center;justify-content:space-between;gap:18px;pointer-events:auto;background:rgba(255,255,255,.97)!important;backdrop-filter:blur(16px);border:1px solid rgba(209,226,218,.9)}
.mui-map-title{min-width:0;flex:1}
.mui-map-title-icon{height:38px;width:38px;flex:none;border-radius:11px;background:#e5f3ee;color:#087b68;display:grid;place-items:center}
.mui-map-actions{flex:none}
.mui-map-actions .MuiToggleButtonGroup-root{gap:3px;background:#f2f7f4;border-radius:11px;padding:3px}
.mui-map-actions .MuiToggleButton-root{height:38px;gap:6px;padding:0 10px;border:0;color:#4e6259}
.mui-map-actions .MuiToggleButton-root.Mui-selected{background:#d9eee5;color:#075e50}
.mui-map-actions .MuiToggleButton-root.Mui-selected:hover{background:#cde6db}
.mui-base-label{white-space:nowrap}
.mui-layer-drawer{position:absolute;top:86px;left:16px;bottom:16px;width:min(332px,calc(100vw - 32px));display:flex;flex-direction:column;overflow:hidden;pointer-events:auto;border:1px solid #dce6e0;background:rgba(255,255,255,.98)!important}
.mui-layer-header{padding:18px 18px 16px;flex:none}
.mui-layer-list{flex:1;min-height:0;overflow-y:auto;overscroll-behavior:contain;padding-bottom:8px}
.mui-layer-list .MuiAccordion-root{border-bottom:1px solid #e8eeeb}
.mui-layer-list .MuiAccordionSummary-root.Mui-expanded{background:#edf6f2;color:#075e50}
.mui-group-all,.mui-layer-item{min-height:40px;padding:2px 8px;display:flex;align-items:center;justify-content:space-between;gap:10px;border-radius:9px}
.mui-group-all{background:#f5f8f6}
.mui-layer-item:hover{background:#f5f8f6}
.mui-layer-label{min-width:0;flex:1;display:flex;align-items:center;gap:9px}
.mui-layer-symbol{flex:none;width:34px;height:30px;display:grid;place-items:center;overflow:hidden;border:1px solid #e2e9e5;border-radius:6px;background:#fff}
.mui-layer-legend-image{display:block;max-width:32px;max-height:28px;width:auto;height:auto;object-fit:contain}
.mui-layer-legend-image-line{width:103px;height:62px;max-width:none;max-height:none;flex:none;transform-origin:center 37px;transform:translateY(-23px) scaleY(3)}
.mui-layer-legend-image-tall{max-height:none;align-self:start}
.mui-layer-station-symbol{width:14px;height:14px;border:2px solid #fff;border-radius:50%;box-shadow:0 0 0 1px #60716b}
.mui-layer-symbol-fallback{color:#57746b}
.mui-layer-legend-detail{display:block;max-width:260px;max-height:300px;object-fit:contain;background:#fff;border-radius:4px}
.mui-layer-footer{padding:10px 16px;display:flex;align-items:center;gap:8px;color:#64776d;border-top:1px solid #e8eeeb}
#mappa:fullscreen,#mappa.map-fullscreen-fallback{width:100vw;height:100dvh;min-height:0;padding:0;margin:0}
@media(max-width:900px){
 #mappa{height:100dvh;scroll-margin-top:0}
 .mui-map-toolbar{top:10px;left:10px;right:10px;gap:6px;padding:6px 8px}
 .mui-map-title{max-width:43%}
 .mui-map-title .MuiTypography-caption{display:none}
 .mui-base-label{display:none}
 .mui-map-actions .MuiToggleButton-root{width:38px;padding:0}
 .mui-layer-drawer{top:80px;left:10px;bottom:10px;width:min(332px,calc(100vw - 20px))}
 #mappa .map-dashboard>#map-detail-panel{top:auto!important;right:10px!important;bottom:10px!important;left:10px!important;width:auto!important;height:min(55dvh,500px)!important;padding:18px!important}
 #mappa:has(#map-detail-panel.open) .ol-zoom{right:16px;bottom:calc(min(55dvh,500px) + 22px)}
}
@media(max-width:580px){.mui-map-title .MuiTypography-subtitle1{font-size:13px}.mui-map-title-icon{width:32px;height:32px}.mui-map-actions{gap:2px!important}.mui-map-actions .MuiIconButton-root{padding:5px}}
#point-specifications .point-measure-note{font-size:13px;line-height:1.45;color:#526b60;margin:4px 0 12px}
#point-specifications .point-measure-series{border:1px solid #dce8e1;border-radius:9px;margin:7px 0;overflow:hidden}
#point-specifications .point-measure-series summary{cursor:pointer;padding:10px 12px;font-weight:650;color:#234e42;background:#f3f8f5}
#point-specifications .point-measure-day{padding:9px 12px 2px;font-size:13px;font-weight:600}
#point-specifications .point-measure-original{padding:1px 12px 6px 22px;font-size:12px;color:#60756b}
.station-row[data-historic="true"] .station-name i{background:#a3afa8!important}
.station-row[data-historic="true"] .status-text{color:#576c62}
.point-history-chart{margin:18px 0;padding:15px 13px 10px;border:1px solid #dce8e1;border-radius:12px;background:#f9fcfa}
.point-history-chart h4{margin:0 0 9px;color:#234e42}
.point-history-picker{width:100%;padding:8px 10px;border:1px solid #b9d1c5;border-radius:8px;background:#fff;color:#234e42;font:inherit}
.point-history-caption,.point-history-legend{font-size:12px;line-height:1.45;color:#526b60}
.point-history-caption{margin:9px 0 3px}
.point-history-legend{margin:5px 0 0}
.point-history-scroll{max-width:100%;overflow-x:auto}
.point-history-scroll svg{display:block;max-width:none}
