/* =========================================================
   Stili dei calcolatori stipendio netto e pensione.
   Stessi token, card, campi e hero del calcolatore mutuo:
   un solo file condiviso (e in cache) tra le due pagine.
   ========================================================= */
:root {
  --indigo: #4f46e5;
  --indigo-bright: #5b6cf5;
  --indigo-deep: #4133b7;
  --bg: #f3f4fb;
  --card: #ffffff;
  --ink: #131829;
  --ink-2: #6b7280;
  --ink-3: #9ca3af;
  --field: #f4f5f9;
  --line: #eef0f5;
  --green: #10b981;
  --green-bg: #f0fdf6;
  --green-ink: #059669;
  --teal: #14b8a6;
  --amber: #f59e0b;
  --rose: #e11d48;
  --radius-card: 24px;
  --radius-field: 15px;
  --shadow-card: 0 18px 40px -22px rgba(40, 44, 96, 0.30);
  --shadow-soft: 0 6px 18px -10px rgba(40, 44, 96, 0.22);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
a { color: var(--indigo); }

/* ---------- HERO ---------- */
.hero {
  position: relative;
  background:
    radial-gradient(120% 90% at 85% 8%, rgba(124, 152, 255, 0.55) 0%, rgba(124, 152, 255, 0) 55%),
    radial-gradient(120% 120% at 10% 100%, rgba(58, 40, 165, 0.55) 0%, rgba(58, 40, 165, 0) 60%),
    linear-gradient(155deg, #5468f3 0%, #4f46e5 48%, #4133b7 100%);
  color: #fff;
  padding: 18px 20px 84px;
  border-radius: 0 0 34px 34px;
  overflow: hidden;
  text-align: center;
}
.hero-top {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.back-btn, .menu-btn {
  width: 44px; height: 44px;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(255,255,255,0.16);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 13px;
  color: #fff; text-decoration: none; cursor: pointer;
  transition: background .2s ease;
}
.back-btn:hover, .menu-btn:hover { background: rgba(255,255,255,0.28); }
.menu-btn { flex-direction: column; gap: 5px; }
.menu-btn span { display: block; width: 18px; height: 2px; border-radius: 2px; background: #fff; }
.hero h1 {
  position: relative; z-index: 2;
  font-size: 27px; font-weight: 800; letter-spacing: -0.6px; line-height: 1.15;
}
.hero h1 span { display: block; font-weight: 500; opacity: 0.92; font-size: 0.72em; margin-top: 4px; }
.hero p {
  position: relative; z-index: 2;
  margin: 12px auto 0; max-width: 36ch;
  font-size: 14.5px; color: rgba(255,255,255,0.86); line-height: 1.55;
}

/* ---------- MENU (overlay condiviso) ---------- */
.nav-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: rgba(19,24,41,0.45);
  backdrop-filter: blur(3px);
  opacity: 0; visibility: hidden;
  transition: opacity .22s ease, visibility .22s ease;
}
.nav-overlay.open { opacity: 1; visibility: visible; }
.nav-panel {
  position: absolute; top: 16px; right: 16px;
  width: min(290px, calc(100vw - 32px));
  background: #fff; border-radius: 22px;
  box-shadow: 0 30px 60px -20px rgba(19,24,41,0.5);
  padding: 12px;
  transform: translateY(-12px) scale(0.97);
  opacity: 0; transition: transform .24s ease, opacity .24s ease;
}
.nav-overlay.open .nav-panel { transform: translateY(0) scale(1); opacity: 1; }
.nav-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 10px 12px; }
.nav-title { font-weight: 800; font-size: 15px; letter-spacing: -0.3px; color: var(--ink); }
.nav-overlay .nav-close {
  width: 44px; height: 44px; border-radius: 10px;
  border: 1px solid var(--line); background: #fff; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2);
}
.nav-link {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 12px; border-radius: 13px;
  text-decoration: none; color: var(--ink); font-weight: 600; font-size: 15px;
}
.nav-link:hover { background: var(--bg); }
.nav-link .ni { color: var(--indigo); display: inline-flex; flex-shrink: 0; }

/* ---------- LAYOUT ---------- */
.wrap {
  max-width: 560px;
  margin: -60px auto 0;
  padding: 0 14px 40px;
  position: relative; z-index: 3;
}
.stack { display: flex; flex-direction: column; gap: 16px; }

.card {
  background: var(--card);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.card-body { padding: 20px 18px; display: flex; flex-direction: column; gap: 18px; }
.card h2, .section-title {
  font-size: 20px; font-weight: 800; letter-spacing: -0.4px; line-height: 1.25;
}
.card p { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }

/* ---------- CAMPI ---------- */
.lbl {
  display: block;
  font-size: 15px; font-weight: 600; color: var(--ink);
  margin-bottom: 9px;
}
.field, .select {
  position: relative;
  display: flex; align-items: center; gap: 10px;
  background: var(--field);
  border: 1.5px solid transparent;
  border-radius: var(--radius-field);
  padding: 0 14px;
  min-height: 56px;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}
.field:focus-within, .select:focus-within {
  border-color: var(--indigo); background: #fff;
  box-shadow: 0 0 0 4px rgba(79,70,229,0.10);
}
.field input {
  flex: 1; min-width: 0; width: 100%;
  border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: 21px; font-weight: 700; color: var(--ink);
  letter-spacing: -0.3px; min-height: 52px;
  -moz-appearance: textfield; appearance: textfield;
}
.field input::-webkit-outer-spin-button,
.field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.field .unit { color: var(--ink-2); font-weight: 600; font-size: 16px; white-space: nowrap; }
.field.sm input { font-size: 18px; }
.select select {
  flex: 1; min-width: 0; width: 100%;
  border: 0; background: transparent; outline: none;
  font-family: inherit; font-size: 16px; font-weight: 600; color: var(--ink);
  appearance: none; -webkit-appearance: none;
  padding-right: 24px; min-height: 52px; cursor: pointer;
}
.select .caret {
  position: absolute; right: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ink-3); pointer-events: none; display: inline-flex;
}
.field-note { font-size: 13px; color: var(--ink-2); font-weight: 500; margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row2 > * { min-width: 0; }

/* Segmented control (mensilità, contratto) */
.seg { display: flex; gap: 6px; background: var(--field); border-radius: var(--radius-field); padding: 5px; }
.seg label { flex: 1; position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; cursor: pointer; margin: 0; }
.seg span {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 46px; padding: 4px 6px; border-radius: 11px;
  font-size: 15px; font-weight: 700; color: var(--ink-2);
  transition: background .15s ease, color .15s ease, box-shadow .15s ease;
}
.seg input:checked + span { background: #fff; color: var(--indigo); box-shadow: var(--shadow-soft); }
.seg input:focus-visible + span { outline: 2px solid var(--indigo); outline-offset: 1px; }

/* Checkbox grande */
.check {
  display: flex; align-items: flex-start; gap: 12px;
  min-height: 44px; padding: 10px 0; cursor: pointer;
  font-size: 15px; font-weight: 600; color: var(--ink);
}
.check input { width: 24px; height: 24px; flex-shrink: 0; accent-color: var(--indigo); margin-top: 0; cursor: pointer; }
.check.small { font-size: 13.5px; font-weight: 500; color: var(--ink-2); line-height: 1.5; }
.check.small input { width: 22px; height: 22px; }

/* Slider */
.slider-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.slider-head .lbl { margin: 0; }
.slider-val { font-size: 19px; font-weight: 800; color: var(--indigo); letter-spacing: -0.3px; white-space: nowrap; }
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 44px; background: transparent;
  outline: none; cursor: pointer; display: block;
}
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 99px; background: var(--field); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 99px; background: var(--field); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 28px; height: 28px; border-radius: 50%; margin-top: -11px;
  background: #fff; border: 3px solid var(--indigo);
  box-shadow: 0 2px 6px rgba(79,70,229,0.35);
}
input[type="range"]::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  background: #fff; border: 3px solid var(--indigo);
  box-shadow: 0 2px 6px rgba(79,70,229,0.35);
}
input[type="range"]:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 5px rgba(79,70,229,0.25); }
.range-labels { display: flex; justify-content: space-between; font-size: 13px; font-weight: 600; color: var(--ink-3); }

details.more-opts summary {
  cursor: pointer; list-style: none; min-height: 44px;
  display: flex; align-items: center; gap: 8px;
  font-size: 14.5px; font-weight: 700; color: var(--indigo);
}
details.more-opts summary::-webkit-details-marker { display: none; }
details.more-opts summary::before { content: "+"; font-size: 20px; line-height: 1; width: 18px; text-align: center; }
details.more-opts[open] summary::before { content: "−"; }
details.more-opts .opts { display: flex; flex-direction: column; gap: 16px; padding-top: 8px; }

/* ---------- RISULTATO ---------- */
.result {
  background:
    radial-gradient(120% 120% at 90% 0%, rgba(124,152,255,0.5), transparent 55%),
    linear-gradient(150deg, #5468f3, #4f46e5 55%, #4133b7);
  color: #fff;
  border-radius: var(--radius-card);
  padding: 26px 20px 22px;
  text-align: center;
  box-shadow: 0 20px 40px -18px rgba(79,70,229,0.6);
}
.result .r-label { font-size: 15px; font-weight: 600; color: rgba(255,255,255,0.88); }
.result .r-value {
  font-size: clamp(40px, 13vw, 54px); font-weight: 800; letter-spacing: -1.5px;
  margin: 8px 0 6px; line-height: 1.05; font-variant-numeric: tabular-nums;
}
.result .r-value small { font-size: 0.42em; font-weight: 700; letter-spacing: -0.3px; }
.result .r-sub { font-size: 14.5px; color: rgba(255,255,255,0.86); }
.result .r-sub b { color: #fff; }
.result .fn { color: #fff; }
.result .r-alt {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid rgba(255,255,255,0.18);
  font-size: 15px; font-weight: 600;
}
.result.warn {
  background:
    radial-gradient(120% 120% at 90% 0%, rgba(253,164,175,0.35), transparent 55%),
    linear-gradient(150deg, #4f46e5, #4133b7 60%, #2e1f8f);
}

.badge-card {
  display: flex; align-items: flex-start; gap: 12px;
  background: #fffbeb; border: 1.5px solid rgba(245,158,11,0.30);
  border-radius: 17px; padding: 14px 16px;
  font-size: 14px; color: #92400e; line-height: 1.5;
}
.badge-card .b-icon { color: #d97706; flex-shrink: 0; margin-top: 1px; }
.badge-card[hidden] { display: none; }

/* Righe di dettaglio */
.rows { display: flex; flex-direction: column; }
.drow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
  font-size: 15px;
}
.drow:last-child { border-bottom: 0; }
.drow .t { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 600; min-width: 0; }
.drow .s { display: block; font-size: 13px; color: var(--ink-2); font-weight: 500; }
.drow .v { font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.drow.total .v { color: var(--green-ink); font-size: 17px; }
.dot-key { width: 12px; height: 12px; border-radius: 4px; flex-shrink: 0; }

/* Ciambella */
.donut-wrap { display: flex; align-items: center; gap: 18px; }
.donut { width: 42%; max-width: 180px; min-width: 120px; flex-shrink: 0; }
.donut svg { width: 100%; height: auto; display: block; }
.donut-wrap .rows { flex: 1; min-width: 0; }
.donut-wrap .drow { padding: 8px 0; font-size: 14px; }

/* Barre pensione */
.bars { display: flex; flex-direction: column; gap: 14px; }
.bar-row .bar-lbl { display: flex; justify-content: space-between; gap: 10px; font-size: 14px; font-weight: 600; margin-bottom: 6px; }
.bar-row .bar-lbl b { white-space: nowrap; font-variant-numeric: tabular-nums; }
.bar-track { height: 26px; background: var(--field); border-radius: 9px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 9px; transition: width .35s ease; }

/* Pulsanti */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  width: 100%; min-height: 54px; padding: 0 20px;
  border: 0; border-radius: 16px; cursor: pointer;
  font-family: inherit; font-size: 16.5px; font-weight: 700; text-decoration: none; text-align: center;
  transition: transform .15s ease, box-shadow .15s ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: linear-gradient(135deg, var(--indigo-bright), var(--indigo) 70%);
  color: #fff; box-shadow: 0 14px 26px -12px rgba(79,70,229,0.75);
}
.btn-ghost { background: #fff; color: var(--indigo); border: 1.5px solid rgba(79,70,229,0.25); }
.btn[disabled] { opacity: .65; cursor: default; }
.share-row { display: flex; flex-direction: column; gap: 8px; align-items: stretch; }
.share-msg { font-size: 13.5px; color: var(--green-ink); font-weight: 600; text-align: center; min-height: 20px; }

/* ---------- MAIL ---------- */
.mail-card { border: 2px solid rgba(79,70,229,0.18); }
.mail-card .trap { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mail-card input[type="email"] {
  width: 100%; min-height: 54px; padding: 0 16px;
  font-family: inherit; font-size: 16px; color: var(--ink);
  background: var(--field); border: 1.5px solid transparent; border-radius: var(--radius-field); outline: none;
}
.mail-card input[type="email"]:focus { border-color: var(--indigo); background: #fff; box-shadow: 0 0 0 4px rgba(79,70,229,0.10); }
.form-error { font-size: 14px; font-weight: 600; color: var(--rose); }
.form-done {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--green-bg); border: 1.5px solid rgba(16,185,129,0.28);
  border-radius: 17px; padding: 16px; font-size: 15px; color: var(--green-ink); font-weight: 600;
}
.form-done[hidden], .form-error[hidden], form[hidden] { display: none; }

/* ---------- AFFILIATO ---------- */
.aff-card { border: 1px solid var(--line); }
.aff-label {
  align-self: flex-start;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 99px;
  background: #fef3c7; color: #92400e;
  font-size: 12.5px; font-weight: 700; letter-spacing: 0.4px; text-transform: uppercase;
}

/* ---------- ALTRI CALCOLATORI ---------- */
.calc-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
.calc-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--card); border: 1px solid var(--line); border-radius: 18px;
  padding: 16px; min-height: 72px;
  text-decoration: none; color: inherit; box-shadow: var(--shadow-soft);
}
.calc-card .ic {
  width: 46px; height: 46px; border-radius: 14px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: rgba(79,70,229,0.12); color: var(--indigo);
}
.calc-card .ic.teal { background: rgba(20,184,166,0.15); color: var(--teal); }
.calc-card .ic.amber { background: rgba(245,158,11,0.15); color: #d97706; }
.calc-card .ic.green { background: rgba(16,185,129,0.14); color: var(--green); }
.calc-card h3 { font-size: 16px; font-weight: 700; letter-spacing: -0.2px; }
.calc-card p { font-size: 13.5px; color: var(--ink-2); margin-top: 2px; line-height: 1.45; }
.calc-card .go { margin-left: auto; color: var(--indigo); flex-shrink: 0; }

/* ---------- FAQ ---------- */
.faq details { border-bottom: 1px solid var(--line); }
.faq details:last-child { border-bottom: 0; }
.faq summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  min-height: 52px; padding: 12px 0;
  font-size: 15.5px; font-weight: 700; color: var(--ink); line-height: 1.4;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-size: 24px; font-weight: 600; color: var(--indigo); flex-shrink: 0; transition: transform .2s ease; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { padding: 0 0 16px; font-size: 14.5px; color: var(--ink-2); line-height: 1.65; }

.prose h2 { margin-bottom: 4px; }
.prose h3 { font-size: 16.5px; font-weight: 800; margin-top: 6px; }
.prose p { font-size: 15px; color: var(--ink-2); line-height: 1.7; }

/* ---------- RICHIAMI E NOTE ---------- */
.fn {
  position: relative;
  display: inline-block; min-width: 0.9em; text-align: center;
  font-size: 0.78em; font-weight: 800; line-height: 1;
  vertical-align: super; text-decoration: none; color: var(--indigo);
  margin-left: 2px;
}
/* Area di tocco più grande del simbolo, senza spostare il testo. */
.fn::after { content: ""; position: absolute; inset: -12px -10px; }
.result .r-value .fn { font-size: 22px; vertical-align: top; margin-left: 4px; }
.fn:hover, .fn:focus-visible { text-decoration: underline; }
.notes ol, .sources ul { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.notes li, .sources li { font-size: 13px; color: var(--ink-2); line-height: 1.6; }
.notes li .sym { font-weight: 800; color: var(--ink); margin-right: 4px; }
.notes li:target { background: #fffbeb; border-radius: 8px; outline: 6px solid #fffbeb; }
.notes .back { font-weight: 700; white-space: nowrap; text-decoration: none; display: inline-block; padding: 2px 0; }
.sources ul { list-style: disc; padding-left: 18px; }
.sources li b { color: var(--ink); }
.sources .updated { font-size: 13px; font-weight: 700; color: var(--ink); }
.disclaimer {
  background: #fff; border: 1.5px solid rgba(225,29,72,0.25); border-radius: 18px;
  padding: 16px; font-size: 13.5px; line-height: 1.6; color: var(--ink);
}
.disclaimer.top { font-size: 14px; font-weight: 600; background: #fff1f2; }
.disclaimer p + p { margin-top: 8px; }
.small { font-size: 13px; color: var(--ink-2); }

/* Barra fissa col risultato: visibile finché il riquadro del risultato è fuori schermo. */
.sticky-res {
  position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 40; max-width: 536px; margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  min-height: 54px; padding: 8px 18px;
  background: var(--ink); color: #fff; border-radius: 16px;
  box-shadow: 0 16px 34px -12px rgba(19,24,41,0.6);
  font-size: 15px; font-weight: 600; text-decoration: none;
  transform: translateY(0); transition: transform .25s ease, opacity .25s ease;
}
.sticky-res b { font-size: 19px; font-weight: 800; white-space: nowrap; }
.sticky-res.off { transform: translateY(140%); opacity: 0; pointer-events: none; }

/* ---------- DESKTOP ---------- */
@media (min-width: 720px) {
  .hero { padding: 26px 40px 100px; }
  .hero h1 { font-size: 36px; }
  .hero p { font-size: 16px; max-width: 48ch; }
  .wrap { max-width: 720px; margin-top: -70px; }
  .card-body { padding: 26px 26px; }
  .calc-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 719px) {
  .hero { padding-bottom: 76px; }
  .hero-top { margin-bottom: 12px; }
  .hero p { margin-top: 8px; font-size: 14px; }
}
@media (max-width: 340px) {
  .row2 { grid-template-columns: 1fr; }
}
@media (max-width: 380px) {
  .donut-wrap { flex-direction: column; align-items: stretch; }
  .donut { width: 60%; margin: 0 auto; }
}
