/* caratteri del sito (2026-10-12) */
@import url("../_comune/caratteri.css");
/* Layout: avvio guidato (passi 1–3: pannello | mappa d'Italia) e banco GIS a tre colonne (passo 4: dati | mappa |
   risultati); la fase visibile è in .app[data-fase]. Sugli schermi stretti tutto si impila. */
:root {
  --bg: #eef0eb;
  --panel: #fafbf7;
  --panel-2: #f2f4ee;
  --ink: #1c2420;
  --ink-2: #4c5852;
  --muted: #7f8a84;
  --line: #d6dbd2;
  --accent: #1e6e8a;
  --accent-ink: #ffffff;
  --water: #1e6e8a;
  --spill: #b4532a;
  --air: #7650c2;
  --crit: #d03b3b;
  --serious: #ec835a;
  --warn: #fab219;
  --good: #0ca30c;
  --map-bg: #dfe3da;
  --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --grid: #e1e0d9; --axis: #c3c2b7;
  --shadow: 0 1px 2px rgba(20,30,25,.08), 0 4px 14px rgba(20,30,25,.06);
  --f-ui: "Barlow", "Segoe UI", system-ui, sans-serif;
  --f-cond: "Barlow Semi Condensed", "Barlow", "Arial Narrow", system-ui, sans-serif;
  --f-num: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111513; --panel: #181d1a; --panel-2: #1e2420; --ink: #e7ece6; --ink-2: #b2bcb5; --muted: #7d8882;
    --line: #2d3530; --accent: #5cb2cf; --accent-ink: #0d1a1f; --spill: #e2804f; --air: #a98be8;
    --map-bg: #1b201d; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --grid: #2c2c2a; --axis: #383835;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111513; --panel: #181d1a; --panel-2: #1e2420; --ink: #e7ece6; --ink-2: #b2bcb5; --muted: #7d8882;
  --line: #2d3530; --accent: #5cb2cf; --accent-ink: #0d1a1f; --spill: #e2804f; --air: #a98be8;
  --map-bg: #1b201d; --s1: #3987e5; --s2: #d95926; --s3: #199e70; --s4: #c98500; --grid: #2c2c2a; --axis: #383835;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 4px 14px rgba(0,0,0,.3);
  color-scheme: dark;
}
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--f-ui); font-size: 14px; line-height: 1.4; }
* { box-sizing: border-box; }
button, input, select { font: inherit; color: inherit; }
button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.app { display: grid; grid-template-columns: 330px minmax(0, 1fr) 360px; grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top top" "ctl map res"; height: 100%; }
.top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; min-width: 0; }
.brand h1 { margin: 0; font-family: var(--f-cond); font-weight: 600; font-size: 21px; letter-spacing: .01em; }
.brand .ds { color: var(--ink-2); font-size: 13px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--panel); border-radius: 6px;
  padding: 6px 12px; cursor: pointer; font-weight: 500; }
.btn:hover { background: var(--panel-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.small { padding: 3px 9px; font-size: 13px; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--panel); border-color: var(--ink); }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: var(--shadow); padding: 6px; display: grid; min-width: 240px; }
.menu-list button, .menu-file { text-align: left; background: none; border: 0; padding: 8px 10px; border-radius: 5px; cursor: pointer; }
.menu-list button:hover, .menu-file:hover { background: var(--panel-2); }
.menu-file input { display: none; }

/* ---------- controls ---------- */
.controls { grid-area: ctl; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; min-height: 0; }
.tabs { position: sticky; top: 0; z-index: 5; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--panel); border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 10px 2px 9px; font-family: var(--f-cond); font-weight: 600; font-size: 13.5px; color: var(--ink-2);
  border-bottom: 2px solid transparent; cursor: pointer; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }
.tabpanel { padding: 4px 16px 24px; }
.grp { padding-block: 12px 4px; border-bottom: 1px dashed var(--line); }
.grp:last-child { border-bottom: 0; }
.grp h3 { margin: 0 0 8px; font-family: var(--f-cond); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.prm { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 8px; align-items: center; margin-bottom: 10px; }
.prm label { font-size: 13.5px; color: var(--ink); }
.prm .val { display: flex; align-items: center; gap: 4px; }
.prm .val input { width: 84px; text-align: right; font-family: var(--f-num); font-size: 12.5px; padding: 2px 5px; border: 1px solid var(--line);
  border-radius: 4px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.prm .unit { font-size: 12px; color: var(--muted); min-width: 34px; }
.prm input[type="range"] { grid-column: 1 / -1; width: 100%; accent-color: var(--accent); margin: 0; }
.prm select { grid-column: 1 / -1; width: 100%; padding: 5px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); }
.prm .hint { grid-column: 1 / -1; font-size: 12px; color: var(--muted); }
.note { font-size: 12.5px; color: var(--ink-2); margin: 6px 0 10px; }
.note.warn { color: var(--spill); }
.field { display: grid; gap: 4px; margin-bottom: 10px; }
.field label { font-size: 13px; color: var(--ink-2); }
.field input[type="text"], .field input[type="number"], .field select { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); width: 100%; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.radio-row { display: grid; gap: 4px; margin-bottom: 10px; }
.radio-row label { display: flex; gap: 8px; align-items: center; font-size: 13.5px; cursor: pointer; }
.pt-box { background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin-block: 8px 10px; font-size: 13px; }
.pt-box .mono { font-family: var(--f-num); font-size: 12.5px; }
.credits { font-size: 12px; color: var(--muted); }
.credits a { color: var(--ink-2); }

/* ---------- map column ---------- */
.mapcol { grid-area: map; display: grid; grid-template-rows: auto minmax(0, 1fr) auto auto; min-width: 0; min-height: 0; }
.maptools { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; padding: 8px 12px; background: var(--panel); border-bottom: 1px solid var(--line); }
.maptools select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); max-width: 100%; }
.masters { display: inline-flex; gap: 6px; }
.master { display: inline-flex; align-items: center; gap: 6px; padding: 4px 11px 4px 8px; border: 1px solid var(--line); border-radius: 999px;
  font-weight: 600; font-size: 13px; cursor: pointer; background: var(--panel-2); }
.master input { accent-color: var(--ink); margin: 0; }
.master.air:has(input:checked) { border-color: var(--air); box-shadow: inset 0 0 0 1px var(--air); }
.master.water:has(input:checked) { border-color: var(--water); box-shadow: inset 0 0 0 1px var(--water); }
.master:has(input:not(:checked)) { color: var(--muted); }
.off-note { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; }
.timebar input:disabled, .play:disabled { opacity: .4; cursor: not-allowed; }
.toggles { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 13px; color: var(--ink-2); }
.toggles label { display: inline-flex; gap: 5px; align-items: center; cursor: pointer; }
.toggles input { accent-color: var(--accent); }
.tools { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.tools button { border: 0; border-right: 1px solid var(--line); background: var(--panel); padding: 5px 10px; font-size: 13px; cursor: pointer; }
.tools button:last-child { border-right: 0; }
.tools button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
.mapwrap { position: relative; background: var(--map-bg); overflow: hidden; touch-action: none; min-height: 320px; }
.mapwrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
#map { cursor: grab; }
#map.tool-move { cursor: move; }
#map.tool-well { cursor: copy; }
.maplabel { position: absolute; left: 12px; top: 10px; background: color-mix(in srgb, var(--panel) 88%, transparent); border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 10px; font-family: var(--f-cond); font-weight: 600; font-size: 15px; pointer-events: none; }
.maplabel small { display: block; font-family: var(--f-ui); font-weight: 400; font-size: 12px; color: var(--ink-2); }
.legend { position: absolute; left: 12px; bottom: 12px; background: color-mix(in srgb, var(--panel) 92%, transparent); border: 1px solid var(--line);
  border-radius: 8px; padding: 8px 10px; font-size: 12px; max-width: min(320px, calc(100% - 24px)); pointer-events: none; }
.legend .lt { font-weight: 600; margin-bottom: 5px; font-size: 12.5px; }
.legend .ramp { height: 10px; border-radius: 3px; margin-bottom: 3px; }
.legend .ticks { display: flex; justify-content: space-between; font-family: var(--f-num); font-size: 11px; color: var(--ink-2); gap: 6px; }
.legend .cat { display: flex; align-items: center; gap: 6px; margin: 2px 0; }
.legend .sw { width: 12px; height: 12px; border-radius: 3px; flex: none; border: 1px solid rgba(0,0,0,.15); }
.zoom { position: absolute; right: 12px; top: 10px; display: grid; gap: 4px; }
.zoom button { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--line); background: var(--panel); cursor: pointer; font-size: 17px; line-height: 1; }
.busy { position: absolute; right: 56px; top: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; box-shadow: var(--shadow); }
.busy .bar { height: 4px; background: var(--panel-2); border-radius: 2px; margin-top: 4px; width: 160px; overflow: hidden; }
.busy .bar i { display: block; height: 100%; width: 0; background: var(--accent); }
.toast { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 7px 14px; border-radius: 6px; font-size: 13px; max-width: 80%; text-align: center; }
.readout { padding: 5px 12px; font-family: var(--f-num); font-size: 12px; color: var(--ink-2); background: var(--panel); border-top: 1px solid var(--line);
  min-height: 27px; white-space: nowrap; overflow-x: auto; font-variant-numeric: tabular-nums; }
.timebar { display: grid; grid-template-columns: 44px repeat(auto-fit, minmax(170px, 1fr)); gap: 8px 16px; align-items: center; padding: 8px 12px; background: var(--panel); border-top: 1px solid var(--line); }
.timebar .tl { display: grid; gap: 2px; padding-left: 8px; border-left: 3px solid var(--line); }
.timebar .tl.air { border-left-color: var(--air); }
.timebar .tl.water { border-left-color: var(--water); }
.kpi-head { grid-column: 1 / -1; font-size: 13px; color: var(--ink-2); padding: 2px 2px 0; }
.kpi-head b { color: var(--ink); }
.timebar .tl span { font-size: 12px; color: var(--ink-2); display: flex; justify-content: space-between; gap: 8px; }
.timebar .tl b { font-family: var(--f-num); font-weight: 500; color: var(--ink); }
.timebar input[type="range"] { width: 100%; accent-color: var(--accent); }
/* cursore del tempo: area di presa alta (dito), binario con la parte già trascorsa, pomello grande */
#tSlider { -webkit-appearance: none; appearance: none; height: 30px; margin: 0; background: transparent; cursor: pointer; touch-action: none; --p: 0%; }
#tSlider:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
#tSlider::-webkit-slider-runnable-track { height: 8px; border-radius: 4px; background: linear-gradient(to right, var(--air) var(--p), var(--line) var(--p)); }
#tSlider::-moz-range-track { height: 8px; border-radius: 4px; background: var(--line); }
#tSlider::-moz-range-progress { height: 8px; border-radius: 4px; background: var(--air); }
#tSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -7px; border-radius: 50%; background: var(--panel); border: 3px solid var(--air); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
#tSlider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: var(--panel); border: 3px solid var(--air); box-shadow: 0 1px 3px rgba(0, 0, 0, .25); }
#tSlider:active::-webkit-slider-thumb { transform: scale(1.12); }
#tSlider:disabled { cursor: not-allowed; }
.play { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--line); background: var(--accent); color: var(--accent-ink); cursor: pointer; font-size: 15px; }

/* ---------- results ---------- */
.results { grid-area: res; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; min-height: 0; padding: 4px 16px 24px; }
.results h2 { font-family: var(--f-cond); font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 8px; }
.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi { background: var(--panel-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.kpi .k { font-size: 12px; color: var(--ink-2); line-height: 1.25; }
.kpi .v { font-family: var(--f-cond); font-weight: 600; font-size: 20px; margin-top: 2px; }
.kpi .v small { font-family: var(--f-ui); font-weight: 400; font-size: 12px; color: var(--ink-2); margin-left: 3px; }
.kpi.alert { box-shadow: inset 3px 0 0 var(--crit); }
.kpi.ok { box-shadow: inset 3px 0 0 var(--good); }
.chart { position: relative; margin-top: 4px; }
.chart canvas { width: 100%; height: 170px; display: block; }
.chart .lg { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; color: var(--ink-2); margin-bottom: 4px; }
.chart .lg i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }
.chart .ct { font-size: 13px; font-weight: 600; margin: 14px 0 2px; }
.tip { position: absolute; pointer-events: none; background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; font-size: 12px;
  box-shadow: var(--shadow); white-space: nowrap; z-index: 4; }
.tip b { font-family: var(--f-num); font-weight: 500; }
.tbl-wrap { overflow-x: auto; }
table.wells { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.wells th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 4px 4px; white-space: nowrap; }
table.wells td { border-bottom: 1px solid var(--line); padding: 4px 4px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11.5px; font-weight: 600; color: #1b1b1b; }
.pill.z3 { background: var(--crit); color: #fff; } .pill.z2 { background: var(--serious); } .pill.z1 { background: var(--warn); } .pill.z0 { background: var(--panel-2); color: var(--ink-2); border: 1px solid var(--line); }
.method { font-size: 12.5px; color: var(--ink-2); }
.method p { margin: 0 0 8px; }
.method summary { cursor: pointer; font-weight: 600; color: var(--ink); margin: 14px 0 6px; }

@media (max-width: 1280px) {
  .app { grid-template-columns: 320px minmax(0, 1fr); grid-template-rows: auto minmax(560px, 1fr) auto; grid-template-areas: "top top" "ctl map" "res res"; height: auto; min-height: 100%; }
  .controls { max-height: calc(100vh - 60px); }
  .results { border-left: 0; border-top: 1px solid var(--line); overflow: visible; }
  .results-inner { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 0 24px; }
}
@media (max-width: 860px) {
  .legend { font-size: 11px; max-width: 62%; padding: 6px 8px; }
  .legend .cat { margin: 1px 0; }
  .maplabel { font-size: 13.5px; max-width: calc(100% - 70px); }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "top" "map" "ctl" "res"; }
  .controls { max-height: none; border-right: 0; border-top: 1px solid var(--line); }
  .mapwrap { height: 62vh; }
  .timebar { grid-template-columns: 44px minmax(0, 1fr); }
  .timebar .tl:not(:first-of-type) { grid-column: 1 / -1; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; } }

/* ---------- rifinitura grafica ---------- */
.top { padding-block: 9px; box-shadow: 0 1px 0 var(--line), 0 6px 18px rgba(20, 30, 25, .04); position: relative; z-index: 6; }
.brand { align-items: center; }
.logo { width: 30px; height: 30px; flex: none; }
.brand h1 { font-size: 22px; letter-spacing: .005em; }
.brand .ds { padding-left: 12px; border-left: 1px solid var(--line); }
.controls { background: linear-gradient(180deg, var(--panel) 0%, var(--panel) 60%, var(--panel-2) 100%); }
.tabs button { position: relative; transition: color .15s; }
.tabs button:hover { color: var(--ink); }
.grp h3 { display: flex; align-items: center; gap: 8px; }
.grp h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.grp { border-bottom: 0; }
.prm input[type="range"] { height: 18px; }
.maptools { gap: 8px 12px; box-shadow: 0 1px 0 var(--line); position: relative; z-index: 3; }
.master { transition: background .15s, color .15s; }
.master.air:has(input:checked) { background: color-mix(in srgb, var(--air) 14%, var(--panel)); color: var(--ink); }
.master.water:has(input:checked) { background: color-mix(in srgb, var(--water) 14%, var(--panel)); color: var(--ink); }
.master.air input { accent-color: var(--air); }
.master.water input { accent-color: var(--water); }
.mapwrap { background:
  radial-gradient(circle at 1px 1px, color-mix(in srgb, var(--ink) 9%, transparent) 1px, transparent 1.2px) 0 0 / 14px 14px, var(--map-bg); }
.maplabel { box-shadow: var(--shadow); padding: 7px 12px; border-radius: 8px; }
.maplabel small { margin-top: 1px; }
.legend { box-shadow: var(--shadow); padding: 10px 12px; border-radius: 10px; min-width: 220px; }
.legend .ramp { height: 12px; border-radius: 6px; border: 1px solid color-mix(in srgb, var(--ink) 12%, transparent);
  background-color: #fff !important; }
.legend .sw { width: 14px; height: 14px; border-radius: 4px; }
.zoom button { box-shadow: var(--shadow); }
.zoom button:hover { background: var(--panel-2); }
.timebar { padding-block: 10px; gap: 8px 18px; }
.timebar .tl { border-left-width: 3px; padding-block: 2px; }
.timebar .tl.air input { accent-color: var(--air); }
.timebar .tl.water input { accent-color: var(--water); }
.timebar .tl span label { font-weight: 500; color: var(--ink-2); }
.play { box-shadow: var(--shadow); transition: transform .1s; }
.play:active { transform: scale(.95); }
.results h2 { display: flex; align-items: center; gap: 8px; color: var(--ink-2); margin-top: 22px; }
.results h2::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--muted); flex: none; }
.results h2.h-water::before { background: var(--water); }
.results h2.h-air::before { background: var(--air); }
.kpi { border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); transition: border-color .15s; }
.kpi .k { font-size: 11.8px; }
.kpi .v { font-size: 21px; font-variant-numeric: tabular-nums; }
.kpi.alert { box-shadow: inset 3px 0 0 var(--crit); background: color-mix(in srgb, var(--crit) 6%, var(--panel-2)); }
.kpi.ok { box-shadow: inset 3px 0 0 var(--good); }
.kpi-head { display: block; background: color-mix(in srgb, var(--accent) 9%, var(--panel)); border-radius: 8px; padding: 8px 10px; color: var(--ink); }
.chart { background: var(--panel-2); border-radius: 10px; padding: 2px 10px 8px; margin-top: 10px; border: 1px solid color-mix(in srgb, var(--line) 70%, transparent); }
.chart .ct { margin-top: 10px; }
.chart canvas { height: 160px; }
table.wells th { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
table.wells tr:hover td { background: var(--panel-2); }
.method { margin-top: 10px; }

#baseSel { padding: 4px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font-size: 13px; }
.legend .cat.hum { margin-top: 3px; }
.legend .sw.sw-hum { background: rgba(226,204,186,.9); border: 1.5px dashed #6b3d2a; }
.legend .sw.sw-ind { background: rgba(196,178,214,.9); border: 1.5px dashed #5d3f78; }

.pt-go { display: grid; grid-template-columns: 1fr auto; gap: 6px; }
.pt-go input { padding: 5px 7px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); width: 100%; min-width: 0; font-family: var(--f-num); font-size: 12.5px; }
.nudge-wrap { display: grid; grid-template-columns: auto 1fr; gap: 12px; align-items: start; margin-bottom: 8px; }
.nudge { display: grid; grid-template-columns: repeat(3, 34px); grid-auto-rows: 34px; gap: 3px; }
.nudge button { border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); font-size: 16px; line-height: 1; cursor: pointer; }
.nudge button:hover { background: var(--panel); border-color: var(--ink-2); }
.nudge button:active { transform: translateY(1px); }
.nudge .nudge-c { color: #2b6cb0; font-weight: 600; }
.nudge-step .note { margin: 2px 0 0; }
.pt-actions { display: flex; flex-wrap: wrap; gap: 6px; }
#ptShift.far { color: #9a4b12; }

/* ---------- aggiunte del simulatore universale ---------- */
.badge-ipotesi { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; background: #fff3cd; color: #6a4b00; border: 1px solid #e8c766;
  font-family: var(--f-cond); font-weight: 600; font-size: 12.5px; letter-spacing: .04em; text-transform: uppercase; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-ipotesi { background: #3a3014; color: #f3d98a; border-color: #6d5a1f; } }
.avviso { margin: 10px 0 4px; padding: 9px 11px; border-radius: 8px; background: var(--panel-2); border-left: 3px solid #e8c766; font-size: 12.5px; color: var(--ink-2); }
.avviso b { color: var(--ink); }
.avviso.ambito { border-left-color: #2a8c7d; }
.avviso a { color: var(--ink); font-weight: 600; }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: 1 0 auto; font-size: 13.5px; padding: 11px 9px 10px; white-space: nowrap; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto; gap: 8px; align-items: center; font-size: 12.5px; margin: 4px 0; }
.bar-row .bl { color: var(--ink-2); }
.bar-row .bt { height: 9px; background: var(--panel-2); border-radius: 5px; overflow: hidden; }
.bar-row .bt i { display: block; height: 100%; border-radius: 5px; }
.bar-row b { font-family: var(--f-num); font-weight: 500; font-size: 12px; }
table.tab { width: 100%; border-collapse: collapse; font-size: 12px; }
table.tab th { text-align: left; font-weight: 600; color: var(--ink-2); border-bottom: 1px solid var(--line); padding: 4px; white-space: nowrap; }
table.tab td { border-bottom: 1px solid var(--line); padding: 4px; vertical-align: top; }
table.tab td.num { font-family: var(--f-num); white-space: nowrap; text-align: right; }
table.tab tr.sel td { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.mini { font-size: 11.5px; color: var(--muted); }
.row-btn { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; vertical-align: middle; margin-right: 4px; border: 1px solid rgba(0,0,0,.2); }
.tipo-card { display: grid; gap: 6px; }
.tipo-card label { display: grid; grid-template-columns: auto 1fr; gap: 2px 8px; align-items: start; padding: 7px 9px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.tipo-card label:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.tipo-card small { grid-column: 2; color: var(--muted); font-size: 11.5px; }

/* ---------- legende dei temi nel tempo (corso d'acqua, suolo) ---------- */
.legend .ls { color: var(--ink-2); margin: -2px 0 6px; font-size: 11.5px; line-height: 1.3; }
.legend .cls { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 2px; }
.legend .cls div { display: grid; gap: 2px; justify-items: center; min-width: 0; }
.legend .cls span { display: block; width: 100%; height: 11px; border: 1px solid rgba(0,0,0,.18); }
.legend .cls div:first-child span { border-radius: 4px 0 0 4px; }
.legend .cls div:last-child span { border-radius: 0 4px 4px 0; }
.legend .cls small { font-family: var(--f-num); font-size: 10.5px; color: var(--ink-2); white-space: nowrap; letter-spacing: -.02em; }
.legend .lsoglia { margin: 3px 0 0 50%; border-top: 2px solid var(--crit); padding-top: 1px; font-size: 10.5px; color: var(--ink-2); text-align: center; position: relative; }
.legend .lsoglia::before { content: ""; position: absolute; left: 0; top: -6px; height: 6px; border-left: 2px solid var(--crit); }
.legend .lst { margin-top: 6px; padding-top: 5px; border-top: 1px solid var(--line); font-size: 12px; line-height: 1.35; }
.legend .lnota { font-size: 11px; color: var(--muted); margin-top: 4px; line-height: 1.3; }
.legend details.lgd summary { pointer-events: auto; cursor: pointer; list-style: none; color: var(--accent); font-size: 11.5px; font-weight: 600; margin-top: 5px; display: inline-block; }
.legend details.lgd summary::-webkit-details-marker { display: none; }
.legend details.lgd summary::before { content: "▸ "; }
.legend details.lgd[open] summary::before { content: "▾ "; }
.legend details.lgd[open] { padding-top: 2px; }
.legend .cat > span:last-child { min-width: 0; }
.legend .sy { position: relative; display: inline-block; flex: none; width: 26px; height: 14px; }
.legend .sy.film { background: linear-gradient(#2a1c10, #2a1c10) center / 100% 12px no-repeat; }
.legend .sy.film::after { content: ""; position: absolute; left: 0; right: 0; top: 4px; height: 6px; background: #cf4ea6; box-shadow: 0 0 0 1.5px #fff; }
.legend .sy.sponda { background: repeating-linear-gradient(90deg, #c98500 0 2px, transparent 2px 4px) top / 100% 4px no-repeat, repeating-linear-gradient(90deg, #c98500 0 2px, transparent 2px 4px) bottom / 100% 4px no-repeat, linear-gradient(#cf4ea6, #cf4ea6) center / 100% 4px no-repeat; }
.legend .sy.fronte::before { content: ""; position: absolute; left: 8px; top: 0; width: 2px; height: 14px; background: #1c2420; }
.legend .sy.fronte::after { content: ""; position: absolute; left: 10px; top: 0; width: 11px; height: 8px; background: #e8541c; clip-path: polygon(0 0, 100% 45%, 0 100%); }
.legend .sy.base { background: linear-gradient(#7fb3dc, #7fb3dc) center / 100% 3px no-repeat; }
.legend .sy.rivolo { background: linear-gradient(90deg, #a8743f 0 50%, #3d2312 50%) center / 100% 4px no-repeat; }
.legend .sy.rivolo::after { content: ""; position: absolute; left: 0; top: 2px; width: 10px; height: 10px; border-radius: 50%; background: rgba(61,35,18,.85); box-shadow: 0 0 0 1.5px #fff; }
.legend .sy.iso { background: linear-gradient(#1c2420, #1c2420) center / 2px 100% no-repeat, linear-gradient(#7fb3dc, #7fb3dc) center / 100% 3px no-repeat; }
.legend .sy.libero::after { content: ""; position: absolute; left: 8px; top: 2px; width: 9px; height: 9px; background: #2a78d6; transform: rotate(45deg); box-shadow: 0 0 0 1.5px #fff; }
.legend .sy.pozza::after { content: ""; position: absolute; left: 6px; top: 0; width: 13px; height: 13px; border-radius: 50%; background: #8c430e; box-shadow: 0 0 0 1.5px #1c140c; }
.legend .sy.rivolo-s { background: linear-gradient(#bb7325, #bb7325) center / 100% 5px no-repeat, linear-gradient(#1c140c, #1c140c) center / 100% 8px no-repeat; }
.legend .sy.percorso { background: repeating-linear-gradient(90deg, #4c5852 0 4px, transparent 4px 7px) center / 100% 2px no-repeat; }
.legend .keys { display: flex; flex-wrap: wrap; gap: 3px 10px; margin-top: 6px; font-size: 11.5px; color: var(--ink-2); }
.legend .keys > span { display: inline-flex; align-items: center; gap: 4px; }
.legend .keys .sy { width: 22px; }
.maplabel .ora { font-variant-numeric: tabular-nums; font-weight: 600; background: color-mix(in srgb, var(--accent) 14%, transparent); padding: 0 5px; border-radius: 4px; white-space: nowrap; }

/* ---------- indicatori e classi del liquido ---------- */
.kpi.wide { grid-column: 1 / -1; }
.kpi .arr { display: flex; flex-wrap: wrap; gap: 2px 14px; margin-top: 4px; font-size: 12.5px; color: var(--ink-2); }
.kpi .arr b { font-family: var(--f-cond); font-weight: 600; font-size: 17px; color: var(--ink); margin-left: 3px; font-variant-numeric: tabular-nums; }
.kpi.ora { border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); }
.kpi.ora .k { color: var(--ink); font-weight: 500; }
.classe-liq { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; font-size: 12.5px; color: var(--ink-2); margin: 12px 0 4px; line-height: 1.4; }
.badge-cl { display: inline-block; padding: 1px 9px; border-radius: 999px; font-family: var(--f-cond); font-weight: 600; font-size: 12.5px; letter-spacing: .03em; text-transform: uppercase; border: 1px solid; }
.badge-cl.cl-insolubile { background: #f3e6d8; color: #5c3414; border-color: #c9a27e; }
.badge-cl.cl-parziale { background: #f6e1ee; color: #7a1650; border-color: #d99bc0; }
.badge-cl.cl-solubile { background: #dcebf8; color: #164a7a; border-color: #8fb7dc; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge-cl.cl-insolubile { background: #3a2a1c; color: #f0d2b4; border-color: #7a5a3c; } :root:not([data-theme="light"]) .badge-cl.cl-parziale { background: #3d1c30; color: #f3c2df; border-color: #85456b; } :root:not([data-theme="light"]) .badge-cl.cl-solubile { background: #182e44; color: #c3dcf3; border-color: #3f6a93; } }
:root[data-theme="dark"] .badge-cl.cl-insolubile { background: #3a2a1c; color: #f0d2b4; border-color: #7a5a3c; }
:root[data-theme="dark"] .badge-cl.cl-parziale { background: #3d1c30; color: #f3c2df; border-color: #85456b; }
:root[data-theme="dark"] .badge-cl.cl-solubile { background: #182e44; color: #c3dcf3; border-color: #3f6a93; }
.results h2.h-soil::before { background: var(--spill); }
.results h2.h-gw::before { background: #b02a6e; }

/* ---------- grafici: legenda e note ---------- */
.chart .lg span { display: inline-flex; align-items: center; }
.chart .lg i.sq { width: 10px; height: 10px; border-radius: 2px; }
.chart .lg i.tratt { background: repeating-linear-gradient(135deg, #1e140c 0 1.5px, transparent 1.5px 4px); border: 1px solid rgba(0,0,0,.25); }
.chart .lg i.dash { width: 14px; height: 0; border-top: 2px dashed; border-radius: 0; background: none; }
.chart .lg i.vuoto { background: transparent; border: 1px dashed var(--ink-2); }
.chart .lg .u { margin-left: auto; }
.chart .cn { font-size: 11.5px; color: var(--ink-2); margin-top: 4px; line-height: 1.35; }
.chart .cn:empty { display: none; }
.tip .mini { color: var(--muted); }

.mapcol { grid-template-columns: minmax(0, 1fr); }
#layerSel { min-width: 0; max-width: 100%; text-overflow: ellipsis; }
.legend.fuori { position: static; max-width: none; width: auto; min-width: 0; border-radius: 0; border: 0; border-top: 1px solid var(--line); box-shadow: none; background: var(--panel); padding: 8px 12px 10px; }
.legend.fuori .cls { max-width: 420px; }
@media (max-width: 860px) {
  #layerSel { width: 100%; }
  .legend .cls small { font-size: 9.5px; }
  .maplabel small { font-size: 11px; }
}

/* =====================================================================
   AVVIO GUIDATO A CASCATA: 1 Luogo · 2 Scenario · 3 Dati · 4 Simulazione
   ===================================================================== */
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.salta { position: absolute; left: -9999px; top: 8px; z-index: 100; background: var(--panel); color: var(--ink); padding: 8px 14px; border-radius: 8px; box-shadow: var(--shadow); font-weight: 600; }
.salta:focus { left: 8px; }
h2[tabindex="-1"]:focus { outline: none; }
.mono { font-family: var(--f-num); font-variant-numeric: tabular-nums; }
.btn.grande { padding: 9px 18px; font-size: 15px; font-weight: 600; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; filter: none; }
.btn:focus-visible, .link:focus-visible, .esempio:focus-visible, .stepper button:focus-visible, .ripristina:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.err { color: var(--crit); font-size: 12.5px; margin: 4px 0 0; }

/* ---------- fasi ---------- */
.wiz, .italia { display: none; }
.app:not([data-fase="simulazione"]) { grid-template-columns: minmax(340px, 440px) minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top" "pan ita"; height: 100%; }
.app[data-fase="luogo"] #wizLuogo, .app[data-fase="scenario"] #wizScenario { display: flex; grid-area: pan; }
.app[data-fase="dati"] .controls { grid-area: pan; max-height: none; border-top: 0; border-right: 1px solid var(--line); }
.app[data-fase="luogo"] .controls, .app[data-fase="scenario"] .controls { display: none; }
.app:not([data-fase="simulazione"]) .italia { display: block; grid-area: ita; }
.app:not([data-fase="simulazione"]) .mapcol, .app:not([data-fase="simulazione"]) .results,
.app:not([data-fase="simulazione"]) #btnRun, .app:not([data-fase="simulazione"]) #expMenu, .app:not([data-fase="simulazione"]) .ds { display: none; }
.app[data-fase="simulazione"] #btnAvvia { display: none; }
.app[data-fase="dati"] #tab-luogo { display: none; }

/* ---------- indicatore dei passi ---------- */
.top { gap: 10px 16px; }
.stepper { flex: 1 1 auto; display: flex; justify-content: center; min-width: 0; }
.stepper ol { display: flex; align-items: center; gap: 2px; list-style: none; margin: 0; padding: 0; min-width: 0; }
.stepper li { display: flex; align-items: center; min-width: 0; }
.stepper li + li::before { content: ""; flex: none; width: 18px; height: 2px; margin: 0 2px; border-radius: 1px; background: var(--line); }
.stepper li:has(> [data-stato="fatto"]) + li::before { background: var(--accent); }
.stepper button { display: flex; align-items: center; gap: 8px; min-width: 0; border: 1px solid transparent; background: none; border-radius: 999px; padding: 4px 12px 4px 4px; cursor: pointer; text-align: left; transition: background .15s, border-color .15s; }
.stepper button:hover:not(:disabled) { background: var(--panel-2); }
.stepper button:disabled { opacity: .45; cursor: not-allowed; }
.stepper button[aria-current="step"] { background: color-mix(in srgb, var(--accent) 11%, var(--panel)); border-color: color-mix(in srgb, var(--accent) 38%, var(--line)); }
.stepper .n { flex: none; width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line); background: var(--panel); color: var(--ink-2); font: 600 12.5px/1 var(--f-num); position: relative; }
.stepper [data-stato="fatto"] .n { background: var(--accent); border-color: var(--accent); color: transparent; }
.stepper [data-stato="fatto"] .n::after { content: ""; position: absolute; left: 8px; top: 5px; width: 6px; height: 10px; border: solid var(--accent-ink); border-width: 0 2.2px 2.2px 0; transform: rotate(45deg); }
.stepper [aria-current="step"] .n { box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); border-color: var(--accent); }
.stepper [aria-current="step"]:not([data-stato="fatto"]) .n { color: var(--accent); }
.stepper [data-stato="rifare"] .n, .stepper [data-stato="rivedere"] .n { background: #fff3cd; border-color: #d9a520; color: #6a4b00; }
.stepper [data-stato="errore"] .n { border-color: var(--crit); color: var(--crit); }
.stepper [data-stato="corso"] .n { border-color: var(--accent); border-right-color: transparent; animation: gira .9s linear infinite; color: transparent; }
.stepper .t { display: grid; min-width: 0; line-height: 1.15; }
.stepper .t b { font-family: var(--f-cond); font-weight: 600; font-size: 14px; color: var(--ink); }
.stepper .t small { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 150px; }
.stepper [data-stato="rifare"] .t small, .stepper [data-stato="rivedere"] .t small { color: #8a5a00; font-weight: 600; }
.stepper [data-stato="errore"] .t small { color: var(--crit); }
@keyframes gira { to { transform: rotate(360deg); } }
@media (max-width: 1240px) { .stepper { order: 3; flex-basis: 100%; justify-content: flex-start; } .top { padding-bottom: 8px; } }
@media (max-width: 700px) { .stepper .t small { display: none; } .stepper button { padding-right: 8px; gap: 6px; } .stepper li + li::before { width: 10px; } }
@media (max-width: 460px) {
  .stepper { justify-content: space-between; }
  .stepper ol { width: 100%; justify-content: space-between; }
  .stepper li + li::before { flex: 1 1 auto; width: auto; min-width: 6px; }
  .stepper li { flex: 0 1 auto; }
  .stepper li:has(+ li) { flex: 1 1 auto; }
  .stepper button:not([aria-current="step"]) .t { display: none; }
  .stepper button:not([aria-current="step"]) { padding: 2px; }
}

/* ---------- pannelli dei passi 1 e 2 ---------- */
.wiz { flex-direction: column; min-height: 0; background: var(--panel); border-right: 1px solid var(--line); }
.wiz-corpo { flex: 1 1 auto; overflow-y: auto; padding: 18px 22px 26px; }
.wiz-piede { flex: none; display: flex; gap: 8px; justify-content: flex-end; align-items: center; padding: 12px 22px; border-top: 1px solid var(--line); background: var(--panel); box-shadow: 0 -8px 16px rgba(20, 30, 25, .05); }
.wiz-piede .btn.primary { flex: 0 1 auto; }
.wiz-k { margin: 0 0 4px; font-family: var(--f-cond); font-weight: 600; font-size: 12.5px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.wiz h2, .ctl-testa h2 { margin: 0 0 6px; font-family: var(--f-cond); font-weight: 600; font-size: 27px; line-height: 1.12; letter-spacing: .003em; }
.wiz-lead { margin: 0 0 16px; color: var(--ink-2); font-size: 14.5px; }
.wiz h3, .esempi h3 { margin: 22px 0 4px; font-family: var(--f-cond); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); display: flex; align-items: center; gap: 8px; }
.wiz h3::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.coord { display: grid; gap: 5px; }
.coord label { font-weight: 600; font-size: 13.5px; }
.coord .pt-go input { padding: 9px 11px; font-size: 14px; border-radius: 8px; }
.coord .pt-go .btn { padding: 8px 16px; border-radius: 8px; font-weight: 600; }
.coord input[aria-invalid="true"] { border-color: var(--crit); box-shadow: 0 0 0 2px color-mix(in srgb, var(--crit) 18%, transparent); }
.hint { font-size: 12px; color: var(--muted); margin: 2px 0 0; }

.pin { flex: none; display: inline-block; width: 16px; height: 16px; border-radius: 50%; background: #ffd84a; border: 3px solid #3a2410; box-sizing: border-box; box-shadow: 0 0 0 3px rgba(255, 216, 74, .35); }
.punto { margin: 16px 0 6px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2); }
.punto.vuoto { border-style: dashed; background: transparent; color: var(--ink-2); font-size: 13.5px; }
.punto.vuoto p { margin: 0; }
.punto-testa { display: flex; gap: 10px; align-items: center; }
.punto-testa b { display: block; font-size: 14px; font-weight: 500; }
.punto-testa small { display: block; color: var(--ink-2); font-size: 12.5px; }
.punto-dati { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; margin: 12px 0 0; }
.punto-dati dt { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.punto-dati dd { margin: 0; font-weight: 500; font-size: 13.5px; }
.punto-fonte { margin: 10px 0 0; padding: 8px 10px; border-radius: 8px; font-size: 12.8px; line-height: 1.4; border-left: 3px solid var(--accent); background: color-mix(in srgb, var(--accent) 9%, var(--panel)); }
.punto-fonte.ok { border-left-color: var(--good); background: color-mix(in srgb, var(--good) 10%, var(--panel)); }
.punto-fonte.no { border-left-color: #d39b00; background: color-mix(in srgb, var(--warn) 15%, var(--panel)); }
.punto-caso { margin: 8px 0 0; font-size: 12.8px; }
.punto-caso a { color: var(--accent); font-weight: 600; }
.nota-cambio, .nota-tipo { margin: 10px 0; padding: 8px 11px; border-radius: 8px; font-size: 13px; color: var(--ink-2); background: var(--panel-2); border-left: 3px solid var(--accent); }
.nota-cambio { border-left-color: #d9a520; background: color-mix(in srgb, var(--warn) 14%, var(--panel)); color: var(--ink); }
.nota-tipo:empty { display: none; }
.nota-tipo b { color: #8a5a00; }

.esempi-lista { display: grid; gap: 8px; margin-top: 8px; }
.esempio { display: grid; grid-template-columns: 46px minmax(0, 1fr); gap: 12px; align-items: center; text-align: left; padding: 9px 12px 9px 9px; border: 1px solid var(--line); border-radius: 12px; background: var(--panel); cursor: pointer; transition: border-color .15s, background .15s, transform .1s; }
.esempio:hover { border-color: color-mix(in srgb, var(--c) 70%, var(--line)); background: color-mix(in srgb, var(--c) 5%, var(--panel)); }
.esempio:active { transform: translateY(1px); }
.esempio b { display: block; font-size: 14px; }
.esempio small { display: block; color: var(--ink-2); font-size: 12.3px; line-height: 1.3; }
.esempio small.mini { color: var(--muted); margin-top: 2px; }
.esempio-ico, .tipo-ico { display: grid; place-items: center; border-radius: 11px; color: var(--ink); background: color-mix(in srgb, var(--c) 13%, var(--panel)); }
.esempio-ico { width: 46px; height: 46px; }
.esempio-ico svg { width: 34px; height: 34px; }
.esempio-ico svg, .tipo-ico svg, .chip-ico svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg .acc { fill: var(--c); fill-opacity: .38; stroke: var(--c); }
svg .acs { stroke: var(--c); }

.avanzate { margin: 18px 0 8px; border: 1px solid var(--line); border-radius: 10px; padding: 0 14px; background: var(--panel); }
.avanzate summary { cursor: pointer; padding: 11px 0; font-weight: 600; font-size: 13.5px; list-style: none; display: flex; align-items: center; gap: 8px; }
.avanzate summary::-webkit-details-marker { display: none; }
.avanzate summary::before { content: ""; width: 7px; height: 7px; border: solid var(--ink-2); border-width: 0 2px 2px 0; transform: rotate(-45deg); transition: transform .15s; }
.avanzate[open] summary::before { transform: rotate(45deg); }
.avanzate[open] { padding-bottom: 6px; }
.avanzate .field input, .avanzate .field select { padding: 7px 9px; border-radius: 6px; }

/* ---------- passo 2: tipi di scenario ---------- */
.riepilogo { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 10px; }
.riepilogo:empty { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; max-width: 100%; padding: 3px 4px 3px 8px; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-2); font-size: 12.5px; }
.chip .pin { width: 12px; height: 12px; border-width: 2.5px; box-shadow: none; }
.chip-ico { display: inline-grid; color: var(--c); }
.chip-ico svg { width: 20px; height: 20px; }
.link { border: 0; background: none; color: var(--accent); font-weight: 600; cursor: pointer; padding: 3px 8px; border-radius: 999px; font-size: 12.5px; }
.link:hover { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.tipi { display: grid; gap: 10px; margin-top: 12px; }
.tipo { position: relative; display: grid; grid-template-columns: 58px minmax(0, 1fr); gap: 14px; align-items: start; padding: 13px 40px 13px 13px; border: 1.5px solid var(--line); border-radius: 14px; background: var(--panel); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s; }
.tipo input { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.tipo:hover { border-color: color-mix(in srgb, var(--c) 55%, var(--line)); }
.tipo:has(input:checked) { border-color: var(--c); background: color-mix(in srgb, var(--c) 6%, var(--panel)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 16%, transparent); }
.tipo:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 3px; }
.tipo:has(input:checked)::after { content: ""; position: absolute; right: 13px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; background: var(--c); box-shadow: inset 0 0 0 5px var(--panel), 0 0 0 1.5px var(--c); }
.tipo::before { content: ""; position: absolute; right: 13px; top: 50%; width: 20px; height: 20px; margin-top: -10px; border-radius: 50%; border: 1.5px solid var(--line); box-sizing: border-box; }
.tipo-ico { width: 58px; height: 58px; }
.tipo-ico svg { width: 44px; height: 44px; }
.tipo-tx b { display: block; font-family: var(--f-cond); font-weight: 600; font-size: 17px; line-height: 1.2; }
.tipo-tx small { display: block; color: var(--ink-2); font-size: 12.8px; line-height: 1.35; margin-top: 2px; }
.tipo-m { display: block; font-style: normal; font-size: 12.3px; color: var(--ink-2); margin-top: 6px; }
.tipo-m:empty { display: none; }
.tipo.no { cursor: not-allowed; background: var(--panel-2); border-style: dashed; }
.tipo.no .tipo-ico, .tipo.no .tipo-tx b, .tipo.no .tipo-tx small { opacity: .5; }
.tipo.no .tipo-m { color: #8a4b12; }
.tipo-badge { display: none; position: absolute; right: 12px; top: 9px; font-family: var(--f-cond); font-weight: 600; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--c); border: 1px solid currentColor; padding: 0 7px; border-radius: 999px; background: var(--panel); }
.tipo.cons .tipo-badge { display: inline-block; }
.tipo.cons { padding-top: 22px; }

/* ---------- mappa d'insieme ---------- */
.italia { position: relative; min-width: 0; min-height: 0; }
.italiawrap { position: absolute; inset: 0; overflow: hidden; background: var(--map-bg); touch-action: none; }
.italiawrap canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; cursor: crosshair; }
.italiawrap canvas.trascina { cursor: grabbing; }
.italiawrap canvas:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.italiawrap .zoom button span { font: 600 11px var(--f-num); }
.mappa-nota { position: absolute; left: 12px; top: 12px; max-width: min(430px, calc(100% - 76px)); background: color-mix(in srgb, var(--panel) 95%, transparent); border: 1px solid var(--line); border-left: 3px solid #d39b00; border-radius: 9px; padding: 8px 11px; font-size: 12.5px; line-height: 1.4; box-shadow: var(--shadow); }
.mappa-nota .btn { margin-left: 4px; padding: 1px 9px; }
.mappa-coord { position: absolute; left: 12px; bottom: 40px; font: 500 11.5px var(--f-num); background: color-mix(in srgb, var(--panel) 90%, transparent); padding: 3px 8px; border-radius: 6px; pointer-events: none; font-variant-numeric: tabular-nums; }
.mappa-coord:empty { display: none; }
.mappa-legenda { position: absolute; left: 12px; bottom: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; font-size: 11.5px; color: var(--ink-2); background: color-mix(in srgb, var(--panel) 90%, transparent); padding: 4px 9px; border-radius: 7px; pointer-events: none; max-width: calc(100% - 190px); }
.mappa-legenda .sw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; margin-left: 4px; }
.mappa-legenda .sw:first-child { margin-left: 0; }
.sw-terra { background: linear-gradient(135deg, #aac596, #d6cca2 60%, #bca386); }
.sw-mare { background: linear-gradient(135deg, #cce5f0, #7aa8cf); }
.sw-caso { background: #b4532a; border-radius: 50% !important; box-shadow: 0 0 0 1.5px #fff inset; }
.sw-area { border: 1.5px dashed #1e6e8a; }

/* ---------- passo 3 e simulatore: pannello dei dati ---------- */
.ctl-testa { display: none; padding: 18px 20px 6px; }
.app[data-fase="dati"] .ctl-testa { display: block; }
.ctl-testa .note { margin-bottom: 6px; }
.ctl-piede { display: none; position: sticky; bottom: 0; z-index: 6; background: var(--panel); border-top: 1px solid var(--line); padding: 10px 16px 12px; box-shadow: 0 -8px 16px rgba(20, 30, 25, .05); }
.app[data-fase="dati"] .ctl-piede, .app[data-fase="simulazione"] .ctl-piede { display: block; }
.ctl-stato { margin: 0 0 8px; font-size: 12.5px; color: var(--ink-2); }
.ctl-stato:empty { display: none; }
.ctl-azioni { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.app[data-fase="simulazione"] .ctl-piede { display: flex; align-items: center; gap: 10px; padding: 8px 14px; }
.app[data-fase="simulazione"] .ctl-stato { margin: 0; flex: 1; font-size: 12px; }
.app[data-fase="simulazione"] #btnDefault { padding: 3px 10px; font-size: 13px; }
.nmod { display: inline-grid; place-items: center; min-width: 17px; height: 17px; padding: 0 5px; margin-left: 5px; border-radius: 999px; background: var(--accent); color: var(--accent-ink); font: 600 10.5px/1 var(--f-num); vertical-align: 1px; }
.prm { padding: 7px 10px 7px 9px; margin: 0 -10px 3px -11px; border-radius: 8px; border-left: 3px solid transparent; transition: background .15s, border-color .15s; }
.prm.mod { border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.prm.err-on { border-left-color: var(--crit); background: color-mix(in srgb, var(--crit) 6%, transparent); }
.prm .val input[type="text"] { width: 86px; text-align: right; font-family: var(--f-num); font-size: 12.5px; padding: 3px 6px; border: 1px solid var(--line); border-radius: 5px; background: var(--panel-2); font-variant-numeric: tabular-nums; }
.prm .val input[aria-invalid="true"] { border-color: var(--crit); }
.prm .val input:focus { background: var(--panel); }
.prm-meta { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center; gap: 8px; min-height: 20px; font-size: 11.5px; color: var(--muted); }
.prm-def b { font-weight: 500; color: var(--ink-2); }
.ripristina { border: 1px solid color-mix(in srgb, var(--accent) 45%, var(--line)); background: var(--panel); color: var(--accent); border-radius: 999px; padding: 1px 9px; font-size: 11.5px; font-weight: 600; cursor: pointer; }
.ripristina::before { content: "↺ "; }
.ripristina:hover { background: color-mix(in srgb, var(--accent) 10%, var(--panel)); }
.prm .hint { margin: 1px 0 0; }
.prm .err { grid-column: 1 / -1; margin: 2px 0 0; font-size: 12px; }
.scen-box { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel-2); font-weight: 500; }
.scen-box > span { display: inline-flex; align-items: center; gap: 8px; }

/* ---------- passo 4: avanzamento e dati non disponibili ---------- */
.progresso { position: absolute; inset: 0; z-index: 12; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--map-bg) 82%, transparent); overflow-y: auto; }
.prog-card { width: min(460px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 18px 20px 16px; box-shadow: 0 14px 44px rgba(20, 30, 25, .18); }
.prog-card h3 { margin: 0 0 14px; font-family: var(--f-cond); font-weight: 600; font-size: 22px; line-height: 1.15; }
.prog-card p { margin: 0 0 8px; font-size: 13.5px; color: var(--ink-2); }
.prog-passi { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 11px; }
.prog-passi li { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 10px; align-items: start; }
.prog-passi .ic { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line); box-sizing: border-box; position: relative; margin-top: 1px; }
.prog-passi .pt b { display: block; font-weight: 600; font-size: 14px; }
.prog-passi .pt small { display: block; font-size: 12.3px; color: var(--ink-2); min-height: 1em; }
.prog-passi li[data-st="attesa"] { color: var(--muted); }
.prog-passi li[data-st="attesa"] .pt small { color: var(--muted); }
.prog-passi li[data-st="corso"] .ic { border-color: var(--accent); border-right-color: transparent; animation: gira .8s linear infinite; }
.prog-passi li[data-st="fatto"] .ic { background: var(--good); border-color: var(--good); }
.prog-passi li[data-st="fatto"] .ic::after { content: ""; position: absolute; left: 6px; top: 2.5px; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: rotate(45deg); }
.prog-passi li[data-st="avviso"] .ic { background: var(--warn); border-color: var(--warn); }
.prog-passi li[data-st="avviso"] .ic::after, .prog-passi li[data-st="errore"] .ic::after { content: "!"; position: absolute; inset: 0; display: grid; place-items: center; font: 700 12px/1 var(--f-ui); color: #1b1b1b; }
.prog-passi li[data-st="errore"] .ic { background: var(--crit); border-color: var(--crit); }
.prog-passi li[data-st="errore"] .ic::after { color: #fff; }
.prog-card .bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.prog-card .bar i { display: block; height: 100%; width: 0; background: var(--accent); border-radius: 3px; transition: width .35s ease; }
.prog-card .prog-txt { margin: 8px 0 0; }
.prog-card .prog-txt:empty { display: none; }
.prog-card.errore { border-top: 4px solid var(--crit); }
.prog-card.errore h4 { margin: 16px 0 8px; font-family: var(--f-cond); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.prog-card .alt { display: grid; gap: 8px; }
.prog-card .alt > div { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.prog-card .alt b { display: block; font-size: 14px; }
.prog-card .alt small { display: block; color: var(--ink-2); font-size: 12.5px; }
.prog-card .alt .row-btn { margin: 8px 0 0; }
.prog-card .row-btn.fine { justify-content: space-between; margin: 14px 0 0; }
.res-vuoto { display: grid; justify-items: center; text-align: center; gap: 6px; padding: 56px 18px; color: var(--muted); font-size: 13.5px; }
.res-vuoto svg { color: var(--line); }
.res-vuoto p { max-width: 260px; margin: 0; }

/* ---------- simulatore: livelli, vento, legenda ---------- */
.maptools { flex-wrap: wrap; }
.maptools #layerSel { flex: 1 1 260px; }
.livelli summary { display: inline-flex; align-items: center; gap: 6px; }
.livelli .menu-list { left: auto; right: 0; min-width: 260px; gap: 1px; }
.livelli .menu-list label { display: flex; align-items: flex-start; gap: 9px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.livelli .menu-list label:hover { background: var(--panel-2); }
.livelli .menu-list label input { accent-color: var(--accent); margin: 3px 0 0; }
.livelli .menu-list label small { display: block; color: var(--muted); font-size: 11.5px; }
.livelli .menu-list label.sel { display: grid; gap: 4px; margin-top: 4px; padding-top: 10px; border-top: 1px solid var(--line); border-radius: 0; cursor: default; }
.livelli .menu-list label.sel span { font-size: 12px; color: var(--ink-2); }
#flow { pointer-events: none; }
.mapwrap:has(> .progresso:not([hidden])) > :not(.progresso):not(.toast) { visibility: hidden; }
.toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); z-index: 60; max-width: min(560px, calc(100vw - 32px)); box-shadow: 0 8px 24px rgba(20, 30, 25, .25); line-height: 1.35; }
.legend .lazioni { margin-top: 7px; }
.legend .lazioni .btn { pointer-events: auto; padding: 2px 10px; font-size: 12px; }
.legend .lsoglia-u { text-align: right; font-size: 10.5px; color: var(--ink-2); margin-top: -1px; }
.app[data-fase="simulazione"] .timebar { padding-block: 8px; }
@media (prefers-reduced-motion: reduce) {
  .prog-passi li[data-st="corso"] .ic, .stepper [data-stato="corso"] .n { animation: none; border-style: dashed; border-right-color: var(--accent); }
  .prog-card .bar i { transition: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .stepper [data-stato="rifare"] .n, :root:not([data-theme="light"]) .stepper [data-stato="rivedere"] .n { background: #3a3014; border-color: #8a6a1f; color: #f3d98a; }
  :root:not([data-theme="light"]) .stepper [data-stato="rifare"] .t small, :root:not([data-theme="light"]) .stepper [data-stato="rivedere"] .t small, :root:not([data-theme="light"]) .nota-tipo b { color: #f3d98a; }
  :root:not([data-theme="light"]) .tipo.no .tipo-m { color: #f0b37a; }
}
:root[data-theme="dark"] .stepper [data-stato="rifare"] .n, :root[data-theme="dark"] .stepper [data-stato="rivedere"] .n { background: #3a3014; border-color: #8a6a1f; color: #f3d98a; }
:root[data-theme="dark"] .stepper [data-stato="rifare"] .t small, :root[data-theme="dark"] .stepper [data-stato="rivedere"] .t small, :root[data-theme="dark"] .nota-tipo b { color: #f3d98a; }
:root[data-theme="dark"] .tipo.no .tipo-m { color: #f0b37a; }

/* ---------- avvio guidato su schermi medi e stretti ---------- */
@media (max-width: 1280px) {
  .app:not([data-fase="simulazione"]) { grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
}
@media (max-width: 860px) {
  .app:not([data-fase="simulazione"]) { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "top" "ita" "pan"; height: auto; min-height: 100%; }
  .app:not([data-fase="simulazione"]) .italia { height: 34vh; min-height: 220px; }
  .app[data-fase="luogo"] .italia { height: 52vh; min-height: 300px; }
  .wiz { border-right: 0; border-top: 1px solid var(--line); }
  .wiz-corpo { overflow: visible; padding: 16px 16px 20px; }
  .wiz-piede { position: sticky; bottom: 0; z-index: 8; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); }
  .wiz-piede .btn.primary { flex: 1 1 auto; justify-content: center; }
  .app[data-fase="dati"] .controls { border-right: 0; border-top: 1px solid var(--line); overflow: visible; }
  .app[data-fase="dati"] .tabs { top: 0; }
  .ctl-piede { padding-bottom: calc(10px + env(safe-area-inset-bottom)); }
  .app[data-fase="dati"] .ctl-azioni .btn { flex: 1 1 auto; justify-content: center; }
  .wiz h2, .ctl-testa h2 { font-size: 24px; }
  .mappa-legenda { max-width: calc(100% - 24px); bottom: 34px; }
  .mappa-coord { display: none; }
  .tipo { grid-template-columns: 48px minmax(0, 1fr); gap: 11px; padding-right: 38px; }
  .tipo-ico { width: 48px; height: 48px; }
  .tipo-ico svg { width: 38px; height: 38px; }
  .brand { gap: 8px; }
  .brand h1 { font-size: 19px; }
  .badge-ipotesi { font-size: 11px; padding: 2px 8px; }
  .top { padding: 8px 12px; }
  .top-actions .btn { padding: 5px 10px; }
  .livelli .menu-list { right: auto; left: 0; }
}

.app.universale .brand .ds { display: none; }
.legend .cls.c5 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.legend .lst b { font-variant-numeric: tabular-nums; }
.app[data-fase="simulazione"] .tabs button { padding: 10px 7px 9px; font-size: 13px; }
.app[data-fase="simulazione"] .nmod { min-width: 15px; height: 15px; font-size: 10px; margin-left: 3px; padding: 0 4px; }
#layerSel:disabled { opacity: .6; }

/* ---------- rifiniture: scheda di avanzamento che scorre, intestazione compatta sui telefoni ---------- */
.progresso { display: flex; }
.prog-card { margin: auto; }
.corto { display: none; }
@media (max-width: 860px) {
  .brand { flex-basis: 100%; flex-wrap: nowrap; min-width: 0; }
  .brand h1 { font-size: 18px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .badge-ipotesi { flex: none; font-size: 10.5px; letter-spacing: .03em; padding: 2px 7px; }
  .logo { width: 24px; height: 24px; }
  .stepper { order: 2; flex: 1 1 0; }
  .top-actions { order: 3; margin-left: auto; }
  #btnRun { display: none; }
  .brand .ds { display: none; }
  .app:not(.universale) .brand { flex-wrap: wrap; }
  .app:not(.universale) .brand h1 { white-space: normal; overflow: visible; }
  .mappa-nota .lungo, .mappa-legenda { display: none; }
  .mappa-nota { padding: 6px 9px; }
  .app[data-fase="dati"] .ctl-stato { font-size: 12px; margin-bottom: 6px; }
  .app[data-fase="dati"] .ctl-azioni { flex-wrap: nowrap; }
  .app[data-fase="dati"] #btnDefault { flex: 0 0 auto; padding-inline: 12px; }
  .app[data-fase="dati"] #btnDefault .lungo { display: none; }
  .app[data-fase="dati"] #btnDefault .corto { display: inline; }
  .app:not([data-fase="simulazione"]) .toast { bottom: 96px; }
  .progresso { position: relative; inset: auto; min-height: 62vh; padding: 12px; }
  .mapwrap:has(> .progresso:not([hidden])) { height: auto; }
  .prog-card { padding: 16px; }
}
a.btn { color: inherit; text-decoration: none; }
.btn-file { position: relative; display: inline-flex; }
.btn-file input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.btn-file:focus-within { outline: 2px solid var(--accent); outline-offset: 2px; }
.app.vuoto .timebar, .app.vuoto .readout { display: none; }

/* ---------- fase 3: sostanza del tema, soglie in legenda, meteo da dati aperti, indicazioni pratiche ---------- */
.maptools #specieSel { flex: 0 1 220px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--panel-2); }
.legend .lsoglie { display: grid; gap: 2px; margin-top: 5px; font-size: 11px; color: var(--ink-2); }
.legend .lsoglie span { display: flex; align-items: center; gap: 6px; }
.legend .lsoglie i { width: 14px; height: 3px; border-radius: 2px; flex: none; }
.legend .sw-pozzo { background: #fff !important; border: 2.5px solid #b0272f; border-radius: 50%; }
.meteo-dati { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: var(--panel-2); }
.meteo-dati h3 { margin-top: 0; }
.meteo-dati .row-btn { margin: 6px 0; }
.meteo-tab { max-height: 260px; overflow: auto; margin: 6px 0; }
.meteo-tab table { font-size: 12px; }
.meteo-tab td, .meteo-tab th { padding: 3px 6px; white-space: nowrap; }
.meteo-tab tr.rug td { background: color-mix(in srgb, var(--accent) 10%, transparent); }
.frecciav { display: inline-block; font-weight: 700; color: var(--air); line-height: 1; }
.rosa { display: flex; flex-wrap: wrap; gap: 10px 14px; align-items: flex-start; margin-top: 6px; }
.rosa svg { flex: none; }
.rosa > div { flex: 1 1 180px; min-width: 0; }
.leg-rosa { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11px; color: var(--ink-2); margin: 4px 0; }
.leg-rosa i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.indicazioni { border: 1px solid var(--line); border-left: 4px solid var(--crit); border-radius: 10px; padding: 10px 14px; margin: 10px 0 14px; background: var(--panel-2); }
.indicazioni h2 { margin-top: 2px; }
.indicazioni ul { margin: 6px 0; padding-left: 18px; display: grid; gap: 6px; }
.indicazioni li { line-height: 1.45; }
.tab-specie td .link { font: inherit; font-weight: 600; text-align: left; }
.tab td.num.alert { color: var(--crit); font-weight: 600; }
.tab td small { color: var(--muted); display: block; }
.prm[hidden], .grp[hidden] { display: none !important; }
.res .tab td, #resInner .tab td { vertical-align: top; }
#resInner .tab-fasi td { white-space: nowrap; }

/* ---------- veste grafica di www.fictilis.it (dal 2026-10-12) ----------
   Fondi caldi, grafite e caratteri del sito (Space Grotesk per i titoli, Instrument Sans per il testo:
   _comune/caratteri.css, importato in cima). Logo ufficiale scuro nell'intestazione: per questo il simulatore
   resta sempre in tema chiaro.
   ⚠️ L'accento d'interfaccia è GRAFITE, non il rame del sito: il rame (#BE5E30) è quasi identico al colore del
   liquido sversato (--spill #b4532a) e sulla mappa i due si confonderebbero. Il rame resta ai pulsanti principali
   e al contorno di focus, fuori dalla mappa. --water separa il colore dell'acqua dall'accento: fino all'11/10
   coincidevano, e cambiare l'uno avrebbe cambiato l'altro. I colori dei dati (liquido, aria, acqua, soglie,
   serie) restano quelli di prima. */
:root {
  --bg: #F6F4F0; --panel: #FCFBF9; --panel-2: #F6F4F0; --ink: #1D2026; --ink-2: #333844; --muted: #6B7078; --line: #E4DFD6;
  --accent: #333844; --accent-ink: #FCFBF9; --water: #1e6e8a; --map-bg: #E5E1D9; --grid: #E4DFD6; --axis: #C9C3B8;
  --spill: #b4532a; --air: #7650c2; --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --shadow: 0 1px 2px rgba(20, 22, 27, .04), 0 10px 32px -14px rgba(20, 22, 27, .14);
  --f-ui: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-cond: "Instrument Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-display: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  --f-num: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #F6F4F0; --panel: #FCFBF9; --panel-2: #F6F4F0; --ink: #1D2026; --ink-2: #333844; --muted: #6B7078; --line: #E4DFD6;
  --accent: #333844; --accent-ink: #FCFBF9; --water: #1e6e8a; --map-bg: #E5E1D9; --grid: #E4DFD6; --axis: #C9C3B8;
  --spill: #b4532a; --air: #7650c2; --s1: #2a78d6; --s2: #eb6834; --s3: #1baf7a; --s4: #eda100;
  --shadow: 0 1px 2px rgba(20, 22, 27, .04), 0 10px 32px -14px rgba(20, 22, 27, .14);
    color-scheme: light;
  }
  :root:not([data-theme="light"]) .badge-ipotesi { background: #fffaf1; color: #7a5418; border-color: #ecdcbf; }
}
body { -webkit-font-smoothing: antialiased; }
.top { background: rgba(246, 244, 240, .94); box-shadow: 0 1px 0 var(--line); padding-block: 10px; }
.brand { align-items: center; gap: 14px; }
.brand-logo { display: inline-flex; align-items: center; flex: none; border-radius: 6px; }
.brand-logo img { display: block; height: 24px; width: auto; }
.brand-sep { flex: none; width: 1px; height: 24px; background: var(--line); }
.brand h1 { font-family: var(--f-display); font-weight: 600; font-size: 18px; letter-spacing: -.015em; color: var(--ink); }
/* ritorno alla pagina del servizio, solo dove l'intestazione ha spazio */
.brand-sez { display: none; flex: none; margin-left: auto; color: var(--ink-2); font-size: 13px; font-weight: 500; text-decoration: none; white-space: nowrap; }
.brand-sez:hover { color: #853C1D; text-decoration: underline; text-underline-offset: 3px; }
@media (min-width: 1181px) { .brand-sez { display: inline-flex; } }
.btn { border-radius: 999px; padding: 6px 14px; font-weight: 500; border-color: rgba(51, 56, 68, .3); }
.btn:hover { background: var(--panel); border-color: #333844; }
.btn.primary { background: #A44C24; border-color: #A44C24; color: #FCFBF9; }
.btn.primary:hover { background: #853C1D; border-color: #853C1D; filter: none; }
.btn.small { padding: 4px 12px; }
.badge-ipotesi { background: #fffaf1; color: #7a5418; border-color: #ecdcbf; font-weight: 700; letter-spacing: .08em; }
.badge-ipotesi::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #d6a058; flex: none; }
.tabs button[aria-selected="true"] { border-bottom-color: var(--accent); }
.grp h3 { color: #4A505E; letter-spacing: .1em; font-weight: 600; font-size: 11.5px; }
.menu-list, .legend, .maplabel { border-color: var(--line); }
.master.water:has(input:checked) { border-color: var(--water); box-shadow: inset 0 0 0 1px var(--water); background: color-mix(in srgb, var(--water) 12%, var(--panel)); }
.master.water input { accent-color: var(--water); }
:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, summary:focus-visible, .btn:focus-visible, .link:focus-visible { outline-color: #BE5E30; }
@media (max-width: 860px) {
  .brand { gap: 10px; }
  .brand-logo img { height: 20px; }
  .brand-sep { height: 20px; }
  .brand h1 { font-size: 16px; }
}
@media (max-width: 460px) { .brand-sep, .app.universale .brand-sep { display: none; } }
/* intestazione su una riga sugli schermi larghi: il nome dell'area si accorcia per primo */
@media (min-width: 861px) {
  .app:not(.universale) .top { flex-wrap: nowrap; }
  .app:not(.universale) .brand { flex: 1 1 auto; flex-wrap: nowrap; min-width: 0; }
  .app:not(.universale) .brand h1 { white-space: nowrap; flex: none; }
  .app:not(.universale) .brand .ds { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .app:not(.universale) .top-actions { flex: none; }
}
@media (min-width: 861px) and (max-width: 1180px) { .app:not(.universale) .brand .ds { display: none; } }
.brand .badge-ipotesi { flex: none; white-space: nowrap; }
/* riproduzione: inizio, indietro e avanti di 10 minuti attorno al pulsante di avvio */
/* (una riga flessibile: i pulsanti a sinistra, i cursori del tempo che si dividono lo spazio restante) */
.timebar { display: flex; flex-wrap: wrap; align-items: center; }
.timebar .tl { flex: 1 1 170px; min-width: 0; }
.trasporto { display: flex; align-items: center; gap: 6px; }
.trasporto .tr { width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--ink); cursor: pointer; display: inline-grid; place-items: center; padding: 0; box-shadow: var(--shadow); }
.trasporto .tr:hover { background: var(--panel-2); }
.trasporto .tr:disabled { opacity: .4; cursor: not-allowed; }
.play { display: inline-grid; place-items: center; padding: 0; }
@media (max-width: 440px) { .trasporto { flex: 1 1 100%; justify-content: center; } }
/* vista 3D del terreno con i risultati (vista3d.js) */
.zoom .b3d { font: 700 12px/1 var(--f-ui, sans-serif); letter-spacing: .02em; }
.zoom .b3d[aria-pressed="true"] { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.vista3d { position: absolute; inset: 0; z-index: 4; background: linear-gradient(#dbe7ee, #f1f4ef 60%); overflow: hidden; }
.vista3d canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.vista3d canvas:active { cursor: grabbing; }
.v3-pie { position: absolute; right: 10px; bottom: 8px; display: grid; justify-items: end; gap: 4px; max-width: 46%; }
.v3-aiuto, .v3-info { margin: 0; font-size: 11.5px; color: var(--ink-2); background: rgba(255,255,255,.85); padding: 3px 8px; border-radius: 6px; text-align: right; }
.zoom .v3b { display: none; font: 600 12px/1 var(--f-ui, sans-serif); place-items: center; }
.mapwrap.in3d .zoom .v3b { display: inline-grid; }
.vista3d .v3-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; padding: 24px; font-size: 14px; color: var(--ink-2); }
@media (max-width: 760px) { .v3-pie { max-width: 36%; } .v3-aiuto { display: none; } }
.mapwrap.in3d .zoom button:not(.b3d):not(.v3b) { display: none; }
.mapwrap.in3d .zoom { z-index: 6; }
.mapwrap .maplabel, .mapwrap .legend { z-index: 5; }
.mapwrap .busy { z-index: 7; }
