/* =============================================================================
   1. Tokens
   ========================================================================== */
:root {
  --navy: #0f2a43;
  --navy-700: #17395b;
  --navy-100: #e6edf4;
  --ink: #16232f;
  --muted: #57697a;
  --line: #dfe5ec;
  --line-soft: #edf1f6;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --accent: #1257a5;
  --money: #0b6b4f;
  --money-soft: #e8f5ef;
  --warn: #9a4b00;
  --warn-soft: #fdf3e6;
  --danger: #a12b1e;

  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Source Serif 4", Georgia, "Times New Roman", serif;

  --radius: 12px;
  --radius-sm: 8px;
  --gutter: clamp(1rem, 4vw, 2rem);
  --maxw: 1080px;
  --shadow: 0 1px 2px rgba(15, 42, 67, .06), 0 8px 24px rgba(15, 42, 67, .07);
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
}

/* =============================================================================
   2. Reset & base
   ========================================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; scroll-padding-top: 5rem; color-scheme: light; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.62;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
}
img, svg { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { text-wrap: balance; line-height: 1.18; letter-spacing: -0.015em; }
ul, ol { padding-left: 1.15rem; }
li { margin: .3rem 0; }
::selection { background: var(--navy); color: #fff; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 4px; }

/* =============================================================================
   3. Utilities
   ========================================================================== */
.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--gutter); }

.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--navy); color: #fff;
  border-radius: var(--radius-sm); font-weight: 600;
}
.skip-link:focus { top: 1rem; }

/* =============================================================================
   4. Header
   ========================================================================== */
.site-header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(255, 255, 255, .94);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.header-inner {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; min-height: 60px; flex-wrap: wrap;
}
.brand { display: inline-flex; align-items: center; gap: .55rem; color: var(--navy); }
.brand:hover { text-decoration: none; }
.brand-mark {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--navy); color: #fff;
  font-weight: 700; font-size: 1rem;
}
.brand-name { font-size: 1.02rem; font-weight: 500; letter-spacing: -.01em; }
.brand-name strong { font-weight: 700; }
/* En móvil la barra de secciones se oculta: la herramienta debe verse
   nada más entrar, sin scroll. Las secciones siguen abajo. */
.header-nav { display: none; gap: 1.1rem; flex-wrap: wrap; font-size: .9rem; }
@media (min-width: 720px) { .header-nav { display: flex; } }
.header-nav a { color: var(--muted); font-weight: 500; }
.header-nav a:hover { color: var(--navy); }

/* =============================================================================
   5. Hero + tool card
   ========================================================================== */
.hero { padding: clamp(1.1rem, 4vw, 2.6rem) var(--gutter) 1rem; }
h1 {
  font-family: var(--serif);
  font-size: clamp(1.75rem, 4.4vw, 2.6rem);
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -.02em;
}
.hero-sub {
  margin-top: .7rem; max-width: 62ch;
  color: var(--muted); font-size: clamp(.94rem, 2.2vw, 1.08rem);
}

.tool-card {
  margin-top: 1.2rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.calc-form { padding: clamp(1.1rem, 3vw, 1.75rem); }

.card-title {
  font-size: .78rem; font-weight: 700; letter-spacing: .09em;
  text-transform: uppercase; color: var(--muted);
  margin-bottom: 1rem;
}
.card-title-sep {
  margin-top: 1.75rem; padding-top: 1.25rem;
  border-top: 1px solid var(--line-soft);
}

.field-row { display: flex; flex-wrap: wrap; gap: .9rem; }
.field { display: flex; flex-direction: column; gap: .35rem; min-width: 0; flex: 1 1 100%; }
.field-grow { flex: 1 1 160px; }
.field-row > .field:not(.field-grow) { flex: 1 1 140px; }

.field label { font-size: .84rem; font-weight: 600; color: var(--ink); }

input[type="number"], input[type="date"], select {
  width: 100%;
  padding: .68rem .8rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #fff;
  font-size: 1rem;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
input:hover, select:hover { border-color: #c3cedb; }
input:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(18, 87, 165, .13);
}
select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2357697a' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .75rem center;
  padding-right: 2.1rem;
}
.input-group { position: relative; }
.input-group input { padding-right: 2.1rem; }
.input-suffix {
  position: absolute; right: .8rem; top: 50%; transform: translateY(-50%);
  color: var(--muted); font-size: .95rem; pointer-events: none;
}

.field-help { margin-top: .55rem; font-size: .84rem; color: var(--muted); }
.field-help a { font-weight: 600; }

.antiguedad-line {
  margin-top: 1rem;
  padding: .6rem .8rem;
  background: var(--navy-100);
  border-radius: var(--radius-sm);
  font-size: .88rem; font-weight: 600; color: var(--navy);
}

.manual-toggle { margin-top: .9rem; }
.manual-toggle > summary {
  cursor: pointer; font-size: .86rem; font-weight: 600; color: var(--accent);
  list-style: none; padding: .4rem 0;
}
.manual-toggle > summary::-webkit-details-marker { display: none; }
.manual-toggle > summary::before { content: "＋ "; }
.manual-toggle[open] > summary::before { content: "− "; }
.manual-toggle[open] > summary { margin-bottom: .6rem; }

.calc-form > .field:last-of-type { margin-top: 1.1rem; }

/* =============================================================================
   6. Results
   ========================================================================== */
.results {
  border-top: 1px solid var(--line);
  background: #fbfcfe;
  padding: clamp(1.1rem, 3vw, 1.75rem);
}
.result-empty { color: var(--muted); font-size: .95rem; }

.result-block + .result-block { margin-top: 1.4rem; }
.result-block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: .75rem; flex-wrap: wrap;
  padding-bottom: .5rem; border-bottom: 1px solid var(--line-soft);
}
.result-block-head h3 {
  font-size: .95rem; font-weight: 700; color: var(--navy);
}
.result-amount {
  font-size: clamp(1.15rem, 3.4vw, 1.4rem); font-weight: 700;
  color: var(--navy); font-variant-numeric: tabular-nums;
}

.breakdown { list-style: none; padding: 0; margin: .6rem 0 0; }
.breakdown-item {
  display: flex; justify-content: space-between; gap: 1rem;
  padding: .38rem 0; font-size: .9rem;
  border-bottom: 1px dashed var(--line-soft);
}
.bd-label { color: var(--muted); }
.bd-value { font-variant-numeric: tabular-nums; white-space: nowrap; font-weight: 500; }
.breakdown-item.is-total {
  border-bottom: 0; margin-top: .25rem; padding-top: .5rem;
  border-top: 1px solid var(--line); font-weight: 700;
}
.breakdown-item.is-total .bd-label { color: var(--ink); }
.breakdown-item.is-cap .bd-label,
.breakdown-item.is-cap .bd-value { color: var(--warn); font-weight: 600; }

.result-note { margin-top: .55rem; font-size: .82rem; color: var(--muted); }

.result-total {
  margin-top: 1.6rem;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: 1.1rem 1.25rem;
  background: var(--money-soft);
  border: 1px solid #c8e6d8;
  border-radius: var(--radius);
}
.result-total-label { font-weight: 700; color: var(--money); font-size: .95rem; }
.result-total-amount {
  font-size: clamp(1.9rem, 7vw, 2.75rem); font-weight: 700;
  color: var(--money); letter-spacing: -.03em;
  font-variant-numeric: tabular-nums; line-height: 1.1;
}

.notice {
  margin-top: 1.2rem; padding: .95rem 1.1rem;
  border-radius: var(--radius); border: 1px solid var(--line);
  background: #fff;
}
.notice h4, .notice h3 { font-size: .95rem; color: var(--navy); margin-bottom: .4rem; }
.notice p { font-size: .89rem; color: var(--muted); }
.notice-tax { background: var(--warn-soft); border-color: #f0dcc0; }
.notice-tax h4 { color: var(--warn); }
.notice-tax p { color: #6d4a22; }
.warn-inline { color: var(--danger); }

.notice-deadline { background: #fdf0ee; border-color: #f2d2cc; }
.notice-deadline h3 { color: var(--danger); }
.notice-deadline p { color: #6f342c; font-size: .95rem; }
.strong-warn { font-weight: 700; color: var(--danger); }

.disclaimer {
  margin-top: 1rem; padding: .8rem 1rem;
  border-left: 3px solid var(--navy);
  background: var(--navy-100);
  font-size: .84rem; color: var(--navy-700);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.privacy-badge {
  padding: .8rem clamp(1.1rem, 3vw, 1.75rem);
  border-top: 1px solid var(--line);
  background: var(--surface);
  font-size: .84rem; color: var(--muted);
}

/* =============================================================================
   7. Ad slots (placeholders — sin código de terceros)
   ========================================================================== */
.ad-slot {
  display: grid; place-items: center;
  margin: 2rem 0;
  border: 1px dashed #c8d2de;
  border-radius: var(--radius);
  background: repeating-linear-gradient(135deg, #fff, #fff 10px, #fafbfd 10px, #fafbfd 20px);
}
.ad-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .18em;
  color: #9aa8b6;
}
.ad-leaderboard { min-height: 100px; }
.ad-incontent { min-height: 260px; max-width: 336px; margin-inline: auto; }
@media (min-width: 720px) { .ad-leaderboard { min-height: 120px; } }

/* =============================================================================
   8. Content sections
   ========================================================================== */
.section { padding: clamp(1.75rem, 5vw, 3rem) var(--gutter); }
.section > h2 {
  font-family: var(--serif);
  font-size: clamp(1.35rem, 3.4vw, 1.9rem);
  font-weight: 600; color: var(--navy);
  margin-bottom: .8rem;
}
.section-lead { color: var(--muted); max-width: 68ch; margin-bottom: 1.5rem; }

.steps { list-style: none; padding: 0; display: grid; gap: 1rem; margin-top: 1.4rem; }
.step {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.2rem; margin: 0;
}
.step-num {
  display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--navy); color: #fff;
  font-weight: 700; font-size: .88rem; margin-bottom: .7rem;
}
.step h3 { font-size: 1.02rem; color: var(--navy); margin-bottom: .35rem; }
.step p { font-size: .92rem; color: var(--muted); }
@media (min-width: 720px) { .steps { grid-template-columns: repeat(3, 1fr); } }

.tipo {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: clamp(1.1rem, 3vw, 1.6rem);
  margin-bottom: 1.1rem;
  scroll-margin-top: 5rem;
}
.tipo h3 {
  font-family: var(--serif); font-weight: 600;
  font-size: clamp(1.1rem, 2.8vw, 1.35rem);
  color: var(--navy); margin-bottom: .7rem;
}
.tipo p { font-size: .95rem; margin-bottom: .7rem; color: #33424f; }
.tipo-rule {
  padding: .8rem 1rem; background: var(--navy-100);
  border-radius: var(--radius-sm); color: var(--navy-700) !important;
}
.tipo-base { display: block; margin-top: .3rem; font-size: .82rem; color: var(--muted); }
.tipo-cta { font-weight: 600; font-size: .92rem; }
.tipo:target { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(18, 87, 165, .12); }

.plazos-list { margin-top: 1.2rem; }
.plazos-list li { margin-bottom: .6rem; font-size: .95rem; color: #33424f; }
.plazos-extra { margin-top: 1.1rem; font-size: .95rem; color: #33424f; }

.faq-item {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); margin-bottom: .7rem; overflow: hidden;
}
.faq-item > summary {
  cursor: pointer; list-style: none;
  padding: 1rem 1.1rem;
  font-weight: 600; color: var(--navy); font-size: .98rem;
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
}
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::after {
  content: "+"; font-size: 1.3rem; font-weight: 400; color: var(--muted); line-height: 1;
}
.faq-item[open] > summary::after { content: "−"; }
.faq-item[open] > summary { border-bottom: 1px solid var(--line-soft); }
.faq-answer { padding: 1rem 1.1rem 1.2rem; }
.faq-answer p, .faq-answer li { font-size: .93rem; color: #33424f; }
.faq-answer p + p, .faq-answer ul, .faq-answer ol { margin-top: .7rem; }

/* =============================================================================
   9. Footer
   ========================================================================== */
.site-footer {
  margin-top: 2rem;
  background: var(--navy); color: #c8d6e4;
  padding: 2rem 0;
}
.footer-inner { display: grid; gap: .7rem; }
.footer-brand { color: #fff; font-size: 1.02rem; font-weight: 500; }
.footer-legal { font-size: .85rem; max-width: 62ch; color: #a9bccd; }
.footer-nav { display: flex; gap: 1.2rem; flex-wrap: wrap; font-size: .88rem; }
.footer-nav a { color: #e2ecf5; }

/* =============================================================================
   10. Legal pages
   ========================================================================== */
.legal { padding: clamp(1.75rem, 5vw, 3rem) var(--gutter); max-width: 760px; }
.legal h1 { font-size: clamp(1.5rem, 4vw, 2.1rem); margin-bottom: 1rem; }
.legal h2 { font-family: var(--serif); font-size: 1.2rem; color: var(--navy); margin: 1.6rem 0 .5rem; }
.legal p, .legal li { font-size: .95rem; color: #33424f; }
.legal p { margin-bottom: .7rem; }
.legal .todo {
  background: var(--warn-soft); border: 1px dashed #e2c69b;
  padding: .7rem .9rem; border-radius: var(--radius-sm);
  font-size: .88rem; color: var(--warn);
}

/* =============================================================================
   11. Reduced motion (solo lo intrusivo)
   ========================================================================== */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}
