/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg: #f5f8f6;
  --surface: #ffffff;
  --surface-soft: #eaf3ee;
  --border: #dbe6e0;
  --text: #142420;
  --text-soft: #47594f;
  --text-faint: #7c8c82;
  --primary: #0f3d2e;
  --primary-soft: #e3f1ea;
  --accent: #14804a;
  --accent-warm: #e08a2e;
  --ok: #14804a;
  --danger: #d1453a;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(15, 61, 46, 0.05), 0 10px 30px -14px rgba(15, 61, 46, 0.2);
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Manrope", var(--sans);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --container: 880px;
}

/* =============================================================
   2. Reset & base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg, canvas { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; }
p { text-wrap: pretty; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.01em; color: var(--primary); }
code { background: var(--surface-soft); padding: 0.1em 0.4em; border-radius: 4px; font-size: 0.92em; }
::selection { background: var(--accent); color: #fff; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================
   3. Utilities
   ============================================================= */
.container { max-width: var(--container); margin-inline: auto; padding-inline: 1.25rem; }
.skip-link {
  position: fixed; top: -100px; left: 1rem;
  padding: .6rem 1rem; background: var(--primary); color: #fff;
  z-index: 9999; border-radius: 8px; font-weight: 600; text-decoration: none;
}
.skip-link:focus { top: 1rem; }
[data-reveal] { opacity: 0; transform: translateY(16px); transition: opacity .5s var(--ease-out), transform .5s var(--ease-out); }
[data-reveal].is-revealed { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { [data-reveal] { opacity: 1; transform: none; transition: none; } }

/* =============================================================
   4. Typography
   ============================================================= */
h1 { font-size: clamp(1.9rem, 4.4vw, 2.7rem); }
h2 { font-size: clamp(1.3rem, 2.6vw, 1.6rem); margin-block: 1.6rem 0.7rem; }
.hero-sub { color: var(--text-soft); font-size: 1.05rem; max-width: 46ch; margin-top: .5rem; }

/* =============================================================
   5. Header / footer
   ============================================================= */
.site-header { padding-block: 1.1rem; border-bottom: 1px solid var(--border); background: var(--surface); }
.header-row { display: flex; align-items: baseline; gap: .9rem; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: .5rem; }
.brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: 8px; background: var(--primary); color: #fff;
  font-family: var(--display); font-weight: 800; font-size: 1rem;
}
.brand-name { font-family: var(--display); font-weight: 800; font-size: 1.15rem; color: var(--primary); }
.brand-tagline { color: var(--text-faint); font-size: .92rem; }

.site-footer { margin-top: 3rem; padding-block: 1.6rem; border-top: 1px solid var(--border); color: var(--text-faint); font-size: .88rem; }
.footer-row { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; }
.footer-links { display: flex; gap: 1rem; }
.footer-links a { text-decoration: underline; text-underline-offset: 2px; }

/* =============================================================
   6. Sections
   ============================================================= */
.hero { padding-block: 2.2rem 1rem; }
.tool-section { padding-block: .5rem 1.5rem; display: grid; gap: 1.4rem; }

.tool-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 1.4rem; box-shadow: var(--shadow);
}

.calc-form { display: grid; grid-template-columns: 1fr; gap: 1rem; }
@media (min-width: 720px) { .calc-form { grid-template-columns: 1fr 1fr; } }
.calc-form-b { margin-top: .8rem; padding-top: .8rem; border-top: 1px dashed var(--border); }

.field { display: grid; gap: .35rem; }
.field label { font-size: .85rem; font-weight: 600; color: var(--text-soft); }
.field-input { position: relative; display: flex; align-items: center; }
.field-input input {
  width: 100%; padding: .68rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 1.02rem; font-family: var(--sans); color: var(--text); background: var(--surface);
  transition: border-color .18s var(--ease-out);
}
.field-input input:focus { border-color: var(--accent); }
.field-input .suffix { position: absolute; right: .8rem; color: var(--text-faint); font-size: .88rem; pointer-events: none; }

.field-select {
  width: 100%; padding: .68rem .85rem; border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: .98rem; font-family: var(--sans); color: var(--text); background: var(--surface);
}

.field-group { border: 0; padding: 0; grid-column: 1 / -1; }
.field-group legend { font-size: .85rem; font-weight: 600; color: var(--text-soft); padding: 0; margin-bottom: .35rem; }
.radio-row { display: flex; gap: .6rem; flex-wrap: wrap; }
.radio-chip {
  display: inline-flex; align-items: center; gap: .4rem; padding: .5rem .85rem;
  border: 1.5px solid var(--border); border-radius: 999px; font-size: .9rem; font-weight: 600;
  color: var(--text-soft); cursor: pointer; transition: border-color .15s var(--ease-out), background .15s var(--ease-out), color .15s var(--ease-out);
}
.radio-chip input { accent-color: var(--accent); }
.radio-chip:has(input:checked) { border-color: var(--accent); background: var(--primary-soft); color: var(--primary); }

.btn-calc {
  padding: .72rem 1.3rem; background: var(--accent); color: #fff; border-radius: var(--radius-sm);
  font-weight: 700; white-space: nowrap; transition: transform .15s var(--ease-out), background .15s var(--ease-out);
}
.btn-calc:hover { background: #0e6339; }
.btn-calc:active { transform: scale(0.98); }

.compare-switch { display: flex; align-items: center; gap: .6rem; margin-top: 1.1rem; font-size: .92rem; color: var(--text-soft); cursor: pointer; }
.compare-switch input { width: 18px; height: 18px; accent-color: var(--accent); flex-shrink: 0; }

.noscript-note { margin-top: 1rem; padding: .8rem 1rem; background: #fff4e8; border: 1px solid #f0d5ad; border-radius: var(--radius-sm); color: #7a4a12; font-size: .92rem; }

.results-grid { display: grid; grid-template-columns: 1fr; gap: 1rem; margin-top: 1.4rem; }
@media (min-width: 640px) { .results-grid:has(#card-b:not([hidden])) { grid-template-columns: 1fr 1fr; } }
.result-card { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 1.1rem 1.2rem; }
.result-label { font-size: .78rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.result-cuota { font-family: var(--display); font-size: clamp(1.7rem, 4vw, 2.2rem); font-weight: 800; color: var(--primary); margin-top: .2rem; }
.result-cuota small { font-size: .95rem; font-weight: 500; color: var(--text-faint); margin-left: .25rem; }
.result-anual { font-size: .92rem; color: var(--text-soft); margin-top: .15rem; }
.result-anual strong { color: var(--text); }

.stacked-bar { display: flex; width: 100%; height: 10px; border-radius: 999px; overflow: hidden; margin-top: .7rem; background: var(--border); }
.stacked-bar .seg { height: 100%; transition: width .4s var(--ease-out); }
.stacked-bar .seg-neto { background: var(--ok); }
.stacked-bar .seg-ss { background: var(--accent-warm); }
.stacked-bar .seg-irpf { background: #6b7f9e; }

.result-details { display: flex; gap: 1.6rem; margin-top: .8rem; flex-wrap: wrap; }
.result-details dt { font-size: .78rem; color: var(--text-faint); }
.result-details dd { font-weight: 700; font-size: 1rem; }
.result-diff { margin-top: 1rem; padding: .8rem 1rem; background: #eafaf5; border: 1px solid #bfe8db; border-radius: var(--radius-sm); font-size: .92rem; color: #0b5c48; }

.chart-legend { list-style: none; display: flex; gap: 1.2rem; margin-top: .9rem; flex-wrap: wrap; font-size: .85rem; color: var(--text-soft); }
.chart-legend .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: .4rem; }
.dot-a { background: var(--ok); }
.dot-interest { background: var(--accent-warm); }
.dot-b { background: #6b7f9e; }

.privacy-badge { margin-top: 1.3rem; font-size: .88rem; color: var(--ok); }
.limits-note { margin-top: .4rem; font-size: .82rem; color: var(--text-faint); }

.ad-slot {
  min-height: 90px; display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border); border-radius: var(--radius-sm); color: var(--text-faint);
  font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; background: var(--surface-soft);
}
.ad-slot-leaderboard { margin-inline: 0; }

.content-section p { color: var(--text-soft); margin-block: .7rem; max-width: 70ch; }
.steps { padding-left: 1.2rem; display: grid; gap: .6rem; color: var(--text-soft); max-width: 70ch; }
.steps li strong { color: var(--text); }

.more-tools a { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 2px; }

.faq-section details {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .9rem 1.1rem; margin-bottom: .6rem;
}
.faq-section summary { font-weight: 700; cursor: pointer; color: var(--primary); }
.faq-section p { margin-top: .6rem; color: var(--text-soft); }

/* =============================================================
   7. Responsive
   ============================================================= */
@media (min-width: 960px) {
  .tool-section { grid-template-columns: 1fr; }
}
