/* =============================================================
   Kalculia UI — sistema de diseño compartido («Fintech vivo»)
   Lo cargan todas las páginas antes de su propio styles.css, que solo
   contiene lo específico de cada herramienta.

   Espaciado: escala única de base 4px (--s-1 … --s-8). Toda separación
   entre bloques, rellenos y huecos de rejilla sale de esta escala, para
   que márgenes y alineaciones sean idénticos en todas las páginas.
   Simetría: las rejillas de tarjetas usan filas de igual altura y los
   contenedores comparten un único ancho máximo, alineado con la cabecera.
   ============================================================= */

@font-face { font-family: "Caveat"; src: url("fonts/caveat-latin-500.woff2") format("woff2"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Caveat"; src: url("fonts/caveat-latin-700.woff2") format("woff2"); font-weight: 700; font-style: normal; font-display: swap; }

/* 1. Tokens */
:root {
  /* Controles nativos (desplegable de <select>, calendario de fecha, barras de
     scroll) en claro u oscuro según el sistema, igual que la página. */
  color-scheme: light dark;
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem; --s-6: 2rem; --s-7: 3rem; --s-8: 4rem;
  --page-max: 1040px;
  --gutter: 1.25rem;

  --bg: #f3f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #0b1411;
  --text-muted: #52605a;
  --rule: #e3e9e6;
  --border: #d3ddd8;
  /* Contorno de los campos de formulario: 3:1 frente a su relleno (--surface-2)
     y frente a la tarjeta (WCAG 1.4.11). --border sigue para separadores. */
  --control-border: #818c87;
  --accent: #047857;
  --accent-dark: #065f46;
  --accent-soft: #d9f5e9;
  --on-accent: #ffffff;
  --brand: #0e6e5b;
  --hero-from: #064e3b;
  --hero-via: #047857;
  --hero-to: #10b981;
  --opt-a: #059669; /* esmeralda-600: 3,8:1 sobre blanco (líneas y barras de gráfico necesitan 3:1) */
  --opt-b: #7c5cff;
  --opt-a-ink: #047857;
  --opt-b-ink: #5b3fd6;
  --loss: #c42531;
  /* Pérdida/ganancia sobre superficie invertida (fondo var(--text)): barra fija
     del móvil y pestañas activas. Sobre fondo oscuro van claros; en el tema
     oscuro ese fondo es claro y pasan a tonos oscuros. */
  --loss-inverse: #ff9aa2;
  --gain-inverse: #7ef0c2;
  --money: #047857;
  --money-soft: #d9f5e9;
  --warning: #8f4708;
  --warning-soft: #fbecd9;
  --pen: #2453c9;
  --active-pct: #34d399;
  --radius-xl: 32px;
  --radius-lg: 24px;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-card: 0 1px 2px rgba(6, 40, 30, .06), 0 12px 32px -18px rgba(6, 60, 44, .28);
  --shadow: var(--shadow-card);
  --shadow-sm: 0 1px 2px rgba(6, 40, 30, .06), 0 6px 16px -10px rgba(6, 60, 44, .22);
  --hero-shadow: 0 24px 40px -28px rgba(4, 80, 58, .55);
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --sans: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Outfit", var(--sans);
  --hand: "Caveat", "Segoe Print", "Bradley Hand", cursive;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0a0f0d; --surface: #131a17; --surface-2: #1a2420;
    --text: #eef3f1; --text-muted: #a6b4ae; --rule: #232e2a; --border: #2f3c37; --control-border: #66726d;
    --accent: #34d399; --accent-dark: #6ee7b7; --accent-soft: #10302a; --on-accent: #04120d;
    --hero-from: #064e3b; --hero-via: #047857; --hero-to: #10b981;
    --opt-a: #34d399; --opt-b: #a78bfa; --opt-a-ink: #6ee7b7; --opt-b-ink: #c4b5fd;
    --loss: #ff6b72; --loss-inverse: #c42531; --gain-inverse: #047857; --money: #6ee7b7; --money-soft: #10302a; --pen: #8fb0ff; --active-pct: #047857;
    --warning: #f4a860; --warning-soft: #3a2711;
    --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -18px rgba(0,0,0,.7);
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 6px 16px -10px rgba(0,0,0,.6);
    --hero-shadow: 0 24px 40px -28px rgba(0,0,0,.8);
  }
}
:root[data-theme="dark"] {
  --bg: #0a0f0d; --surface: #131a17; --surface-2: #1a2420;
  --text: #eef3f1; --text-muted: #a6b4ae; --rule: #232e2a; --border: #2f3c37; --control-border: #66726d;
  --accent: #34d399; --accent-dark: #6ee7b7; --accent-soft: #10302a; --on-accent: #04120d;
  --hero-from: #064e3b; --hero-via: #047857; --hero-to: #10b981;
  --opt-a: #34d399; --opt-b: #a78bfa; --opt-a-ink: #6ee7b7; --opt-b-ink: #c4b5fd;
  --loss: #ff6b72; --loss-inverse: #c42531; --gain-inverse: #047857; --money: #6ee7b7; --money-soft: #10302a; --pen: #8fb0ff; --active-pct: #047857;
  --warning: #f4a860; --warning-soft: #3a2711;
  --shadow-card: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -18px rgba(0,0,0,.7);
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4), 0 6px 16px -10px rgba(0,0,0,.6);
  --hero-shadow: 0 24px 40px -28px rgba(0,0,0,.8);
}

/* 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; overflow-x: clip; }
img, svg, video { display: block; max-width: 100%; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.08; letter-spacing: -0.025em; font-weight: 700; }
ul, ol { padding: 0; margin: 0; list-style: none; }
::selection { background: var(--accent); color: var(--on-accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.skip-link { position: fixed; top: -100px; left: var(--s-4); padding: var(--s-2) var(--s-4); background: var(--accent); color: var(--on-accent); z-index: 100; border-radius: 999px; font-weight: 600; }
.skip-link:focus { top: var(--s-4); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.container { width: 100%; max-width: 880px; margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 960px) { .container { max-width: var(--page-max); } }

/* 3. Cabecera / pie: mismo ancho que el contenido, para que todo quede alineado */
.site-header { position: sticky; top: 0; z-index: 40; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: saturate(1.4) blur(14px); -webkit-backdrop-filter: saturate(1.4) blur(14px); }
.site-header-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); padding-block: var(--s-3); max-width: 880px; margin-inline: auto; padding-inline: var(--gutter); }
@media (min-width: 960px) { .site-header-row { max-width: var(--page-max); padding-block: var(--s-4); } }
.logo { display: flex; align-items: center; gap: .15rem; min-width: 0; font-family: var(--display); font-weight: 800; font-size: 1.08rem; }
.logo strong { color: var(--accent); font-weight: 700; }
.logo svg { flex-shrink: 0; }
.site-nav { display: none; gap: var(--s-1); font-size: .9rem; font-weight: 600; }
.site-nav a { padding: var(--s-2) var(--s-3); border-radius: 999px; color: var(--text-muted); transition: background-color .15s ease, color .15s ease; }
@media (hover: hover) and (pointer: fine) { .site-nav a:hover { background: var(--surface); color: var(--text); } }
.site-nav a[aria-current="page"] { background: var(--surface); color: var(--text); }
@media (min-width: 720px) { .site-nav { display: flex; } }
/* En móvil el menú baja a una segunda fila (se desliza en horizontal si no cabe) para que siempre haya navegación */
@media (max-width: 719px) {
  .site-header-row { flex-wrap: wrap; row-gap: var(--s-1); padding-bottom: var(--s-2); }
  .site-nav { display: flex; order: 3; flex: 1 0 100%; justify-content: space-between; margin-inline: -.3rem; overflow-x: auto; scrollbar-width: none; font-size: .8rem; }
  .site-nav::-webkit-scrollbar { display: none; }
  .site-nav a { flex-shrink: 0; padding: var(--s-1) .3rem; white-space: nowrap; }
  .tool-card { scroll-margin-top: 6.5rem; }
}

.site-footer { padding-block: var(--s-6); margin-top: var(--s-5); border-top: 1px solid var(--rule); }
.footer-row { display: flex; flex-direction: column; gap: var(--s-4); font-size: .85rem; color: var(--text-muted); }
.footer-links { display: flex; flex-wrap: wrap; gap: var(--s-2) var(--s-5); }
@media (hover: hover) and (pointer: fine) { .footer-links a:hover { color: var(--text); } }
@media (min-width: 720px) { .footer-row { flex-direction: row; justify-content: space-between; align-items: center; } }

/* 4. Hero de cada página */
.hero { position: relative; padding-block: var(--s-5) var(--s-4); }
.hero h1 { position: relative; font-size: clamp(2rem, 5.2vw, 3.25rem); max-width: 19ch; font-weight: 800; letter-spacing: -0.035em; }
.hero-sub { position: relative; margin-top: var(--s-3); color: var(--text-muted); font-size: 1.02rem; max-width: 50ch; }
.byline-top { position: relative; margin-top: var(--s-3); font-size: .84rem; color: var(--text-muted); max-width: 60ch; }
.byline-top a { color: var(--text); font-weight: 600; text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 3px; }
@media (min-width: 720px) { .hero { padding-block: var(--s-7) var(--s-5); } .hero-sub { font-size: 1.12rem; } }
/* Objetos 3D junto al titular (decoración) */
.hero-art { position: absolute; right: var(--s-2); top: var(--s-3); width: 96px; height: 96px; pointer-events: none; }
.hero-art img { position: absolute; width: 72px; height: 72px; filter: drop-shadow(0 10px 14px rgba(6, 60, 44, .22)); }
.hero-art-bill { right: 0; top: 0; transform: rotate(14deg); }
.hero-art .hero-art-coin { right: 46px; top: 46px; width: 44px; height: 44px; transform: rotate(-12deg); }
@media (max-width: 559px) { .hero-art { right: var(--s-3); top: var(--s-1); } .hero-art img { width: 54px; height: 54px; } .hero-art .hero-art-coin { right: 36px; top: 40px; width: 34px; height: 34px; } .hero h1 { padding-right: 3.5rem; } }
@media (min-width: 960px) { .hero-art { right: var(--s-8); top: var(--s-7); width: 220px; height: 200px; } .hero-art img { width: 150px; height: 150px; } .hero-art .hero-art-coin { right: 140px; top: 100px; width: 92px; height: 92px; } }

/* 5. Calculadora: los bloques son tarjetas blancas sueltas sobre el fondo gris */
.tool-card { margin-top: var(--s-5); scroll-margin-top: 5rem; }
.tool-card--panel { background: var(--surface); border-radius: var(--radius-xl); padding: var(--s-5) var(--s-4); box-shadow: var(--shadow-card); }
@media (min-width: 720px) { .tool-card--panel { padding: var(--s-6); } }
.notice-nojs { background: var(--warning-soft); color: var(--warning); border-radius: var(--radius); padding: var(--s-3) var(--s-4); font-size: .9rem; margin-bottom: var(--s-4); }

.slider-field { margin-bottom: var(--s-4); padding: var(--s-4) var(--s-4) var(--s-3); background: var(--surface); border-radius: var(--radius-lg); }
.slider-field-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); margin-bottom: var(--s-1); }
.slider-field-head label { font-size: .84rem; font-weight: 600; color: var(--text-muted); }
.slider-number {
  width: 8rem; text-align: right; font: inherit; font-family: var(--display); font-size: 1.45rem; font-weight: 700; letter-spacing: -0.02em; color: var(--text);
  padding: .1rem .2rem; border: 0; border-radius: 8px; background: transparent; font-variant-numeric: tabular-nums;
  transition: background-color .15s ease, box-shadow .15s ease;
}
.slider-number:not(:focus) { box-shadow: none; }
.slider-number::placeholder { color: var(--text-muted); font-weight: 500; font-size: .95rem; letter-spacing: 0; opacity: .8; }
.slider-number:focus { outline: none; background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.slider-number--pct { width: 5.5rem; }
.slider-number::-webkit-outer-spin-button, .slider-number::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }
.slider-number { -moz-appearance: textfield; appearance: textfield; }

input[type="range"] { width: 100%; height: 26px; padding: 0; border: 0; background: transparent; cursor: pointer; appearance: none; -webkit-appearance: none; accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 999px; background: var(--border); }
input[type="range"]::-moz-range-progress { height: 6px; border-radius: 999px; background: var(--accent); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; margin-top: -8px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px rgba(6, 40, 30, .25); transition: transform .15s var(--ease-out); }
input[type="range"]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 0 0 1px rgba(0,0,0,.08), 0 2px 6px rgba(6, 40, 30, .25); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.12); }

/* Campos genéricos (hipoteca, amortización, tax free…). :where() deja la especificidad a cero
   para que las clases propias de cada herramienta manden. */
.field { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-4); }
.field label, fieldset.field legend { font-size: .84rem; font-weight: 600; color: var(--text-muted); }
fieldset.field { border: 0; padding: 0; }
.field-hint { font-size: .78rem; color: var(--text-muted); font-weight: 400; }
.field-row { display: grid; grid-template-columns: 1fr; gap: 0 var(--s-4); }
@media (min-width: 480px) { .field-row { grid-template-columns: 1fr 1fr; } }
:where(input[type="number"], input[type="text"], input[type="email"], input[type="date"], select, textarea) {
  width: 100%; font: inherit; font-size: 1rem; font-weight: 600; color: var(--text);
  padding: .7rem .9rem; border: 0; border-radius: var(--radius-sm); background: var(--surface-2);
  box-shadow: inset 0 0 0 1px var(--control-border); transition: box-shadow .15s ease;
}
:where(input[type="number"], input[type="text"], input[type="email"], input[type="date"], select, textarea):focus { outline: none; box-shadow: inset 0 0 0 2px var(--accent); }
:where(select) { appearance: none; padding-right: 2.4rem; background-image: linear-gradient(45deg, transparent 50%, var(--text-muted) 50%), linear-gradient(135deg, var(--text-muted) 50%, transparent 50%); background-position: calc(100% - 20px) center, calc(100% - 14px) center; background-size: 6px 6px; background-repeat: no-repeat; }
.field label span[data-out] { color: var(--accent); font-weight: 700; }
.checkbox-inline { display: flex; align-items: flex-start; gap: var(--s-2); font-size: .9rem; font-weight: 500; color: var(--text); cursor: pointer; line-height: 1.45; }
.checkbox-inline input[type="checkbox"] { width: 18px; height: 18px; margin-top: .15rem; flex-shrink: 0; accent-color: var(--accent); cursor: pointer; }

.radio-row { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.radio-pill {
  display: flex; align-items: center; gap: var(--s-2); border-radius: 999px; background: var(--surface-2);
  padding: .55rem 1rem; font-size: .9rem; font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--border);
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s var(--ease-out);
}
.radio-pill:active { transform: scale(0.97); }
.radio-pill input[type="radio"] { accent-color: var(--accent); }
.radio-pill:has(input:checked) { background: var(--text); color: var(--surface); box-shadow: none; }
.radio-pill:has(input:checked) input[type="radio"] { accent-color: var(--active-pct); }

/* Chips y píldoras */
.rate-chips { display: flex; gap: var(--s-2); flex-wrap: wrap; margin-top: var(--s-2); }
.rate-chip, .cc-preset-chip, .mode-toggle-btn, .vista-toggle-btn, .horizonte-chip, .stress-tab {
  border: 0; border-radius: 999px; background: var(--surface-2);
  padding: .42rem .85rem; font-size: .82rem; font-weight: 600; color: var(--text);
  box-shadow: inset 0 0 0 1px var(--border);
  transition: background-color .15s ease, color .15s ease, box-shadow .15s ease, transform .12s var(--ease-out);
}
.rate-chip:active, .cc-preset-chip:active, .mode-toggle-btn:active, .vista-toggle-btn:active, .horizonte-chip:active, .stress-tab:active { transform: scale(0.96); }
@media (hover: hover) and (pointer: fine) { .rate-chip:hover, .cc-preset-chip:hover, .mode-toggle-btn:hover, .vista-toggle-btn:hover, .horizonte-chip:hover, .stress-tab:hover { box-shadow: inset 0 0 0 1px var(--text); } }
.rate-chip.is-active, .cc-preset-chip.is-active, .mode-toggle-btn.is-active, .vista-toggle-btn.is-active, .horizonte-chip.is-active, .stress-tab.is-active { background: var(--text); color: var(--surface); box-shadow: none; }
/* En pantallas táctiles, 44px de alto mínimo para el dedo; con ratón se mantiene el tamaño compacto. */
@media (pointer: coarse) {
  .rate-chip, .btn-sm, .mode-toggle-btn, .vista-toggle-btn, .horizonte-chip, .stress-tab, .radio-pill { min-height: 44px; }
  .cc-preset-chip { min-height: 44px; align-items: center; }
}

.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); border-radius: 999px; font-weight: 700; font-size: .95rem; padding: .8rem 1.5rem; transition: background-color .15s ease, box-shadow .15s ease, transform .12s var(--ease-out); }
.btn:active { transform: scale(0.97); }
.btn-primary { background: var(--text); color: var(--surface); }
.btn-primary:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-sm { padding: .5rem 1rem; font-size: .85rem; }
.btn-block { width: 100%; }
.btn-secondary { background: var(--surface-2); color: var(--text); }
@media (hover: hover) and (pointer: fine) { .btn-primary:not(:disabled):hover { background: color-mix(in srgb, var(--text) 85%, var(--accent)); } .btn-secondary:hover { background: var(--border); } }

.privacy-badge { margin-top: var(--s-5); font-size: .82rem; color: var(--text-muted); text-align: center; }
.tiny-note { font-size: .8rem; color: var(--text-muted); margin-top: var(--s-2); }

.toggle-field { display: flex; align-items: flex-start; gap: var(--s-3); margin-bottom: var(--s-4); padding: var(--s-4); background: var(--accent-soft); border-radius: var(--radius); font-size: .86rem; color: var(--text); cursor: pointer; }
.toggle-field input { width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; margin-top: .1rem; }
.toggle-field strong { font-weight: 700; }

/* 6. Resultado: la tarjeta protagonista en verde Kalculia vivo */
.ic-result { margin-top: var(--s-6); }
.cc-hero-card {
  position: relative; isolation: isolate; padding: var(--s-5) var(--s-5) var(--s-5); border-radius: var(--radius-xl); color: #fff;
  background:
    radial-gradient(60% 70% at 100% 0%, color-mix(in srgb, var(--hero-to) 90%, transparent) 0%, transparent 70%),
    linear-gradient(150deg, var(--hero-from) 0%, var(--hero-via) 70%, var(--hero-to) 140%);
  box-shadow: var(--hero-shadow);
}
@media (min-width: 720px) { .cc-hero-card { padding: var(--s-6) var(--s-6) var(--s-6); } }
.cc-hero-card .ic-headline-label { position: relative; z-index: 1; font-size: .92rem; font-weight: 600; color: #fff; max-width: 26ch; text-transform: none; letter-spacing: 0; }
@media (max-width: 719px) { .cc-hero-card .ic-headline-label { padding-right: 6.5rem; } }
.cc-hero-card .ic-headline { position: relative; z-index: 1; font-family: var(--display); font-size: clamp(3rem, 13vw, 5.4rem); font-weight: 800; line-height: .95; letter-spacing: -0.04em; color: #fff; margin-top: var(--s-2); font-variant-numeric: tabular-nums; }
.cc-hero-card .cc-headline-sub { position: relative; z-index: 1; margin-top: var(--s-4); font-size: .92rem; color: #fff; max-width: 44ch; }
.cc-hero-bill, .cc-hero-coin { position: absolute; pointer-events: none; z-index: 0; filter: drop-shadow(0 14px 18px rgba(2, 30, 20, .35)); }
.cc-hero-bill { width: 96px; height: 96px; right: -10px; top: -34px; transform: rotate(16deg); }
.cc-hero-coin { width: 56px; height: 56px; right: 70px; top: -16px; transform: rotate(-14deg); }
@media (min-width: 720px) { .cc-hero-bill { width: 150px; height: 150px; right: 18px; top: -44px; } .cc-hero-coin { width: 82px; height: 82px; right: 150px; top: -22px; } }
/* Cifra que es una pérdida (p. ej. poder adquisitivo): la misma tarjeta en granate.
   Blanco sobre su tono más claro (#c42531) da 5,6:1. */
.cc-hero-card--loss { --hero-from: #3b0d14; --hero-via: #7f1d2a; --hero-to: #c42531; --hero-shadow: 0 24px 40px -28px rgba(80, 12, 22, .6); }
.cc-hero-badge { position: relative; z-index: 1; display: inline-flex; margin-top: var(--s-3); padding: .3rem .8rem; border-radius: 999px; background: rgba(255, 255, 255, .16); color: #fff; font-size: .9rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.cc-hero-badge[hidden] { display: none; }

/* Notas a mano del autor */
.cc-note { font-family: var(--hand); font-weight: 700; font-size: 1.35rem; line-height: 1.3; color: var(--pen); }
.cc-note::before { content: "↑ "; }
.cc-note--hero { position: relative; z-index: 1; margin-top: var(--s-4); color: #fff6b0; display: inline-block; transform: rotate(-2deg); }
.cc-note--below { display: block; margin: var(--s-4) 0 0 var(--s-1); transform: rotate(-1deg); max-width: 36ch; }
.cc-note-sign { display: block; font-weight: 500; font-size: 1.1rem; margin-top: .1rem; opacity: .85; }

/* Cifras de resultado en rejilla (interés compuesto, amortización, hipoteca, tax free) */
.calc-result-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-3); }
@media (min-width: 640px) { .calc-result-grid { grid-auto-rows: 1fr; } }
@media (min-width: 640px) { .calc-result-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 640px) { .calc-result-grid--3 { grid-template-columns: repeat(3, 1fr); } }
.result-stat { display: flex; flex-direction: column; justify-content: space-between; gap: var(--s-2); padding: var(--s-4) var(--s-4); border-radius: var(--radius-lg); background: var(--surface-2); }
.result-label { font-size: .84rem; font-weight: 600; color: var(--text-muted); }
.result-value { font-family: var(--display); font-size: 1.6rem; font-weight: 800; letter-spacing: -0.02em; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1.1; }
.result-value--sm { font-size: 1.2rem; }
.result-note { font-size: .8rem; color: var(--text-muted); }
/* La cifra principal de una rejilla toma la tarjeta verde */
.result-stat--highlight { color: #fff; background: linear-gradient(150deg, var(--hero-from) 0%, var(--hero-via) 100%); box-shadow: var(--hero-shadow); }
.result-stat--highlight .result-label, .result-stat--highlight .result-note { color: #fff; }
.result-stat--highlight .result-value { color: #fff; }
.result-warning { margin-top: var(--s-4); background: var(--warning-soft); color: var(--warning); border-radius: var(--radius); padding: var(--s-3) var(--s-4); font-size: .88rem; font-weight: 600; }
.result-disclaimer { margin-top: var(--s-5); font-size: .8rem; color: var(--text-muted); }

/* Primera aparición del resultado: caen los objetos y se escriben las notas */
@keyframes kc-drop-bill { 0% { opacity: 0; transform: translateY(-38px) rotate(-10deg) scale(.9); } 70% { opacity: 1; } 100% { opacity: 1; transform: translateY(0) rotate(16deg) scale(1); } }
@keyframes kc-drop-coin { 0% { opacity: 0; transform: translateY(-48px) rotate(40deg) scale(.9); } 100% { opacity: 1; transform: translateY(0) rotate(-14deg) scale(1); } }
@keyframes kc-write { from { clip-path: inset(0 100% 0 0); } to { clip-path: inset(0 0 0 0); } }
@keyframes kc-rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes kc-fade { from { opacity: 0; } to { opacity: 1; } }
.is-revealing .cc-hero-card { animation: kc-rise 320ms var(--ease-out) both; }
.is-revealing .cc-hero-bill { animation: kc-drop-bill 520ms cubic-bezier(0.34, 1.4, 0.64, 1) 160ms both; }
.is-revealing .cc-hero-coin { animation: kc-drop-coin 520ms cubic-bezier(0.34, 1.4, 0.64, 1) 260ms both; }
.is-revealing .cc-note { animation: kc-write 600ms ease-out 650ms both; }
@media (prefers-reduced-motion: reduce) {
  .is-revealing .cc-hero-card, .is-revealing .cc-hero-bill, .is-revealing .cc-hero-coin, .is-revealing .cc-note { animation: kc-fade 200ms ease both; }
}

/* 7. Gráficos */
.chart-wrap { margin-top: var(--s-5); background: var(--surface); border-radius: var(--radius-lg); padding: var(--s-4); position: relative; }
.chart-download-btn { margin-top: var(--s-4); }

/* Tarjeta para descargar la imagen de compartir: gris, con la moneda 3D, fácil de encontrar */
.share-card { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: var(--s-3) var(--s-4); margin-top: var(--s-4); padding: var(--s-4) var(--s-5); background: var(--surface-2); border-radius: var(--radius-lg); box-shadow: inset 0 0 0 1px var(--rule); }
.share-card-art { width: 52px; height: 52px; transform: rotate(-8deg); filter: drop-shadow(0 6px 10px rgba(6, 40, 30, .18)); }
.share-card-title { font-family: var(--display); font-weight: 800; font-size: 1.08rem; letter-spacing: -0.01em; color: var(--text); line-height: 1.2; }
.share-card-sub { margin-top: var(--s-1); font-size: .88rem; color: var(--text-muted); line-height: 1.5; }
.share-card-btn { grid-column: 1 / -1; display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); width: 100%; }
@media (min-width: 640px) {
  .share-card { grid-template-columns: auto 1fr auto; }
  .share-card-btn { grid-column: auto; width: auto; white-space: nowrap; }
}
/* Dos formatos de imagen: horizontal para X (principal) y vertical */
.share-card-actions { grid-column: 1 / -1; display: flex; gap: var(--s-2); }
.share-card-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--s-2); white-space: nowrap; }
.share-card-actions .btn-primary { flex: 1 1 auto; }
/* La tarjeta ya es --surface-2: el secundario necesita su propio fondo y contorno para leerse como botón */
.share-card-actions .btn-secondary { background: var(--surface); box-shadow: inset 0 0 0 1px var(--border); }
.share-card-actions .btn[aria-busy="true"] { opacity: .7; cursor: progress; }
@media (min-width: 640px) { .share-card-actions { grid-column: auto; } }
/* Enlace secundario: abre X con el texto y el enlace a este cálculo ya escritos */
.share-card-post { grid-column: 1 / -1; justify-self: start; font-size: .86rem; font-weight: 600; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; }
@media (hover: hover) and (pointer: fine) { .share-card-post:hover { color: var(--text); } }
.chart-legend { display: flex; flex-wrap: wrap; gap: var(--s-1) var(--s-5); margin-top: var(--s-3); font-size: .82rem; color: var(--text-muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: var(--s-2); }
.chart-legend i { width: 10px; height: 10px; display: inline-block; border-radius: 50%; }
.chart-tooltip { position: absolute; pointer-events: none; z-index: 5; background: var(--text); color: var(--surface); font-size: .8rem; line-height: 1.5; padding: var(--s-2) var(--s-3); border-radius: var(--radius-sm); transform: translate(-50%, -110%); white-space: nowrap; font-variant-numeric: tabular-nums; }
.chart-tooltip strong { display: block; font-size: .85rem; margin-bottom: .1rem; }
/* Filas comunes de todos los tooltips: punto del color de la serie, etiqueta y cifra a la derecha;
   la última fila es la diferencia, en verde o rojo legibles sobre el fondo invertido */
.chart-tooltip .tt-row { display: flex; align-items: center; gap: var(--s-2); }
.chart-tooltip .tt-row b { margin-left: auto; padding-left: var(--s-4); font-weight: 700; }
.chart-tooltip .tt-dot { flex: none; width: 8px; height: 8px; border-radius: 50%; }
.chart-tooltip .tt-dot--a { background: var(--opt-a); }
.chart-tooltip .tt-dot--b { background: var(--opt-b); }
.chart-tooltip .tt-diff { margin-top: .25rem; padding-top: .25rem; border-top: 1px solid color-mix(in srgb, var(--surface) 25%, transparent); }
.chart-tooltip .tt-diff--gain b { color: var(--gain-inverse); }
.chart-tooltip .tt-diff--loss b { color: var(--loss-inverse); }

/* 8. Tablas */
.gastos-breakdown { margin-top: var(--s-5); font-size: .88rem; }
.gastos-breakdown summary { cursor: pointer; font-weight: 700; color: var(--text); list-style: none; display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--radius); background: var(--surface-2); font-size: .92rem; transition: background-color .15s ease; }
.gastos-breakdown summary::-webkit-details-marker { display: none; }
.gastos-breakdown summary::after { content: ""; width: 9px; height: 9px; flex-shrink: 0; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .2s var(--ease-out); }
.gastos-breakdown[open] summary::after { transform: translateY(2px) rotate(-135deg); }
@media (hover: hover) and (pointer: fine) { .gastos-breakdown summary:hover { background: var(--accent-soft); } }
.gastos-breakdown > .table-controls { margin-top: var(--s-3); }
.gastos-breakdown ul { margin-top: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); }
.gastos-breakdown li { display: flex; justify-content: space-between; gap: var(--s-3); color: var(--text-muted); padding-bottom: var(--s-2); border-bottom: 1px solid var(--rule); }
.gastos-breakdown li span:last-child { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.table-scroll { overflow-x: auto; margin-top: var(--s-3); border-radius: var(--radius); background: var(--surface); }
.vat-table { width: 100%; border-collapse: collapse; min-width: 420px; font-size: .86rem; font-variant-numeric: tabular-nums; }
.vat-table th, .vat-table td { text-align: right; padding: var(--s-3) var(--s-4); border-bottom: 1px solid var(--rule); }
.vat-table th:first-child, .vat-table td:first-child { text-align: left; }
.vat-table thead th { font-weight: 700; color: var(--text-muted); font-size: .8rem; background: var(--surface); position: sticky; top: 0; }
.vat-table tbody tr:last-child td { border-bottom: 0; }
.vat-table-section { padding-block: var(--s-7) var(--s-4); }
.vat-table-section h2 { font-size: clamp(1.5rem, 3.6vw, 2.2rem); font-weight: 800; letter-spacing: -0.03em; }
.table-controls { display: flex; align-items: center; gap: var(--s-3); margin-top: var(--s-5); flex-wrap: wrap; }
.table-controls label { font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.table-controls select { width: auto; }

/* 9. Huecos de anuncio (la ubicación no se toca, solo el aspecto) */
.ad-slot { display: flex; align-items: center; justify-content: center; border: 1.5px dashed var(--border); border-radius: var(--radius); color: var(--text-muted); font-size: .8rem; font-weight: 700; background: var(--surface-2); position: relative; }
.ad-slot--leaderboard { min-height: 90px; margin: var(--s-5) auto; max-width: 880px; }
.ad-slot--rectangle { min-height: 250px; max-width: 336px; width: 100%; margin: var(--s-5) auto; }
.ad-slot--in-content { min-height: 250px; margin: var(--s-6) auto; max-width: 880px; }
.ad-slot--sticky { position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; min-height: 64px; border-radius: 0; border-inline: 0; border-bottom: 0; box-shadow: var(--shadow-card); }
.sticky-ad-close { position: absolute; top: 4px; right: 6px; width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); color: var(--text-muted); font-size: 1rem; box-shadow: var(--shadow-sm); }
@media (min-width: 1280px) { .ad-slot--sticky { left: auto; bottom: var(--s-5); right: var(--s-5); width: 300px; min-height: 250px; border-radius: var(--radius); border: 1.5px dashed var(--border); } }

/* 10. Secciones de lectura: mismo ritmo vertical en todas las páginas */
.steps, .faq, .mas-herramientas { padding-block: var(--s-7) var(--s-4); }
.steps h2, .faq h2, .mas-herramientas h2, .section-title { font-size: clamp(1.5rem, 3.6vw, 2.2rem); margin-bottom: var(--s-5); font-weight: 800; letter-spacing: -0.03em; }
.steps-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-4); }
@media (min-width: 720px) { .steps-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; } }
.step-card { background: var(--surface); border-radius: var(--radius-lg); padding: var(--s-5); }
.step-card svg { width: 40px; height: 40px; padding: 8px; border-radius: 12px; background: var(--accent-soft); color: var(--accent); margin-bottom: var(--s-4); }
.step-card h3 { font-size: 1.05rem; margin-bottom: var(--s-2); }
.step-card p { color: var(--text-muted); font-size: .92rem; }
.step-card strong { color: var(--text); font-variant-numeric: tabular-nums; }
/* Subtítulo de sección: nunca con margen negativo (se montaba sobre el título); el título que lo precede deja un hueco fijo */
.section-sub { color: var(--text-muted); margin-top: 0; margin-bottom: var(--s-5); max-width: 62ch; }
:is(h1, h2, h3):has(+ .section-sub) { margin-bottom: var(--s-3) !important; }
.section-sub a { color: var(--accent); font-weight: 700; }

.mistakes-list { display: flex; flex-direction: column; gap: var(--s-2); }
.mistakes-list li { background: var(--surface); border-radius: var(--radius); padding: var(--s-4) var(--s-5); font-size: .92rem; color: var(--text-muted); }
.mistakes-list li strong { color: var(--text); display: block; margin-bottom: .15rem; }

.faq { padding-bottom: var(--s-7); }
.faq-item { background: var(--surface); border-radius: var(--radius); margin-bottom: var(--s-2); }
.faq-item summary { padding: var(--s-4) var(--s-5); font-weight: 700; cursor: pointer; list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--s-4); }
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary::after { content: "+"; display: grid; place-items: center; width: 28px; height: 28px; flex-shrink: 0; border-radius: 50%; background: var(--surface-2); font-size: 1.1rem; color: var(--text); transition: transform .2s var(--ease-out); }
.faq-item[open] summary::after { transform: rotate(45deg); }
.faq-item p { padding: 0 var(--s-5) var(--s-4); color: var(--text-muted); font-size: .94rem; }
.faq-item p a { color: var(--accent); font-weight: 600; }

/* 11. Bloque de afiliado */
.cta-broker { background: var(--surface); border-radius: var(--radius-lg); padding: var(--s-5); margin-top: var(--s-5); }
.cta-broker-label { display: inline-block; font-size: .75rem; font-weight: 600; color: var(--text-muted); background: var(--surface-2); border-radius: 999px; padding: .2rem .65rem; margin-bottom: var(--s-3); text-transform: none; letter-spacing: 0; }
.cta-broker h2, .cta-broker h3 { font-size: 1.15rem; margin-bottom: var(--s-2); }
.cta-broker > p { font-size: .92rem; line-height: 1.55; color: var(--text-muted); max-width: 60ch; margin-bottom: var(--s-4); }
.cta-broker .btn { margin-bottom: var(--s-4); }
.cta-broker-disclaimer { font-size: .78rem; color: var(--text-muted); max-width: 64ch; }
.cta-broker-disclaimer a { color: var(--text); text-decoration: underline; text-underline-offset: 2px; }

/* 12. Más herramientas: rejilla de filas iguales */
.mini-tools-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-2); }
@media (min-width: 640px) {
  .mini-tools-grid { grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; }
  /* Si sobra una tarjeta en la última fila de tres, ocupa la fila entera */
  .mini-tools-grid > :last-child:nth-child(3n+1) { grid-column: 1 / -1; }
}
.mini-tool-card { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); background: var(--surface); border-radius: var(--radius); padding: var(--s-4) var(--s-5); font-weight: 700; font-size: .94rem; transition: transform .15s var(--ease-out), box-shadow .15s ease; }
.mini-tool-card::after { content: "→"; color: var(--accent); margin-left: auto; }
.mini-tool-card:has(.mini-tool-emoji) { justify-content: flex-start; padding-left: var(--s-4); }
.mini-tool-emoji { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 12px; background: var(--accent-soft); font-size: 1.25rem; line-height: 1; }
@media (hover: hover) and (pointer: fine) { .mini-tool-emoji { transition: transform .25s var(--ease-out); } .mini-tool-card:hover .mini-tool-emoji { transform: scale(1.1) rotate(-6deg); } }
.mini-tool-card:active { transform: scale(0.98); }
@media (hover: hover) and (pointer: fine) { .mini-tool-card:hover { box-shadow: var(--shadow-card); } }

.about-list { display: flex; flex-direction: column; gap: var(--s-2); font-size: .92rem; }
.about-list a { color: var(--accent); font-weight: 700; }

/* 13. Ayudas */
@media (max-width: 1279px) { body { padding-bottom: 76px; } }

/* 14. Comparación de dos opciones (comparador de comisiones y coste de la inflación) */
/* Chips de producto */
.cc-preset-chip { display: inline-flex; align-items: baseline; gap: .35rem; cursor: pointer; font: inherit; font-size: .82rem; font-weight: 600; }
.cc-preset-chip span { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.cc-preset-chip.is-active span { color: var(--active-pct); }

/* Las dos opciones del formulario */
.cc-options-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); margin-bottom: var(--s-2); }
@media (min-width: 640px) { .cc-options-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cc-option { min-width: 0; padding: var(--s-4); border-radius: var(--radius-lg); background: var(--surface); }
.cc-option::before { display: inline-flex; align-items: center; gap: .45rem; margin-bottom: var(--s-3); font-family: var(--display); font-size: 1rem; font-weight: 700; color: var(--opt-a-ink); }
.cc-option--a::before { content: "● Opción A"; }
.cc-option--b::before { content: "● Opción B"; color: var(--opt-b-ink); }
.cc-preset-chips { display: flex; flex-wrap: wrap; gap: var(--s-2); margin-bottom: var(--s-3); }
.cc-option-or { font-size: .78rem; color: var(--text-muted); margin: 0 0 var(--s-2); }
.cc-presets-note { font-size: .78rem; color: var(--text-muted); margin-top: var(--s-2); }
.cc-presets-note a { color: var(--text); text-decoration: underline; text-decoration-color: var(--border); text-underline-offset: 2px; }
.cc-option-name { margin-bottom: var(--s-3); font-size: .92rem; }
.cc-option-field { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.cc-option-field label { font-size: .82rem; font-weight: 600; color: var(--text-muted); }
.cc-option-field input[type="number"] { width: 6rem; text-align: right; font-family: var(--display); font-size: 1.2rem; font-weight: 700; padding: .35rem .6rem; font-variant-numeric: tabular-nums; -moz-appearance: textfield; appearance: textfield; }
.cc-option-field input::-webkit-outer-spin-button, .cc-option-field input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

/* Apuntes de cada opción: dos tarjetas iguales */
.cc-compare-grid { display: grid; grid-template-columns: 1fr; gap: var(--s-4); margin-top: var(--s-5); }
@media (min-width: 640px) { .cc-compare-grid { grid-template-columns: 1fr 1fr; } }
.cc-option-card { position: relative; padding: var(--s-4) var(--s-5); border-radius: var(--radius-lg); background: var(--surface); }
.cc-option-title { display: flex; align-items: center; gap: var(--s-2); font-family: var(--display); font-weight: 700; font-size: 1rem; line-height: 1.25; margin-bottom: var(--s-3); color: var(--opt-a-ink); }
.cc-option-title::before { content: ""; flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--opt-a); }
:is(#cc-card-b, #ci-card-b) .cc-option-title { color: var(--opt-b-ink); }
:is(#cc-card-b, #ci-card-b) .cc-option-title::before { background: var(--opt-b); }
.cc-option-card--winner { box-shadow: inset 0 0 0 2px var(--opt-a); }
:is(#cc-card-b, #ci-card-b).cc-option-card--winner { box-shadow: inset 0 0 0 2px var(--opt-b); }
.cc-option-card--winner::after { content: "Más barata"; position: absolute; top: -10px; right: var(--s-4); padding: .15rem .6rem; border-radius: 999px; background: var(--text); color: var(--surface); font-size: .72rem; font-weight: 700; }
.cc-stat-row { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); padding-block: .38rem; font-size: .88rem; }
.cc-stat-row span:first-child { color: var(--text-muted); }
.cc-stat-row span:last-child { font-weight: 700; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cc-stat-row .cc-stat-lost { color: var(--loss); }
.cc-stat-row--final { margin-top: var(--s-2); padding-top: var(--s-3); border-top: 1px solid var(--border); }
.cc-stat-row--final span:first-child { color: var(--text); font-weight: 600; }
.cc-stat-row--final span:last-child { font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.02em; }
.is-revealing .cc-option-card { animation: kc-rise 300ms var(--ease-out) both; }
.is-revealing :is(#cc-card-b, #ci-card-b) { animation-delay: 60ms; }
@media (prefers-reduced-motion: reduce) { .is-revealing .cc-option-card { animation: kc-fade 200ms ease both; } }

/* 15. Calculadoras con campos normales (hipoteca, amortización, tax free): el bloque es un panel blanco.
   Las de deslizadores (interés compuesto, inflación, comparador) usan tarjetas sueltas. */
.tool-card:not(:has(.slider-field)) { background: var(--surface); border-radius: var(--radius-xl); padding: var(--s-5) var(--s-4); box-shadow: var(--shadow-card); }
@media (min-width: 720px) { .tool-card:not(:has(.slider-field)) { padding: var(--s-6); } }
.radio-pill--stack { align-items: flex-start; border-radius: var(--radius); padding: var(--s-3) var(--s-4); }
.radio-pill--stack span { display: flex; flex-direction: column; gap: .1rem; }
.radio-pill--stack small { font-size: .76rem; font-weight: 500; color: var(--text-muted); }
.radio-pill--stack:has(input:checked) small { color: color-mix(in srgb, var(--surface) 80%, transparent); }
.block-title { font-size: 1.15rem; margin-bottom: var(--s-4); }
.block-title-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-4); margin: var(--s-5) 0 var(--s-4); flex-wrap: wrap; }
.block-title-row .block-title { margin-bottom: 0; }
.offer-remove { position: absolute; top: var(--s-3); right: var(--s-3); width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: var(--surface); box-shadow: var(--shadow-sm); font-size: 1.1rem; color: var(--text-muted); }
.ic-comparativa { margin-top: var(--s-4); padding: var(--s-4) var(--s-5); font-size: .92rem; color: var(--text-muted); background: var(--surface); border-radius: var(--radius-lg); }
.tool-card:not(:has(.slider-field)) .ic-comparativa { background: var(--surface-2); }
.ic-comparativa strong { color: var(--text); font-variant-numeric: tabular-nums; }


/* 16. Simetría: opciones con descripción del mismo ancho; columnas de lectura alineadas al borde del titular */
.radio-row:has(> .radio-pill--stack) > .radio-pill--stack { flex: 1 1 0; min-width: 9rem; }
.about-article.container, .article.container { max-width: 880px; }
@media (min-width: 960px) { .about-article.container, .article.container { max-width: var(--page-max); } }
.about-article.container > *, .article.container > * { max-width: 720px; }
/* Inflación: la tarjeta ganadora tiene más poder adquisitivo, no es «más barata»; lo perdido en rojo */
#ci-card-a.cc-option-card--winner::after, #ci-card-b.cc-option-card--winner::after { content: "Mejor opción"; }
.cc-stat-row .cc-stat-perdido { color: var(--loss); }
/* Interés compuesto: la frase del porcentaje no es una cifra */
#res-porcentaje { font-family: var(--sans); font-size: 1rem; font-weight: 700; letter-spacing: 0; line-height: 1.35; }

/* 17. Ritmo tipográfico: espacio entre palabras y entre título y descripción.
   El interletrado negativo de los titulares también estrecha el espacio entre palabras;
   se compensa con word-spacing, más cuanto más apretado es el titular. */
h1, h2, h3, h4 { word-spacing: .04em; }
.hero h1, .hub-hero h1, .page-intro h1, .b-block.arquetipo-head .arquetipo-nombre, .featured-banner h2,
.steps h2, .faq h2, .mas-herramientas h2, .vat-table-section h2, .tool-picker h2 { word-spacing: .1em; }
.cc-hero-card .ic-headline, .result-value, .cc-stat-row--final span:last-child { word-spacing: .06em; }
p, li, dd { line-height: 1.65; }
.hero-sub { margin-top: var(--s-4); line-height: 1.55; }
.byline-top { margin-top: var(--s-4); }
.step-card h3, .why-card h3, .hub-card h3 { margin-bottom: var(--s-3); line-height: 1.2; }
.step-card p, .why-card p, .hub-card p { line-height: 1.65; }
.mistakes-list li strong { margin-bottom: var(--s-1); }
.faq-item p { line-height: 1.7; }
.faq-item summary { line-height: 1.4; }
.section-sub { line-height: 1.6; }
.cta-broker h2, .cta-broker h3 { margin-bottom: var(--s-3); }
.cta-broker-label { margin-bottom: var(--s-4); }
.field { gap: var(--s-2); }
.field-hint { line-height: 1.5; margin-top: var(--s-1); }
.radio-pill--stack span { gap: var(--s-1); }
.radio-pill--stack small { line-height: 1.4; }
.toggle-field { line-height: 1.55; }
.result-stat { gap: var(--s-3); }
.result-note { line-height: 1.45; }
.cc-option-or { margin-bottom: var(--s-2); }
.cc-headline-sub { line-height: 1.55; }
.cc-hero-card .ic-headline-label { line-height: 1.4; }
.slider-field-head label { line-height: 1.35; }
.tiny-note { line-height: 1.5; }

/* 18. Banner de cookies (assets/consent.js inyecta su propio CSS; aquí solo se viste con el sistema).
   Rechazar y Aceptar mantienen exactamente el mismo tamaño: rechazar debe ser igual de fácil. */
body .kc-banner { left: var(--s-3); right: var(--s-3); bottom: var(--s-3); border: 0; border-radius: var(--radius-xl); background: var(--surface); color: var(--text); box-shadow: 0 2px 6px rgba(6, 40, 30, .08), 0 24px 60px -20px rgba(6, 40, 30, .45); font-family: var(--sans); }
@media (min-width: 720px) { body .kc-banner { left: 50%; right: auto; width: min(960px, calc(100% - 2 * var(--s-5))); transform: translateX(-50%); bottom: var(--s-5); } }
body .kc-inner { padding: var(--s-5); gap: var(--s-4) var(--s-6); }
body .kc-title { font-family: var(--display); font-size: 1.05rem; font-weight: 800; letter-spacing: -0.01em; margin-bottom: var(--s-2); }
body .kc-text p { line-height: 1.55; }
body .kc-text a { color: var(--accent); }
body .kc-btn { min-height: 44px; padding: 0 var(--s-5); border: 0; border-radius: 999px; font-weight: 700; background: var(--surface-2); color: var(--text); box-shadow: inset 0 0 0 1px var(--border); transition: background-color .15s ease, transform .12s var(--ease-out); }
body .kc-btn:active { transform: scale(0.97); }
@media (hover: hover) and (pointer: fine) { body .kc-btn:hover { background: var(--border); } }
body .kc-btn--main { background: var(--text); color: var(--surface); box-shadow: none; }
@media (hover: hover) and (pointer: fine) { body .kc-btn--main:hover { background: color-mix(in srgb, var(--text) 85%, var(--accent)); } }
body .kc-btn--link { background: transparent; box-shadow: none; }
body .kc-row { border: 0; border-radius: var(--radius); background: var(--surface-2); padding: var(--s-3) var(--s-4); }
body .kc-switch input:checked + span { background: var(--accent); }

/* Los objetos 3D asoman de las tarjetas a propósito, pero nunca deben crear scroll horizontal */
main { overflow-x: clip; }

/* =============================================================
   19. Móvil: ayudas comunes (assets/kalculia-mobile.js) y cabecera compacta
   ============================================================= */
.hero-sub--short { display: none; }
.calc-missing { margin-top: var(--s-3); padding: var(--s-3) var(--s-4); border-radius: var(--radius); background: var(--accent-soft); color: var(--accent-dark); font-size: .9rem; font-weight: 600; }
.calc-missing[hidden] { display: none; }
.mini-bar { display: none; }
.collapse-toggle { display: none; }
@media (max-width: 719px) {
  .mini-bar { display: grid; grid-template-columns: repeat(3, 1fr); position: fixed; left: var(--s-3); right: var(--s-3); bottom: calc(var(--s-3) + env(safe-area-inset-bottom, 0px)); z-index: 40; padding: var(--s-2) var(--s-3); border-radius: var(--radius-lg); background: var(--text); color: var(--surface); box-shadow: 0 10px 30px rgba(6, 20, 14, .28); transform: translateY(140%); opacity: 0; pointer-events: none; transition: transform .25s var(--ease-out), opacity .2s ease; }
  .mini-bar.is-visible.has-data { transform: none; opacity: 1; }
  .mini-bar > div { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; min-width: 0; }
  .mb-lbl { font-size: .72rem; font-weight: 600; opacity: .75; white-space: nowrap; }
  .mb-val { font-family: var(--display); font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .mb-val--loss { color: var(--loss-inverse); }
  .mb-val--gain { color: var(--gain-inverse); }
}
@media (prefers-reduced-motion: reduce) { .mini-bar { transition: opacity .2s ease; transform: none; } }
@media (max-width: 559px) {
  .hero h1 { font-size: 1.6rem; }
  .hero .hero-sub--long { display: none; }
  .hero .hero-sub--short { display: block; font-size: .95rem; line-height: 1.5; }
  .hero .byline-top { font-size: .76rem; }
  .hero .hero-art { transform: scale(.62); transform-origin: top right; }
  .rate-chips { display: grid; grid-template-columns: repeat(3, 1fr); }
  .rate-chip { justify-content: center; text-align: center; line-height: 1.25; padding-inline: var(--s-2); }
  .calc-result-grid--list-mobile { grid-template-columns: 1fr !important; grid-auto-rows: auto; gap: 0; padding: var(--s-1) var(--s-4); border-radius: var(--radius-lg); background: var(--surface-2); }
  .calc-result-grid--list-mobile .result-stat { flex-direction: row; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 2px var(--s-3); padding: var(--s-3) 0; min-height: 0; border-radius: 0; background: none; box-shadow: none; color: var(--text); }
  .calc-result-grid--list-mobile .result-stat + .result-stat { border-top: 1px solid var(--rule); }
  .calc-result-grid--list-mobile .result-stat--highlight .result-label, .calc-result-grid--list-mobile .result-stat--highlight .result-value { color: var(--opt-a-ink); }
  .calc-result-grid--list-mobile .result-value { font-size: 1.1rem; white-space: nowrap; margin-left: auto; }
  .calc-result-grid--list-mobile .result-note { flex-basis: 100%; color: var(--text-muted); }
  [data-collapse-mobile]:not(.is-open) > :not(h2):not(.section-sub):not(.collapse-toggle):not([data-keep-mobile]) { display: none; }
  [data-collapse-mobile] .collapse-toggle { display: inline-flex; align-items: center; min-height: 44px; margin-top: var(--s-3); padding: 0 var(--s-4); border-radius: 999px; background: var(--surface); font-weight: 700; font-size: .9rem; color: var(--text); box-shadow: inset 0 0 0 1px var(--border); }
}
/* Letra mínima de 13 px en notas y tablas */
.field-hint, .tiny-note, .result-note, .result-disclaimer, .vat-table thead th, .data-table thead th, .cc-presets-note, .cc-option-or { font-size: .8125rem; }
/* Ancho de línea: en escritorio el texto corrido no pasa de ~70 caracteres
   (llegaba a 91-105 en FAQ, errores comunes y notas). En las tarjetas con
   fondo se estrecha solo el texto, no la tarjeta. */
.field-hint, .tiny-note, .result-disclaimer, .cc-presets-note { max-width: 75ch; }
.faq-item p { max-width: 74ch; }
.airport-block-body p { max-width: 70ch; }
.mistakes-list li { padding-right: max(var(--s-5), calc(100% - 70ch)); }
.checkbox-inline input[type="checkbox"] { width: 22px; height: 22px; }
.radio-pill input[type="radio"] { width: 18px; height: 18px; }

/* 20. Hub y guías en móvil */
.leer-mas-toggle { display: none; }
@media (max-width: 559px) {
  .hub-hero h1 { font-size: 1.6rem; }
  .hub-hero .hero-sub--long { display: none; }
  .hub-hero .hero-sub--short { display: block; font-size: .95rem; line-height: 1.5; }
  .hub-hero .hero-art { transform: scale(.62); transform-origin: top right; }
  [data-leer-mas]:not(.is-open) p { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  [data-leer-mas] .leer-mas-toggle { display: inline-flex; align-items: center; min-height: 44px; margin-top: var(--s-1); padding: 0; font-weight: 700; font-size: .88rem; color: var(--accent); background: none; }
}

/* 21. Sensación de app en el móvil
   - sin el destello gris al tocar (cada control ya tiene su :active);
   - toques inmediatos (sin la espera del doble toque) y sin seleccionar el texto de un botón al mantenerlo;
   - casillas de texto a 16 px en pantallas táctiles para que iOS no haga zoom al escribir. */
html { -webkit-tap-highlight-color: transparent; }
button, a, summary, label, select, [role="button"], input[type="range"], input[type="checkbox"], input[type="radio"] { touch-action: manipulation; }
button, summary, [role="button"], .radio-pill, .mini-tool-card, .collapse-toggle { -webkit-user-select: none; user-select: none; }
@media (pointer: coarse) { .cc-option-name { font-size: 16px; } }

/* Móvil más sencillo: "Cómo funciona" en filas compactas y "Más herramientas" en dos columnas */
@media (max-width: 559px) {
  .steps-grid { gap: var(--s-2); }
  .step-card { display: grid; grid-template-columns: 36px 1fr; gap: 2px var(--s-3); align-items: start; padding: var(--s-4); }
  .step-card svg { grid-row: 1 / span 2; width: 36px; height: 36px; padding: 7px; margin: 0; border-radius: 10px; }
  .step-card h3 { font-size: .98rem; margin: 0 0 2px; align-self: center; }
  .step-card p { grid-column: 2; font-size: .875rem; line-height: 1.55; }

  .mini-tools-grid { grid-template-columns: 1fr 1fr; }
  /* Número impar de tarjetas: la última ocupa la fila entera en vez de quedarse sola a la izquierda */
  .mini-tools-grid > :last-child:nth-child(odd) { grid-column: 1 / -1; }
  /* Opciones que no caben en una línea: cada fila se reparte a partes iguales, sin pastillas de anchos sueltos */
  .radio-row > .radio-pill { flex: 1 1 0; min-width: fit-content; max-width: 100%; }
  .mini-tool-card, .mini-tool-card:has(.mini-tool-emoji) { flex-direction: column; align-items: flex-start; justify-content: flex-start; gap: var(--s-2); padding: var(--s-3) var(--s-4); font-size: .875rem; line-height: 1.3; min-height: 88px; }
  .mini-tool-card::after { display: none; }
}

/* Móvil: menos aire entre secciones (antes ~80 px vacíos entre una y otra) */
@media (max-width: 559px) {
  .steps, .faq, .mas-herramientas, .vat-table-section { padding-top: var(--s-6); }
  .faq { padding-bottom: var(--s-6); }
}

@media (max-width: 559px) { .step-card .leer-mas-toggle { grid-column: 2; margin-top: 0; min-height: 36px; } }

/* Móvil: tablas que caben en la pantalla y sin la nota a mano bajo el resultado */
@media (max-width: 559px) {
  .vat-table { min-width: 0; font-size: .7rem; letter-spacing: -.01em; }
  .vat-table thead th { font-size: .66rem; line-height: 1.25; vertical-align: bottom; }
  .vat-table th, .vat-table td { padding: var(--s-2) 3px; }
  .vat-table th:first-child, .vat-table td:first-child { padding-left: var(--s-2); }
  .vat-table th:last-child, .vat-table td:last-child { padding-right: var(--s-2); }
  .tool-card .cc-note--below { display: none; }
}
.th-short { display: none; }
@media (max-width: 559px) { .th-long { display: none; } .th-short { display: inline; } }

/* 22. Secciones editoriales de cada herramienta: fórmula paso a paso, ejemplo resuelto y conceptos clave */
.tool-formula { margin-top: var(--s-4); padding: var(--s-4) var(--s-5); border-radius: var(--radius-lg); background: var(--surface); font-family: var(--mono); font-size: .85rem; line-height: 1.7; color: var(--text); white-space: pre-wrap; overflow-wrap: anywhere; }
.tool-steps { list-style: decimal; display: flex; flex-direction: column; gap: var(--s-3); max-width: 72ch; margin-top: var(--s-4); padding-left: 1.4rem; }
.tool-steps li { color: var(--text-muted); line-height: 1.65; }
.tool-steps li strong { color: var(--text); }
.tool-extra-more { margin-top: var(--s-4); }
.tool-extra-more a { color: var(--accent); font-weight: 700; }
.tool-extra-note { max-width: 72ch; margin-top: var(--s-3); color: var(--text-muted); line-height: 1.65; }
.tool-extra .table-scroll { margin-top: var(--s-4); border-radius: var(--radius-lg); background: var(--surface); }
.tool-extra .vat-table { min-width: 0; }
.glosario-list { display: grid; grid-template-columns: 1fr; gap: var(--s-3); margin-top: var(--s-4); }
@media (min-width: 720px) { .glosario-list { grid-template-columns: 1fr 1fr; } .glosario-list > div:last-child:nth-child(odd) { grid-column: 1 / -1; } }
.glosario-list > div { padding: var(--s-4) var(--s-5); border-radius: var(--radius-lg); background: var(--surface); }
.glosario-list dt { font-weight: 700; color: var(--text); }
.glosario-list dd { margin-top: var(--s-1); font-size: .92rem; line-height: 1.6; color: var(--text-muted); }
@media (max-width: 559px) { .tool-formula { padding: var(--s-3) var(--s-4); font-size: .78rem; } .glosario-list > div { padding: var(--s-3) var(--s-4); } }

/* Móvil: la tabla de cookies de la política de privacidad pasa a tarjetas (una por cookie) */
@media (max-width: 559px) {
  .legal .legal-table table { min-width: 0; }
  .legal .legal-table thead { display: none; }
  .legal .legal-table tr { display: block; padding: .7rem .85rem; border-bottom: 1px solid var(--border); }
  .legal .legal-table tr:last-child { border-bottom: 0; }
  .legal .legal-table td { display: block; padding: .15rem 0; border: 0; font-size: .875rem; }
  .legal .legal-table td:first-child { margin-bottom: .2rem; color: var(--text); font-weight: 600; }
  .legal .legal-table td:nth-child(2)::before { content: "Para qué sirve: "; }
  .legal .legal-table td:nth-child(3)::before { content: "Cuándo se usa: "; }
  .legal .legal-table td:nth-child(4)::before { content: "Duración: "; }
  .legal .legal-table td:not(:first-child)::before { font-weight: 600; color: var(--text); }
  .legal .legal-table code { word-break: break-all; }
}
