/* Consolidamento debiti — foglio unico. Idea grafica: la «barra delle rate».
   Le rate di oggi sono segmenti di colori diversi; la rata unica è un solo colore.
   È l'unico elemento vistoso: il resto è testo grande e tabelle leggibili. */
:root {
  --pine: #173b36;
  --pine-soft: #e4eeea;
  --paper: #f4f7f5;
  --white: #ffffff;
  --ink: #1b2523;
  --muted: #55645f;
  --line: #cfdad5;
  --seg-1: #b9770e;
  --seg-2: #7a3e5c;
  --seg-3: #2b7a78;
  --seg-4: #56677a;
  --warn-bg: #fbf1dc;
  --warn-ink: #6b4708;
  --measure: 44rem;
  --wide: 62rem;
  --font: "Atkinson Hyperlegible Next", "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 1.125rem; line-height: 1.6; }
a { color: var(--pine); text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 3px solid var(--seg-1); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.18; font-weight: 700; color: var(--pine); }
h1 { font-size: clamp(2rem, 1.5rem + 2.4vw, 3.1rem); margin: 0 0 1rem; letter-spacing: -0.012em; }
h2 { font-size: clamp(1.45rem, 1.25rem + 0.9vw, 1.9rem); margin: 3rem 0 0.75rem; scroll-margin-top: 5rem; }
h3 { font-size: 1.2rem; margin: 1.75rem 0 0.5rem; }
p, ul, ol, dl { margin: 0 0 1rem; }
ul, ol { padding-left: 1.3rem; }
li { margin-bottom: 0.4rem; }
.h1-sub { display: block; margin-top: 0.6rem; font-size: 0.48em; font-weight: 400; line-height: 1.3; color: var(--muted); letter-spacing: 0; }

/* Nav */
.nav { position: sticky; top: 0; z-index: 20; background: var(--pine); }
.nav-inner { display: flex; align-items: center; gap: 1.4rem; max-width: var(--wide); margin: 0 auto; padding: 0.7rem 1rem; }
.nav a { color: var(--white); text-decoration: none; font-size: 1rem; }
.nav a:hover { text-decoration: underline; }
.nav .brand { font-weight: 700; font-size: 1.15rem; margin-right: auto; }
.nav .cta { background: var(--white); color: var(--pine); font-weight: 700; padding: 0.42rem 0.95rem; border-radius: 6px; }
.burger-btn { display: none; background: none; border: 1px solid rgba(255,255,255,.55); border-radius: 6px; color: var(--white); font: inherit; font-size: 0.95rem; padding: 0.35rem 0.7rem; cursor: pointer; }
.burger-overlay { display: none; position: fixed; inset: 0; background: rgba(15, 30, 27, .5); z-index: 30; }
.burger-overlay.is-open { display: block; }
.burger-panel { position: fixed; top: 0; right: 0; bottom: 0; width: min(21rem, 88vw); background: var(--white); z-index: 31; padding: 1rem 1.25rem; transform: translateX(100%); visibility: hidden; transition: transform .2s ease, visibility .2s; overflow-y: auto; }
.burger-panel.is-open { transform: none; visibility: visible; }
.burger-close { display: block; margin-left: auto; background: none; border: 0; font: inherit; color: var(--pine); font-weight: 700; padding: 0.4rem; cursor: pointer; }
.burger-nav a { display: block; padding: 0.65rem 0; border-bottom: 1px solid var(--line); text-decoration: none; }
@media (max-width: 860px) {
  .nav-link { display: none; }
  .burger-btn { display: block; }
  .nav .cta { padding: 0.35rem 0.75rem; }
}

/* Corpo */
main { max-width: var(--measure); margin: 0 auto; padding: 2.5rem 1rem 3rem; }
.breadcrumb { font-size: 0.95rem; color: var(--muted); margin-bottom: 1.25rem; }
.hero-sub { font-size: 1.28rem; line-height: 1.5; }
.trust-author { font-size: 1rem; color: var(--muted); }
.quick-facts { display: grid; grid-template-columns: minmax(8rem, 13rem) 1fr; gap: 0; background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 0.4rem 1rem; margin: 1.5rem 0; }
.quick-facts dt, .quick-facts dd { padding: 0.55rem 0; margin: 0; border-top: 1px solid var(--line); }
.quick-facts dt { font-weight: 700; padding-right: 1rem; }
.quick-facts dt:first-of-type, .quick-facts dt:first-of-type + dd { border-top: 0; }
@media (max-width: 520px) {
  .quick-facts { grid-template-columns: 1fr; }
  .quick-facts dd { border-top: 0; padding-top: 0; }
}
.insight-box { background: var(--pine-soft); border-left: 5px solid var(--pine); padding: 1rem 1.2rem; margin: 1.5rem 0; }
.nota-datazione { font-size: 0.95rem; color: var(--muted); border-top: 1px solid var(--line); padding-top: 1rem; margin-top: 2.5rem; }
.bozza { background: var(--warn-bg); color: var(--warn-ink); padding: 0.75rem 1rem; border: 2px dashed var(--seg-1); }

/* Barra delle rate */
.rate-demo { background: var(--white); border: 1px solid var(--line); border-radius: 8px; padding: 1.25rem; margin: 1.75rem 0; margin-inline: 0; }
.rate-row + .rate-row { margin-top: 1.25rem; }
.rate-label { display: flex; justify-content: space-between; gap: 1rem; font-weight: 700; margin-bottom: 0.4rem; }
.rate-bar { display: flex; height: 3rem; gap: 3px; }
.rate-seg { flex-grow: var(--w, 1); flex-basis: 0; background: var(--seg-4); color: var(--white); font-size: 0.86rem; display: flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; min-width: 0; }
.seg-1 { background: var(--seg-1); } .seg-2 { background: var(--seg-2); } .seg-3 { background: var(--seg-3); } .seg-4 { background: var(--seg-4); }
.seg-one { background: var(--pine); font-weight: 700; }
.rate-demo figcaption { font-size: 0.95rem; color: var(--muted); margin-top: 1rem; }

/* Tabelle */
.table-scroll { overflow-x: auto; margin: 1.5rem 0; }
.guide-table { width: 100%; border-collapse: collapse; background: var(--white); font-size: 1rem; }
.guide-table th, .guide-table td { padding: 0.65rem 0.75rem; text-align: left; vertical-align: top; border: 1px solid var(--line); }
.guide-table th { background: var(--pine-soft); color: var(--pine); }
.guide-table td.num, .guide-table th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.guide-table tr.riga-onesta td { background: var(--warn-bg); }

/* Schede sotto i 640px, come add_table_labels.py: 3-4 colonne diventano schede,
   da 5 in su scorrono di lato con la prima colonna ferma. */
@media (max-width: 640px) {
  .table-scroll--cards .guide-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .table-scroll--cards .guide-table, .table-scroll--cards .guide-table tbody, .table-scroll--cards .guide-table tr, .table-scroll--cards .guide-table td { display: block; width: 100%; }
  .table-scroll--cards .guide-table tr { border: 1px solid var(--line); margin-bottom: 0.75rem; background: var(--white); }
  .table-scroll--cards .guide-table td { border: 0; border-top: 1px solid var(--line); text-align: left; white-space: normal; }
  .table-scroll--cards .guide-table td:first-child { border-top: 0; font-weight: 700; }
  .table-scroll--cards .guide-table td[data-label]::before { content: attr(data-label); display: block; font-size: 0.85rem; color: var(--muted); }
  .table-scroll--cards .guide-table td:first-child::before { display: none; }
  .table-scroll--wide .guide-table th:first-child, .table-scroll--wide .guide-table td:first-child { position: sticky; left: 0; background: var(--white); z-index: 1; min-width: 7.5rem; }
  .table-scroll--wide .guide-table th:first-child { background: var(--pine-soft); }
}

/* FAQ */
.faq-item { border-top: 1px solid var(--line); }
.faq-item:last-of-type { border-bottom: 1px solid var(--line); }
.faq-q { display: flex; justify-content: space-between; gap: 1rem; width: 100%; background: none; border: 0; font: inherit; font-weight: 700; color: var(--pine); text-align: left; padding: 0.9rem 0; cursor: pointer; }
.faq-arrow { flex: none; transition: transform .15s ease; }
.faq-a { display: none; padding-bottom: 0.5rem; }
.faq-item.open .faq-a { display: block; }
.faq-item.open .faq-arrow { transform: rotate(180deg); }

/* Hub */
.card-list { list-style: none; padding: 0; }
.card-list li { background: var(--white); border: 1px solid var(--line); padding: 0.9rem 1.1rem; margin-bottom: 0.6rem; }
.card-list strong { display: block; }

/* Bottoni e form */
.btn { display: inline-block; background: var(--pine); color: var(--white); font: inherit; font-weight: 700; border: 2px solid var(--pine); border-radius: 6px; padding: 0.6rem 1.2rem; text-decoration: none; cursor: pointer; }
.btn:hover { background: #0f2a26; }
.btn-alt { background: transparent; color: var(--pine); }
.btn-alt:hover { background: var(--pine-soft); }
.btn-presto, .btn-presto:hover { background: transparent; color: var(--muted, #5b6b68); border-style: dashed; cursor: default; }
.cta-row { display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.5rem 0; }
.contact { background: var(--white); border: 1px solid var(--line); border-top: 6px solid var(--pine); padding: 1.5rem; margin-top: 3rem; scroll-margin-top: 5rem; }
.contact h2 { margin-top: 0; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.form-group { display: flex; flex-direction: column; gap: 0.3rem; }
.form-group label { font-weight: 700; font-size: 1rem; }
.form-full { grid-column: 1 / -1; }
input, select, textarea { font: inherit; padding: 0.55rem 0.65rem; border: 1px solid var(--muted); border-radius: 5px; background: var(--white); color: var(--ink); width: 100%; }
.consent { display: flex; gap: 0.6rem; align-items: flex-start; font-size: 1rem; margin: 1rem 0; }
.consent input { width: auto; margin-top: 0.35rem; }
.hp { position: absolute; left: -9999px; }
#formSuccess { display: none; background: var(--pine-soft); padding: 1rem; }
.sticky-bar { display: none; position: fixed; bottom: 0; left: 0; right: 0; background: var(--pine); padding: 0.6rem 1rem; z-index: 15; }
.sticky-bar a { color: var(--white); font-weight: 700; }
.sticky-bar button { float: right; background: none; border: 0; color: var(--white); font: inherit; cursor: pointer; }
@media (max-width: 768px) { .sticky-bar { display: block; } }
.sticky-bar[hidden], body.cc-aperto .sticky-bar { display: none; }

/* Banner dei cookie, costruito da cookie-consent.js */
#cc { position: fixed; bottom: 16px; left: 16px; right: 16px; max-width: 640px; margin: 0 auto; background: var(--pine); color: var(--white); z-index: 9999; padding: 18px 22px; border-radius: 12px; box-shadow: 0 8px 32px rgba(0,0,0,.45); opacity: 0; transform: translateY(12px); transition: opacity .35s ease, transform .35s ease; }
#cc.cc-show { opacity: 1; transform: translateY(0); }
.cc-in { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.cc-msg { margin: 0; font-size: 14px; flex: 1; min-width: 220px; line-height: 1.55; color: rgba(255,255,255,.88); }
.cc-msg a { color: var(--white); text-decoration: underline; }
.cc-state { display: block; margin-top: 6px; font-size: 12.5px; color: rgba(255,255,255,.55); }
.cc-btns { display: flex; gap: 10px; flex-shrink: 0; }
.cc-btn { padding: 10px 22px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; line-height: 1; min-width: 96px; }
.cc-ok { background: var(--white); color: var(--pine); border: 1px solid var(--white); }
.cc-ok:hover { background: var(--pine-soft); }
.cc-no { background: transparent; color: rgba(255,255,255,.75); border: 1px solid rgba(255,255,255,.28); }
.cc-no:hover { color: var(--white); border-color: rgba(255,255,255,.55); }
.cc-x { position: absolute; top: 8px; right: 12px; background: none; border: 0; color: rgba(255,255,255,.5); font-size: 18px; line-height: 1; cursor: pointer; padding: 4px 6px; }
.cc-x:hover { color: var(--white); }
@media (max-width: 600px) { #cc { left: 10px; right: 10px; bottom: 10px; padding: 16px 18px; } .cc-in { flex-direction: column; align-items: stretch; } .cc-btns { width: 100%; } .cc-btn { flex: 1; text-align: center; } }

/* Calcolatori */
.calc { background: var(--white); border: 1px solid var(--line); padding: 1.25rem; margin: 2rem 0; scroll-margin-top: 5rem; }
.calc h3 { margin-top: 0; }
.calc-results { background: var(--pine); color: var(--white); padding: 1.1rem 1.25rem; margin-top: 1.25rem; }
.calc-results a { color: var(--white); }
.calc-stale { display: none; margin: 0 0 0.6rem; font-size: 0.95rem; color: var(--warn-bg); }
.calc-results.is-stale .calc-stale { display: block; }
.calc-results.is-stale .calc-body { opacity: 0.45; }
.calc-big { font-size: 2rem; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.2; margin: 0 0 0.5rem; }
.calc-table { width: 100%; border-collapse: collapse; font-size: 0.97rem; }
.calc-table th, .calc-table td { padding: 0.4rem 0.35rem; border-bottom: 1px solid rgba(255,255,255,.28); text-align: right; font-variant-numeric: tabular-nums; }
.calc-table th:first-child, .calc-table td:first-child { text-align: left; }
.calc-note { font-size: 0.93rem; margin: 0.75rem 0 0; }
.calc-foot { font-size: 0.9rem; color: var(--muted); margin: 0.75rem 0 0; }
.calc-btn { margin-top: 1rem; }

/* Footer */
.footer { background: var(--pine); color: var(--white); padding: 2rem 1rem 3.5rem; font-size: 0.97rem; }
.footer-inner { max-width: var(--wide); margin: 0 auto; }
.footer a { color: var(--white); }
.footer-links { display: flex; flex-wrap: wrap; gap: 0.5rem 1.2rem; margin-bottom: 1rem; }
.footer .cc-prefs { background: none; border: 0; padding: 0; font: inherit; color: var(--white); text-decoration: underline; cursor: pointer; }
.footer-legal { font-size: 0.9rem; opacity: 0.88; margin: 0; }

@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } .burger-panel, .faq-arrow, #cc { transition: none; } }
