
@font-face { font-family: "IBM Plex Sans"; font-style: normal; font-weight: 400 600; font-display: swap; src: url(/fonts/plex-sans.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 400; font-display: swap; src: url(/fonts/plex-mono-400.woff2) format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-style: normal; font-weight: 500; font-display: swap; src: url(/fonts/plex-mono-500.woff2) format("woff2"); }
/* Layout: due colonne, a sinistra RAL, contratto e comune, a destra un cedolino con le voci; sotto la tabella di confronto per fasce di RAL */
:root {
  --bg: #f3f5f8;
  --surface: #ffffff;
  --fg: #16202e;
  --muted: #5d6879;
  --line: #dde2ea;
  --accent: #2448c7;
  --accent-soft: #e6ebfb;
  --net: #12805c;
  --irpef: #c2551f;
  --inps: #6b5bd6;
  --addiz: #c49a12;
  --font-display: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-body: "IBM Plex Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f141c; --surface: #171e29; --fg: #e7ecf3; --muted: #97a2b4; --line: #2a3442;
    --accent: #7d9bff; --accent-soft: #1d2843; --net: #3cc58f; --irpef: #ee8a55; --inps: #a597ff; --addiz: #e2be45;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f141c; --surface: #171e29; --fg: #e7ecf3; --muted: #97a2b4; --line: #2a3442;
  --accent: #7d9bff; --accent-soft: #1d2843; --net: #3cc58f; --irpef: #ee8a55; --inps: #a597ff; --addiz: #e2be45;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  background: var(--bg); color: var(--fg);
  font: 15px/1.55 var(--font-body);
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 32px 48px;
}
.wrap { max-width: 1080px; margin: 0 auto; display: flex; flex-direction: column; gap: 28px; }
header h1 {
  font-family: var(--font-display); font-weight: 600; font-size: clamp(28px, 4.5vw, 42px);
  line-height: 1.1; margin: 0 0 8px; text-wrap: balance; letter-spacing: -0.02em;
}
header p { margin: 0; color: var(--muted); max-width: 62ch; }
.eyebrow { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent); font-weight: 600; margin-bottom: 6px; }

.grid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 24px; align-items: start; }
@media (max-width: 820px) { .grid { grid-template-columns: minmax(0, 1fr); } }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 22px; min-width: 0; }
.panel h2 { font-family: var(--font-display); font-weight: 500; font-size: 19px; margin: 0 0 16px; }

form { display: flex; flex-direction: column; gap: 16px; }
fieldset { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
fieldset + fieldset { border-top: 1px solid var(--line); padding-top: 18px; }
legend { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); font-weight: 600; padding: 0; margin-bottom: 14px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field label, .field .lbl { font-weight: 500; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--muted); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 400px) { .row2 { grid-template-columns: 1fr; } }
input, select {
  font: 500 16px var(--font-mono); color: var(--fg); background: var(--bg);
  border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; width: 100%;
}
select, input[type="search"] { font-family: var(--font-body); font-size: 16px; }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ral-row { display: flex; gap: 8px; align-items: stretch; }
.ral-row .ral-input { flex: 1; min-width: 0; }
.step {
  flex: none; width: 52px; font: 500 24px var(--font-mono); color: var(--accent); background: var(--accent-soft);
  border: 0; border-radius: 6px; cursor: pointer; touch-action: manipulation; transition: transform .1s ease;
}
.step:active { transform: scale(0.94); }
input[type="range"] {
  -webkit-appearance: none; appearance: none; width: 100%; height: 32px; margin: 2px 0 0; padding: 0;
  background: transparent; border: 0; cursor: pointer; touch-action: pan-y;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%));
}
input[type="range"]::-moz-range-track {
  height: 6px; border-radius: 3px; background: linear-gradient(to right, var(--accent) var(--p, 0%), var(--line) var(--p, 0%));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 28px; height: 28px; margin-top: -11px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); box-shadow: 0 2px 6px rgb(0 0 0 / 0.2);
}
.range-scale { display: flex; justify-content: space-between; font: 12px var(--font-mono); color: var(--muted); }
@keyframes flash { from { background: var(--accent-soft); } to { background: transparent; } }
.flash { animation: flash .9s ease-out; border-radius: 4px; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 44px; font-weight: 500; font-size: 14px; cursor: pointer; }
.switch input { flex: none; width: 22px; height: 22px; margin: 0; padding: 0; accent-color: var(--accent); cursor: pointer; }
.cnt { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.cnt .lbl { font-weight: 500; font-size: 14px; }
.stepper { flex: none; display: flex; align-items: center; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.stepper button {
  width: 44px; height: 44px; border: 0; background: var(--accent-soft); color: var(--accent);
  font: 500 20px var(--font-mono); cursor: pointer; touch-action: manipulation;
}
.stepper button:disabled { opacity: 0.35; cursor: default; }
.stepper output { min-width: 38px; text-align: center; font: 500 17px var(--font-mono); }
.avviso { font-size: 13px; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; margin: 14px 0 0; }
.ral-input { position: relative; }
.ral-input input { font-size: 24px; padding: 12px 14px 12px 34px; }
.ral-input span { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font: 500 20px var(--font-mono); color: var(--muted); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button {
  flex: 1; font: 500 14px var(--font-body); color: var(--fg); background: var(--bg);
  border: 0; padding: 10px 8px; min-height: 44px; cursor: pointer; touch-action: manipulation;
}
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--surface); }

.combo { position: relative; }
.combo ul {
  position: absolute; z-index: 5; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px;
  list-style: none; background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 8px 24px rgb(0 0 0 / 0.12); max-height: 280px; overflow-y: auto;
}
.combo li { padding: 11px 12px; border-radius: 5px; cursor: pointer; display: flex; justify-content: space-between; gap: 12px; }
.combo li span { color: var(--muted); font-size: 13px; white-space: nowrap; }
.combo li[aria-selected="true"], .combo li:hover { background: var(--accent-soft); }
.combo li.empty { color: var(--muted); cursor: default; background: none; }

.rates { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; font-size: 13px; display: flex; flex-direction: column; gap: 10px; }
.rates h3 { margin: 0 0 4px; font-size: 13px; font-weight: 600; display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.rates h3 small { font-weight: 400; color: var(--muted); }
.rates ol { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 2px; }
.rates li { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); }
.rates li b { font: 500 13px var(--font-mono); color: var(--fg); font-variant-numeric: tabular-nums; }
.rates .extra { color: var(--muted); margin: 4px 0 0; }
.rates .field label { font-size: 13px; }
.rates b.man { color: var(--accent); }
.link {
  align-self: flex-start; background: none; border: 0; padding: 6px 0; min-height: 32px; cursor: pointer;
  font: 500 13.5px var(--font-body); color: var(--accent); text-decoration: underline; text-underline-offset: 3px;
}

.headline { display: flex; flex-wrap: wrap; gap: 12px 32px; align-items: flex-end; padding-bottom: 18px; border-bottom: 1px dashed var(--line); }
.big { font: 500 clamp(34px, 6vw, 48px)/1 var(--font-mono); color: var(--net); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.big-label { font-size: 13px; color: var(--muted); margin-top: 6px; }
.sub { font: 500 20px var(--font-mono); font-variant-numeric: tabular-nums; }
.context { font-size: 13px; color: var(--muted); margin-top: 12px; }

.bar { display: flex; height: 14px; border-radius: 4px; overflow: hidden; margin: 18px 0 10px; background: var(--line); }
.bar div { transition: width .45s cubic-bezier(.2, .8, .2, 1); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; font-size: 13px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 6px; vertical-align: -1px; }

.voci { width: 100%; border-collapse: collapse; margin-top: 18px; font-size: 14px; }
.voci td { padding: 8px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
.voci td:last-child { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; padding-left: 12px; }
.voci .note { display: block; font-size: 12px; color: var(--muted); }
.voci .neg { color: var(--irpef); }
.voci .pos { color: var(--net); }
.voci tr.tot td { font-weight: 600; border-bottom: 0; border-top: 2px solid var(--fg); padding-top: 10px; }
.voci tr.sect td { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); padding-top: 16px; border-bottom: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip { font-size: 12.5px; background: var(--accent-soft); color: var(--accent); padding: 4px 10px; border-radius: 999px; font-weight: 500; }
.chip b { font-family: var(--font-mono); font-weight: 500; }

.table-wrap { overflow-x: auto; }
table.cmp { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 560px; }
.cmp th { text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.cmp th:first-child, .cmp td:first-child { text-align: left; }
.cmp td { text-align: right; padding: 9px 10px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.cmp tr.current td { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.cmp td.n { color: var(--net); }

.fine { font-size: 13px; color: var(--muted); max-width: 80ch; display: flex; flex-direction: column; gap: 6px; }
.fine p { margin: 0; }

/* Barra fissa col netto mensile: su schermi stretti i risultati stanno sotto il modulo */
.sticky {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; display: none;
  align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px max(16px, env(safe-area-inset-right, 0px)) calc(10px + env(safe-area-inset-bottom, 0px)) max(16px, env(safe-area-inset-left, 0px));
  background: var(--surface); border-top: 1px solid var(--line); box-shadow: 0 -6px 20px rgb(0 0 0 / 0.08);
  transition: transform .2s ease;
}
.sticky.off { transform: translateY(110%); }
.sticky .lbl { font-size: 12px; color: var(--muted); display: block; }
.sticky .val { font: 500 22px/1.1 var(--font-mono); color: var(--net); font-variant-numeric: tabular-nums; }
.sticky button {
  font: 600 14px var(--font-body); color: var(--surface); background: var(--accent);
  border: 0; border-radius: 6px; padding: 0 16px; min-height: 44px; cursor: pointer; white-space: nowrap; touch-action: manipulation;
}
@media (max-width: 820px) {
  .sticky { display: flex; }
  body { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
@media (max-width: 600px) {
  body { padding-block: 18px calc(96px + env(safe-area-inset-bottom, 0px)); font-size: 14.5px; }
  .wrap, .grid { gap: 16px; }
  header p { font-size: 14px; }
  .panel { padding: 16px; border-radius: 8px; }
  .panel h2 { margin-bottom: 12px; }
  .headline { gap: 10px 24px; }
  .voci { font-size: 13.5px; }
  .combo ul { max-height: 40vh; }
  table.cmp { min-width: 0; font-size: 13.5px; }
  .cmp th, .cmp td { padding: 9px 6px; }
  .cmp td:first-child { white-space: nowrap; }
  .cmp th:nth-child(2), .cmp td:nth-child(2), .cmp th:nth-child(3), .cmp td:nth-child(3), .cmp th:nth-child(4), .cmp td:nth-child(4) { display: none; }
}
/* Guida sotto il calcolatore */
.guida { font-size: 15.5px; line-height: 1.65; }
.guida > * { max-width: 760px; }
.guida h2 { font-size: clamp(22px, 3.5vw, 28px); font-weight: 600; letter-spacing: -0.01em; margin-bottom: 4px; }
.guida h3 { font-size: 19px; font-weight: 600; margin: 34px 0 10px; scroll-margin-top: 16px; line-height: 1.3; }
.guida p { margin: 0 0 12px; }
.guida ul, .guida ol { margin: 0 0 12px; padding-left: 22px; }
.guida li { margin-bottom: 6px; }
.guida a { color: var(--accent); text-underline-offset: 3px; }
.guida .agg { font-size: 13px; color: var(--muted); }
.toc { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 14px 16px; margin: 16px 0 8px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2 240px; column-gap: 24px; font-size: 14.5px; }
.toc li { margin-bottom: 4px; break-inside: avoid; }
.passi li::marker { font-weight: 600; color: var(--accent); }
table.tab { width: 100%; border-collapse: collapse; font-size: 14px; margin: 4px 0 14px; }
.tab th { text-align: right; font-weight: 500; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: bottom; }
.tab td { text-align: right; padding: 8px 8px; border-bottom: 1px solid var(--line); font-family: var(--font-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tab th:first-child, .tab td:first-child { text-align: left; }
.tab td.t { font-family: var(--font-body); white-space: normal; text-align: left; vertical-align: top; }
.tab .nw { white-space: nowrap; }
.tab .nota { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.tab th { white-space: normal; }
.tab tr.tot td { font-weight: 600; border-top: 2px solid var(--fg); }
.tab td a { color: inherit; text-decoration: none; }
.tab td a:hover { color: var(--accent); text-decoration: underline; }
.faq details { border-bottom: 1px solid var(--line); }
.faq summary { cursor: pointer; padding: 14px 28px 14px 0; font-weight: 500; position: relative; list-style: none; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 4px; top: 12px; font: 400 20px var(--font-mono); color: var(--accent); }
.faq details[open] summary::after { content: "−"; }
.faq details > div { padding: 0 0 6px; color: var(--fg); }
.fine a { color: inherit; }
#calcolatore { scroll-margin-top: 12px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
@media (max-width: 600px) {
  .guida { font-size: 15px; }
  .tab th, .tab td { padding: 8px 5px; font-size: 13px; }
}
@media (prefers-reduced-motion: reduce) { .bar div, .sticky, .step { transition: none; } .flash { animation: none; } }

/* Barra del sito: marchio e collegamenti principali, uguale su tutte le pagine */
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.brand { font: 600 16px var(--font-display); color: var(--fg); text-decoration: none; letter-spacing: -0.01em; display: inline-flex; align-items: center; gap: 8px; }
.brand::before { content: ""; width: 10px; height: 10px; border-radius: 3px; background: var(--net); }
.top nav { display: flex; gap: 6px 18px; flex-wrap: wrap; font-size: 14px; }
.top nav a { color: var(--muted); text-decoration: none; padding: 6px 0; }
.top nav a:hover, .top nav a[aria-current="page"] { color: var(--accent); }
.crumb { font-size: 13px; color: var(--muted); margin: 0 0 10px; }
.crumb a { color: var(--muted); text-underline-offset: 3px; }
header .lead { font-size: 16px; color: var(--fg); max-width: 68ch; }
header .lead strong { color: var(--net); font-family: var(--font-mono); font-weight: 500; white-space: nowrap; }

/* Manovra 2027 nel cedolino */
.anno27 { margin-top: 20px; padding-top: 16px; border-top: 1px dashed var(--line); }
.anno27 h3 { margin: 0 0 10px; font: 600 14px var(--font-body); display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.anno27 h3 small { font-weight: 500; font-size: 11.5px; color: var(--accent); background: var(--accent-soft); padding: 2px 8px; border-radius: 999px; }
.anno27 .row27 { display: flex; flex-wrap: wrap; gap: 10px 32px; align-items: flex-end; }
#o27-diff { color: var(--net); }
#o27-diff.zero { color: var(--muted); }
.anno27 .context { margin-top: 10px; color: var(--fg); }
.anno27 .fonte27 { font-size: 12px; color: var(--muted); margin: 6px 0 0; }
.aum-input input { font-size: 18px; padding: 10px 12px 10px 32px; }
.aum-input span { font-size: 17px; }
.u30-tag { font-size: 11px; font-weight: 600; color: var(--surface); background: var(--net); padding: 2px 7px; border-radius: 999px; margin-left: 6px; vertical-align: 2px; }

/* Griglia di collegamenti alle pagine RAL */
.ral-grid { list-style: none; padding: 0 !important; margin: 8px 0 14px; display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; max-width: none !important; }
.ral-grid li { margin: 0; }
.ral-grid a { display: block; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--fg); text-decoration: none; font: 500 14px var(--font-mono); font-variant-numeric: tabular-nums; transition: border-color .15s ease, color .15s ease; }
.ral-grid a:hover, .ral-grid a:focus-visible { border-color: var(--accent); color: var(--accent); }
.ral-grid a[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: var(--surface); }
.ral-grid small { display: block; font: 12px var(--font-body); color: var(--muted); margin-top: 2px; }
.ral-grid a[aria-current="page"] small { color: var(--surface); opacity: .85; }
.risposta { background: var(--accent-soft); border-radius: 8px; padding: 14px 16px; margin: 6px 0 16px; }
.risposta p { margin: 0; }
.guida h4 { font-size: 16px; font-weight: 600; margin: 22px 0 8px; }
@media (prefers-reduced-motion: reduce) { .ral-grid a { transition: none; } }
@media (max-width: 600px) {
  .cmp th:nth-child(5), .cmp td:nth-child(5) { display: none; }
}
.voci tr.sect td { text-align: left; }
