/* =============================================================
   Calcula tu Dividendo - hoja de estilo unica
   1 Tokens - 2 Reset - 3 Utilidades - 4 Tipografia - 5 Componentes
   6 Secciones - 7 Efectos - 8 Responsive - 9 Reduced motion - 10 Print
   ============================================================= */

/* =============================================================
   1. Tokens
   ============================================================= */
:root {
  --bg:        #f4f6f8;
  --bg-deep:   #eceff3;
  --surface:   #ffffff;
  --surface-2: #f8fafb;
  --ink:       #101828;
  --ink-soft:  #344054;
  --muted:     #667085;
  --line:      #e1e6ec;
  --line-soft: #eef1f5;

  --accent:      #0b7a63;
  --accent-deep: #075847;
  --accent-soft: #e6f4f0;
  --gold:        #b7791f;
  --gold-soft:   #fdf6e7;
  --danger:      #b42318;
  --danger-soft: #fdeceb;
  --ok:          #067647;
  --serie-1:     #0b7a63;
  --serie-2:     #b7791f;
  --serie-3:     #4a6fa5;

  --sans: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Manrope", var(--sans);

  --gutter: clamp(1rem, 4vw, 2rem);
  --radius: 14px;
  --radius-sm: 10px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .05);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, .08);

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --ease-soft: cubic-bezier(0.25, 0.46, 0.45, 0.94);

  color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0d1117;
    --bg-deep:   #090d12;
    --surface:   #151b23;
    --surface-2: #1b222b;
    --ink:       #e9eef5;
    --ink-soft:  #c3ccd8;
    --muted:     #8d99a8;
    --line:      #262f3a;
    --line-soft: #1f272f;

    --accent:      #2fb89a;
    --accent-deep: #7fd9c5;
    --accent-soft: #10312a;
    --gold:        #e0a84a;
    --gold-soft:   #2e2413;
    --danger:      #ff8a80;
    --danger-soft: #331a19;
    --ok:          #4ade80;
    --serie-1:     #2fb89a;
    --serie-2:     #e0a84a;
    --serie-3:     #7aa2d8;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .4);
    --shadow-md: 0 8px 28px rgba(0, 0, 0, .45);
  }
}

/* =============================================================
   2. Reset y base
   ============================================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; }
html { -webkit-text-size-adjust: 100%; tab-size: 2; scroll-behavior: smooth; }
body {
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: clip;
  overscroll-behavior-y: none;
}
img, svg, video { display: block; max-width: 100%; }
img { height: auto; }
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }
p { text-wrap: pretty; }
h1, h2, h3, h4 { font-family: var(--display); text-wrap: balance; line-height: 1.15; letter-spacing: -0.02em; }
::selection { background: var(--accent); color: #fff; }

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

/* =============================================================
   3. Utilidades
   ============================================================= */
.wrap { width: min(100% - 2 * var(--gutter), 1120px); margin-inline: auto; }
.narrow { width: min(100% - 2 * var(--gutter), 760px); margin-inline: auto; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip-link {
  position: fixed; top: -100px; left: 1rem; z-index: 999;
  padding: .6rem 1rem; background: var(--surface); color: var(--ink);
  border-radius: 8px; font-weight: 600; box-shadow: var(--shadow-md);
}
.skip-link:focus { top: 1rem; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }

/* =============================================================
   4. Tipografia
   ============================================================= */
h1 { font-size: clamp(1.55rem, 1.1rem + 2vw, 2.5rem); font-weight: 800; }
h2 { font-size: clamp(1.3rem, 1.05rem + 1vw, 1.8rem); font-weight: 700; margin-bottom: .6rem; }
h3 { font-size: 1.05rem; font-weight: 700; }
.lede { color: var(--muted); font-size: clamp(.95rem, .9rem + .2vw, 1.06rem); }

/* =============================================================
   5. Componentes
   ============================================================= */

/* --- Cabecera --- */
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header .bar {
  display: flex; align-items: center; gap: 1rem;
  min-height: 58px; padding-block: .5rem;
}
.brand { display: flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 800; letter-spacing: -.03em; }
.brand svg { width: 26px; height: 26px; flex: none; }
.brand span { font-size: 1.02rem; }
.brand b { color: var(--accent); font-weight: 800; }
.site-nav { margin-left: auto; display: flex; align-items: center; gap: .35rem; flex-wrap: wrap; }
.site-nav a {
  padding: .4rem .7rem; border-radius: 8px; font-size: .88rem; font-weight: 500; color: var(--ink-soft);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.site-nav a:hover { background: var(--surface); color: var(--ink); }
.site-nav a[aria-current="page"] { color: var(--accent); font-weight: 700; }

/* --- Tarjeta de la herramienta --- */
.tool-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}

/* Resultado principal, arriba de todo, se actualiza en vivo */
.result {
  padding: 1.1rem;
  background: linear-gradient(160deg, var(--accent-soft), transparent 70%);
  border-bottom: 1px solid var(--line);
}
.result-label { font-size: .78rem; text-transform: uppercase; letter-spacing: .09em; color: var(--muted); font-weight: 600; }
.result-main {
  font-family: var(--display); font-weight: 800;
  font-size: clamp(2.1rem, 1.3rem + 4vw, 3.1rem);
  letter-spacing: -.035em; line-height: 1.05; color: var(--accent-deep);
  font-variant-numeric: tabular-nums;
}
.result-sub { color: var(--muted); font-size: .9rem; }
/* En movil el bloque de cifras va DEBAJO del formulario, para que los campos
   queden al alcance sin hacer scroll. En escritorio vuelve a la columna derecha. */
.result-extra {
  padding: 1.1rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.result-grid {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .5rem;
}
.result-extra .avisos { margin-top: .8rem; }
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm);
  padding: .55rem .65rem;
}
.stat dt { font-size: .74rem; color: var(--muted); font-weight: 600; }
.stat dd { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.stat dd small { font-weight: 500; color: var(--muted); font-size: .78rem; }

/* Formulario */
.form { padding: 1.1rem; display: grid; gap: .85rem; }
.field { display: grid; gap: .3rem; }
.field > label, .field-label { font-size: .84rem; font-weight: 600; color: var(--ink-soft); }
.field .hint { font-size: .76rem; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .suffix {
  position: absolute; right: .7rem; font-size: .82rem; color: var(--muted); font-weight: 600; pointer-events: none;
}
input[type="number"], input[type="text"], select {
  width: 100%; padding: .62rem .75rem; padding-right: 3.2rem;
  background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius-sm);
  font-variant-numeric: tabular-nums; font-weight: 600;
  transition: border-color .18s var(--ease-out), box-shadow .18s var(--ease-out);
}
select { padding-right: .75rem; }
input:hover, select:hover { border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
input:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
input[type="range"] { padding: 0; accent-color: var(--accent); width: 100%; background: none; border: 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .85rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: .85rem; }

/* Control segmentado */
.seg { display: inline-flex; padding: 3px; gap: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 999px; }
.seg button {
  padding: .32rem .85rem; border-radius: 999px; font-size: .82rem; font-weight: 600; color: var(--muted);
  transition: background .2s var(--ease-out), color .2s var(--ease-out);
}
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; }
.seg-row { display: flex; align-items: center; justify-content: space-between; gap: .6rem; flex-wrap: wrap; }

/* Fila del valor UF */
.uf-row {
  display: flex; align-items: center; gap: .5rem; flex-wrap: wrap;
  padding: .6rem .75rem; background: var(--surface-2);
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  font-size: .82rem; color: var(--muted);
}
.uf-row input { width: 130px; padding: .3rem .5rem; padding-right: .5rem; font-size: .85rem; }
.uf-row .fecha { margin-left: auto; font-size: .74rem; }
.uf-row .fecha.es-auto { color: var(--ok); }
.uf-row .fecha.es-propio { color: var(--gold); }
.uf-row .fecha.es-viejo { color: var(--muted); }
.uf-row .fecha.es-auto::before,
.uf-row .fecha.es-propio::before {
  content: ""; display: inline-block; width: 6px; height: 6px;
  border-radius: 50%; background: currentColor; margin-right: .35rem; vertical-align: 1px;
}
.uf-boton { font-size: .76rem; }
.uf-boton[hidden] { display: none; }

/* Avisos */
.avisos { display: grid; gap: .45rem; }
.aviso {
  display: flex; gap: .5rem; align-items: flex-start;
  padding: .55rem .7rem; border-radius: var(--radius-sm);
  font-size: .84rem; line-height: 1.45;
  background: var(--gold-soft); color: var(--ink-soft);
  border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
}
.aviso b { color: var(--ink); }
.aviso--ok { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 30%, transparent); }
.aviso--danger { background: var(--danger-soft); border-color: color-mix(in srgb, var(--danger) 35%, transparent); }
.aviso i { font-style: normal; flex: none; }

/* Panel plegable */
details.panel {
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-2);
}
details.panel > summary {
  cursor: pointer; list-style: none; padding: .6rem .75rem;
  font-size: .86rem; font-weight: 600; color: var(--ink-soft);
  display: flex; align-items: center; gap: .5rem;
}
details.panel > summary::-webkit-details-marker { display: none; }
details.panel > summary::before {
  content: ""; width: 8px; height: 8px; flex: none;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor;
  transform: rotate(-45deg); transition: transform .2s var(--ease-out); margin-left: 2px;
}
details.panel[open] > summary::before { transform: rotate(45deg); }
details.panel .panel-body { padding: .2rem .75rem .85rem; display: grid; gap: .85rem; }

/* Privacidad */
.privacy {
  display: flex; align-items: center; gap: .5rem; justify-content: center;
  margin-top: .8rem; font-size: .82rem; color: var(--muted); text-align: center;
}

/* Botones */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .45rem;
  padding: .6rem 1.05rem; border-radius: var(--radius-sm);
  font-weight: 600; font-size: .9rem;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  transition: transform .18s var(--ease-out), border-color .18s var(--ease-out), background .18s var(--ease-out);
}
.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; }
.btn-row { display: flex; flex-wrap: wrap; gap: .5rem; }

/* Grafico */
.chart-box { position: relative; }
.chart-box canvas { width: 100%; height: 240px; display: block; }
.legend { display: flex; gap: 1rem; flex-wrap: wrap; font-size: .8rem; color: var(--muted); margin-top: .5rem; }
.legend i { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: .35rem; vertical-align: -1px; }

/* Tabla de amortizacion */
.tabla-wrap { overflow: auto; max-height: 70vh; contain: paint; border: 1px solid var(--line); border-radius: var(--radius-sm); }
table.amort { width: 100%; border-collapse: collapse; font-size: .82rem; font-variant-numeric: tabular-nums; }
table.amort th, table.amort td { padding: .45rem .6rem; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line-soft); }
table.amort th { position: sticky; top: 0; background: var(--surface-2); font-size: .74rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); z-index: 1; }
table.amort td:first-child, table.amort th:first-child { text-align: left; color: var(--muted); }
table.amort tbody tr:hover td { background: var(--surface-2); }

/* Comparador */
.vs-table { width: 100%; border-collapse: collapse; font-size: .88rem; font-variant-numeric: tabular-nums; }
.vs-table th, .vs-table td { padding: .55rem .6rem; border-bottom: 1px solid var(--line-soft); text-align: right; }
.vs-table th:first-child, .vs-table td:first-child { text-align: left; font-weight: 500; color: var(--ink-soft); }
.vs-table thead th { font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.vs-table .mejor { color: var(--ok); font-weight: 700; }
.vs-table .peor { color: var(--danger); font-weight: 700; }

/* Espacios de publicidad, vacios a proposito */
.ad-slot {
  display: flex; align-items: center; justify-content: center;
  min-height: 100px; margin: 1.6rem 0;
  border: 1px dashed var(--line); border-radius: var(--radius-sm);
  color: var(--muted); font-size: .72rem; letter-spacing: .14em; text-transform: uppercase;
  background: var(--surface-2);
}
.ad-slot--tall { min-height: 250px; }

/* =============================================================
   6. Secciones
   ============================================================= */
.hero { padding: 1.4rem 0 .5rem; }
.hero h1 { margin-bottom: .35rem; }
.hero .lede { max-width: 62ch; }

main section { margin-top: 2.2rem; }
main section > h2 { margin-bottom: .7rem; }

.card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.1rem; box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: 1rem; }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: .6rem; flex-wrap: wrap; margin-bottom: .7rem; }
.card-head h2, .card-head h3 { margin: 0; }
.card-head p { font-size: .84rem; color: var(--muted); }

.pasos { display: grid; gap: .9rem; grid-template-columns: 1fr; }
.paso { display: flex; gap: .75rem; align-items: flex-start; }
.paso .ico { flex: none; width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; }
.paso .ico svg { width: 20px; height: 20px; }
.paso h3 { font-size: .96rem; margin-bottom: .1rem; }
.paso p { font-size: .88rem; color: var(--muted); }

.prosa { max-width: 68ch; }
.prosa h2 { margin-top: 1.6rem; }
.prosa h3 { margin-top: 1.2rem; margin-bottom: .3rem; }
.prosa p, .prosa li { color: var(--ink-soft); font-size: .96rem; }
.prosa p + p { margin-top: .75rem; }
.prosa ul, .prosa ol { margin: .6rem 0 .6rem 1.1rem; display: grid; gap: .35rem; }
.prosa strong { color: var(--ink); }
.prosa table { width: 100%; border-collapse: collapse; margin: .9rem 0; font-size: .9rem; }
.prosa th, .prosa td { border-bottom: 1px solid var(--line); padding: .45rem .5rem; text-align: left; }
.prosa th { color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }

.faq { display: grid; gap: .5rem; }
.faq details {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); overflow: hidden;
}
.faq summary {
  cursor: pointer; list-style: none; padding: .8rem 1rem; font-weight: 600; font-size: .95rem;
  display: flex; gap: .6rem; align-items: flex-start;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; margin-left: auto; color: var(--accent); font-weight: 700; font-size: 1.2rem; line-height: 1; }
.faq details[open] summary::after { content: "-"; }
.faq .faq-body { padding: 0 1rem 1rem; color: var(--ink-soft); font-size: .92rem; }
.faq .faq-body p + p { margin-top: .6rem; }

.tools-grid { display: grid; gap: .8rem; grid-template-columns: 1fr; }
.tool-link {
  display: block; padding: .95rem 1.05rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  transition: border-color .2s var(--ease-out), transform .2s var(--ease-out);
}
.tool-link:hover { border-color: var(--accent); transform: translateY(-2px); }
.tool-link h3 { font-size: .98rem; margin-bottom: .15rem; }
.tool-link p { font-size: .86rem; color: var(--muted); }

.site-footer {
  margin-top: 3rem; padding: 1.6rem 0 2.2rem;
  border-top: 1px solid var(--line); background: var(--bg-deep);
  font-size: .85rem; color: var(--muted);
}
.site-footer .cols { display: grid; gap: .6rem; }
.site-footer a:hover { color: var(--accent); text-decoration: underline; }
.site-footer nav { display: flex; gap: .9rem; flex-wrap: wrap; }
.disclaimer { font-size: .8rem; color: var(--muted); max-width: 70ch; }

/* Sin JavaScript */
.nojs-msg { display: none; }
html.no-js .nojs-msg {
  display: block; padding: .7rem .8rem; margin: .8rem 0 0;
  background: var(--gold-soft); border: 1px solid color-mix(in srgb, var(--gold) 35%, transparent);
  border-radius: var(--radius-sm); font-size: .86rem;
}
html.no-js .js-only { display: none !important; }

/* =============================================================
   7. Efectos, minimos: esto es una herramienta, no un escaparate
   ============================================================= */
.result-main, .stat dd { transition: color .25s var(--ease-soft); }

/* =============================================================
   8. Responsive
   ============================================================= */
@media (min-width: 540px) {
  .result-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .tools-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 720px) {
  .form { padding: 1.3rem; }
  .result, .result-extra { padding: 1.3rem; }
  .pasos { grid-template-columns: repeat(3, 1fr); }
  .chart-box canvas { height: 300px; }
}
@media (min-width: 960px) {
  .tool-card {
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    align-items: start;
  }
  .tool-card .form { grid-column: 1; grid-row: 1 / span 2; border-right: 1px solid var(--line); }
  .tool-card .result { grid-column: 2; grid-row: 1; border-bottom: 0; }
  .tool-card .result-extra { grid-column: 2; grid-row: 2; border-top: 0; background: transparent; padding-top: 0; }
  .result-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero { padding-top: 2rem; }
}

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

/* =============================================================
   10. Impresion de la tabla de amortizacion
   ============================================================= */
@media print {
  .site-header, .site-nav, .ad-slot, .faq, .tools-grid, .site-footer,
  .btn-row, .privacy, .chart-box, .nojs-msg,
  #desglose, #antes-llaves, #plazos, #conceptos { display: none !important; }
  body { background: #fff; color: #000; font-size: 11px; }
  .card, .tool-card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; }
  .tabla-wrap { overflow: visible; border: 0; max-height: none; }
  table.amort { font-size: 9.5px; }
  table.amort th { position: static; }
  table.amort tbody tr { break-inside: avoid; }
}

/* =============================================================
   11. Modulos de analisis (desglose, carga, gastos, plazos, glosario)
   ============================================================= */

.nota {
  margin-top: .9rem; font-size: .9rem; line-height: 1.55;
  color: var(--muted); max-width: 62ch;
}
.nota strong { color: var(--ink-soft); font-weight: 600; }

.dos-paneles { display: grid; gap: 1rem; grid-template-columns: 1fr; }

/* --- Barra apilada del dividendo --- */
.barra-apilada {
  display: flex; height: 30px; border-radius: 8px; overflow: hidden;
  background: var(--line-soft); margin-bottom: .9rem;
}
.barra-apilada .tramo { display: block; height: 100%; transition: width .3s var(--ease-out); }
.c-cuota { background: var(--serie-1); }
.c-desgravamen { background: var(--serie-2); }
.c-incendio { background: var(--serie-3); }

.leyenda-desglose { list-style: none; display: grid; gap: .45rem; }
.leyenda-desglose li {
  display: flex; align-items: center; gap: .55rem;
  font-size: .9rem; color: var(--ink-soft);
  padding-bottom: .45rem; border-bottom: 1px solid var(--line-soft);
}
.leyenda-desglose li:last-child { border-bottom: 0; padding-bottom: 0; }
.leyenda-desglose i { width: 12px; height: 12px; border-radius: 3px; flex: none; }
.leyenda-desglose span { flex: 1; }
.leyenda-desglose em { font-style: normal; color: var(--muted); font-size: .82rem; }
.leyenda-desglose b { font-variant-numeric: tabular-nums; white-space: nowrap; }

/* --- Medidor de carga financiera --- */
.medidor { margin-bottom: .8rem; }
.medidor-barra {
  position: relative; display: flex; height: 14px;
  border-radius: 999px; background: var(--line-soft);
}
.medidor-barra .zona { display: block; height: 100%; }
.medidor-barra .zona:first-child { border-radius: 999px 0 0 999px; }
.medidor-barra .zona:nth-child(3) { border-radius: 0 999px 999px 0; }
.zona--ok { width: 50%; background: color-mix(in srgb, var(--ok) 55%, transparent); }
.zona--medio { width: 10%; background: color-mix(in srgb, var(--gold) 65%, transparent); }
.zona--alto { width: 40%; background: color-mix(in srgb, var(--danger) 55%, transparent); }
.medidor-marca {
  position: absolute; top: -6px; width: 4px; height: 26px; margin-left: -2px;
  background: var(--ink); border-radius: 3px;
  box-shadow: 0 0 0 2px var(--surface);
  transition: left .3s var(--ease-out);
}
.medidor-escala {
  position: relative; height: 1.4em; margin-top: .3rem;
  font-size: .74rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.medidor-escala span { position: absolute; top: 0; transform: translateX(-50%); }
.medidor-escala span:nth-child(1) { left: 0; transform: none; }
.medidor-escala span:nth-child(2) { left: 50%; }
.medidor-escala span:nth-child(3) { left: 60%; }
.medidor-escala span:nth-child(4) { left: 100%; transform: translateX(-100%); }

.medidor-texto {
  font-size: .92rem; line-height: 1.5; color: var(--ink-soft);
  padding-left: .7rem; border-left: 3px solid var(--line);
}
.medidor-texto b { color: var(--ink); }
.medidor-texto.es-ok { border-left-color: var(--ok); }
.medidor-texto.es-medio { border-left-color: var(--gold); }
.medidor-texto.es-alto { border-left-color: var(--danger); }

.enlace {
  color: var(--accent); font-weight: 600; text-decoration: underline;
  text-underline-offset: 2px; padding: 0;
}
.enlace:hover { color: var(--accent-deep); }

/* --- Tarjetas de gastos al firmar --- */
.gastos-grid {
  display: grid; gap: .6rem;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}
.gasto {
  display: grid; gap: .15rem;
  padding: .8rem .85rem; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.gasto-ico {
  width: 30px; height: 30px; border-radius: 8px; margin-bottom: .25rem;
  background: var(--accent-soft); color: var(--accent);
  display: grid; place-items: center;
}
.gasto-ico svg { width: 17px; height: 17px; }
.gasto-nombre { font-size: .8rem; color: var(--muted); font-weight: 600; line-height: 1.3; }
.gasto-monto { font-size: 1.08rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.gasto-detalle { font-size: .74rem; color: var(--muted); }

.total-firma {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 1rem; margin-top: .9rem; padding-top: .8rem;
  border-top: 2px solid var(--line);
}
.total-firma span { font-weight: 600; color: var(--ink-soft); }
.total-firma strong {
  font-family: var(--display); font-size: clamp(1.4rem, 1.1rem + 1.4vw, 1.9rem);
  color: var(--accent-deep); font-variant-numeric: tabular-nums; letter-spacing: -.03em;
}

/* --- Comparador de plazos --- */
.tabla-plazos-wrap {
  overflow-x: auto;
  /* contain evita que la tabla ancha propague desbordamiento al documento
     (la envoltura ya la desplaza por dentro) */
  contain: paint;
}
.plazos-tabla { width: 100%; border-collapse: collapse; font-size: .92rem; }
.plazos-tabla th, .plazos-tabla td {
  padding: .6rem .5rem; text-align: left; border-bottom: 1px solid var(--line-soft);
  vertical-align: middle;
}
.plazos-tabla thead th {
  font-size: .74rem; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); font-weight: 600;
}
.plazos-tabla td:nth-child(2) { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plazos-tabla td:first-child { font-weight: 600; white-space: nowrap; }
.plazos-tabla tr.es-actual td { background: var(--accent-soft); }
.plazos-tabla tr.es-actual td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.plazos-tabla td:last-child { text-align: right; }

.celda-barra { min-width: 190px; }
.celda-barra > span:last-child {
  display: block; margin-top: .3rem; font-size: .84rem;
  font-variant-numeric: tabular-nums; color: var(--ink-soft);
}
.celda-barra em { font-style: normal; color: var(--danger); font-size: .8rem; }
.barra-interes {
  display: block; height: 7px; border-radius: 999px;
  background: var(--line-soft); overflow: hidden;
}
.barra-interes i { display: block; height: 100%; background: var(--serie-2); border-radius: 999px; transition: width .3s var(--ease-out); }

.pastilla {
  display: inline-block; margin-left: .3rem; padding: .1rem .45rem;
  font-size: .66rem; text-transform: uppercase; letter-spacing: .06em;
  background: var(--accent); color: #fff; border-radius: 999px; font-weight: 700;
  vertical-align: 1px;
}
.btn--mini { padding: .32rem .7rem; font-size: .8rem; border-radius: 8px; }

input.destacado { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* --- Glosario --- */
.glosario {
  display: grid; gap: .8rem;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
}
.termino {
  padding: .9rem 1rem; background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius);
  border-top: 3px solid var(--accent);
}
.termino h3 { font-size: .98rem; margin-bottom: .3rem; }
.termino p { font-size: .87rem; color: var(--muted); line-height: 1.5; }

#conceptos .disclaimer { margin-top: 1.1rem; }

.mes-fecha { opacity: .6; }

@media (min-width: 960px) {
  .dos-paneles { grid-template-columns: 1fr 1fr; }
}


/* =============================================================
   12. Calculadora de ahorro
   ============================================================= */

/* Selector de modo: cada modo muestra solo sus campos */
.seg--modos { flex-wrap: wrap; }
.seg--modos button { font-size: .8rem; }
.form[data-modo="juntar"] [data-modos]:not([data-modos~="juntar"]),
.form[data-modo="meta"] [data-modos]:not([data-modos~="meta"]),
.form[data-modo="tiempo"] [data-modos]:not([data-modos~="tiempo"]) { display: none; }

/* Comparador de formas de ahorrar */
.comparador-ahorro td { vertical-align: top; }
.inst-nombre { display: block; font-weight: 600; }
.inst-nota { display: block; font-size: .76rem; color: var(--muted); font-weight: 400; margin-top: .1rem; }
.celda-tasa { white-space: nowrap; }
.celda-tasa input {
  width: 78px; padding: .3rem .45rem; padding-right: .45rem;
  font-size: .86rem; text-align: right;
}
.celda-tasa .tasa-fija {
  display: inline-block; width: 78px; text-align: right;
  font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted);
}
.celda-tasa .tasa-tipo { display: block; font-size: .72rem; color: var(--muted); margin-top: .15rem; }
.barra-interes i.es-negativo { background: var(--danger); }
.celda-barra em.mejor { color: var(--ok); }

/* El resultado del modo "cuánto me demoro" es texto, no un monto */
.result-main { overflow-wrap: break-word; }

@media (min-width: 720px) {
  .comparador-ahorro td:first-child { min-width: 210px; }
}
