/* ==========================================================================
   PIA - Calculadora inmobiliaria, propuesta B: una página con resumen
   Solo la carga inversion-inmobiliaria.html, después de pia-real-estate-tema.css, y todo
   cuelga de body.re-calc-page: dashboard.html comparte pia-real-estate.css y no cambia.
   Usa los tokens --rc-* del tema (mismos valores que site/css/site.css).
   ========================================================================== */

body.re-calc-page {
  /* Acento de datos del sitio (DIRECTION.md, Data Voice Rule): solo para cifras */
  --rc-data: #9A5B13;
  --rc-mono: "Geist Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --rc-ease: cubic-bezier(0.16, 1, 0.3, 1);
}
:root[data-theme="dark"] body.re-calc-page {
  --rc-data: #F2B45A;
}

/* ---------- Moneda propia en cada monto ----------
   El <select id="currX"> queda oculto (guarda el valor) y se ve el selector de moneda (.pia-moneda,
   pia-moneda.css) dentro del campo. El contenedor hace de caja del campo; el input va sin borde dentro. */
body.re-calc-page .re-curr-native { display: none !important; }

body.re-calc-page .re-input-wrapper.has-curr {
  border: 1.5px solid var(--rc-border-strong);
  border-radius: 8px;
  background: var(--rc-field);
  transition: border-color 160ms var(--rc-ease), box-shadow 160ms var(--rc-ease);
}
body.re-calc-page .re-input-wrapper.has-curr:focus-within {
  border-color: var(--rc-accent);
  box-shadow: 0 0 0 3px var(--rc-pos-soft);
}
body.re-calc-page .re-input-wrapper.has-curr > .re-input {
  flex: 1 1 auto;
  min-width: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}
body.re-calc-page .re-input-wrapper.has-curr > .re-input:focus { box-shadow: none; background: transparent; }

body.re-calc-page .re-curr-seg-btn {
  min-width: 44px;
  height: 44px;
  padding: 0 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--rc-text-2);
  font: 600 0.8rem/1 var(--rc-mono);
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background-color 140ms var(--rc-ease), color 140ms var(--rc-ease);
}
body.re-calc-page .re-curr-seg-btn:hover { color: var(--rc-text); background: var(--rc-surface-2); }
body.re-calc-page .re-curr-seg-btn[aria-checked="true"] {
  background: var(--rc-text);
  color: var(--rc-surface);
}
body.re-calc-page .re-curr-seg-btn:focus-visible {
  outline: 2px solid var(--rc-accent);
  outline-offset: 1px;
}

body.re-calc-page .re-periodo-seg .re-curr-seg-btn { font-family: inherit; font-size: 0.82rem; height: auto; min-height: 44px; padding: 0 14px; }
@media (max-width: 520px) { body.re-calc-page .re-periodo-seg .re-curr-seg-btn { padding: 0 8px; } }

@media (prefers-reduced-motion: reduce) {
  body.re-calc-page .re-input-wrapper.has-curr,
  body.re-calc-page .re-curr-seg-btn { transition: none; }
}

/* ==========================================================================
   Propuesta B: hero compacto, índice | formulario | resumen fijo, hoja inferior en móvil
   ========================================================================== */
body.re-calc-page .re-ico { width: 1.1em; height: 1.1em; flex: none; vertical-align: -0.17em; }

/* Las luces de fondo del landing no van con el sitio Instrumento */
body.re-calc-page .ambient-glows-container { display: none; }

body.re-calc-page .re-page-container { max-width: 1288px; padding: 104px 24px 72px; }

/* ---------- Hero compacto en una fila ---------- */
body.re-calc-page .re-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  flex-wrap: wrap;
  gap: 20px 32px;
  max-width: none;
  margin: 0 0 28px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--rc-border);
  text-align: left;
}
body.re-calc-page .re-header-text { min-width: 0; flex: 1 1 520px; }
body.re-calc-page .re-eyebrow {
  margin: 0 0 8px;
  font: 500 0.75rem/1.2 var(--rc-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--rc-text-2);
}
body.re-calc-page .re-title {
  margin: 0;
  font-size: clamp(1.8rem, 3.4vw, 2.5rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
  font-weight: 650;
  text-wrap: balance;
}
/* Bajo 428 px, con Atkinson Hyperlegible la pregunta ocupa dos líneas; con la fuente de respaldo (Segoe UI,
   Roboto, SF) cabía en una y el formulario saltaba 31 px al llegar la fuente (CLS 0,166 en móvil).
   Se reservan las dos líneas desde el primer pintado. */
@media (max-width: 427.98px) {
  body.re-calc-page .re-title { min-height: calc(2em * 1.08); }
}
body.re-calc-page .re-subtitle { margin: 8px 0 0; font-size: 1rem; line-height: 1.5; }
/* Los controles ocupan a lo más 600 px y bajan en dos filas: así la pregunta cabe en una línea */
body.re-calc-page .re-header-controls-row {
  flex: 0 1 600px;
  justify-content: flex-end;
  gap: 8px;
  margin: 0;
}
body.re-calc-page .re-country-picker-wrap,
body.re-calc-page .re-uf-reference-pill {
  min-height: 44px;
  padding: 0 14px;
  box-shadow: none;
  font-size: 0.85rem;
}
body.re-calc-page .re-uf-reference-pill {
  background: var(--rc-surface);
  border-color: var(--rc-border-strong);
}
/* La píldora de la UF llena lo que deja el país en la primera fila y, si su texto no cabe ("consultando el
   indicador", "sin conexión", la fuente y la fecha), parte en dos líneas dentro de sus 44 px. Antes bajaba a una
   fila propia según el texto o al llegar la fuente, y el encabezado crecía y se encogía 54 px (CLS 0,11 a 0,29 a
   1440). La base de 200 px deja la moneda siempre en la segunda fila. */
body.re-calc-page .re-uf-reference-pill { flex: 1 1 200px; min-width: 0; line-height: 1.35; }
body.re-calc-page .re-uf-reference-pill strong { color: var(--rc-text); font-weight: 600; }
body.re-calc-page #reUfRefText { font-variant-numeric: tabular-nums; }
/* La fuente de la UF envuelve dentro del botón; la fecha ya viene en la fuente o va entre paréntesis */
body.re-calc-page #reUfRefText { min-width: 0; overflow-wrap: anywhere; }
body.re-calc-page #reUfRefText > span { white-space: normal; }
/* La fecha entre paréntesis nunca se parte ("(2026-" / "10-24)"): baja entera de línea */
body.re-calc-page #reUfRefText .re-uf-fecha { white-space: nowrap; }
body.re-calc-page .re-uf-reference-pill { min-width: 0; max-width: 100%; }
body.re-calc-page .re-uf-pill-icon { color: var(--rc-accent); }
body.re-calc-page .re-country-select { min-height: 42px; }
body.re-calc-page .re-currency-dock-wrap { display: inline-flex; align-items: center; gap: 8px; }
body.re-calc-page .re-currency-dock-label { font-size: 0.8rem; color: var(--rc-text-2); }
body.re-calc-page .re-currency-dock { padding: 3px; box-shadow: none; background: var(--rc-surface); }
body.re-calc-page .re-currency-btn {
  min-height: 38px;
  min-width: 56px;
  padding: 0 14px;
  font: 600 0.85rem/1 var(--rc-mono);
}
body.re-calc-page .re-currency-btn.is-active { background: var(--rc-text); color: var(--rc-surface); }
/* Sin tipo de cambio del día el botón USD queda visible pero apagado (el motivo va en title y aria-label) */
body.re-calc-page .re-currency-btn:disabled { opacity: 0.45; cursor: not-allowed; }
/* Aviso al cambiar de país (montos convertidos o país sin tipo de cambio): una línea bajo los controles */
body.re-calc-page .re-country-notice {
  margin: 8px 0 0;
  max-width: 72ch;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--rc-text-2);
  overflow-wrap: anywhere;
}
/* Vacía sigue en el DOM como región viva, pero no ocupa lugar ni se ve */
body.re-calc-page .re-country-notice:empty {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}
body.re-calc-page .re-country-notice .re-nowrap { white-space: nowrap; }
/* Dólar con que se muestran los montos en USD (y la marca de referencial cuando no es el oficial) */
body.re-calc-page .re-usd-nota {
  margin: 8px 0 0;
  max-width: 72ch;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--rc-text-2);
  overflow-wrap: anywhere;
}
body.re-calc-page .re-usd-nota[hidden] { display: none; }
body.re-calc-page .re-usd-nota strong { color: var(--rc-text); font-weight: 600; }
body.re-calc-page .re-usd-nota .re-nowrap { white-space: nowrap; }

/* ---------- Grilla de tres columnas ---------- */
body.re-calc-page .re-calc-grid {
  display: grid;
  grid-template-columns: 184px minmax(0, 1fr) 340px;
  gap: 32px;
  align-items: start;
}
body.re-calc-page .re-calc-grid > * { min-width: 0; }

/* Índice de pasos */
body.re-calc-page .re-toc { position: sticky; top: 96px; }
body.re-calc-page .re-toc ol { list-style: none; margin: 0; padding: 0; border-left: 2px solid var(--rc-border); }
body.re-calc-page .re-toc a {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding-left: 16px;
  margin-left: -2px;
  border-left: 2px solid transparent;
  color: var(--rc-text-2);
  font-size: 0.9rem;
  text-decoration: none;
  transition: color 160ms var(--rc-ease), border-color 160ms var(--rc-ease);
}
body.re-calc-page .re-toc a:hover { color: var(--rc-text); }
body.re-calc-page .re-toc a[aria-current="step"] { border-color: var(--rc-accent); color: var(--rc-text); font-weight: 600; }
body.re-calc-page .re-toc-n {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 1px solid var(--rc-border-strong);
  border-radius: 50%;
  font: 500 0.75rem/1 var(--rc-mono);
}
body.re-calc-page .re-toc a[aria-current="step"] .re-toc-n,
body.re-calc-page .re-toc a.is-done .re-toc-n {
  background: var(--rc-accent);
  border-color: var(--rc-accent);
  color: var(--rc-accent-ink);
}

/* Formulario por pasos */
body.re-calc-page .re-step { margin-bottom: 32px; scroll-margin-top: 96px; }
body.re-calc-page .re-step-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
body.re-calc-page .re-step-ico {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--rc-pos-soft);
  color: var(--rc-accent);
}
body.re-calc-page .re-step-ico .re-ico { width: 20px; height: 20px; }
body.re-calc-page .re-step-title { margin: 0; font-size: 1.15rem; font-weight: 650; letter-spacing: -0.02em; color: var(--rc-text); }
body.re-calc-page .re-step-tag { margin-left: auto; font: 500 0.72rem/1 var(--rc-mono); color: var(--rc-text-2); }
body.re-calc-page .re-card { border-radius: 12px; }
body.re-calc-page .re-card-title { font-size: 1rem; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; }
body.re-calc-page .re-card-title .re-ico { color: var(--rc-accent); }
body.re-calc-page .re-accordion-caret .re-ico { transition: transform 200ms var(--rc-ease); }
body.re-calc-page .re-accordion-trigger[aria-expanded="true"] .re-accordion-caret .re-ico { transform: rotate(180deg); }
body.re-calc-page .re-accordion-trigger > span:first-child { display: inline-flex; align-items: center; gap: 8px; }
body.re-calc-page .re-badge-tag .re-ico,
body.re-calc-page .re-mini-dock-btn .re-ico { margin-right: 2px; }
body.re-calc-page .re-waterfall { border-radius: 12px; background: var(--rc-surface); border-color: var(--rc-border); }
body.re-calc-page .re-waterfall-title { display: flex; align-items: center; gap: 8px; }
body.re-calc-page .re-waterfall-value,
body.re-calc-page .re-waterfall-sec { font-variant-numeric: tabular-nums; }

/* Mapa: en oscuro las teselas se oscurecen con un filtro (el marcador y los controles no) */
:root[data-theme="dark"] body.re-calc-page .re-map-view .leaflet-tile-pane {
  filter: invert(1) hue-rotate(180deg) brightness(0.85) contrast(0.9);
}
:root[data-theme="dark"] body.re-calc-page .re-map-view { background: #1a1f26; }
/* Mapa diferido: mientras no se monta conserva su alto (240 px) y un fondo neutro, sin saltos al cargar */
body.re-calc-page .re-map-view[data-mapa="pendiente"] { background: var(--rc-surface-2, #f1f5f9); }
:root[data-theme="dark"] body.re-calc-page .re-map-view[data-mapa="pendiente"] { background: #1a1f26; }

/* ---------- Resumen fijo ---------- */
body.re-calc-page .re-calc-grid > .re-results-panel {
  position: sticky;
  top: 88px;
  z-index: 5;
  border: 1px solid var(--rc-border);
  border-radius: 12px;
  background: var(--rc-surface);
  box-shadow: 0 1px 2px rgba(15, 23, 32, 0.04), 0 12px 32px -14px rgba(15, 23, 32, 0.18);
  transition: top 240ms var(--rc-ease);
}
/* Con la barra del sitio oculta al bajar, el resumen y el índice suben con ella */
body.re-calc-page .site-chrome:has(.nav.is-hidden) ~ .re-page-container .re-calc-grid > .re-results-panel,
body.re-calc-page .site-chrome:has(.nav.is-hidden) ~ .re-page-container .re-toc { top: 24px; }
:root[data-theme="dark"] body.re-calc-page .re-calc-grid > .re-results-panel {
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, 0.6);
}
body.re-calc-page .re-sheet-bar { display: none; }
/* Escritorio y tableta: el resumen cabe entero a 1440 x 900 (guardar y proyección a la vista sin
   scroll interno). Las descripciones de cada fila quedan para la hoja móvil, que tiene más alto. */
@media (min-width: 768px) {
  body.re-calc-page .re-calc-grid > .re-results-panel { align-self: start; }
  body.re-calc-page .re-results-panel .re-result-desc,
  body.re-calc-page .re-results-panel .re-metric-subtext { display: none; }
}
/* (Los ajustes de ritmo del resumen en escritorio van después de las reglas base, más abajo:
   aquí arriba quedaban anulados por ellas.) */

/* Veredicto: deja el bloque verde oscuro y pasa a la superficie del sitio */
body.re-calc-page .re-results-panel .re-hero-verdict {
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  color: var(--rc-text);
}
body.re-calc-page .re-results-panel .re-hero-verdict::before { display: none; }
body.re-calc-page .re-resumen-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--rc-border);
}
body.re-calc-page .re-resumen-title { margin: 0; font-size: 0.95rem; font-weight: 600; color: var(--rc-text); }
body.re-calc-page .re-results-panel .re-status-badge {
  margin: 0;
  padding: 5px 10px;
  font: 500 0.72rem/1.1 var(--rc-mono);
  letter-spacing: 0;
  box-shadow: none;
  border: 1px solid transparent;
}
body.re-calc-page .re-results-panel .re-status-badge.is-excellent,
body.re-calc-page .re-results-panel .re-status-badge.is-good {
  background: var(--rc-pos-soft);
  color: var(--rc-pos-ink);
  border-color: var(--rc-pos-line);
}
body.re-calc-page .re-results-panel .re-status-badge.is-moderate {
  background: var(--rc-warn-soft);
  color: var(--rc-warn);
  border-color: var(--rc-warn-line);
}
body.re-calc-page .re-results-panel .re-status-badge.is-poor,
body.re-calc-page .re-results-panel .re-status-badge.is-bad,
body.re-calc-page .re-results-panel .re-status-badge.is-danger {
  background: var(--rc-neg-soft);
  color: var(--rc-neg);
  border-color: var(--rc-neg-line);
}
body.re-calc-page .re-results-panel .re-metric-big { padding: 18px 20px 0; }
body.re-calc-page .re-results-panel .re-metric-label { color: var(--rc-text-2); font-size: 0.8rem; }
body.re-calc-page .re-results-panel .re-metric-value-huge,
body.re-calc-page .re-results-panel .re-metric-value-huge.highlight-green {
  margin: 4px 0 2px;
  font: 600 2.8rem/1 var(--rc-mono);
  letter-spacing: -0.05em;
  color: var(--rc-data);
}
body.re-calc-page .re-results-panel .re-metric-subtext { color: var(--rc-text-2); }
body.re-calc-page .re-results-panel .re-verdict-narrative {
  margin: 10px 20px 0;
  padding: 0 0 16px;
  border-top: 0;
  border-bottom: 1px solid var(--rc-border);
  color: var(--rc-text-2);
  font-size: 0.85rem;
  line-height: 1.5;
}
/* DSCR (solo con crédito) */
body.re-calc-page .re-results-panel .re-dscr-panel {
  margin: 12px 20px 0;
  padding: 10px 12px;
  background: var(--rc-surface-2);
  border: 1px solid var(--rc-border);
  backdrop-filter: none;
}
body.re-calc-page .re-results-panel .re-dscr-label { color: var(--rc-text); font-size: 0.82rem; }
body.re-calc-page .re-results-panel .re-dscr-desc { color: var(--rc-text-2); }
body.re-calc-page .re-results-panel .re-dscr-badge { box-shadow: none; font-family: var(--rc-mono); font-weight: 600; }
body.re-calc-page .re-results-panel .re-dscr-badge.is-healthy { background: var(--rc-pos-soft); color: var(--rc-pos-ink); border-color: var(--rc-pos-line); }
body.re-calc-page .re-results-panel .re-dscr-badge.is-tight { background: var(--rc-warn-soft); color: var(--rc-warn); border-color: var(--rc-warn-line); }
body.re-calc-page .re-results-panel .re-dscr-badge.is-danger { background: var(--rc-neg-soft); color: var(--rc-neg); border-color: var(--rc-neg-line); }

/* Métricas en filas: ? | rótulo | cifra (tarea 6, 2026-10-26; el "?" pasó a la izquierda en la 2.3, 2026-11-03).
   La lista es la grilla y cada fila hereda sus columnas (subgrid): la columna de la cifra mide lo mismo
   en todas, así los "?" quedan en una sola línea vertical sin importar el largo del rótulo o la cifra.
   La equivalencia (≈ CLP) y la descripción van bajo el rótulo. Ritmo: 12 px arriba y abajo en todas. */
body.re-calc-page .re-results-panel .re-result-list {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr) auto;
  column-gap: 6px;
  margin: 0;
  padding: 0 20px;
}
body.re-calc-page .re-results-panel .re-result-row {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: subgrid;
  row-gap: 2px;
  align-items: center;
  box-sizing: border-box;
  min-height: 48px;
  padding-block: 12px;
  border-top: 1px solid var(--rc-border);
  background: var(--rc-surface);
}
/* Sin subgrid (navegadores viejos): la misma grilla por fila, con la cifra en un ancho fijo */
@supports not (grid-template-columns: subgrid) {
  body.re-calc-page .re-results-panel .re-result-row { grid-template-columns: 24px minmax(0, 1fr) 8.5rem; column-gap: 6px; }
}
body.re-calc-page .re-results-panel .re-result-row:first-child { border-top: 0; }
/* Escritorio y tableta: el mismo ritmo en todas las filas, más ceñido para que el resumen (con la fila
   de la TIR) quepa entero a 1440 x 900 */
@media (min-width: 768px) {
  body.re-calc-page .re-results-panel .re-result-row { min-height: 38px; padding-block: 7px; }
}
/* En tableta (o con puntero táctil) las filas conservan el ritmo de 48 px: con 38 px las áreas de 44 px de los "?"
   de filas contiguas se solapaban */
@media (min-width: 768px) and (max-width: 900px), (min-width: 768px) and (pointer: coarse) {
  body.re-calc-page .re-results-panel .re-result-row { min-height: 48px; padding-block: 12px; }
}
body.re-calc-page .re-results-panel .re-result-list { border-bottom: 1px solid var(--rc-border); }
body.re-calc-page .re-results-panel .re-result-label {
  grid-column: 2;
  grid-row: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 500;
  line-height: 1.35;
  color: var(--rc-text-2);
  overflow-wrap: break-word; /* una palabra larga se parte antes de pasar bajo el "?" */
}
body.re-calc-page .re-results-panel .re-nowrap { white-space: nowrap; }
body.re-calc-page .re-results-panel .re-result-row > .re-tooltip-btn {
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  margin: 0;
}
body.re-calc-page .re-results-panel .re-result-value {
  grid-column: 3;
  grid-row: 1;
  justify-self: end;
  font: 600 0.98rem/1.3 var(--rc-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--rc-text);
  white-space: nowrap;
}
body.re-calc-page .re-results-panel .re-result-value.is-positive { color: var(--rc-pos); }
body.re-calc-page .re-results-panel .re-result-value.is-negative { color: var(--rc-neg); }
body.re-calc-page .re-results-panel .re-result-value.highlight-green { color: var(--rc-text); }
body.re-calc-page .re-results-panel .re-result-sub,
body.re-calc-page .re-results-panel .re-result-desc {
  grid-column: 2 / 3;
  min-width: 0;
  font-size: 0.75rem;
  line-height: 1.35;
  color: var(--rc-text-2);
}
body.re-calc-page .re-results-panel .re-result-sub { font-weight: 500; font-variant-numeric: tabular-nums; }
/* Los supuestos de la TIR viven en su globo "?"; ya no hay una línea aparte bajo la cifra */
/* Sin cifra ("No calculable", "Fuera de rango"): misma letra y peso que las cifras, en tono secundario */
body.re-calc-page .re-results-panel .re-result-value.is-na { font-size: 0.9rem; color: var(--rc-text-2); }
/* Cifras muy anchas (initFilasResumen marca la fila .is-apilada si su cifra supera ~42 % del ancho): la cifra baja a
   su propia línea, alineada a la derecha, y el rótulo conserva todo el ancho; si aun así no cabe, se parte. */
body.re-calc-page .re-results-panel .re-result-row.is-apilada .re-result-value {
  grid-column: 2 / -1;
  grid-row: 2;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
}

/* El "?" del cap rate neto y del DSCR va junto a su rótulo, centrado en la línea (antes caía por debajo) */
body.re-calc-page .re-results-panel .re-metric-label,
body.re-calc-page .re-results-panel .re-dscr-label { display: inline-flex; align-items: center; gap: 6px; }
body.re-calc-page .re-results-panel .re-metric-label > .re-tooltip-btn,
body.re-calc-page .re-results-panel .re-dscr-label > .re-tooltip-btn { margin-inline: 0 !important; }

/* Ayudas (?): la caja original es solo la fuente del contenido; la muestra #reTooltipLayer
   (pia-tooltip-popover.js), una capa fija que no alarga la página ni el panel. */
body.re-calc-page .re-tooltip-box,
body.re-calc-page .re-tooltip-btn:hover .re-tooltip-box,
body.re-calc-page .re-tooltip-btn:focus-visible .re-tooltip-box { display: none !important; }

body.re-calc-page .re-tooltip-layer {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1200;
  box-sizing: border-box;
  width: min(340px, calc(100vw - 16px));
  max-height: min(60vh, 420px);
  /* La capa no se desplaza: lo hace su cuerpo (región enfocable si el texto no cabe), y "Cerrar"
     queda fuera del área que se desplaza, sin tapar texto */
  display: flex;
  flex-direction: column;
  overflow: hidden;
  margin: 0;
  padding: 14px 16px;
  border: 1px solid var(--rc-tip-line);
  border-radius: 12px;
  background: var(--rc-tip-bg);
  color: var(--rc-tip-text);
  box-shadow: 0 18px 40px -16px rgba(15, 23, 32, 0.45);
  font-size: 0.82rem;
  font-weight: 400;
  line-height: 1.55;
  text-align: left;
  transform-origin: var(--tip-origin, 50% 0);
}
body.re-calc-page .re-tooltip-layer-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--rc-tip-line) transparent;
}
body.re-calc-page .re-tooltip-layer-body:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; border-radius: 4px; }
body.re-calc-page .re-tooltip-layer[hidden] { display: none; }
body.re-calc-page .re-tooltip-layer strong { color: var(--rc-tip-strong); font-weight: 600; }
body.re-calc-page .re-tooltip-layer code {
  display: block;
  margin: 4px 0 2px;
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--rc-tip-code);
  color: inherit;
  font: 500 0.76rem/1.5 var(--rc-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
body.re-calc-page .re-tooltip-layer code + br { display: none; }
body.re-calc-page .re-tooltip-layer:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
body.re-calc-page .re-tooltip-close { display: none; }
/* Entrada casi imperceptible y solo con puntero fino (se abre decenas de veces); con teclado o dedo, sin animación */
@media (hover: hover) and (pointer: fine) and (prefers-reduced-motion: no-preference) {
  body.re-calc-page .re-tooltip-layer:not([data-instant]) {
    transition: opacity 125ms cubic-bezier(0.23, 1, 0.32, 1), scale 125ms cubic-bezier(0.23, 1, 0.32, 1);
    @starting-style { opacity: 0; scale: 0.97; }
  }
}
/* Teléfono: hoja inferior compacta, por encima de la hoja del resumen (z-index 900), con "Cerrar" de 44 px */
@media (max-width: 599px) {
  /* Los botones con acción propia (data-pia-tip) no usan la hoja: la capa queda anclada al botón, sin "Cerrar" */
  body.re-calc-page .re-tooltip-layer:not([data-anclado]) {
    top: auto !important;
    left: 8px !important;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    width: auto;
    max-height: min(60vh, 420px);
    padding: 16px 16px 12px;
    border-radius: 16px;
    box-shadow: 0 -12px 40px -12px rgba(15, 23, 32, 0.55);
  }
  body.re-calc-page .re-tooltip-close {
    flex: none;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    min-height: 44px;
    margin: 12px 0 0; /* fuera del cuerpo que se desplaza: nunca tapa el texto */
    border: 1px solid var(--rc-tip-line);
    border-radius: 999px;
    background: var(--rc-tip-bg);
    color: var(--rc-tip-strong);
    font-family: inherit;
    font-size: 0.88rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
  }
  body.re-calc-page .re-tooltip-close:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
  body.re-calc-page .re-tooltip-layer[data-anclado] .re-tooltip-close { display: none; }
}

/* Acciones */
body.re-calc-page .re-resumen-acciones { display: grid; gap: 10px; padding: 16px 20px 18px; }
body.re-calc-page .re-results-panel .re-save-prospect-btn,
body.re-calc-page .re-results-panel .re-btn-projection {
  width: 100%;
  min-height: 46px;
  margin: 0;
  padding: 0 20px;
  border-radius: 999px;
  justify-content: center;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  transition: transform 140ms var(--rc-ease), background-color 160ms var(--rc-ease);
}
body.re-calc-page .re-results-panel .re-btn-projection {
  background: transparent;
  color: var(--rc-text);
  border: 1px solid var(--rc-border-strong);
}
body.re-calc-page .re-results-panel .re-btn-projection:hover { background: var(--rc-surface-2); }
body.re-calc-page .re-results-panel .re-save-prospect-btn:active,
body.re-calc-page .re-results-panel .re-btn-projection:active { transform: scale(0.97); }
body.re-calc-page .re-resumen-nota { margin: 2px 0 0; font-size: 0.75rem; line-height: 1.45; color: var(--rc-text-2); }
/* Escritorio y tableta: ritmo más ceñido para que el resumen completo (con la fila de la TIR) y sus
   botones quepan a 1440 x 900 sin scroll interno. Va después de las reglas base para ganarles. */
@media (min-width: 768px) {
  body.re-calc-page .re-results-panel .re-metric-big { padding-top: 14px; }
  body.re-calc-page .re-results-panel .re-verdict-narrative { margin-top: 6px; padding-bottom: 10px; font-size: 0.82rem; }
  body.re-calc-page .re-resumen-head { padding: 10px 20px; }
  body.re-calc-page .re-resumen-acciones { padding: 12px 20px 14px; gap: 6px; }
}

/* Pantallas bajas (portátiles de 720 a 800 px de alto): sin scroll interno, el resumen se compacta para que
   quepa entero bajo la barra. La frase del veredicto y la del DSCR dejan de verse, pero siguen en el DOM
   (ocultas solo a la vista, nunca con display: none) para lectores de pantalla, y su texto también está en
   el globo "?" de su métrica. Con el puntero táctil se conserva el ritmo de 48 px de las filas. */
@media (min-width: 768px) and (max-height: 800px) {
  body.re-calc-page .re-results-panel .re-verdict-narrative,
  body.re-calc-page .re-results-panel .re-dscr-desc {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
    border: 0;
  }
  body.re-calc-page .re-results-panel .re-metric-big { padding-top: 10px; }
  body.re-calc-page .re-resumen-head { padding-block: 6px; }
  body.re-calc-page .re-resumen-acciones { padding: 8px 20px 10px; gap: 4px; }
}
@media (min-width: 901px) and (max-height: 800px) and (hover: hover) and (pointer: fine) {
  body.re-calc-page .re-results-panel .re-result-row { min-height: 34px; padding-block: 5px; }
}

/* ---------- 768 a 1100 px: sin índice, formulario y resumen ---------- */
@media (max-width: 1100px) {
  body.re-calc-page .re-calc-grid { grid-template-columns: minmax(0, 1fr) 320px; gap: 24px; }
  body.re-calc-page .re-toc { display: none; }
}

/* ---------- Móvil: hoja inferior ---------- */
@media (max-width: 767px) {
  body.re-calc-page .re-page-container { padding: 92px 16px calc(96px + env(safe-area-inset-bottom)); }
  body.re-calc-page .re-header { gap: 16px; margin-bottom: 20px; padding-bottom: 20px; }
  body.re-calc-page .re-header-controls-row { justify-content: flex-start; }
  body.re-calc-page .re-uf-reference-pill { flex: 1 1 100%; justify-content: flex-start; padding-block: 8px; }
  body.re-calc-page .re-calc-grid { grid-template-columns: minmax(0, 1fr); gap: 0; }
  body.re-calc-page .re-step-tag { display: none; }

  /* La hoja de resultados queda fija abajo (asa de 64 px + zona segura): el foco con teclado
     desplaza la página para que el campo enfocado no quede detrás de ella */
  :root:has(> body.re-calc-page) {
    scroll-padding-bottom: calc(64px + 16px + env(safe-area-inset-bottom));
  }
  body.re-calc-page .re-calc-grid > .re-results-panel {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 900;
    max-height: 82vh;
    max-height: 82dvh;
    overflow-y: auto; /* solo la hoja móvil: fija abajo, necesita su propio desplazamiento en pantallas bajas */
    overscroll-behavior: contain;
    scrollbar-width: thin;
    padding-bottom: env(safe-area-inset-bottom);
    border-radius: 16px 16px 0 0;
    border-bottom: 0;
    box-shadow: 0 -16px 40px -18px rgba(15, 23, 32, 0.45);
  }
  /* La regla de la barra oculta (top: 24px) no aplica a la hoja: se estiraría hasta arriba */
  body.re-calc-page .site-chrome:has(.nav.is-hidden) ~ .re-page-container .re-calc-grid > .re-results-panel {
    top: auto;
    max-height: 82dvh;
  }
  :root[data-theme="dark"] body.re-calc-page .re-calc-grid > .re-results-panel {
    box-shadow: 0 -16px 40px -12px rgba(0, 0, 0, 0.8);
    border-color: var(--rc-border-strong);
  }
  /* Barra de la hoja: asa (cap rate, flujo, «Ver detalle») y «Guardar», hermanos en una fila */
  body.re-calc-page .re-sheet-bar {
    position: sticky;
    top: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    width: 100%;
    border-bottom: 1px solid var(--rc-border);
    background: var(--rc-surface);
  }
  body.re-calc-page .re-sheet-handle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex: 1 1 0;
    min-width: 0;
    min-height: 64px;
    padding: 14px 8px 10px 16px;
    border: 0;
    background: transparent;
    color: var(--rc-text);
    font: inherit;
    text-align: left;
    cursor: pointer;
  }
  body.re-calc-page .re-sheet-save {
    flex: none;
    min-width: 92px;
    min-height: 44px;
    margin: 6px 12px 0 0;
    padding: 0 18px;
    border: 0;
    border-radius: 999px;
    background: var(--rc-accent);
    color: var(--rc-accent-ink);
    font-family: inherit;
    font-size: 0.9rem;
    font-weight: 600;
    line-height: 1;
    cursor: pointer;
    transition: transform 140ms var(--rc-ease), background-color 160ms var(--rc-ease), opacity 160ms var(--rc-ease);
  }
  body.re-calc-page .re-sheet-save:active { transform: scale(0.97); }
  body.re-calc-page .re-sheet-save:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
  body.re-calc-page .re-sheet-save.is-guardando { opacity: 0.7; cursor: progress; }
  @media (hover: hover) and (pointer: fine) {
    body.re-calc-page .re-sheet-save:hover { background: var(--rc-accent-hover); }
  }
  body.re-calc-page .re-sheet-bar::before {
    content: "";
    position: absolute;
    top: 6px;
    left: 50%;
    width: 36px;
    height: 4px;
    border-radius: 4px;
    background: var(--rc-border-strong);
    transform: translateX(-50%);
  }
  body.re-calc-page .re-sheet-handle:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: -4px; border-radius: 16px 16px 0 0; }
  body.re-calc-page .re-sheet-kpis { display: flex; flex: 1 1 auto; gap: 20px; min-width: 0; overflow: hidden; }
  body.re-calc-page .re-sheet-kpi { display: grid; gap: 2px; min-width: 0; flex: 0 1 auto; }
  body.re-calc-page .re-sheet-kpi-l { font-size: 0.7rem; color: var(--rc-text-2); }
  body.re-calc-page .re-sheet-kpi strong {
    font: 600 1.1rem/1.15 var(--rc-mono);
    color: var(--rc-data);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
    /* Montos enormes: se recortan con puntos suspensivos; la cifra completa está en el resumen abierto */
    overflow: hidden;
    text-overflow: ellipsis;
  }
  body.re-calc-page #sheetFlow { color: var(--rc-pos); }
  body.re-calc-page #sheetFlow.is-neg { color: var(--rc-neg); }
  body.re-calc-page .re-sheet-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex: none;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--rc-accent);
  }
  body.re-calc-page .re-sheet-caret { transform: rotate(180deg); transition: transform 240ms var(--rc-ease); }
  body.re-calc-page .re-results-panel.is-open .re-sheet-caret { transform: none; }
  body.re-calc-page .re-results-panel:not(.is-open) .re-resumen-cuerpo { display: none; }
  body.re-calc-page .re-results-panel.is-open .re-resumen-cuerpo { animation: re-hoja-entra 260ms var(--rc-ease); }
}
@media (max-width: 380px) {
  body.re-calc-page .re-sheet-kpis { gap: 14px; }
  body.re-calc-page .re-sheet-kpi strong { font-size: 1rem; }
}
/* Pantallas angostas: «Ver detalle» baja a una segunda línea del asa para que las cifras y «Guardar» quepan sin pisarse */
@media (max-width: 399px) {
  body.re-calc-page .re-sheet-handle { flex-wrap: wrap; align-content: center; row-gap: 2px; padding-bottom: 8px; }
  body.re-calc-page .re-sheet-kpis { flex: 1 1 100%; gap: 10px; }
  body.re-calc-page .re-sheet-save { min-width: 84px; padding: 0 14px; margin-right: 10px; }
  body.re-calc-page .re-page-container { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  :root:has(> body.re-calc-page) { scroll-padding-bottom: calc(80px + 16px + env(safe-area-inset-bottom)); }
}
@keyframes re-hoja-entra {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  body.re-calc-page .re-toc a,
  body.re-calc-page .re-calc-grid > .re-results-panel,
  body.re-calc-page .re-results-panel .re-save-prospect-btn,
  body.re-calc-page .re-results-panel .re-btn-projection,
  body.re-calc-page .re-sheet-save,
  body.re-calc-page .re-sheet-caret,
  body.re-calc-page .re-accordion-caret .re-ico { transition: none; }
  body.re-calc-page .re-results-panel.is-open .re-resumen-cuerpo { animation: none; }
}

/* ==========================================================================
   Deudas de los modales
   ========================================================================== */
/* Botones del editor de escenarios, de la matriz y de compartir: .btn no existe en esta página */
body.re-calc-page .re-modal-custom .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: transform 140ms var(--rc-ease), background-color 160ms var(--rc-ease), border-color 160ms var(--rc-ease);
}
body.re-calc-page .re-modal-custom .btn:active { transform: scale(0.97); }
body.re-calc-page .re-modal-custom .btn-sm { min-height: 44px; padding: 0 16px; font-size: 0.84rem; }
body.re-calc-page .re-modal-custom .btn-primary { background: var(--rc-accent); color: var(--rc-accent-ink); }
body.re-calc-page .re-modal-custom .btn-primary:hover { background: var(--rc-accent-hover); }
body.re-calc-page .re-modal-custom .btn-secondary {
  background: var(--rc-surface);
  color: var(--rc-text);
  border-color: var(--rc-border-strong);
}
body.re-calc-page .re-modal-custom .btn-secondary:hover { background: var(--rc-surface-2); }
body.re-calc-page .re-modal-custom .btn-outline-primary {
  background: transparent;
  color: var(--rc-pos-ink);
  border-color: var(--rc-pos-line);
}
body.re-calc-page .re-modal-custom .btn-outline-primary:hover { background: var(--rc-pos-soft); }
body.re-calc-page .re-modal-custom .btn:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }

/* Tarjeta de los modales en oscuro: contorno visible sobre el fondo atenuado */
:root[data-theme="dark"] body.re-calc-page .re-modal-custom-content,
:root[data-theme="dark"] body.re-calc-page .re-modal-card {
  border: 1px solid var(--rc-border-strong);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.04), 0 24px 60px -12px rgba(0, 0, 0, 0.75);
}

@media (max-width: 480px) {
  /* Compartir: el campo y su botón se apilan; WhatsApp ocupa el ancho */
  body.re-calc-page #modalShareProspect .re-modal-custom-content > div:last-child div[style*="display: flex"] { flex-wrap: wrap; }
  body.re-calc-page #modalShareProspect .proyectos-search-input { flex: 1 1 100% !important; min-width: 0; }
  body.re-calc-page #modalShareProspect .btn { flex: 1 1 auto; }
  body.re-calc-page #btnShareWhatsApp { width: 100%; border-radius: 999px !important; }
  /* Proyección: píldoras y moneda bajan de línea en vez de salirse */
  body.re-calc-page .re-projection-pills,
  body.re-calc-page .re-pill-toggle,
  body.re-calc-page .re-projection-inflation-group > div { flex-wrap: wrap; max-width: 100%; }
  body.re-calc-page .re-projection-control-bar > * { min-width: 0; max-width: 100%; }
  /* La vista de moneda se apila: tres opciones iguales en vez de una píldora partida */
  body.re-calc-page .re-projection-currency-group { width: 100%; }
  body.re-calc-page .re-pill-toggle { display: grid; grid-template-columns: minmax(0, 1fr); width: 100%; border-radius: 12px; }
  body.re-calc-page .re-pill-toggle-btn { min-height: 44px; }
  body.re-calc-page .re-pill-toggle-btn + .re-pill-toggle-btn { border-left: 0; border-top: 1px solid var(--pj-border, #cbd5e1); }
}
@media (prefers-reduced-motion: reduce) {
  body.re-calc-page .re-modal-custom .btn { transition: none; }
}

/* Íconos de las tarjetas de tipo de inversión (antes emoji) */
body.re-calc-page .re-type-icon { color: var(--rc-accent); line-height: 1; }
body.re-calc-page .re-type-icon .re-ico { width: 2.2rem; height: 2.2rem; }

/* ---------- Revisión de cierre (tarea 9g) ---------- */

/* Arriendo e impuesto estimados: neutros, con la acción en el verde del sitio (antes, un azul que hacía de segundo
   acento). "Aplicar" mide al menos 32 px de alto (44 px con puntero grueso, en pia-real-estate.css). */
body.re-calc-page .re-suggested-rent-pill,
body.re-calc-page .re-suggested-tax-badge {
  background: var(--rc-surface-2);
  border-color: var(--rc-border);
  color: var(--rc-text-2);
  padding: 8px 8px 8px 12px;
  line-height: 1.45;
}
body.re-calc-page .re-suggested-rent-pill strong,
body.re-calc-page .re-suggested-tax-badge strong { color: var(--rc-text); }
body.re-calc-page .re-suggested-note { color: var(--rc-text-2); font-size: 0.78rem; }
body.re-calc-page #suggestedRentVal { white-space: nowrap; }
body.re-calc-page .re-apply-btn {
  flex: none;
  min-height: 32px;
  padding: 0 14px;
  border: 1px solid var(--rc-accent);
  border-radius: 999px;
  background: transparent;
  color: var(--rc-pos-ink);
  font-size: 0.8rem;
  font-weight: 600;
}
body.re-calc-page .re-apply-btn:hover { background: var(--rc-pos-soft); }
body.re-calc-page .re-apply-btn:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }

/* "Ver en mapa": botón secundario del sitio (borde y texto), sin el degradado menta. */
body.re-calc-page .re-btn-secondary {
  background: transparent;
  border: 1px solid var(--rc-border-strong);
  border-radius: 999px;
  color: var(--rc-text);
  box-shadow: none;
  font-weight: 600;
}
body.re-calc-page .re-btn-secondary:hover:not(:disabled) {
  background: var(--rc-surface-2);
  border-color: var(--rc-text-2);
  color: var(--rc-text);
  box-shadow: none;
  transform: none;
}
body.re-calc-page .re-btn-secondary:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
body.re-calc-page .re-coords-badge {
  color: var(--rc-text-2);
  background: var(--rc-surface);
  border: 1px solid var(--rc-border);
}

/* Ayuda "?": 24 px (DIRECTION.md) */
/* El margen negativo deja la línea con el alto de antes (18 px): el resumen fijo no crece. */
body.re-calc-page .re-tooltip-btn { width: 24px; height: 24px; margin-block: -3px; font-size: 12px; flex: none; }
/* Objetivo táctil de 44 px sin agrandar el círculo de 24 px */
body.re-calc-page .re-tooltip-btn::before { content: ""; position: absolute; inset: -10px; }
/* El área de 44 px queda sobre el borde de arriba del campo siguiente (si no, el campo se lleva el toque): el campo
   sigue teniendo más de 44 px propios bajo esa franja de 7 px. */
body.re-calc-page .re-tooltip-btn { z-index: 1; }
/* El "?" de la ayuda abierta queda marcado mientras la capa está a la vista */
body.re-calc-page .re-tooltip-btn[data-tip-open] { background: var(--rc-accent); color: var(--rc-accent-ink); box-shadow: inset 0 0 0 1px var(--rc-accent); }

/* País: el select va sin borde dentro de la píldora; el anillo de foco se dibuja en la píldora. */
body.re-calc-page .re-country-picker-wrap:has(.re-country-select:focus-visible) {
  outline: 2px solid var(--rc-accent);
  outline-offset: 2px;
}

/* Preguntas frecuentes con el idioma visual del sitio: título a la izquierda, tarjetas redondeadas y chevron en
   círculo que gira al abrir. */
body.re-calc-page .re-edu-header { text-align: left; }
body.re-calc-page .re-edu-title { font-size: clamp(1.6rem, 3.2vw, 2.2rem); line-height: 1.1; letter-spacing: -0.03em; font-weight: 700; text-wrap: balance; }
body.re-calc-page .re-edu-subtitle { margin-top: 12px; max-width: 56ch; }
body.re-calc-page .re-faq-card {
  border-radius: 20px;
  box-shadow: none;
  transition: border-color 180ms var(--rc-ease), background-color 180ms var(--rc-ease);
}
body.re-calc-page .re-faq-question {
  gap: 16px;
  padding: 20px 24px;
  background: transparent;
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: -0.01em;
}
body.re-calc-page .re-faq-question:hover { background: transparent; }
body.re-calc-page .re-faq-question > span:first-child { flex: 1; min-width: 0; }
body.re-calc-page .re-faq-question:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: -2px; border-radius: 20px; }
body.re-calc-page .re-faq-ico {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--rc-surface-2);
  color: var(--rc-text-2);
  transition: transform 240ms var(--rc-ease), background-color 180ms, color 180ms;
}
body.re-calc-page .re-faq-ico .re-ico { width: 14px; height: 14px; }
body.re-calc-page .re-faq-card:has(.re-faq-question[aria-expanded="true"]) { border-color: var(--rc-accent); background: var(--rc-pos-soft); }
body.re-calc-page .re-faq-question[aria-expanded="true"] .re-faq-ico { transform: rotate(180deg); background: var(--rc-pos-soft); color: var(--rc-pos-ink); }
body.re-calc-page .re-faq-answer { padding: 0 24px 20px; border-top: 0; background: transparent; }
@media (hover: hover) and (pointer: fine) {
  body.re-calc-page .re-faq-card:hover { border-color: var(--rc-accent); }
  body.re-calc-page .re-faq-card:hover .re-faq-ico { background: var(--rc-pos-soft); color: var(--rc-pos-ink); }
}
@media (max-width: 640px) {
  body.re-calc-page .re-faq-question { padding: 18px 16px 18px 20px; font-size: 1rem; }
  body.re-calc-page .re-faq-answer { padding: 0 20px 18px; }
}
@media (prefers-reduced-motion: reduce) {
  body.re-calc-page .re-faq-ico { transition: none; }
}

/* Cierre "Antes de invertir, conoce tu perfil": titular y CTA arriba, la escala de los 5 niveles del test como
   pieza firma (tarea 4, 2026-11-02: se mueve; el tramo activo en verde y el puntaje en ámbar --rc-data, que es la
   única cifra inventada y va rotulada "Ejemplo"), la tarjeta que explica el nivel y tres hechos abajo. */
body.re-calc-page .re-final { display: block; padding: 72px 24px 96px; }
body.re-calc-page .re-final-box {
  position: relative;
  overflow: hidden;
  max-width: 1192px;
  margin: 0 auto;
  padding: 56px;
  border: 1px solid var(--rc-border);
  border-radius: 12px;
  background: var(--rc-surface);
}
body.re-calc-page .re-final-box::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(520px circle at 12% 0%, var(--rc-pos-soft), transparent 70%);
}
body.re-calc-page .re-final-box > * { position: relative; }
body.re-calc-page .re-final-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 24px 56px; align-items: end; }
body.re-calc-page .re-final-title {
  max-width: 18ch;
  margin: 0;
  color: var(--rc-text);
  font-size: clamp(1.9rem, 3.6vw, 2.8rem);
  line-height: 1.08;
  letter-spacing: -0.03em;
  font-weight: 700;
  text-wrap: balance;
}
body.re-calc-page .re-final-sub { max-width: 46ch; margin: 16px 0 0; color: var(--rc-text-2); font-size: 1.0625rem; line-height: 1.6; text-wrap: pretty; }
body.re-calc-page .re-final-act { display: flex; flex-direction: column; align-items: flex-start; max-width: 300px; }
body.re-calc-page .re-final-note { margin: 12px 0 0; color: var(--rc-text-2); font-size: 0.875rem; line-height: 1.5; }
/* El CTA envuelve en vez de recortarse con texto grande o zoom (el .btn del sitio es nowrap) */
body.re-calc-page .re-final-act .btn { max-width: 100%; white-space: normal; text-align: center; line-height: 1.25; padding-block: 11px; }
body.re-calc-page .re-final .tag { font-family: var(--rc-mono); font-size: 0.75rem; line-height: 1.3; color: var(--rc-text-2); border: 1px solid var(--rc-border-strong); padding: 4px 11px; border-radius: 999px; white-space: nowrap; }

body.re-calc-page .re-final-preview { margin: 44px 0 0; }
body.re-calc-page .rfs-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-bottom: 16px; }
body.re-calc-page .rfs-title { font-size: 0.875rem; font-weight: 600; color: var(--rc-text); }
body.re-calc-page .rfs-hint { flex-basis: 100%; margin: 0; color: var(--rc-text-2); font-size: 0.875rem; line-height: 1.45; }
body.re-calc-page .rfs-hint[hidden], body.re-calc-page .lv-card[hidden] { display: none; }

/* Escala (pia-perfil-escala.js). El <input type=range> cubre la regla (44 px de alto, transparente) y hace todo el
   trabajo: puntero, toque, teclado y lector de pantalla. Lo que se ve es dibujo: la barra de 5 tramos y el marcador
   ámbar. Columnas 20,5/20/20/20/19,5: los bordes caen en 20,5 %, 40,5 %..., justo entre 20|21, 40|41..., y el
   marcador va en v %, la misma posición que el pulgar nativo (22 px; la regla tiene 11 px de margen). */
body.re-calc-page .sa { --thumb: 22px; }

/* Cabecera del nivel: número y fase arriba; debajo, la figura del inversor camina sobre la barra siguiendo al marcador */
body.re-calc-page .sa-stage-wrap {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: 0 0 8px;
}

body.re-calc-page .sa-readout-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

body.re-calc-page .sa-readout { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 6px; margin: 0; }

body.re-calc-page .sa-stage-badge {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

body.re-calc-page .sa-stage-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--rc-mono);
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--rc-pos-ink);
  background: var(--rc-pos-soft);
  border: 1px solid var(--rc-border);
  padding: 3px 10px;
  border-radius: 999px;
  letter-spacing: -0.01em;
}

body.re-calc-page .sa-evo-caption {
  font-size: 0.72rem;
  font-family: var(--rc-mono);
  color: var(--rc-text-2);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* Pista de la figura: mismo ancho útil que la barra (11 px de margen a cada lado, como el pulgar). La posición
   horizontal sale de --v (0 a 1), que el script acerca poco a poco al puntaje. Sin JS no se muestra. */
body.re-calc-page .sa-evo-display {
  --v: 0.54;
  display: none;
  position: relative;
  height: 156px;
  padding: 0 calc(var(--thumb) / 2);
  pointer-events: none;
}
body.re-calc-page .sa.is-ready .sa-evo-display { display: block; }

body.re-calc-page .sa-evo-figure-wrap {
  --fig: 132px;
  position: absolute;
  bottom: 6px;
  width: var(--fig);
  height: 145px;
  /* centrada en el marcador, sin salirse de la pista */
  left: clamp(calc(var(--fig) / 2), calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--v)), calc(100% - var(--fig) / 2));
  translate: -50% 0;
}

body.re-calc-page .sa-evo-live {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}

/* El suelo por el que camina: una línea tenue de lado a lado, más intensa bajo la figura. */
body.re-calc-page .sa-evo-pedestal {
  position: absolute;
  left: calc(var(--thumb) / 2);
  right: calc(var(--thumb) / 2);
  bottom: 4px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--rc-border-strong), var(--rc-accent) calc(var(--v) * 100%), var(--rc-border-strong));
  opacity: 0.55;
}

/* Lluvia de billetes y monedas al llegar a 100: cae sobre la pista y se recorta a sus bordes. */
body.re-calc-page .sa-evo-rain {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}
body.re-calc-page .sa-evo-drop { position: absolute; top: 0; display: block; line-height: 0; will-change: transform; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.18)); }
@media (prefers-reduced-motion: reduce) { body.re-calc-page .sa-evo-rain { display: none; } }

@media (max-width: 640px) {
  body.re-calc-page .sa-stage-pill {
    font-size: 0.72rem;
    line-height: 1.25;
    padding: 2px 8px;
    border-radius: 12px;
  }
  body.re-calc-page .sa-evo-display { height: 118px; }
  body.re-calc-page .sa-evo-figure-wrap { --fig: 100px; height: 110px; }
  /* El pie va siempre en su propia línea: si cupiera junto a la fase en un nivel y no en otro, la cabecera cambiaría de alto. */
  body.re-calc-page .sa-evo-caption { flex-basis: 100%; }
}
body.re-calc-page .sa-num { min-width: calc(2ch - 0.1em); font-family: var(--rc-mono); font-size: 2.25rem; font-weight: 600; line-height: 1; letter-spacing: -0.05em; color: var(--rc-data); font-variant-numeric: tabular-nums; }
body.re-calc-page .sa-of { font-family: var(--rc-mono); font-size: 0.75rem; color: var(--rc-text-2); }
/* El nombre junto al número solo hace falta en móvil sin JS: en escritorio se lee bajo la barra y, con JS, en la
   tarjeta (un solo nombre a la vista). */
body.re-calc-page .sa-lv { display: none; font-size: 1.125rem; font-weight: 600; color: var(--rc-text); }
body.re-calc-page .sa-rail { position: relative; padding: 0 calc(var(--thumb) / 2); container-type: inline-size; }
body.re-calc-page .sa-cols { display: grid; grid-template-columns: 20.5fr 20fr 20fr 20fr 19.5fr; gap: 4px; }
body.re-calc-page .sa-bar { height: 44px; align-items: center; }
body.re-calc-page .sa-bar span { height: 8px; background: var(--rc-border-strong); }
body.re-calc-page .sa-bar span:first-child { border-radius: 4px 0 0 4px; }
body.re-calc-page .sa-bar span:last-child { border-radius: 0 4px 4px 0; }
body.re-calc-page .sa-bar span.is-on { background: var(--rc-accent); }
body.re-calc-page .sa-ticks { margin-top: -6px; font-family: var(--rc-mono); font-size: 0.75rem; line-height: 1.3; color: var(--rc-text-2); font-variant-numeric: tabular-nums; }
body.re-calc-page .sa-ticks span { position: relative; padding-top: 8px; }
body.re-calc-page .sa-ticks span::before { content: ""; position: absolute; top: 0; left: 0; width: 1px; height: 6px; background: var(--rc-border-strong); }
body.re-calc-page .sa-names { margin-top: 2px; }
body.re-calc-page .sa-names span { display: flex; align-items: flex-start; min-width: 0; min-height: 44px; padding: 6px 0; color: var(--rc-text-2); font-size: 0.95rem; font-weight: 500; line-height: 1.25; overflow-wrap: break-word; }
body.re-calc-page .sa-names span.is-on { color: var(--rc-text); font-weight: 600; }
body.re-calc-page .sa.is-ready .sa-names span, body.re-calc-page .sa.is-ready .sa-ticks span { cursor: pointer; }
@media (hover: hover) and (pointer: fine) { body.re-calc-page .sa.is-ready .sa-names span:not(.is-on):hover { color: var(--rc-text); } }

body.re-calc-page .sa-input { position: absolute; z-index: 2; inset: 0 0 auto 0; width: 100%; height: 44px; margin: 0; opacity: 0; cursor: pointer; touch-action: pan-y; -webkit-appearance: none; appearance: none; background: transparent; }
body.re-calc-page .sa-input:disabled { cursor: default; }
body.re-calc-page .sa-input::-webkit-slider-thumb { -webkit-appearance: none; width: var(--thumb); height: 44px; }
body.re-calc-page .sa-input::-moz-range-thumb { width: var(--thumb); height: 44px; border: 0; }
body.re-calc-page .sa-input:active { cursor: grabbing; }
/* El marcador parte en el inicio del recorrido del pulgar (el borde del área útil de la regla, que es su
   contenedor) y se traslada --v (0 a 1) de ese ancho: 100cqi es el recorrido exacto. Solo se animan translate y
   scale. Sin unidades de contenedor, cae a left. */
body.re-calc-page .sa-thumb { --v: 0.54; position: absolute; z-index: 1; top: 22px; left: calc(var(--thumb) / 2); width: var(--thumb); height: var(--thumb); margin: calc(var(--thumb) / -2) 0 0 calc(var(--thumb) / -2); border: 4px solid var(--rc-surface); border-radius: 50%; background: var(--rc-data); box-shadow: 0 0 0 1px var(--rc-data), 0 2px 6px rgba(15, 23, 32, 0.18); pointer-events: none; translate: calc(100cqi * var(--v)) 0; }
@supports not (width: 1cqi) {
  body.re-calc-page .sa-thumb { left: calc(var(--thumb) / 2 + (100% - var(--thumb)) * var(--v)); translate: none; }
}
body.re-calc-page .sa-input:active ~ .sa-thumb { scale: 1.18; }
body.re-calc-page .sa-input:focus-visible ~ .sa-thumb { box-shadow: 0 0 0 1px var(--rc-data), 0 0 0 4px var(--rc-surface), 0 0 0 6px var(--rc-accent); }

/* Tarjeta del nivel: los 5 paneles viven apilados en la misma celda, así la tarjeta mide lo que el panel más alto
   y no salta al cambiar de nivel. Solo el activo es visible y accesible (los otros llevan inert y aria-hidden). */
body.re-calc-page .lv-card { display: grid; margin: 12px 0 0; }
/* El borde y el fondo van en el panel activo, que mide lo que su texto (align-self: start). La celda sigue
   reservando el alto del panel más largo, así que lo que viene abajo no se mueve al cambiar de nivel: el sobrante
   queda fuera del borde, como aire de la sección. */
body.re-calc-page .lv-panel { grid-area: 1 / 1; align-self: start; display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: 20px 32px; align-content: start; padding: 24px 28px; border: 1px solid var(--rc-border); border-radius: 10px; background: var(--rc-surface); }
body.re-calc-page .lv-panel:not(.is-on) { visibility: hidden; }
body.re-calc-page .lv-name { margin: 0; color: var(--rc-text); font-size: 1.25rem; line-height: 1.2; letter-spacing: -0.02em; font-weight: 700; }
body.re-calc-page .lv-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 14px; margin: 8px 0 0; font-family: var(--rc-mono); font-size: 0.75rem; line-height: 1.4; color: var(--rc-text-2); }
body.re-calc-page .lv-meta .lv-phase { color: var(--rc-pos-ink); }
body.re-calc-page .lv-sum { margin: 12px 0 0; color: var(--rc-text-2); font-size: 0.95rem; line-height: 1.55; text-wrap: pretty; }
body.re-calc-page .lv-h { margin: 0 0 10px; color: var(--rc-text); font-size: 0.8125rem; font-weight: 600; line-height: 1.4; }
body.re-calc-page .lv-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
body.re-calc-page .lv-list li { display: grid; grid-template-columns: 16px minmax(0, 1fr); gap: 10px; color: var(--rc-text-2); font-size: 0.9rem; line-height: 1.45; }
body.re-calc-page .lv-list .icon { width: 16px; height: 16px; margin-top: 2px; color: var(--rc-text-2); }
body.re-calc-page .lv-next .icon { color: var(--rc-accent); }

@media (prefers-reduced-motion: no-preference) {
  body.re-calc-page .sa-bar span, body.re-calc-page .sa-names span { transition: background-color 180ms ease, color 180ms ease; }
  body.re-calc-page .sa-thumb { transition: scale 140ms var(--rc-ease), box-shadow 140ms var(--rc-ease); }
  /* Clic o toque que salta lejos: el marcador viaja 200 ms. Arrastrando sigue al dedo sin retraso. */
  body.re-calc-page .sa.is-jump .sa-thumb { transition: translate 200ms cubic-bezier(0.65, 0, 0.35, 1), left 200ms cubic-bezier(0.65, 0, 0.35, 1), scale 140ms var(--rc-ease), box-shadow 140ms var(--rc-ease); }
  /* Cambio de nivel: fundido corto con 4 px de desplazamiento y un desenfoque leve que une los dos estados.
     Es una transición (interrumpible), no un keyframe. */
  body.re-calc-page .lv-panel { transition: opacity 220ms var(--rc-ease), transform 220ms var(--rc-ease), filter 220ms var(--rc-ease), visibility 0s linear 220ms; }
  body.re-calc-page .lv-panel:not(.is-on) { opacity: 0; transform: translateY(4px); filter: blur(2px); }
  body.re-calc-page .lv-panel.is-on { transition-delay: 0s; }
}
/* Con movimiento reducido el sitio deja fundidos de 120 ms en todo .site-chrome (chrome.css); en la escala no
   van: el marcador salta sin viajar y el panel cambia de golpe (con visibility en fundido se verían dos a la vez). */
@media (prefers-reduced-motion: reduce) {
  body.re-calc-page .re-final .sa *, body.re-calc-page .re-final .sa *::before, body.re-calc-page .re-final .lv-panel { transition: none !important; }
}

body.re-calc-page .re-final-facts { display: flex; flex-wrap: wrap; gap: 12px 32px; margin: 28px 0 0; padding: 22px 0 0; border-top: 1px solid var(--rc-border); list-style: none; }
body.re-calc-page .re-final-facts li { display: flex; align-items: center; gap: 12px; color: var(--rc-text-2); font-size: 0.95rem; line-height: 1.4; }
body.re-calc-page .re-final-facts strong { color: var(--rc-text); font-weight: 600; }
body.re-calc-page .re-final-facts .icon { flex: none; width: 20px; height: 20px; color: var(--rc-accent); }

@media (max-width: 1000px) {
  body.re-calc-page .re-final-top { grid-template-columns: minmax(0, 1fr); align-items: start; }
  body.re-calc-page .re-final-act { max-width: none; }
}
@media (max-width: 1000px) {
  body.re-calc-page .lv-panel { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  body.re-calc-page .lv-panel > :first-child { grid-column: 1 / -1; }
}
/* Bajo 760 px los nombres no caben en 5 columnas: se quitan y el nivel se lee en la tarjeta (sin JS, junto al
   número). */
@media (max-width: 760px) {
  body.re-calc-page .sa-names { display: none; }
  body.re-calc-page .sa:not(.is-ready) .sa-lv { display: block; flex-basis: 100%; }
  body.re-calc-page .sa-ticks { margin-bottom: 4px; }
  /* Las marcas son el atajo de un toque por nivel: 44 px de alto y 2 px de cada hueco entre columnas. */
  body.re-calc-page .sa.is-ready .sa-ticks span { min-height: 44px; margin-inline: -2px; padding-inline: 2px; }
  body.re-calc-page .sa.is-ready .sa-ticks span::before { left: 2px; }
}
@media (max-width: 767px) {
  body.re-calc-page .re-final { padding: 56px 16px 64px; }
  body.re-calc-page .re-final-box { padding: 32px 20px; }
  body.re-calc-page .re-final-act { align-items: stretch; }
  body.re-calc-page .re-final-act .btn { width: 100%; justify-content: center; }
  body.re-calc-page .re-final-facts { flex-direction: column; }
  body.re-calc-page .lv-panel { grid-template-columns: minmax(0, 1fr); gap: 18px; padding: 20px 18px; }
}
@media (max-width: 360px) {
  body.re-calc-page .re-final-act .btn { padding-inline: 12px; font-size: 0.9rem; }
}
/* Entrada: la caja sube y aparece al entrar en pantalla. Ya es visible sin
   soporte de animation-timeline, y con movimiento reducido no se anima nada. */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    body.re-calc-page .re-final-box { animation: re-final-in linear both; animation-timeline: view(); animation-range: entry 0% entry 55%; }
  }
}
@keyframes re-final-in { from { opacity: 0.35; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* Comisión de administración: campo "Otro valor" (3.2) */
body.re-calc-page .re-mgmt-custom[hidden],
body.re-calc-page .re-mgmt-custom-error[hidden] { display: none; }
body.re-calc-page .re-mgmt-custom { margin-top: 8px; }
body.re-calc-page .re-mgmt-custom > .re-input { min-height: 44px; }
body.re-calc-page .re-mgmt-custom-error { color: var(--rc-neg); font-weight: 600; }
body.re-calc-page .re-input[aria-invalid="true"] { border-color: var(--rc-neg); }

/* Selector de comuna con búsqueda (tarea 9): mismos tokens que los campos de la calculadora */
body.re-calc-page .pia-combo-lista { color: var(--rc-text); background: var(--rc-surface); box-shadow: 0 0 0 1px var(--rc-border-strong), var(--rc-shadow); }
body.re-calc-page .pia-combo-opcion.is-activa { background: var(--rc-surface-2); }
body.re-calc-page .pia-combo-opcion:active { background: var(--rc-track); }
body.re-calc-page .pia-combo-opcion[aria-selected="true"]::after { background: var(--rc-accent); }
body.re-calc-page .pia-combo-vacio { color: var(--rc-text-2); background: var(--rc-surface); box-shadow: 0 0 0 1px var(--rc-border-strong), var(--rc-shadow); }

/* Gastos comunes (tarea 6): casilla "Los pago yo aunque esté arrendado" con objetivo táctil de 44 px */
body.re-calc-page .re-ce-owner { min-height: 44px; margin-top: 2px; gap: 10px; line-height: 1.35; }
body.re-calc-page .re-ce-owner input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--rc-accent); }
/* Área de toque de 44 x 44 px centrada en la casilla de 18 px (QA M6): es parte del rótulo, que la marca */
body.re-calc-page .re-ce-owner { position: relative; }
/* La casilla queda encima del área: el toque sobre ella la marca directo */
body.re-calc-page .re-ce-owner input { position: relative; z-index: 1; }
body.re-calc-page .re-ce-owner::before { content: ""; position: absolute; left: -13px; top: 50%; width: 44px; height: 44px; transform: translateY(-50%); }
body.re-calc-page #hintCommonExpenses { margin-bottom: 0; }

/* Objetivos táctiles de 44 px (tarea 0.1): país, UF/CLP/USD y "Aplicar" en pantallas angostas o táctiles */
@media (max-width: 900px), (pointer: coarse) {
  body.re-calc-page .re-country-select,
  body.re-calc-page .re-currency-btn,
  body.re-calc-page .re-apply-btn { min-height: 44px; }
}

/* Tipos de cambio editables: el pill del encabezado abre un panel flotante bajo el encabezado.
   Flota (position: absolute): no suma altura al encabezado ni mueve nada al abrir o al cargar. */
body.re-calc-page .re-header { position: relative; }
body.re-calc-page button.re-uf-reference-pill { font: inherit; font-size: 0.85rem; text-align: left; margin: 0; appearance: none; -webkit-appearance: none; }
body.re-calc-page button.re-uf-reference-pill:disabled { opacity: 1; cursor: default; }
body.re-calc-page .re-uf-reference-pill.has-fx { cursor: pointer; }
body.re-calc-page .re-uf-reference-pill.has-fx::after {
  content: ""; flex: none; width: 7px; height: 7px; margin: 0 2px 3px 2px;
  border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg);
}
body.re-calc-page .re-uf-reference-pill.has-fx[aria-expanded="true"]::after { transform: rotate(-135deg) translate(-2px, -2px); }
body.re-calc-page .re-uf-reference-pill.has-fx:focus-visible { outline: 3px solid var(--rc-accent); outline-offset: 2px; }
body.re-calc-page .re-fx-pop {
  position: absolute; z-index: 30; top: 100%; right: 0; left: auto; width: min(560px, 100%); margin-top: -12px;
  box-shadow: var(--rc-shadow, 0 12px 32px rgba(0, 0, 0, 0.18)); border-radius: 12px;
}
body.re-calc-page .re-fx-pop[hidden] { display: none; }
body.re-calc-page .re-fx-pop .pia-fx { margin: 0; }
@media (max-width: 640px) { body.re-calc-page .re-fx-pop { left: 0; width: 100%; } }

/* Impuesto de timbres: botón "Calcular automáticamente" (pia-stamp-tax-field.js).
   Bajo 401 px el botón pasa a ancho completo y de 44 px; el "?" abre la capa de ayuda compartida. */
body.re-calc-page .re-stamp-auto { margin-top: 8px; }
body.re-calc-page .re-stamp-auto-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
body.re-calc-page .re-stamp-auto-btn {
  min-height: 44px;
  padding: 0 16px;
  border: 1px solid var(--rc-border-strong);
  border-radius: 10px;
  background: var(--rc-surface-2);
  color: var(--rc-text);
  font-weight: 600;
  font-size: 0.86rem;
  line-height: 1.2;
  font-family: inherit;
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease;
}
body.re-calc-page .re-stamp-auto-btn:hover:not(:disabled) { border-color: var(--rc-accent); background: var(--rc-pos-soft); }
body.re-calc-page .re-stamp-auto-btn:focus-visible { outline: 2px solid var(--rc-accent); outline-offset: 2px; }
body.re-calc-page .re-stamp-auto-btn:disabled { cursor: not-allowed; opacity: 0.62; }
body.re-calc-page .re-stamp-auto-tag {
  display: inline-block;
  padding: 3px 9px;
  border: 1px solid var(--rc-warn-line);
  border-radius: 999px;
  background: var(--rc-warn-soft);
  color: var(--rc-warn);
  font-size: 0.75rem;
  font-weight: 600;
  line-height: 1.3;
}
body.re-calc-page .re-stamp-auto-tag[hidden] { display: none; }
body.re-calc-page .re-stamp-auto-msg { margin: 6px 0 0; font-size: 0.8rem; line-height: 1.45; color: var(--rc-text-2); }
@media (max-width: 400px) {
  body.re-calc-page .re-stamp-auto-btn { flex: 1 1 100%; width: 100%; }
}
/* Contenido de la ayuda (se copia a #reTooltipLayer): título, reglas, fórmula en monoespaciada y fuente */
body.re-calc-page .re-tooltip-layer .re-stamp-tip-title { display: block; margin-bottom: 6px; color: var(--rc-tip-strong); font-weight: 600; font-size: 0.88rem; }
body.re-calc-page .re-tooltip-layer .re-stamp-tip-rules { display: block; }
body.re-calc-page .re-tooltip-layer .re-stamp-tip-rule { display: block; margin: 0 0 6px; }
body.re-calc-page .re-tooltip-layer .re-stamp-tip-label { display: block; margin-top: 8px; color: var(--rc-tip-strong); font-weight: 600; font-size: 0.74rem; letter-spacing: 0.02em; }
body.re-calc-page .re-tooltip-layer .re-stamp-tip-source { display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--rc-tip-line); font-size: 0.74rem; opacity: 0.9; }

/* Globo del DSCR: la frase que corresponde a tu cobertura va destacada */
.re-tooltip-layer .re-dscr-nivel { opacity: 0.65; }
.re-tooltip-layer .re-dscr-nivel.is-actual { opacity: 1; font-weight: 700; }

/* ---------- Obra en construcción (decorativa, solo en la sección de los campos) ----------
   De plano técnico a casa terminada. pia-obra-construccion.js dibuja el SVG y escribe --p (0 a 1) según el
   scroll, más --obra-alto (px) y --obra-escala (px de pantalla por unidad del dibujo). Cada trazo tiene su
   tramo (--a inicio, --d duración; --b/--e salida) y calcula aquí su avance --t: dibujo de línea (ob-l),
   aparición (ob-f), crecimiento desde abajo (ob-s), aparición con escala (ob-pop, ob-crece). Solo se animan
   stroke-dashoffset, opacity y transform; los colores son tokens del tema, fijos por clase. Sin JS o con
   movimiento reducido --p vale 1: casa terminada y quieta. El contenedor recorta y desvanece todo a
   transparente antes de sus bordes, y queda lejos de los bordes de la sección (separador de velas). */
/* --p no se hereda: el JS la escribe en el contenedor y, recortada a su ventana, en cada trazo; así el cambio
   de avance solo recalcula el estilo de los trazos que se mueven */
@property --p { syntax: "<number>"; inherits: false; initial-value: 1; }
body.re-calc-page .re-obra {
  --p: 1;
  --ob-mx: 14%;
  --ob-my: 10%;
  --ob-guia: color-mix(in srgb, var(--rc-text-2) 60%, var(--rc-border-strong));
  --ob-estr: color-mix(in srgb, var(--rc-text-2) 72%, transparent);
  --ob-cont: color-mix(in srgb, var(--rc-text-2) 90%, transparent);
  --ob-suave: color-mix(in srgb, var(--rc-accent) 85%, transparent);
  display: none;
  position: relative;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: layout paint style;
  container-type: size;
  container-name: obra;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 var(--ob-mx), #000 calc(100% - var(--ob-mx)), transparent), linear-gradient(to bottom, transparent, #000 var(--ob-my), #000 calc(100% - var(--ob-my)), transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 var(--ob-mx), #000 calc(100% - var(--ob-mx)), transparent), linear-gradient(to bottom, transparent, #000 var(--ob-my), #000 calc(100% - var(--ob-my)), transparent);
  mask-composite: intersect;
}
body.re-calc-page .re-obra .ob-svg { display: block; width: 100%; height: 100%; overflow: visible; }
body.re-calc-page .re-obra .ob-svg * { --b: 2; --e: 1; }
/* Sonda del tamaño de la ventana (la crea el JS): un único observer se entera del alto sin escuchar "resize" */
body.re-calc-page .re-obra-sonda { position: fixed; inset: 0; visibility: hidden; pointer-events: none; contain: strict; }

/* Trazo base: sin relleno, grosor constante en pantalla (el dibujo escala con el contenedor) */
body.re-calc-page .re-obra .ob-svg :is(path, rect, circle) {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: calc(var(--ob-sw, 1px) / var(--obra-escala, 0.8));
}
body.re-calc-page .re-obra :is(.ob-l, .ob-f, .ob-s, .ob-pop, .ob-crece) {
  --t: clamp(0, (var(--p) - var(--a)) / var(--d), 1);
  --fuera: clamp(0, (var(--p) - var(--b)) / var(--e), 1);
}
/* ob-l: el trazo aterriza (salida cuadrática). No lleva raya propia: el dasharray lo usa el dibujo */
body.re-calc-page .re-obra .ob-l {
  --te: calc(var(--t) * (2 - var(--t)));
  stroke-dasharray: 1 1;
  stroke-dashoffset: calc(1 - var(--te));
  opacity: calc(clamp(0, var(--t) * 40, 1) * (1 - var(--fuera)));
}
body.re-calc-page .re-obra .ob-f { opacity: calc(var(--t) * (1 - var(--fuera))); }
body.re-calc-page .re-obra .ob-s {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scaleY(var(--t));
  opacity: calc(clamp(0, var(--t) * 40, 1) * (1 - var(--fuera)));
}
body.re-calc-page .re-obra .ob-pop {
  transform-box: fill-box;
  transform-origin: 50% 50%;
  transform: scale(calc(0.9 + 0.1 * var(--t)));
  opacity: calc(var(--t) * (1 - var(--fuera)));
}
body.re-calc-page .re-obra .ob-crece {
  transform-box: fill-box;
  transform-origin: 50% 100%;
  transform: scale(calc(0.75 + 0.25 * var(--t)));
  opacity: calc(var(--t) * (1 - var(--fuera)));
}
body.re-calc-page .re-obra .ob-sale { opacity: calc(1 - clamp(0, (var(--p) - var(--b)) / var(--e), 1)); }

/* Grosor en pantalla (px): guía y detalle fino 1; estructura 1,2; contornos 1,4; losas y acentos 1,8 */
body.re-calc-page .re-obra .ob-svg :is(.ob-guia, .ob-suelo, .ob-achurado, .ob-teja, .ob-nube, .ob-camino) { --ob-sw: 1px; }
body.re-calc-page .re-obra .ob-svg :is(.ob-estructura, .ob-cimiento, .ob-grua, .ob-gancho) { --ob-sw: 1.2px; }
body.re-calc-page .re-obra .ob-svg :is(.ob-muro, .ob-ventana, .ob-veg, .ob-sol) { --ob-sw: 1.4px; }
body.re-calc-page .re-obra .ob-svg :is(.ob-losa, .ob-acento) { --ob-sw: 1.8px; }
body.re-calc-page .re-obra .ob-svg .ob-fino { --ob-sw: 1px; }

/* Color de trazo: solo tokens del tema (3:1 o más contra --rc-bg en claro y oscuro) */
body.re-calc-page .re-obra .ob-svg :is(.ob-guia, .ob-suelo, .ob-achurado, .ob-camino, .ob-nube) { stroke: var(--ob-guia); }
body.re-calc-page .re-obra .ob-svg :is(.ob-estructura, .ob-cimiento, .ob-grua, .ob-gancho) { stroke: var(--ob-estr); }
body.re-calc-page .re-obra .ob-svg :is(.ob-muro, .ob-ventana) { stroke: var(--ob-cont); }
body.re-calc-page .re-obra .ob-svg .ob-acento { stroke: var(--rc-accent); }
body.re-calc-page .re-obra .ob-svg :is(.ob-teja, .ob-veg, .ob-sol) { stroke: var(--ob-suave); }
body.re-calc-page .re-obra .ob-svg .ob-estaca { stroke-dasharray: 3 3; }
body.re-calc-page .re-obra .ob-svg .ob-eje { stroke-dasharray: 6 2 1 2; }

/* Relleno: cara luz (frontal) y sombra (lateral); luz desde la izquierda */
body.re-calc-page .re-obra .ob-svg .ob-cara-luz { fill: color-mix(in srgb, var(--rc-text-2) 6%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg :is(.ob-cara-sombra, .ob-chimenea-relleno) { fill: color-mix(in srgb, var(--rc-text-2) 16%, transparent); }
body.re-calc-page .re-obra .ob-svg .ob-cara-sombra { stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-techo-luz { fill: color-mix(in srgb, var(--rc-accent) 14%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-techo-sombra { fill: color-mix(in srgb, var(--rc-accent) 26%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-vidrio { fill: color-mix(in srgb, var(--rc-text-2) 16%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-reflejo { fill: color-mix(in srgb, var(--rc-surface) 85%, transparent); stroke: none; }
:root[data-theme="dark"] body.re-calc-page .re-obra .ob-svg .ob-reflejo { fill: color-mix(in srgb, var(--rc-text) 22%, transparent); }
body.re-calc-page .re-obra .ob-svg .ob-luz { fill: color-mix(in srgb, var(--rc-data) 30%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-carga { fill: color-mix(in srgb, var(--rc-data) 55%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-contrapeso { fill: color-mix(in srgb, var(--rc-text-2) 35%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-puerta-relleno { fill: color-mix(in srgb, var(--rc-accent) 14%, transparent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-manilla { fill: var(--rc-accent); stroke: none; }
body.re-calc-page .re-obra .ob-svg .ob-copa { fill: color-mix(in srgb, var(--rc-accent) 14%, transparent); }
body.re-calc-page .re-obra .ob-svg .ob-sol circle { fill: color-mix(in srgb, var(--rc-accent) 14%, transparent); }

/* Tema oscuro: más color de texto o de acento aclara; la luz (izquierda) debe quedar más clara que la sombra */
:root[data-theme="dark"] body.re-calc-page .re-obra .ob-svg .ob-cara-luz { fill: color-mix(in srgb, var(--rc-text-2) 16%, transparent); }
:root[data-theme="dark"] body.re-calc-page .re-obra .ob-svg :is(.ob-cara-sombra, .ob-chimenea-relleno) { fill: color-mix(in srgb, var(--rc-text-2) 6%, transparent); }
:root[data-theme="dark"] body.re-calc-page .re-obra .ob-svg .ob-techo-luz { fill: color-mix(in srgb, var(--rc-accent) 26%, transparent); }
:root[data-theme="dark"] body.re-calc-page .re-obra .ob-svg .ob-techo-sombra { fill: color-mix(in srgb, var(--rc-accent) 14%, transparent); }

/* Escritorio: bajo el índice de pasos (que ya es sticky), si cabe a lo alto. Alto = el que escribe el JS
   (--obra-alto); sin JS el mismo tamaño sale de la proporción del cuadro y de un tope por ventana. */
body.re-calc-page .re-toc { --toc-tope: 96px; top: var(--toc-tope); }
@media (min-width: 1101px) and (min-height: 600px) {
  body.re-calc-page .re-obra--toc {
    --ob-mx: 6%;
    --ob-my: 4%;
    display: block;
    width: 100%;
    aspect-ratio: 240 / 520;
    height: var(--obra-alto, auto);
    max-height: var(--obra-alto, min(60vh, calc(100vh - 280px)));
    margin: 28px 0 24px;
  }
}
/* Tableta y móvil: composición apaisada al final del formulario, ancho completo del formulario */
@media (max-width: 1100px) and (min-height: 366px) {
  body.re-calc-page .re-obra--pie {
    display: block;
    width: 100%;
    aspect-ratio: 400 / 280;
    height: var(--obra-alto, auto);
    max-height: var(--obra-alto, min(46svh, 392px));
    margin: 8px auto 16px;
  }
}
/* Con escala de 0,65 o menos las líneas finas ensucian: se ocultan */
@container obra (max-height: 338px) or (max-width: 156px) { body.re-calc-page .re-obra--toc .ob-fino { display: none; } }
@container obra (max-height: 182px) or (max-width: 260px) { body.re-calc-page .re-obra--pie .ob-fino { display: none; } }

/* Decorativa: se retira con colores forzados y al imprimir */
@media (forced-colors: active) { body.re-calc-page .re-obra { display: none !important; } }
@media print { body.re-calc-page .re-obra { display: none !important; } }
