/* Calcolatore del Potenziale 3F — Advanced
   Un solo colore di accento (--accent, con le sue varianti di luminosità). */
:root {
  --accent: #4c7dff;
  --accent-hi: #7c9fff;
  --accent-lo: #2f5ae0;
  --accent-soft: rgba(76, 125, 255, .14);
  --accent-line: rgba(76, 125, 255, .45);

  --bg: #070b14;
  --surface: #0d1322;
  --surface-2: #121a2c;
  --surface-3: #18223a;
  --line: rgba(148, 163, 184, .13);
  --line-2: rgba(148, 163, 184, .24);
  --ink: #e9edf5;
  --ink-2: #a3acbf;
  --ink-3: #6f7a91;
  --error: #ff8a80;

  --radius: 16px;
  --radius-sm: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--accent-hi); }
h1, h2, h3 { letter-spacing: -.02em; text-wrap: balance; }
.muted { color: var(--ink-2); }
.small { font-size: 13.5px; }
.container { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 16px; }

/* ---------- Topbar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 30;
  background: rgba(7, 11, 20, .72);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--line);
}
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.logo { display: block; height: 28px; width: auto; }
.foot .logo { height: 24px; }
.logo-stampa { display: none; }

/* ---------- Bottoni ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; text-align: center;
  font: inherit; font-weight: 650; font-size: 16px; letter-spacing: -.005em;
  min-height: 50px; padding: 12px 22px;
  border-radius: 12px; border: 1px solid transparent;
  cursor: pointer; text-decoration: none; color: var(--ink);
  transition: transform .08s ease, background-color .2s, border-color .2s, box-shadow .2s, filter .2s;
}
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 3px; }
.btn .ico { width: 18px; height: 18px; }
.btn-primary {
  background: linear-gradient(180deg, var(--accent-hi) -40%, var(--accent) 60%);
  color: #fff;
  box-shadow: 0 0 0 1px rgba(124, 159, 255, .5) inset, 0 10px 30px -10px rgba(76, 125, 255, .7);
}
.btn-primary:hover { filter: brightness(1.08); box-shadow: 0 0 0 1px rgba(124, 159, 255, .6) inset, 0 14px 36px -10px rgba(76, 125, 255, .85); }
.btn-ghost { background: var(--surface-2); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--ink-3); }
.btn-outline { background: transparent; border-color: var(--accent-line); color: var(--ink); }
.btn-outline:hover { background: var(--accent-soft); }
.btn-light { background: var(--ink); color: var(--bg); width: 100%; }
.btn-light:hover { filter: brightness(.94); }
.btn-sm { min-height: 38px; padding: 8px 14px; font-size: 14px; border-radius: 10px; }
.btn-xl { width: 100%; min-height: 58px; font-size: 17px; }
.btn[disabled] { opacity: .6; cursor: progress; }

/* ---------- Hero ---------- */
.hero { position: relative; padding: 44px 0 28px; text-align: center; isolation: isolate; }
.hero::before {
  content: ""; position: absolute; inset: -80px 0 -40px; z-index: -1;
  background:
    radial-gradient(600px 300px at 50% 0%, rgba(76, 125, 255, .28), transparent 70%),
    linear-gradient(var(--line) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, var(--line) 1px, transparent 1px) 0 0 / 44px 44px;
  -webkit-mask-image: radial-gradient(ellipse 70% 80% at 50% 20%, #000 30%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 80% at 50% 20%, #000 30%, transparent 75%);
}
.badge {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 600; color: var(--ink-2);
  padding: 6px 12px; border-radius: 99px;
  background: var(--surface); border: 1px solid var(--line-2);
  margin: 0 0 20px;
}
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
h1 {
  font-size: clamp(32px, 7.4vw, 60px); line-height: 1.04; font-weight: 750; letter-spacing: -.035em;
  margin: 0 auto 16px; max-width: 16ch;
  background: linear-gradient(180deg, #fff 30%, #b8c4dc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sub { font-size: clamp(17px, 2.4vw, 20px); color: var(--ink-2); margin: 0 auto; max-width: 34ch; text-wrap: pretty; }
.hero-meta {
  list-style: none; padding: 0; margin: 28px 0 0;
  display: flex; flex-wrap: wrap; justify-content: center; gap: 8px 24px;
  font-size: 14px; color: var(--ink-3);
}
.hero-meta strong { color: var(--ink); font-weight: 650; margin-right: 4px; }

/* ---------- Frame applicazione ---------- */
.app { padding-bottom: 56px; }
.frame {
  background: linear-gradient(180deg, var(--surface) 0%, #0b101d 100%);
  border: 1px solid var(--line-2);
  border-radius: 20px;
  box-shadow: 0 40px 80px -40px rgba(0, 0, 0, .8), 0 0 0 1px rgba(255, 255, 255, .02) inset;
  overflow: hidden;
  overflow: clip; /* ritaglia senza bloccare la barra "sticky" dei pulsanti su mobile */
}
.frame-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 18px; }
.frame-title { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; min-width: 0; }
.frame-title .muted { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.frame-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); flex: none; }
.frame-sep { color: var(--ink-3); }
.step-count { margin: 0; font-size: 13px; color: var(--ink-3); font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress { height: 2px; background: var(--line); }
.progress-bar { height: 100%; width: 20%; background: linear-gradient(90deg, var(--accent-lo), var(--accent-hi)); box-shadow: 0 0 12px var(--accent); transition: width .5s var(--ease); }
.frame-body { display: grid; }

/* ---------- Wizard ---------- */
.wizard { padding: 24px 18px; display: flex; flex-direction: column; min-width: 0; }
.step { border: 0; margin: 0; padding: 0; min-width: 0; animation: entra .35s var(--ease); }
@keyframes entra { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step legend { font-size: clamp(21px, 3vw, 26px); font-weight: 700; line-height: 1.2; letter-spacing: -.02em; padding: 0; margin: 0 0 6px; }
.step legend label { cursor: default; }
.step-desc { color: var(--ink-2); margin: 0 0 20px; font-size: 15px; }
.field-label { display: block; font-size: 13px; font-weight: 600; color: var(--ink-2); margin: 18px 0 8px; text-transform: uppercase; letter-spacing: .05em; }

/* settori */
.sector-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.sector {
  display: flex; align-items: center; gap: 10px; text-align: left;
  font: inherit; font-size: 14px; font-weight: 550; line-height: 1.25; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px; min-height: 58px; cursor: pointer;
  transition: border-color .15s, background-color .15s, transform .15s;
}
.sector:hover { border-color: var(--line-2); background: var(--surface-3); }
.sector .ico { width: 22px; height: 22px; flex: none; color: var(--ink-2); transition: color .15s; }
.sector[aria-checked="true"] { border-color: var(--accent); background: linear-gradient(180deg, rgba(76,125,255,.2), rgba(76,125,255,.08)); box-shadow: 0 0 0 1px var(--accent) inset; }
.sector[aria-checked="true"] .ico { color: var(--accent-hi); }
.sector:focus-visible, .seg button:focus-visible, .chip:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }

/* "Altro": descrizione attività + 2 domande */
.altro-box { margin-top: 16px; padding: 4px 16px 16px; border: 1px solid var(--accent-line); border-radius: 14px; background: rgba(76,125,255,.05); animation: entra .35s var(--ease); }
.opt-grid { display: grid; gap: 8px; }
.opt {
  display: flex; flex-direction: column; gap: 2px; text-align: left;
  font: inherit; color: var(--ink); background: var(--surface-2);
  border: 1px solid var(--line-2); border-radius: 12px; padding: 11px 14px; cursor: pointer;
  transition: border-color .15s, background-color .15s;
}
.opt strong { font-size: 14.5px; font-weight: 600; }
.opt span { font-size: 12.5px; color: var(--ink-3); }
.opt:hover { border-color: var(--ink-3); }
.opt[aria-checked="true"] { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.opt:focus-visible { outline: 2px solid var(--accent-hi); outline-offset: 2px; }
.hint { font-size: 13px; color: var(--ink-3); margin: 12px 0 0; }
@media (min-width: 560px) { .opt-grid { grid-template-columns: repeat(3, 1fr); } }

/* segmented / chips */
.seg { display: grid; gap: 6px; padding: 5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; }
.seg-4 { grid-template-columns: repeat(2, 1fr); }
.seg-5 { grid-template-columns: repeat(5, 1fr); }
.seg button {
  font: inherit; font-weight: 600; font-size: 15px; color: var(--ink-2);
  background: transparent; border: 0; border-radius: 10px; min-height: 46px; cursor: pointer;
  transition: background-color .2s, color .2s;
}
.seg button:hover { color: var(--ink); }
.seg button[aria-checked="true"] { background: var(--accent); color: #fff; box-shadow: 0 6px 18px -8px var(--accent); }
.chips-wrap { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  font: inherit; font-size: 14px; font-weight: 550; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 99px;
  padding: 8px 14px; min-height: 40px; cursor: pointer;
}
.chip:hover { border-color: var(--ink-3); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: #fff; }

select, input[type="text"], input[type="number"], input[type="email"], input[type="tel"] {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px;
  padding: 13px 14px; min-height: 50px; appearance: none;
}
select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23a3acbf' stroke-width='1.8' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 16px center; padding-right: 40px;
}
select option { background: var(--surface); color: var(--ink); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
[aria-invalid="true"] { border-color: var(--error) !important; }
.error { font-size: 14px; color: var(--error); margin: 10px 0 0; font-weight: 500; }

.area-line { margin: 16px 0 0; font-size: 15px; color: var(--ink-2); min-height: 24px; }
.area-line strong { color: var(--ink); font-variant-numeric: tabular-nums; }

/* valore */
.money { display: flex; align-items: baseline; gap: 10px; border-bottom: 1px solid var(--line-2); padding-bottom: 6px; }
.money:focus-within { border-color: var(--accent); }
.money-sym { font-size: 34px; font-weight: 600; color: var(--ink-3); }
.money input {
  border: 0; background: transparent; padding: 0; min-height: 0; box-shadow: none !important;
  font-size: clamp(40px, 8vw, 56px); font-weight: 700; letter-spacing: -.03em; font-variant-numeric: tabular-nums;
  -moz-appearance: textfield;
}
.money input::-webkit-outer-spin-button, .money input::-webkit-inner-spin-button,
.stepper input::-webkit-outer-spin-button, .stepper input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.range { width: 100%; margin: 22px 0 4px; accent-color: var(--accent); height: 28px; background: transparent; -webkit-appearance: none; appearance: none; }
.range::-webkit-slider-runnable-track { height: 4px; border-radius: 4px; background: linear-gradient(90deg, var(--accent) var(--p, 50%), var(--line-2) var(--p, 50%)); }
.range::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -9px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); box-shadow: 0 2px 10px rgba(0,0,0,.4); }
.range::-moz-range-track { height: 4px; border-radius: 4px; background: var(--line-2); }
.range::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--accent); }
.range::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #fff; border: 4px solid var(--accent); }

/* stepper */
.stepper { display: grid; grid-template-columns: 64px 1fr 64px; gap: 8px; max-width: 360px; }
.stepper input { text-align: center; font-size: 36px; font-weight: 700; min-height: 72px; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.stepper-btn { font: inherit; font-size: 28px; color: var(--ink); background: var(--surface-2); border: 1px solid var(--line-2); border-radius: 12px; cursor: pointer; }
.stepper-btn:hover { border-color: var(--accent); }

.nav { display: flex; gap: 10px; margin-top: auto; padding-top: 28px; }
.nav .btn-primary { flex: 1; }

/* ---------- Pannello live ---------- */
.live { border-top: 1px solid var(--line); background: rgba(5, 8, 15, .5); padding: 18px; display: flex; flex-direction: column; gap: 14px; }
.live-map { position: relative; border: 1px solid var(--line); border-radius: 14px; background: radial-gradient(circle at 50% 40%, #0f1730, #080c17 70%); overflow: hidden; aspect-ratio: 1.12; }
.live-tag { position: absolute; left: 12px; top: 10px; font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); }
.live-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
.live-stats div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; min-width: 0; }
.live-stats dt { font-size: 11.5px; color: var(--ink-3); line-height: 1.3; }
.live-stats dd { margin: 4px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.live-lock { display: flex; gap: 12px; align-items: center; border: 1px dashed var(--line-2); border-radius: 12px; padding: 12px 14px; }
.lock-ico { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hi); flex: none; }
.lock-ico .ico { width: 18px; height: 18px; }
.live-lock-t { margin: 0; font-size: 12.5px; color: var(--ink-3); }
.live-lock-v { margin: 2px 0 0; font-size: 20px; font-weight: 700; }
.blur { filter: blur(7px); user-select: none; color: var(--accent-hi); }

/* ---------- Mappa ---------- */
.map { width: 100%; height: 100%; display: block; }
.map-grid { stroke: rgba(148, 163, 184, .07); stroke-width: .15; }
.map-dot { fill: #3a4660; transition: fill .4s, opacity .4s; }
.map-dot.in { fill: var(--accent-hi); }
.map-dot.out { opacity: .55; }
.map-area { transition: r .6s var(--ease); }
.map-glow-0 { stop-color: var(--accent); stop-opacity: .26; }
.map-glow-1 { stop-color: var(--accent); stop-opacity: .04; }
.map-ring { fill: none; stroke: var(--accent-hi); stroke-width: calc(.45px * var(--map-k, 1)); stroke-dasharray: calc(1.6px * var(--map-k, 1)) calc(1.2px * var(--map-k, 1)); transition: r .6s var(--ease); }
.map-center { fill: #fff; stroke: var(--accent); stroke-width: calc(.8px * var(--map-k, 1)); }
.map-pulse { fill: var(--accent); opacity: .5; transform-box: fill-box; transform-origin: center; animation: pulse 2s ease-out infinite; }
@keyframes pulse { from { transform: scale(1); opacity: .55; } to { transform: scale(4); opacity: 0; } }
.map-label { font-size: calc(3.3px * var(--map-k, 1)); fill: var(--ink-3); text-anchor: middle; font-weight: 600; paint-order: stroke; stroke: #080c17; stroke-width: calc(.8px * var(--map-k, 1)); transition: opacity .3s; }
.map-label.nascosta { opacity: 0; }
.map-label-main { fill: #fff; font-size: calc(4.2px * var(--map-k, 1)); font-weight: 700; }

/* ---------- Overlay analisi ---------- */
.overlay { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: rgba(4, 6, 12, .78); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; } }
.overlay-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--line-2); border-radius: 18px; padding: 28px 24px; box-shadow: 0 40px 100px -30px rgba(0,0,0,.9); }
.spinner { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--line-2); border-top-color: var(--accent); animation: gira .8s linear infinite; margin-bottom: 16px; }
@keyframes gira { to { transform: rotate(360deg); } }
.overlay-t { font-weight: 700; font-size: 19px; margin: 0 0 14px; }
.checklist { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.checklist li { display: flex; gap: 10px; align-items: center; font-size: 15px; color: var(--ink-3); transition: color .3s; }
.checklist li .tick { width: 20px; height: 20px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; flex: none; transition: all .3s; }
.checklist li .tick .ico { width: 12px; height: 12px; opacity: 0; stroke-width: 3; }
.checklist li.fatto { color: var(--ink); }
.checklist li.fatto .tick { background: var(--accent); border-color: var(--accent); }
.checklist li.fatto .tick .ico { opacity: 1; color: #fff; }

/* ---------- Risultato ---------- */
.result { outline: none; padding-top: 28px; padding-bottom: 40px; display: grid; gap: 16px; }
.report-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 14px; margin-bottom: 6px; }
.report-head h2 { font-size: clamp(22px, 3.4vw, 32px); margin: 4px 0 4px; line-height: 1.15; }
.report-head .muted { margin: 0; }
.report-actions { display: flex; gap: 8px; }
.eyebrow { margin: 0; font-size: 12px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--accent-hi); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card-head { margin-bottom: 14px; }
.card-head h3 { margin: 0 0 2px; font-size: 17px; }
.card-head p { margin: 0; }
.grid-2 { display: grid; gap: 16px; }

.kpi-hero {
  position: relative; overflow: hidden; padding: 28px 22px;
  background: radial-gradient(700px 260px at 0% 0%, rgba(76,125,255,.22), transparent 60%), var(--surface);
  border-color: var(--accent-line);
  display: grid; gap: 22px;
}
.kpi-label { margin: 0; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.kpi-big {
  margin: 6px 0 6px; display: flex; flex-wrap: wrap; align-items: baseline; column-gap: .25em;
  font-size: clamp(34px, 6.6vw, 62px); font-weight: 750; line-height: 1.02; letter-spacing: -.04em;
  font-variant-numeric: tabular-nums; color: #fff;
}
.kpi-big .dash { color: var(--ink-3); font-weight: 500; }
.kpi-foot { margin: 0; font-size: 14px; color: var(--ink-2); }
.kpi-hero-side { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.mini { background: rgba(255,255,255,.03); border: 1px solid var(--line); border-radius: 12px; padding: 12px; min-width: 0; }
.mini-l { margin: 0; font-size: 12px; color: var(--ink-3); line-height: 1.3; }
.mini-v { margin: 4px 0 0; font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }

.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 16px; min-width: 0; }
.kpi-top { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: 12.5px; line-height: 1.3; }
.kpi-top .ico { width: 16px; height: 16px; flex: none; color: var(--accent-hi); }
.kpi-v { margin: 8px 0 2px; font-size: clamp(20px, 3vw, 26px); font-weight: 750; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi-s { margin: 0; font-size: 12.5px; color: var(--ink-3); }

.map-wrap { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: radial-gradient(circle at 50% 50%, #0f1730, #080c17 75%); aspect-ratio: 1.12; margin-bottom: 14px; }

.tbl { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tbl th { text-align: left; font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; padding: 8px 0; border-bottom: 1px solid var(--line-2); }
.tbl td { padding: 10px 0; border-bottom: 1px solid var(--line); }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .num { text-align: right; }
.tbl td.num { font-weight: 600; }
.tbl th + th, .tbl td + td { padding-left: 12px; }
.tbl tr.tot td { font-weight: 700; color: #fff; }
.tbl-compact td { padding: 7px 0; }

.card:has(> .funnel) { display: flex; flex-direction: column; }
.funnel { list-style: none; margin: auto 0; padding: 0; display: grid; gap: 8px; }
.funnel li { position: relative; }
.funnel-bar {
  position: relative; margin: 0 auto; border-radius: 10px; padding: 12px 14px;
  background: linear-gradient(90deg, rgba(76,125,255,.16), rgba(76,125,255,.3));
  border: 1px solid var(--accent-line);
  display: flex; justify-content: space-between; align-items: baseline; gap: 10px;
  transform-origin: center; animation: allarga .7s var(--ease) both; animation-delay: calc(var(--i) * 90ms);
}
@keyframes allarga { from { transform: scaleX(.6); opacity: 0; } }
.funnel li:last-child .funnel-bar { background: linear-gradient(90deg, var(--accent-lo), var(--accent)); border-color: var(--accent-hi); }
.funnel-l { font-size: 13px; color: var(--ink-2); line-height: 1.25; }
.funnel li:last-child .funnel-l { color: #dfe7ff; }
.funnel-v { font-weight: 750; font-size: 17px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.funnel-v small { font-weight: 500; font-size: 12px; color: var(--ink-3); margin-left: 4px; }
.funnel li:last-child .funnel-v small { color: #c9d6ff; }
.funnel-x { text-align: center; font-size: 11.5px; color: var(--ink-3); margin: 2px 0 0; }

.chart { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.ch-grid { stroke: var(--line); stroke-width: 1; }
.ch-axis { fill: var(--ink-3); font-size: 11px; font-variant-numeric: tabular-nums; }
.ch-bar { fill: var(--accent); opacity: .75; transition: opacity .2s; transform-box: fill-box; transform-origin: bottom; animation: sale .7s var(--ease) both; animation-delay: calc(var(--i) * 45ms); }
.ch-bar-peak { opacity: 1; fill: var(--accent-hi); }
.ch-bar.dim { opacity: .3; }
@keyframes sale { from { transform: scaleY(0); } }
.ch-peak { fill: var(--ink); font-size: 12px; font-weight: 700; }
.ch-hit { fill: transparent; cursor: pointer; }
.ch-tip {
  position: absolute; transform: translate(-50%, -100%); pointer-events: none; z-index: 2;
  background: var(--surface-3); border: 1px solid var(--line-2); border-radius: 10px; padding: 8px 12px;
  display: grid; font-size: 13px; white-space: nowrap; box-shadow: 0 10px 30px rgba(0,0,0,.5);
}
.ch-tip span { font-weight: 700; font-variant-numeric: tabular-nums; }
.ch-tip em { font-style: normal; font-size: 11.5px; color: var(--ink-3); }

.sim .seg { margin-bottom: 4px; }
.sim .field-label strong { color: var(--ink); text-transform: none; letter-spacing: 0; font-size: 14px; }
.sim .range { margin-top: 4px; }

.cta-band {
  text-align: center; padding: 36px 20px; border-radius: 20px; margin: 8px 0;
  background: radial-gradient(500px 200px at 50% 0%, rgba(76,125,255,.3), transparent 70%), var(--surface);
  border: 1px solid var(--accent-line);
}
.claim { font-size: clamp(20px, 3vw, 26px); font-weight: 700; letter-spacing: -.02em; margin: 0 auto 20px; max-width: 26ch; text-wrap: balance; }
.cta-band .btn-xl { max-width: 440px; }
.cta-band .muted { margin: 12px 0 0; }

/* ---------- Perché ---------- */
.why { padding: 40px 0 8px; }
.why h2 { font-size: clamp(26px, 4.2vw, 40px); line-height: 1.1; margin: 8px 0 14px; max-width: 22ch; }
.lead-text { font-size: 18px; color: var(--ink-2); max-width: 62ch; margin: 0 0 28px; text-wrap: pretty; }
.lead-text strong { color: var(--ink); }
.why-grid { display: grid; gap: 12px; }
.why-item { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; }
.why-item h3 { font-size: 18px; margin: 14px 0 8px; }
.why-item p { margin: 0; color: var(--ink-2); font-size: 15px; }
.why-item p strong { color: var(--ink); }
.why-ico { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent-hi); border: 1px solid var(--accent-line); }
.why-ico .ico { width: 20px; height: 20px; }
.sec-title { font-size: 22px; margin: 40px 0 14px; }

.f3 { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.f3-card { position: relative; background: linear-gradient(180deg, var(--surface-2), var(--surface)); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; display: flex; flex-direction: column; overflow: hidden; }
.f3-card::after { content: "F"; position: absolute; right: -6px; bottom: -36px; font-size: 140px; font-weight: 800; color: rgba(76,125,255,.07); line-height: 1; }
.f3-n { font-family: var(--mono); font-size: 13px; color: var(--accent-hi); margin-bottom: 10px; }
.f3-card strong { font-size: 22px; letter-spacing: -.02em; }
.f3-one { color: var(--ink); font-weight: 550; margin: 2px 0 10px; }
.f3-card p { margin: 0; color: var(--ink-2); font-size: 15px; position: relative; }

.timeline { list-style: none; padding: 0; margin: 0; display: grid; gap: 0; }
.timeline li { display: grid; grid-template-columns: 36px 1fr; gap: 14px; position: relative; padding-bottom: 20px; }
.timeline li:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 36px; bottom: 0; width: 2px; background: var(--line-2); }
.tl-n { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 14px; background: var(--surface-2); border: 1px solid var(--accent-line); color: var(--accent-hi); }
.timeline strong { display: block; margin-top: 6px; }
.timeline p { margin: 2px 0 0; color: var(--ink-2); font-size: 15px; }

/* ---------- Finale ---------- */
.final { margin-top: 12px; }
.final-cta { display: flex; flex-direction: column; justify-content: center; background: radial-gradient(500px 240px at 0% 100%, rgba(76,125,255,.2), transparent 70%), var(--surface); border-color: var(--accent-line); }
.final-t { font-size: clamp(22px, 3vw, 28px); line-height: 1.2; margin: 8px 0 10px; }
.final-t span { color: var(--accent-hi); white-space: nowrap; }
.final-cta .btn-xl { margin-top: 16px; }
.lead h3 { margin: 0 0 4px; font-size: 19px; }
.lead > .muted { margin: 0 0 16px; font-size: 15px; }
.grid-fields { display: grid; gap: 12px; }
.grid-fields label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--ink-2); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 13.5px; color: var(--ink-2); margin: 16px 0; cursor: pointer; }
.check input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }
.lead-ok { font-weight: 600; background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 12px; padding: 14px; margin: 0; }

.method { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 20px; margin-top: 8px; }
.method summary { cursor: pointer; padding: 18px 0; font-weight: 650; list-style-position: inside; }
.method-body { padding-bottom: 18px; color: var(--ink-2); font-size: 14.5px; }
.method-body ol { padding-left: 20px; margin: 0 0 12px; }
.method-body li { margin-bottom: 6px; }
.method-body code { font-family: var(--mono); font-size: 13px; color: var(--ink); background: var(--surface-2); padding: 1px 6px; border-radius: 6px; }

.disclaimer { font-size: 13px; color: var(--ink-3); text-align: center; margin: 8px 0 0; }

.foot { border-top: 1px solid var(--line); padding: 28px 0 36px; margin-top: 24px; }
.foot-in { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--ink-3); }
.foot-in p { margin: 0; }

/* ---------- Breakpoint ---------- */
@media (min-width: 560px) {
  .sector-grid { grid-template-columns: repeat(3, 1fr); }
  .seg-4 { grid-template-columns: repeat(4, 1fr); }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .grid-fields { grid-template-columns: 1fr 1fr; }
}
@media (min-width: 900px) {
  .hero { padding: 72px 0 44px; }
  .frame-body { grid-template-columns: minmax(0, 1.45fr) minmax(320px, 1fr); }
  .wizard { padding: 32px; min-height: 640px; }
  .live { border-top: 0; border-left: 1px solid var(--line); padding: 24px; }
  .sector-grid { grid-template-columns: repeat(3, 1fr); max-height: 470px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .kpi-hero { grid-template-columns: 1.8fr 1fr; align-items: center; padding: 36px; }
  .kpi-hero-side { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .card { padding: 24px; }
  .why-grid { grid-template-columns: repeat(2, 1fr); }
  .f3 { grid-template-columns: repeat(3, 1fr); }
  .timeline { grid-template-columns: repeat(5, 1fr); gap: 16px; }
  .timeline li { grid-template-columns: 1fr; gap: 10px; padding: 0; }
  .timeline li:not(:last-child)::before { left: 44px; right: -16px; top: 17px; bottom: auto; width: auto; height: 2px; }
}
@media (max-width: 380px) {
  .live-stats dd { font-size: 16px; }
  .kpi-hero-side { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}

/* ---------- Stampa / PDF ---------- */
@media print {
  :root { --bg: #fff; --surface: #fff; --surface-2: #f4f6fa; --surface-3: #eef1f7; --ink: #0f172a; --ink-2: #475569; --ink-3: #64748b; --line: #e2e8f0; --line-2: #cbd5e1; }
  body { background: #fff; color: var(--ink); }
  .topbar, .hero, .app, .overlay, .report-actions, .sim, .cta-band, .final, .method, .js-call { display: none !important; }
  .card, .kpi, .why-item, .f3-card { break-inside: avoid; box-shadow: none; }
  .kpi-big, .tbl tr.tot td, .funnel-v { color: var(--ink) !important; }
  .kpi-hero, .cta-band { background: #fff; }
  .map-wrap { background: #f8fafc; }
  .logo-schermo { display: none !important; }
  .logo-stampa { display: block !important; }
  .grid-2 { grid-template-columns: 1fr 1fr; }
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
}

/* =====================================================================
   MOBILE — ottimizzazioni per telefono (sotto i 900px)
   ===================================================================== */
button, a, input, select, label { touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.mobile-cta { display: none; }

@media (max-width: 899px) {
  /* hero più compatto: il calcolatore entra prima nello schermo */
  .hero { padding: 26px 0 18px; }
  .badge { margin-bottom: 14px; font-size: 12px; }
  h1 { font-size: clamp(30px, 8.8vw, 44px); margin-bottom: 12px; }
  .sub { font-size: 16.5px; }
  .hero-meta { margin-top: 18px; gap: 6px 16px; font-size: 13px; }
  .app { padding-bottom: 32px; }

  /* passi: pulsanti Avanti/Indietro sempre a portata di pollice */
  .wizard { padding: 22px 16px 0; }
  .nav {
    position: sticky; bottom: 0; z-index: 5;
    margin: 20px -16px 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
    background: rgba(13, 19, 34, .92);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .nav .btn { min-height: 52px; }
  .step legend { font-size: 22px; }
  .step-desc { font-size: 14.5px; margin-bottom: 16px; }

  /* card settori più compatte */
  .sector { min-height: 54px; padding: 10px; gap: 9px; font-size: 13.5px; }
  .sector .ico { width: 20px; height: 20px; }

  /* pannello live: nascosto finché non c'è un comune, mappa più bassa */
  .frame[data-step="1"] .live { display: none; }
  .frame:not([data-comune]) .live { display: none; }
  .live { padding: 16px; }
  .live-map { aspect-ratio: 1.55; }

  /* report */
  .result { padding-top: 20px; gap: 12px; }
  .report-head { gap: 12px; }
  .report-actions { width: 100%; }
  .report-actions .btn { flex: 1; }
  .kpi-hero { padding: 22px 18px; gap: 16px; }
  .kpi-hero-side { grid-template-columns: 1fr; gap: 6px; }
  .mini { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; padding: 10px 12px; }
  .mini-v { margin: 0; font-size: 16px; text-align: right; white-space: nowrap; }
  .kpi { padding: 13px; }
  .kpi-v { font-size: 18px; }
  .card { padding: 18px 16px; }
  .funnel-bar { width: calc(52% + var(--w, 100) * .48%) !important; padding: 11px 12px; }
  .funnel-v { font-size: 16px; }
  .cta-band { padding: 28px 18px; }
  .why { padding-top: 28px; }
  .lead-text { font-size: 16.5px; }
  .why-item { padding: 18px; }
  .sec-title { margin-top: 32px; }

  /* barra fissa "Prenota la call" mentre si legge il report */
  .mobile-cta {
    display: block; position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom));
    background: rgba(7, 11, 20, .9);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--line-2);
    transform: translateY(110%); transition: transform .3s var(--ease);
  }
  .mobile-cta.visibile { transform: none; }
  .mobile-cta .btn { width: 100%; min-height: 50px; }
  body.con-cta-mobile .foot { padding-bottom: 96px; }
}

@media (max-width: 380px) {
  .sector { font-size: 13px; }
  .seg-5 button { font-size: 14px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
}

/* dita invece del mouse: cursori dei selettori più grandi */
@media (pointer: coarse) {
  .range::-webkit-slider-thumb { width: 28px; height: 28px; margin-top: -12px; }
  .range::-moz-range-thumb { width: 22px; height: 22px; }
  .range { height: 36px; }
}

@media print { .mobile-cta { display: none !important; } }

.chart.statico .ch-bar { animation: none; }
