/* Fuentes IBM Plex (SIL Open Font License 1.1) servidas desde el propio sitio:
   no se hace ninguna petición a Google Fonts. Licencia en /assets/fonts/OFL-IBM-Plex-LICENSE.txt */
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Sans';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-sans-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-serif-latin-400-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-serif-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-serif-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Serif';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-serif-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-latin-500-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-latin-600-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'IBM Plex Mono';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: url('/assets/fonts/ibm-plex-mono-latin-700-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}


  :root {
    --bg: #F6F3EA;
    --bg-alt: #EDE8DA;
    --ink: #17233A;
    --muted: #5B6473;
    --navy: #14213A;
    --navy-ink: #F3EFE3;
    --line: rgba(23,35,58,0.14);
    --grid-line: rgba(23,35,58,0.06);
    --pine: #2E6B5A;
    --pine-ink: #F3EFE3;
    --amber: #B8712C;
    --card-bg: #FCFAF3;
    --shadow: none;
  }
  @media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
      --bg: #10151F;
      --bg-alt: #161D2B;
      --ink: #ECE8DC;
      --muted: #9AA3B2;
      --navy: #0B0F17;
      --navy-ink: #ECE8DC;
      --line: rgba(236,232,220,0.16);
      --grid-line: rgba(236,232,220,0.06);
      --pine: #5FAF9B;
      --pine-ink: #0B0F17;
      --amber: #E0A356;
      --card-bg: #161D2B;
    }
  }
  :root[data-theme="dark"] {
    --bg: #10151F;
    --bg-alt: #161D2B;
    --ink: #ECE8DC;
    --muted: #9AA3B2;
    --navy: #0B0F17;
    --navy-ink: #ECE8DC;
    --line: rgba(236,232,220,0.16);
    --grid-line: rgba(236,232,220,0.06);
    --pine: #5FAF9B;
    --pine-ink: #0B0F17;
    --amber: #E0A356;
    --card-bg: #161D2B;
  }

  * { box-sizing: border-box; }
  html, body { margin: 0; padding: 0; }
  body {
    background: var(--bg);
    color: var(--ink);
    font-family: 'IBM Plex Sans', -apple-system, Segoe UI, sans-serif;
    line-height: 1.55;
  }
  h1, h2, h3 { font-family: 'IBM Plex Serif', Georgia, serif; font-weight: 600; margin: 0 0 0.5em; line-height: 1.2; }
  h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); }
  h2 { font-size: clamp(1.35rem, 2.6vw, 1.7rem); }
  h3 { font-size: 1.1rem; }
  p { margin: 0 0 1em; color: var(--ink); }
  a { color: var(--pine); text-decoration: none; }
  a:hover { text-decoration: underline; }
  main p a:not(.btn), main li a:not(.btn) { text-decoration: underline; text-underline-offset: 2px; }
  .muted { color: var(--muted); }
  .num { font-family: 'IBM Plex Mono', 'Courier New', monospace; font-variant-numeric: tabular-nums; }
  :focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

  .wrap { max-width: 1040px; margin: 0 auto; padding: 0 24px; }

  header.site {
    background: var(--navy);
    color: var(--navy-ink);
    border-bottom: 1px solid var(--line);
  }
  header.site .wrap { display: flex; align-items: center; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; gap: 20px; flex-wrap: wrap; }
  .brand {
    font-family: 'IBM Plex Serif', serif;
    font-weight: 700;
    font-size: 1.25rem;
    color: var(--navy-ink);
    display: inline-block;
  }
  .brand:hover { text-decoration: none; }
  .brand span { color: var(--amber); }
  nav.main { display: flex; gap: 22px; flex-wrap: wrap; }
  nav.main a { color: var(--navy-ink); opacity: 0.82; font-size: 0.95rem; }
  nav.main a:hover, nav.main a.active { opacity: 1; text-decoration: none; border-bottom: 2px solid var(--amber); padding-bottom: 3px; }
  nav.main a.nav-cta { opacity: 1; font-weight: 600; color: var(--amber); }
  nav.main a.nav-cta:hover { border-bottom-color: var(--amber); }

  .skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--amber);
    color: var(--navy);
    padding: 10px 16px;
    z-index: 100;
    border-radius: 0 0 3px 0;
    font-weight: 600;
  }
  .skip-link:focus { left: 0; }

  /* ---- BREADCRUMBS ---- */
  .breadcrumbs {
    font-size: 0.85rem;
    color: var(--muted);
    padding: 18px 0 0;
  }
  .breadcrumbs a { color: var(--muted); }
  .breadcrumbs a:hover { color: var(--pine); }
  .breadcrumbs .sep { margin: 0 6px; opacity: 0.6; }
  .breadcrumbs [aria-current="page"] { color: var(--ink); font-weight: 600; }

  /* ---- HERO / HOME ---- */
  .hero {
    background-image:
      linear-gradient(var(--grid-line) 1px, transparent 1px),
      linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 28px 28px;
    padding: 64px 0 56px;
    border-bottom: 1px solid var(--line);
  }
  .hero .wrap { max-width: 760px; }
  .hero p.lead { font-size: 1.1rem; color: var(--muted); max-width: 54ch; }
  .btn {
    display: inline-block;
    background: var(--pine);
    color: var(--pine-ink);
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    padding: 12px 22px;
    border: 1px solid var(--pine);
    border-radius: 3px;
    margin-top: 8px;
  }
  .btn:hover { text-decoration: none; opacity: 0.92; }
  .btn.secondary { background: transparent; color: var(--ink); border-color: var(--line); }

  .cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
    padding: 48px 0 64px;
  }
  .cat-card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 22px 22px 20px;
    position: relative;
    display: block;
    color: inherit;
    text-decoration: none;
    cursor: pointer;
    transition: border-color 0.15s;
  }
  .cat-card:hover { border-color: var(--pine); text-decoration: none; }
  .cat-card:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }
  .cat-card .tag {
    font-size: 0.78rem;
    color: var(--muted);
    font-family: 'IBM Plex Mono', monospace;
    margin-bottom: 10px;
    display: block;
  }
  .cat-card h2 { font-size: 1.1rem; margin-bottom: 6px; color: var(--ink); }
  .cat-card p { color: var(--muted); font-size: 0.95rem; margin-bottom: 14px; }
  .cat-card .enter { font-weight: 600; color: var(--pine); }
  .cat-card:hover .enter { text-decoration: underline; }

  /* ---- CATEGORY INDEX PAGE ---- */
  .page-head { padding-top: 48px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
  .calc-list { padding-top: 32px; padding-bottom: 64px; display: grid; gap: 12px; }
  .calc-row {
    display: flex; align-items: center; justify-content: space-between;
    border: 1px solid var(--line); border-radius: 3px; padding: 16px 20px;
    background: var(--card-bg);
  }
  .calc-row.disabled { opacity: 0.55; }
  .calc-row .name { font-weight: 600; }
  .calc-row .desc { color: var(--muted); font-size: 0.9rem; margin-top: 2px; }
  .calc-row .status { font-size: 0.82rem; font-family: 'IBM Plex Mono', monospace; color: var(--muted); white-space: nowrap; margin-left: 16px; }
  .calc-row .status.live { color: var(--pine); }
  a.calc-row { color: inherit; text-decoration: none; cursor: pointer; transition: border-color 0.15s; }
  a.calc-row .name { color: var(--pine); }
  a.calc-row:hover { border-color: var(--pine); }
  a.calc-row:hover .name { text-decoration: underline; }
  a.calc-row:focus-visible { outline: 2px solid var(--amber); outline-offset: 2px; }

  /* ---- CALCULATOR PAGE ---- */
  .calc-page { padding-top: 44px; padding-bottom: 20px; }
  .calc-intro { max-width: 68ch; }
  .calc-grid {
    display: grid;
    grid-template-columns: 1.1fr 1fr;
    gap: 28px;
    margin: 32px 0 8px;
    align-items: start;
  }
  .panel {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 26px 26px 22px;
  }
  .ratio-group { display: flex; flex-direction: column; gap: 8px; }
  .ratio-option {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 10px 14px;
    cursor: pointer;
    background: var(--bg);
  }
  .ratio-option:has(input:checked) { border-color: var(--pine); background: var(--card-bg); }
  .ratio-option input { margin-top: 3px; accent-color: var(--pine); }
  .ratio-option .ratio-text { display: block; }
  .ratio-option .ratio-title { font-weight: 600; }
  .ratio-option .ratio-caption { display: block; font-size: 0.82rem; color: var(--muted); margin-top: 2px; }

  .field { margin-bottom: 22px; }
  select { max-width: 100%; }
  .field label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 0.95rem; }
  .field .field-hint { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; margin-top: 2px; }
  .field input[type="text"], .field input[type="email"], .field input[type="tel"], .field textarea {
    width: 100%;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 1rem;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
    color: var(--ink);
  }
  .field textarea { min-height: 140px; resize: vertical; font-family: inherit; }
  .consent-check {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 0.9rem; color: var(--muted); margin-bottom: 22px;
  }
  .consent-check input { margin-top: 3px; accent-color: var(--pine); flex: none; }
  .form-status {
    display: none;
    border: 1px solid var(--amber);
    background: var(--card-bg);
    border-radius: 3px;
    padding: 14px 16px;
    font-size: 0.9rem;
    margin-bottom: 22px;
  }
  .form-status-success { border-color: var(--pine); }
  .form-status-error { border-color: #B3432B; }
  .field-error { color: #B3432B; font-size: 0.85rem; font-weight: 600; margin: 6px 0 0; }
  .consent-wrap { margin-bottom: 22px; }
  .consent-wrap .consent-check { margin-bottom: 0; }
  .consent-wrap.has-error .consent-check { color: var(--ink); }
  .consent-wrap.has-error .consent-check input { outline: 2px solid #B3432B; outline-offset: 2px; }
  .result-cta { margin: 4px 0 18px; }
  .result-cta .btn { margin-top: 0; }
  .result-cta-note { font-size: 0.8rem; margin: 8px 0 0; }
  .book-category { margin-top: 32px; }
  .book-category:first-child { margin-top: 20px; }
  .book-category h2 { font-size: 1.15rem; margin-bottom: 14px; }
  .book-grid { display: grid; grid-template-columns: 1fr; gap: 14px; }
  @media (min-width: 720px) {
    .book-grid { grid-template-columns: 1fr 1fr; }
  }
  .book-card {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 18px 20px;
    background: var(--card-bg);
    margin-bottom: 0;
  }
  .book-card h3 { margin-bottom: 2px; }
  .book-card .book-author { color: var(--muted); font-size: 0.88rem; margin-bottom: 10px; }
  .ad-slot { min-height: 0; }
  .ad-slot[data-ad-status="disabled"] { display: none; }
  .ad-slot[data-ad-status="pending"],
  .ad-slot[data-ad-status="active"] {
    display: block; text-align: center; margin: 24px 0;
    border: 1px solid var(--line); border-radius: 3px; padding: 8px;
    background: var(--card-bg);
  }
  /* Reserva de espacio solo mientras se espera el anuncio real
     (data-ad-status="pending"), para reducir el CLS cuando
     ADS_ENABLED=true. Con "disabled" (flag apagado, el estado normal
     de esta fase) no se reserva ningún espacio. */
  .ad-slot[data-ad-status="pending"] { min-height: 250px; }
  .ad-slot .ad-label { display: block; font-size: 0.72rem; color: var(--muted); font-family: 'IBM Plex Mono', monospace; margin-bottom: 6px; }
  .field label { display: flex; justify-content: space-between; font-size: 0.92rem; font-weight: 600; margin-bottom: 8px; }
  .field label .val { font-family: 'IBM Plex Mono', monospace; color: var(--pine); font-weight: 600; }
  .field input[type="range"] { width: 100%; accent-color: var(--pine); margin-top: 4px; }
  .field input[type="number"] {
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 1rem;
    padding: 9px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
    color: var(--ink);
  }

  .result-hero { text-align: left; padding-bottom: 18px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
  .result-hero .label { font-size: 0.85rem; color: var(--muted); margin-bottom: 4px; }
  .result-hero .figure { font-size: 2.4rem; font-weight: 600; color: var(--amber); }
  .result-hero .figure .cents { font-size: 1.5rem; }

  .stat-row { display: flex; justify-content: space-between; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 0.94rem; }
  .stat-row:last-of-type { border-bottom: none; }
  .stat-row .v { font-weight: 600; }

  .bar { display: flex; height: 14px; border-radius: 3px; overflow: hidden; margin: 16px 0 8px; border: 1px solid var(--line); }
  .bar .capital { background: var(--pine); }
  .bar .interes { background: var(--amber); }
  .legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 0.85rem; color: var(--muted); }
  .legend span { display: inline-flex; align-items: center; gap: 6px; }
  .swatch { width: 10px; height: 10px; border-radius: 2px; display: inline-block; }
  .swatch.capital { background: var(--pine); }
  .swatch.interes { background: var(--amber); }

  .explain { padding-top: 28px; padding-bottom: 28px; border-top: 1px solid var(--line); max-width: 68ch; }
  .faq { padding: 8px 0 56px; max-width: 68ch; }
  .faq details {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 14px 18px;
    margin-bottom: 10px;
    background: var(--card-bg);
  }
  .faq summary { font-weight: 600; cursor: pointer; }
  .faq p { margin-top: 10px; margin-bottom: 0; color: var(--muted); }

  /* ---- RELATED CALCULATORS (internal linking) ---- */
  .related {
    padding: 8px 0 48px;
    border-top: 1px solid var(--line);
    margin-top: 8px;
  }
  .related h2 { margin-bottom: 14px; }
  .related-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .related-item {
    display: block;
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 12px 16px;
    background: var(--card-bg);
    font-weight: 600;
    font-size: 0.94rem;
  }
  .related-item:hover { text-decoration: none; border-color: var(--pine); }
  .related-item.disabled { opacity: 0.5; pointer-events: none; font-weight: 500; }
  @media (max-width: 760px) { .related-grid { grid-template-columns: 1fr; } }

  .tae-compare { display: flex; flex-direction: column; gap: 14px; }
  .tae-compare-row { display: flex; align-items: center; gap: 14px; }
  .tae-compare-label { width: 90px; flex-shrink: 0; font-weight: 600; font-size: 0.92rem; }
  .tae-compare-row .bar { flex: 1; margin: 0; }
  .tae-compare-value { width: 70px; flex-shrink: 0; text-align: right; font-size: 0.94rem; font-weight: 600; }

  .table-wrap { overflow-x: auto; margin: 16px 0; }
  table.amort-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; min-width: 480px; }
  table.amort-table th, table.amort-table td {
    padding: 8px 14px;
    text-align: right;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
  }
  table.amort-table th:first-child, table.amort-table td:first-child { text-align: left; }
  table.amort-table thead th {
    font-family: 'IBM Plex Sans', sans-serif;
    font-weight: 600;
    color: var(--muted);
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
  }
  table.amort-table td { font-family: 'IBM Plex Mono', monospace; }
  table.amort-table tr.amort-extra { display: none; }
  table.amort-table tr.amort-extra.visible { display: table-row; }

  .plazo-compare-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
  .plazo-compare-card {
    border: 1px solid var(--line);
    border-radius: 3px;
    padding: 16px 18px;
    background: var(--card-bg);
  }
  .plazo-compare-card.actual { border-color: var(--pine); }
  .plazo-compare-card .plazo-tag { font-size: 0.78rem; color: var(--muted); font-family: 'IBM Plex Mono', monospace; }
  .plazo-compare-card.actual .plazo-tag { color: var(--pine); font-weight: 600; }
  .plazo-compare-card .plazo-cuota { font-family: 'IBM Plex Mono', monospace; font-size: 1.3rem; font-weight: 600; margin: 6px 0; }
  .plazo-compare-card .plazo-intereses { font-size: 0.85rem; color: var(--muted); }
  @media (max-width: 760px) { .plazo-compare-grid { grid-template-columns: 1fr; } }

  .callout {
    border: 1px solid var(--line);
    border-left: 4px solid var(--amber);
    border-radius: 3px;
    padding: 18px 20px;
    margin: 8px 0 40px;
    background: var(--card-bg);
  }
  .callout h2, .callout h3 { margin-bottom: 8px; font-size: 1.05rem; }
  .callout p { margin-bottom: 8px; font-size: 0.95rem; }
  .callout p:last-child { margin-bottom: 0; }

  .disclaimer {
    font-size: 0.82rem;
    color: var(--muted);
    border-left: 2px solid var(--line);
    padding-left: 14px;
    margin: 8px 0 40px;
    max-width: 60ch;
  }

  footer.site {
    background: var(--navy);
    color: var(--navy-ink);
    padding: 40px 0;
    margin-top: 24px;
  }
  footer.site .wrap { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 24px; }
  footer.site nav { display: flex; flex-direction: column; gap: 8px; }
  footer.site nav h3 {
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    font-weight: 600;
    color: var(--navy-ink);
    opacity: 0.55;
    margin: 0 0 4px;
  }
  footer.site a { color: var(--navy-ink); opacity: 0.8; font-size: 0.92rem; }
  footer.site .fine { font-size: 0.78rem; color: var(--navy-ink); opacity: 0.55; max-width: 46ch; }

  @media (max-width: 760px) {
    .cat-grid { grid-template-columns: 1fr; }
    .calc-grid { grid-template-columns: minmax(0, 1fr); }
    select { width: 100%; }
    .stat-row .v, .result-hero .figure, main .num { overflow-wrap: anywhere; }
    .result-hero .figure { font-size: clamp(1.6rem, 8vw, 2.4rem); }
    nav.main { gap: 14px; }
    footer.site .wrap { flex-direction: column; }
  }

  /* ---- SIMULADOR AVANZADO DE HIPOTECA (cuadro de amortización + amortizaciones múltiples) ---- */
  details.advanced-toggle {
    margin: 28px 0;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--card-bg);
    padding: 18px 22px;
  }
  details.advanced-toggle summary {
    font-weight: 600;
    cursor: pointer;
    list-style: none;
    display: flex;
    align-items: center;
    gap: 8px;
  }
  details.advanced-toggle summary::-webkit-details-marker { display: none; }
  details.advanced-toggle summary::before { content: '▸'; color: var(--pine); transition: transform 0.15s ease; }
  details.advanced-toggle[open] summary::before { transform: rotate(90deg); }
  details.advanced-toggle > *:not(summary) { margin-top: 20px; }

  .amort-row {
    display: flex;
    align-items: flex-end;
    gap: 14px;
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
    flex-wrap: wrap;
  }
  .amort-row:last-of-type { border-bottom: none; }
  .amort-row-field { flex: 1 1 160px; min-width: 140px; }
  .amort-row-field label { display: block; font-size: 0.85rem; font-weight: 600; margin-bottom: 6px; }
  .amort-row-field input[type="number"] {
    width: 100%;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.95rem;
    padding: 8px 10px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
    color: var(--ink);
  }
  .amort-row .amort-remove { flex: 0 0 auto; padding: 8px 14px; font-size: 0.85rem; }

  .tabs { display: flex; gap: 8px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
  .tab-btn {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    padding: 10px 4px;
    font-family: 'IBM Plex Sans', sans-serif;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
  }
  .tab-btn.active { color: var(--pine); border-bottom-color: var(--pine); }
  .tab-btn:hover { color: var(--ink); }

  @media (max-width: 760px) {
    .amort-row { flex-direction: column; align-items: stretch; }
    .amort-row .amort-remove { align-self: flex-start; }
  }

  /* ---- VIABILIDAD HIPOTECARIA: estados y lista explicativa ---- */
  .estado-holgada { color: var(--pine); }
  .estado-ajustada { color: var(--amber); }
  .estado-muy-ajustada { color: var(--amber); }
  .estado-no-encaja { color: #B3432B; }
  @media (prefers-color-scheme: dark) { .estado-no-encaja { color: #E08770; } }

  .porque-simbolo { display: inline-block; width: 1.4em; font-weight: 700; }
  .porque-check .porque-simbolo { color: var(--pine); }
  .porque-aviso .porque-simbolo { color: var(--amber); }
  .porque-cruz .porque-simbolo { color: #B3432B; }
  @media (prefers-color-scheme: dark) { .porque-cruz .porque-simbolo { color: #E08770; } }

  /* ---- AUTOCALLABLES: timeline de observaciones ---- */
  .timeline-wrap { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
  .timeline-item {
    flex: 1 1 200px;
    min-width: 180px;
    border: 1px solid var(--line);
    border-left: 3px solid var(--pine);
    border-radius: 3px;
    padding: 12px 14px;
    background: var(--card-bg);
  }
  .timeline-item.timeline-inactivo { border-left-color: var(--muted); opacity: 0.7; }
  .timeline-item strong { display: block; margin-bottom: 6px; font-family: 'IBM Plex Mono', monospace; font-size: 0.85rem; color: var(--pine); }
  .timeline-item.timeline-inactivo strong { color: var(--muted); }
  .timeline-item p { font-size: 0.85rem; margin-bottom: 4px; }
  .timeline-item p:last-child { margin-bottom: 0; }

  .escenario-input-table input[type="number"] {
    width: 100%;
    min-width: 68px;
    font-family: 'IBM Plex Mono', monospace;
    font-size: 0.92rem;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 3px;
    background: var(--bg);
    color: var(--ink);
  }

  /* ---- FUTUROS: fila de aportación en la tabla de liquidación diaria ---- */
  table.amort-table tr.fila-aportacion { background: rgba(184,113,44,0.08); }
