@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/titillium-web-400-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/titillium-web-400-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/titillium-web-600-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/titillium-web-600-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/titillium-web-700-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Titillium Web"; font-style: normal; font-weight: 700; font-display: swap; src: url("fonts/titillium-web-700-latin.woff2") format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
:root {
  --bg:#f6f5f1; --surface:#ffffff; --ink:#14181c; --ink2:#4a5158; --ink3:#656c73; --line:#e1dfd8; --acc:#1f5fb4; --accbg:#e5eefa;
  --s1:#cde2fb; --s2:#9ec5f4; --s3:#6da7ec; --s4:#3987e5; --s5:#256abf; --s6:#184f95; --s7:#0d366b;
  --ok:#0f7b3f; --warn:#b36b00; --bad:#b3261e; --bar:#2a78d6; --bar2:#9ec5f4; --dim:rgba(244,244,241,.72);
}
:root[data-theme="dark"] {
  --bg:#111314; --surface:#191c1e; --ink:#eceae4; --ink2:#b8bcc0; --ink3:#8f959b; --line:#2a2e31; --acc:#7fb0ee; --accbg:#162536;
  --s1:#0d366b; --s2:#104281; --s3:#184f95; --s4:#2a78d6; --s5:#5598e7; --s6:#86b6ef; --s7:#cde2fb;
  --ok:#4cc27a; --warn:#e0a13a; --bad:#ef7b73; --bar:#3987e5; --bar2:#184f95; --dim:rgba(18,18,17,.72); color-scheme: dark;
}
/* Temi: chiaro (predefinito), scuro, alto contrasto. Il tono (data-tone) lo imposta js/tema.js. */
:root[data-theme="contrast"] {
  --bg:#ffffff; --surface:#ffffff; --ink:#000000; --ink2:#1a1a1a; --ink3:#333333; --line:#000000; --acc:#0033cc; --accbg:#e6ecff;
  --ok:#005c1f; --warn:#7a4500; --bad:#a00000; --bar:#0033cc; --bar2:#99b0ff; --dim:rgba(255,255,255,.78);
}
:root[data-theme="contrast"] button, :root[data-theme="contrast"] select { border-width: 2px; border-color: #000; }
.tools select, .scale select { padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; max-width: 100%; }
.scale { display: flex; gap: .4rem; align-items: center; flex-wrap: wrap; }
.scale .chk { white-space: nowrap; }
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--ink); font: 16px/1.45 "Titillium Web", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; display: flex; flex-direction: column; }
button, select, input { font: inherit; color: inherit; }
button { background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .35rem .7rem; cursor: pointer; }
button:hover { border-color: var(--acc); }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }
.top { display: flex; align-items: center; gap: 1rem; padding: .55rem 1rem; background: var(--surface); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .6rem; color: inherit; text-decoration: none; }
.brand img { width: 40px; height: 40px; flex: none; }
.brand strong { font-size: 1.05rem; display: block; line-height: 1.1; }
.brand span { font-size: .75rem; color: var(--ink3); }
#crumbs { flex: 1; display: flex; gap: .3rem; flex-wrap: wrap; font-size: .9rem; min-width: 0; }
#crumbs a { color: var(--acc); text-decoration: none; } #crumbs a:hover { text-decoration: underline; }
#crumbs .sep { color: var(--ink3); } #crumbs .cur { font-weight: 600; }
.tools { display: flex; gap: .4rem; }
main { flex: 1; display: grid; grid-template-columns: minmax(300px, 46%) 1fr; min-height: 0; }
.mapcol { position: relative; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.mapbar { padding: .5rem .75rem; display: flex; gap: .5rem; align-items: center; background: var(--surface); border-bottom: 1px solid var(--line); font-size: .85rem; flex-wrap: wrap; }
.mapbar select { padding: .3rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; max-width: 100%; }
#map { flex: 1; min-height: 280px; }
.cond { position: relative; }
.cond > button { display: inline-flex; align-items: center; padding: .35rem .5rem; } .cond svg { width: 1.1rem; height: 1.1rem; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.cond-menu { position: absolute; z-index: 60; top: calc(100% + .3rem); right: 0; min-width: 11rem; margin: 0; padding: .25rem; list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 4px 14px rgba(0,0,0,.2); }
.cond-menu[hidden] { display: none; }
.cond-menu a, .cond-menu button { all: unset; box-sizing: border-box; display: block; width: 100%; padding: .4rem .6rem; border-radius: 5px; cursor: pointer; font-size: .85rem; color: var(--ink); }
.cond-menu a:hover, .cond-menu button:hover { background: var(--line); }
.cond-menu a:focus-visible, .cond-menu button:focus-visible { outline: 2px solid var(--ink); outline-offset: -2px; }
.sovra { position: absolute; left: .6rem; bottom: .6rem; display: flex; flex-direction: column; gap: .4rem; width: 250px; z-index: 2; }
.quadro { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .35rem .6rem; font-size: .75rem; }
.quadro summary { cursor: pointer; line-height: 1.35; }
.quadro ul { list-style: none; margin: .35rem 0 0; padding: 0; }
.quadro li button { all: unset; box-sizing: border-box; display: grid; grid-template-columns: 2.6rem 1fr 2.9rem; gap: .35rem; align-items: center; width: 100%; padding: .12rem .2rem; cursor: pointer; border-radius: 4px; }
.quadro li button:hover, .legenda .cat button:hover { background: var(--line); }
.quadro li button:focus-visible, .legenda .cat button:focus-visible { outline: 2px solid var(--ink); outline-offset: 1px; }
.quadro li button.on, .legenda .cat button.on { font-weight: 700; box-shadow: inset 0 0 0 1.5px currentColor; }
.quadro .qn { display: flex; align-items: center; gap: .3rem; } .quadro i, .legenda .cat i { width: .7rem; height: .7rem; border-radius: 2px; flex: none; display: inline-block; }
.quadro .qb { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; } .quadro .qb span { display: block; height: 100%; }
.quadro .qv { text-align: right; font-variant-numeric: tabular-nums; } .quadro .vuoto { color: var(--ink3); }
.legenda .cat { list-style: none; margin: .3rem 0 0; padding: 0; }
.legenda .cat button { all: unset; box-sizing: border-box; display: flex; align-items: center; gap: .35rem; width: 100%; padding: .12rem .2rem; cursor: pointer; border-radius: 4px; }
.legenda .cat small { margin-left: auto; color: var(--ink3); white-space: nowrap; }
.legenda .tutte { all: unset; cursor: pointer; text-decoration: underline; color: var(--ink2); } .legenda .tutte:focus-visible { outline: 2px solid var(--ink); }
.legenda { position: static; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .45rem .6rem; font-size: .75rem; }
.legenda .rampa { display: flex; height: 10px; margin: .3rem 0 .15rem; gap: 2px; } .legenda .rampa i { flex: 1; border-radius: 2px; }
.legenda .estr { display: flex; justify-content: space-between; color: var(--ink2); }
.scheda { overflow-y: auto; padding: 1rem 1.25rem 3rem; min-width: 0; }
.scheda .testa { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.scheda .testa > div:first-child { min-width: 0; }
.sagoma { flex: none; width: 84px; height: 84px; margin-top: .1rem; }
.sagoma svg { width: 100%; height: 100%; display: block; }
.sagoma path { fill: var(--accent, #2f6fdb); fill-opacity: .22; stroke: var(--accent, #2f6fdb); stroke-width: 1.2; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.scheda h1 { font-size: 1.6rem; margin: 0; line-height: 1.15; }
.scheda .sotto { color: var(--ink2); margin: .15rem 0 1rem; font-size: .9rem; }
.scheda h2 { font-size: 1rem; margin: 1.6rem 0 .5rem; padding-bottom: .25rem; border-bottom: 1px solid var(--line); }
.scheda h2 small { font-weight: 400; color: var(--ink3); margin-left: .4rem; }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .6rem; }
.kpi div { background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: .55rem .7rem; }
.kpi b { display: block; font-size: 1.35rem; font-variant-numeric: tabular-nums; } .kpi span { font-size: .78rem; color: var(--ink2); }
.kpi em { display: block; font-style: normal; font-size: .72rem; color: var(--ink3); }
.imbuto { display: grid; gap: .45rem; }
.imbuto .riga { display: grid; grid-template-columns: 11.5rem 1fr 9.5rem; gap: .6rem; align-items: center; font-size: .86rem; }
.imbuto .riga .v { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.barra { height: 14px; background: var(--accbg); border-radius: 0 4px 4px 0; position: relative; }
.barra i { display: block; height: 100%; background: var(--bar); border-radius: 0 4px 4px 0; }
.nota { font-size: .8rem; color: var(--ink2); margin: .5rem 0 0; }
.avviso { background: var(--accbg); border: 1px solid color-mix(in srgb, var(--acc) 40%, transparent); padding: .5rem .75rem; border-radius: 6px; font-size: .85rem; margin: .6rem 0; }
.avviso.alert { border-color: color-mix(in srgb, var(--warn) 55%, transparent); }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
th, td { text-align: left; padding: .35rem .45rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--ink2); font-weight: 600; position: sticky; top: -1px; background: var(--bg); white-space: nowrap; cursor: pointer; user-select: none; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr.cl { cursor: pointer; } tr.cl:hover td { background: var(--accbg); }
td a { color: var(--acc); text-decoration: none; } td a:hover { text-decoration: underline; }
.mini { display: inline-block; height: 8px; background: var(--bar); border-radius: 0 3px 3px 0; vertical-align: middle; min-width: 1px; }
.filtri { display: flex; gap: .5rem; flex-wrap: wrap; margin: .4rem 0; }
.filtri input, .filtri select { padding: .3rem .5rem; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; }
.pager { display: flex; gap: .5rem; align-items: center; margin-top: .5rem; font-size: .85rem; }
.pill { display: inline-block; padding: 0 .45rem; border-radius: 99px; font-size: .72rem; border: 1px solid var(--line); white-space: nowrap; }
.pill.ok { color: var(--ok); border-color: var(--ok); } .pill.warn { color: var(--warn); border-color: var(--warn); }
.caric { color: var(--ink3); }
dialog { max-width: min(760px, 94vw); max-height: 86vh; overflow: auto; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; }
dialog::backdrop { background: rgba(0,0,0,.45); }
dialog .chiudi { position: sticky; top: 0; float: right; }
dialog h3 { margin: 1.1rem 0 .3rem; font-size: 1rem; } dialog p, dialog li { font-size: .88rem; }
.tip { position: absolute; z-index: 5; pointer-events: none; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; padding: .3rem .5rem; font-size: .78rem; box-shadow: 0 2px 8px rgba(0,0,0,.18); }
@media (max-width: 860px) {
  body:not(.home) { height: auto; display: block; } html:has(body:not(.home)) { height: auto; }
  body:not(.home) main { display: block; overflow-x: hidden; }
  body:not(.home) .mapcol { border-right: 0; border-bottom: 1px solid var(--line); height: auto; }
  body:not(.home) #map { flex: none; height: 62vh; min-height: 340px; }
  body:not(.home) .sovra { position: static; width: auto; gap: 0; }
  body:not(.home) .legenda, body:not(.home) .quadro { max-width: none; border: 0; border-top: 1px solid var(--line); border-radius: 0; }
  body:not(.home) .scheda { overflow: visible; padding: 1rem; }
  body:not(.home) .scheda table { display: block; overflow-x: auto; }
  .imbuto .riga { grid-template-columns: 7.5rem 1fr 6.5rem; font-size: .8rem; }
  .brand span { display: none; } .top { gap: .5rem; padding: .5rem .75rem; }
  .kpi { grid-template-columns: 1fr 1fr; }
}

.mapbar { flex-direction: column; align-items: stretch; gap: .45rem; }
.terr, .colora { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.terr { align-items: flex-end; }
#f-reset { padding: .3rem .8rem; font-size: .85rem; line-height: 1.25; }
.terr label { display: flex; flex-direction: column; font-size: .72rem; color: var(--ink2); gap: .1rem; flex: 1 1 130px; min-width: 0; }
.terr select { width: 100%; }
.colora label.chk { display: flex; flex-direction: row; gap: .3rem; align-items: center; font-size: .78rem; }
.legenda .nota-leg { margin-top: .3rem; color: var(--ink3); font-size: .68rem; }
.chips { display: flex; gap: .4rem; flex-wrap: wrap; margin: .3rem 0 .9rem; }
.chip { background: var(--accbg); border-color: var(--acc); font-size: .8rem; padding: .15rem .6rem; border-radius: 99px; }
.chip.azzera { background: var(--surface); border-color: var(--line); color: var(--ink2); }
.filtri-hint { margin: .2rem 0 .9rem; }
.cl { cursor: pointer; }
.riga.cl { border-radius: 6px; margin: 0 -.4rem; padding: .1rem .4rem; }
.riga.cl:hover, .avviso.cl:hover { background: var(--accbg); }
.on, tr.cl.on td, .riga.cl.on { outline: 2px solid var(--acc); outline-offset: -2px; background: var(--accbg); }
tr.cl.on td { outline: none; background: var(--accbg); box-shadow: inset 0 1px 0 var(--acc), inset 0 -1px 0 var(--acc); }
.avviso.cl small { color: var(--ink2); }

/* navigazione tra mappa e statistiche */
.nav { display: flex; gap: 1rem; font-size: .9rem; margin-left: auto; }
.nav a { color: var(--ink2); text-decoration: none; padding: .2rem 0; border-bottom: 2px solid transparent; }
.nav a[aria-current] { color: var(--ink); border-color: var(--acc); font-weight: 600; }
.nav a:hover { color: var(--acc); }

.tip { max-width: 22rem; }
.tip-geo { opacity: .75; }
.tip-mis { margin-top: .3rem; border-collapse: collapse; font-size: .74rem; }
.tip-mis caption { text-align: left; font-weight: 600; padding-bottom: .1rem; }
.tip-mis td { padding: .05rem 0; vertical-align: top; }
.tip-mis td:last-child { text-align: right; padding-left: .8rem; white-space: nowrap; font-variant-numeric: tabular-nums; }
.tip-nome { font-size: 1.1rem; line-height: 1.25; }
.tip-ind { font-size: .95rem; }

/* Logo OpenDataSicilia sulla mappa */
.ctrl-logo { margin: 0 10px 6px 0; float: none; background: rgba(255,255,255,.88); border-radius: 6px; padding: 3px; box-shadow: 0 0 0 1px rgba(0,0,0,.12); }
.ctrl-logo a { display: block; line-height: 0; }
.ctrl-logo img { display: block; width: 44px; height: auto; }

/* Pulsante «Porta in cima» (js/cima.js) */
.in-cima { position: fixed; right: 1rem; bottom: 1rem; z-index: 20; width: 2.6rem; height: 2.6rem; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); background: var(--surface); color: var(--ink); box-shadow: 0 2px 8px rgb(0 0 0 / .18); cursor: pointer; }
.in-cima[hidden] { display: none; }
.in-cima:hover { background: var(--line); }
.in-cima:focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }
/* Finestra Info: schede Metodo, Fonti, Credits */
#dlg-info { padding: 0 1.2rem 1.2rem; width: min(760px, 94vw); }
.info-testa { position: sticky; top: 0; z-index: 2; display: flex; justify-content: space-between; align-items: center; background: var(--surface); padding: .8rem 0 .2rem; }
.info-testa h2 { margin: 0; font-size: 1.2rem; }
.info-testa .chiudi { position: static; float: none; }
.info-tab { position: sticky; top: 2.9rem; z-index: 2; display: flex; gap: .3rem; flex-wrap: wrap; background: var(--surface); border-bottom: 1px solid var(--line); padding: .4rem 0; }
.info-tab button { border-color: transparent; background: transparent; color: var(--ink2); }
.info-tab button[aria-selected="true"] { color: var(--ink); border-color: var(--acc); background: var(--accbg); font-weight: 600; }
.info-pan ul { padding-left: 1.2rem; } .info-pan a { color: var(--acc); }
.cr-logo { margin: 1rem 0 .4rem; } .cr-logo img { height: 48px; width: auto; }
.tools button#btn-info { white-space: nowrap; }
@media (max-width: 1000px) { .brand span { display: none; } }

.legenda .leg-terr { font-size: .72rem; color: var(--ink2, var(--ink3)); margin: .15rem 0 .3rem; line-height: 1.35; }
.legenda summary { cursor: pointer; line-height: 1.35; font-weight: 600; }
.legenda .cat button.qui { outline: 1.5px dashed currentColor; outline-offset: -1px; background: none; }
.legenda .leg-fascia { margin-top: .3rem; font-size: .72rem; }
.quadro .q-terr { font-weight: 700; }

/* barra a tre tratti nel riquadro «Per missione» */
.tri { display: inline-flex; height: 8px; border-radius: 0 3px 3px 0; overflow: hidden; vertical-align: middle; min-width: 1px; }
.tri i { display: block; height: 100%; }
.tri .tp { background: var(--ok); } .tri .tf { background: var(--warn); } .tri .ts { background: var(--ink3); }

/* legenda della barra a tre tratti */
.leg-tri { display: flex; flex-wrap: wrap; gap: .3rem 1.1rem; list-style: none; margin: .5rem 0 .2rem; padding: 0; font-size: .85rem; color: var(--ink2); }
.leg-tri li { display: flex; align-items: center; gap: .4rem; }
.leg-tri i { display: inline-block; width: .8rem; height: .8rem; border-radius: 2px; }
.leg-tri .tp { background: var(--ok); } .leg-tri .tf { background: var(--warn); } .leg-tri .ts { background: var(--ink3); }

/* riquadro «Progetti a rischio»: valore più lungo (importo · quota · progetti) */
.imbuto.largo .riga { grid-template-columns: 11.5rem 1fr 14rem; }
@media (max-width: 860px) { .imbuto.largo .riga { grid-template-columns: 7rem 1fr 8.5rem; } .imbuto.largo .riga .v { white-space: normal; } }

/* riordino colonne */
th[aria-sort] { cursor: pointer; }
th[aria-sort]:hover, th[aria-sort]:focus-visible { color: var(--ink); }
th[aria-sort="ascending"]::after { content: " ▲"; font-size: .7em; }
th[aria-sort="descending"]::after { content: " ▼"; font-size: .7em; }
th[aria-sort="none"]::after { content: " ↕"; font-size: .7em; opacity: .4; }

/* Avviso sul consenso alle statistiche (js/consenso.js) */
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.consenso { position: fixed; z-index: 100; left: .75rem; right: .75rem; bottom: .75rem; max-width: 34rem; margin: 0 auto; padding: .9rem 1rem; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 8px 28px rgb(0 0 0 / .22); }
.consenso-t { margin: 0 0 .25rem; font-size: 1rem; }
.consenso-d { margin: 0 0 .75rem; font-size: .875rem; color: var(--ink2); }
.consenso-d a { color: var(--acc); }
.consenso-az { display: flex; gap: .5rem; flex-wrap: wrap; }
.consenso-az button { min-height: 44px; padding: .5rem 1rem; font-weight: 600; border-radius: 8px; flex: 1 1 10rem; }
.consenso-si { background: var(--acc); color: var(--surface); border-color: var(--acc); }

/* Testata fissa anche nelle pagine che scorrono (statistiche, relazione, privacy): la home ha già il suo guscio */
body:not(.home) .top { position: sticky; top: 0; z-index: 30; }
body:not(.home) { scroll-padding-top: var(--top-h, 4rem); }
body:not(.home) th { top: calc(var(--top-h, 0px) - 1px); }
@media (max-width: 720px) {
  body:not(.home) .top { padding: .35rem .75rem; gap: .2rem .5rem; }
  body:not(.home) .brand { flex: 1; min-width: 0; }
  body:not(.home) .brand img { width: 32px; height: 32px; }
  body:not(.home) .brand strong { font-size: .95rem; white-space: nowrap; }
  body:not(.home) #crumbs { display: none; }
  body:not(.home) .nav { order: 3; flex: 1 0 100%; margin: 0; gap: 1.25rem; overflow-x: auto; scrollbar-width: none; }
  body:not(.home) .nav a { min-height: 32px; display: inline-flex; align-items: center; white-space: nowrap; }
  body:not(.home) .tools { gap: .3rem; }
  body:not(.home) .tools select { width: 6.2rem; padding-left: .4rem; }
}

/* Piede minimo e fisso (js/piede.js) */
.piede { flex: none; position: fixed; z-index: 25; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: center; gap: .9rem; padding: .4rem 1rem; background: var(--surface); border-top: 1px solid var(--line); color: var(--ink2); font-size: .8125rem; line-height: 1.35; }
.piede p { margin: 0; }
.piede-logo { flex: none; line-height: 0; }
.piede-logo img { height: 30px; width: auto; }
.piede-r1 { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 0 .9rem; }
.piede-r1 > * + * { position: relative; }
.piede-r1 > * + *::before { content: ""; position: absolute; left: -.45rem; top: 20%; bottom: 20%; border-left: 1px solid var(--ink3); opacity: .5; }
.piede-r2 { color: var(--ink3); font-size: .75rem; }
.piede strong { color: var(--ink); }
.piede a, .piede-lnk { color: var(--ink2); text-decoration: underline; text-underline-offset: 2px; background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.piede a:hover, .piede-lnk:hover { color: var(--acc); }
.piede-testo { text-align: center; min-width: 0; }
body.home .piede { position: static; }
body:not(.home) { padding-bottom: var(--piede-h, 3.5rem); }
@media (max-width: 720px) {
  .piede { padding: .25rem .75rem; }
  .piede a.piede-logo, .piede .piede-prog, .piede .piede-r2 { display: none; }
  .piede-r1 > * + *::before { left: -.375rem; }
  .piede-r1 > .piede-copy::before { display: none; }
  .piede-r1 { gap: 0 .75rem; min-height: 36px; }
  .piede a, .piede-lnk { min-height: 36px; display: inline-flex; align-items: center; }
}
.in-cima { bottom: calc(var(--piede-h, 0px) + .75rem); z-index: 26; }
body.home .scheda { overflow-x: hidden; }
.consenso { bottom: calc(var(--piede-h, 0px) + .75rem); }

/* Menù da mobile (js/menu.js): su desktop pulsante e pannello non esistono */
.menu-btn, .menu-vela, .menu-pan, .menu-chiudi-pag { display: none; }
@media (max-width: 720px) {
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; padding: 0; border-radius: 10px; }
  .menu-btn svg, .menu-x svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .menu-vela { display: block; position: fixed; inset: 0; z-index: 40; background: rgb(0 0 0 / .45); opacity: 0; transition: opacity .2s; }
  .menu-vela[hidden], .menu-pan[hidden] { display: none; }
  .menu-vela.aperto { opacity: 1; }
  .menu-pan { display: flex; flex-direction: column; position: fixed; z-index: 41; top: 0; bottom: 0; width: min(86vw, 340px); background: var(--surface); box-shadow: 0 0 28px rgb(0 0 0 / .3); transition: transform .2s cubic-bezier(.2, .8, .2, 1); }
  .menu-pan[data-lato="sx"] { left: 0; transform: translateX(-100%); border-radius: 0 18px 18px 0; }
  .menu-pan[data-lato="dx"] { right: 0; transform: translateX(100%); border-radius: 18px 0 0 18px; }
  .menu-pan.aperto { transform: none; }
  .menu-testa { display: flex; align-items: center; gap: .5rem; padding: .6rem .75rem; border-bottom: 1px solid var(--line); }
  .menu-testa .menu-marchio { flex: 1; min-width: 0; }
  .menu-testa .menu-marchio span { display: block; font-size: .72rem; }
  .menu-x { flex: none; width: 44px; height: 44px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border: 0; background: none; }
  .menu-corpo { flex: 1; overflow-y: auto; padding: .5rem .75rem 1rem; }
  html body .menu-pan .nav { display: flex; flex-direction: column; gap: .5rem; margin: 0 0 .5rem; overflow: visible; font-size: 1rem; }
  html body .menu-pan .nav a { display: flex; white-space: normal; align-items: center; min-height: 48px; padding: 0 .85rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); }
  .menu-pan .nav a:hover { border-color: var(--acc); }
  .menu-pan .nav a[aria-current] { background: var(--accbg); border-color: var(--acc); color: var(--acc); font-weight: 600; }
  .menu-chiudi-pag { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 44px; height: 44px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); }
  .menu-chiudi-pag svg { width: 1.4rem; height: 1.4rem; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
  .menu-pan .tools { flex-direction: column; align-items: stretch; gap: .5rem; margin-top: .75rem; padding-top: .75rem; border-top: 1px solid var(--line); }
  .menu-pan .tools button, .menu-pan .tools select { width: 100%; min-height: 48px; padding: 0 .85rem; font-size: 1rem; text-align: left; }
  .menu-piede { padding: .5rem .75rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); font-size: .8125rem; color: var(--ink2); }
  .menu-lnk { display: flex; flex-direction: column; gap: .5rem; margin-top: .5rem; }
  .menu-lnk a, .menu-lnk button { display: flex; align-items: center; width: 100%; min-height: 48px; padding: 0 .85rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); text-decoration: none; font: inherit; font-size: 1rem; text-align: left; cursor: pointer; }
  .menu-lnk a:hover, .menu-lnk button:hover { border-color: var(--acc); }
  .menu-ods { display: flex; align-items: center; gap: .6rem; margin: .25rem 0 0; color: var(--ink3); }
  .menu-ods img { height: 30px; width: auto; flex: none; }
  .menu-ods strong { color: var(--ink); }
  /* nelle pagine che scorrono la testata resta di una riga: marchio + ☰ */
  body:not(.home) .brand span { display: none; }
  /* su mobile il piede sta nel pannello: nessuna fascia fissa in basso, in nessuna pagina */
  html body > .piede { display: none; }
  html body:not(.home) { padding-bottom: 0; }
  html body .menu-pan #btn-schermo { height: 48px; justify-content: flex-start; gap: .6rem; padding: 0 .85rem; font-size: 1rem; }
  .menu-pan #btn-schermo::after { content: "Schermo intero"; }
  .menu-pan .cond > button { width: 100%; min-height: 48px; padding: 0 .85rem; justify-content: flex-start; gap: .6rem; font-size: 1rem; }
  .menu-pan .cond > button::after { content: "Condividi"; }
  .menu-pan .cond-menu { position: static; margin-top: .35rem; box-shadow: none; }
  .menu-pan .cond-menu a, .menu-pan .cond-menu button { min-height: 44px; display: flex; align-items: center; font-size: .95rem; }
  body .menu-pan .tools { align-items: stretch; }
  html body .menu-pan .tools > *, html body .menu-pan .tools select { width: 100%; }
  body .menu-pan .tools select { padding-left: .85rem; }
  @media (prefers-reduced-motion: reduce) { .menu-vela, .menu-pan { transition: none; } }
}

/* In un iframe la linguetta ☰ della testata PalermoHub sta fissa in alto a sinistra (~50 px): logo e titolo si spostano a destra */
html[data-iframe] header.top, html[data-iframe] body:not(.home) .top, html[data-iframe] body.home > header.top { padding-left: 5.65rem; }

/* tooltip: fascia di colore del comune (solo sul telefono, dove la legenda sulla mappa è nascosta) */
.tip-leg { margin-top: .4rem; font-size: .74rem; }
.tip-rampa { display: flex; gap: 2px; margin-bottom: .2rem; }
.tip-rampa i { flex: 1; height: 10px; border-radius: 2px; }
.tip-rampa i.qui { outline: 2px solid var(--ink); outline-offset: 1px; }
/* senza mouse: legenda e conteggi del riquadro si leggono nel tooltip, non sulla mappa */
@media (hover: none) { .sovra { display: none; } }

/* Piano: Componente, Misura, Sub-misura */
.pan-nota { margin: .6rem 0 0; font-size: .78rem; color: var(--ink2); }
.prog-det { margin: 1.4rem 0 0; }
.prog-det > summary { cursor: pointer; list-style: none; font-size: 1rem; font-weight: 700; padding-bottom: .25rem; border-bottom: 1px solid var(--line); margin-bottom: .5rem; }
.prog-det > summary::-webkit-details-marker { display: none; }
.prog-det > summary::before { content: '▸'; display: inline-block; width: 1rem; color: var(--ink3); }
.prog-det[open] > summary::before { content: '▾'; }
.prog-det > summary small { font-weight: 400; color: var(--ink3); margin-left: .4rem; }
.scheda td small.cod { display: block; color: var(--ink3); font-size: .72rem; }
.scheda td b { font-weight: 650; }

/* Grafici come filtri: voce attiva in evidenza, le altre attenuate */
.clicca { cursor: pointer; }
.ciambella .fetta.clicca:hover, .col.clicca:hover .col-barra, .b-riga.clicca:hover .b-riempi { filter: brightness(1.12); }
.ha-attivo .fetta:not(.attivo), .ha-attivo.colonne .col:not(.attivo) .col-barra, .barre.ha-attivo .b-riga:not(.attivo) .b-riempi { opacity: .35; }
.fetta.attivo { stroke: var(--ink); stroke-width: 2; }
.col.attivo .col-barra { stroke: var(--ink); stroke-width: 2; }
.cia-legenda li.clicca { border-radius: 6px; }
.cia-legenda li.clicca:hover { background: var(--surface2, rgba(127,127,127,.12)); }
.cia-box.ha-attivo .cia-legenda li:not(.attivo) { opacity: .55; }
.cia-legenda li.attivo, .b-riga.attivo { background: rgba(37, 106, 191, .12); outline: 1px solid var(--acc); border-radius: 6px; }
.calore td.clicca:hover { outline: 2px solid var(--ink); outline-offset: -2px; }
.calore td.attivo { outline: 3px solid var(--ink); outline-offset: -3px; font-weight: 700; }
canvas.disp.clicca { cursor: pointer; }
