/* La calculadora de hipoteca (19/11/2026): /calculadora-hipoteca y la portada (#calculadora). La monta
   calculadora-hipoteca.js. Usa los colores y las letras de la web (web.css y la cabecera de index.html).
   Compacta (Izan, 19/11/2026: «que no ocupe tanto espacio»): en el ordenador, unos 520 px de alto.
   Se pide como /calculadora-hipoteca.css?v=…: si se cambia, subir ese número en las dos páginas. */
.ch { --ch-noche: var(--noche, #10182a); --ch-linea: #2a3449; --ch-claro: #c9cfdb; }
.ch-sinjs { border: 1px solid var(--linea); border-radius: var(--radio, 20px); background: #fff; padding: 22px 26px; color: var(--tinta2); }
.ch-form { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.ch-oculto { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }

/* LOS DATOS */
.ch-entradas { background: #fff; border: 1px solid var(--linea); border-radius: var(--radio, 20px); box-shadow: var(--sombra); padding: 24px 26px; display: grid; gap: 14px; align-content: start; min-width: 0; }
.ch-arriba { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 10px; margin-bottom: 4px; }
.ch-campo { min-width: 0; }
.ch-fila { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.ch-fila > label { min-width: 0; font-weight: 600; font-size: 14.5px; line-height: 1.35; color: var(--tinta); }
.ch-nota-campo { font-weight: 400; color: var(--tinta2); }
.ch-chip { font-weight: 500; font-size: 13px; color: var(--oro); white-space: nowrap; }
.ch-chip:not(:empty)::before { content: "· "; }
.ch-num { flex: none; display: inline-flex; align-items: center; gap: 5px; min-height: 44px; padding: 0 12px 0 8px; border: 1px solid #b9b0a1; border-radius: 12px; background: #fff; }
.ch-num:focus-within { border-color: var(--oro); outline: 2px solid var(--oro); outline-offset: 2px; }
.ch-num input { width: 6.6em; min-height: 42px; border: 0; outline: 0; background: transparent; color: var(--tinta); text-align: right; font: 600 17px var(--sans); font-variant-numeric: lining-nums tabular-nums; }
.ch-par .ch-num input { width: 2.9em; }
.ch-ud { color: var(--tinta2); font-size: 14px; }
.ch-num input[aria-invalid] { color: #9b3a1e; }
.ch-error { margin-top: 2px; font-size: 13px; font-weight: 500; color: #9b3a1e; }
.ch-ayuda { margin-top: -4px; font-size: 13px; line-height: 1.5; color: var(--tinta2); }
.ch-ayuda a { color: var(--tinta2); }
.ch-par { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 14px 26px; }

/* el tipo de vivienda: dos botones (radios de verdad, se manejan con las flechas) */
.ch-seg { display: grid; grid-template-columns: 1fr 1fr; gap: 3px; margin: 0; padding: 3px; min-width: 0; border-radius: 999px; background: var(--papel2, #f1ede5); border: 1px solid var(--linea); }
.ch-seg label { position: relative; display: block; cursor: pointer; }
.ch-seg input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.ch-seg span { display: flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 8px; border-radius: 999px; font-size: 14px; font-weight: 500; color: var(--tinta2); text-align: center; line-height: 1.2; white-space: nowrap; transition: background-color .2s ease, color .2s ease, box-shadow .2s ease; }
.ch-seg input:checked + span { background: #fff; color: var(--tinta); box-shadow: 0 1px 2px rgba(18, 26, 43, .08), 0 4px 12px -6px rgba(18, 26, 43, .25); }
.ch-seg input:focus-visible + span { outline: 2px solid var(--oro); outline-offset: 1px; }
.ch-entradas select { width: 100%; min-width: 0; min-height: 48px; border: 1px solid #b9b0a1; border-radius: 999px; background: #fff; color: var(--tinta); font: 500 14.5px var(--sans); padding: 0 14px; }
.ch-entradas select:focus-visible { outline: 2px solid var(--oro); outline-offset: 2px; }

/* los deslizadores: la parte hasta el valor, en oro; 32 px de alto para el dedo */
.ch-rango { -webkit-appearance: none; appearance: none; display: block; width: 100%; height: 32px; margin: 2px 0 0; background: transparent; cursor: pointer; --p: 50%; }
.ch-rango::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: linear-gradient(to right, var(--oro) var(--p), #d6cdbd var(--p)); }
.ch-rango::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 24px; height: 24px; margin-top: -9.5px; border-radius: 50%; background: #fff; border: 2px solid var(--oro); box-shadow: 0 2px 6px rgba(18, 26, 43, .22); }
.ch-rango::-moz-range-track { height: 5px; border-radius: 999px; background: #d6cdbd; }
.ch-rango::-moz-range-progress { height: 5px; border-radius: 999px; background: var(--oro); }
.ch-rango::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: #fff; border: 2px solid var(--oro); box-shadow: 0 2px 6px rgba(18, 26, 43, .22); }
.ch-rango:focus { outline: none; }
.ch-rango:focus-visible::-webkit-slider-thumb { outline: 2px solid var(--oro); outline-offset: 3px; }
.ch-rango:focus-visible::-moz-range-thumb { outline: 2px solid var(--oro); outline-offset: 3px; }

/* la barra del móvil: se queda abajo mientras se ven los datos; al acabar, se queda al final de la tarjeta */
.ch-resumen { display: none; }

/* EL RESULTADO */
.ch-res { display: flex; flex-direction: column; background: var(--ch-noche); color: #f4efe6; border-radius: var(--radio, 20px); padding: 26px 28px 24px; box-shadow: 0 24px 48px -28px rgba(16, 24, 42, .6); min-width: 0; scroll-margin-top: 96px; }
.ch-res:focus { outline: none; }
.ch-eti { font: 500 13px var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--oro-suave, #b4965a); }
.ch-cuota { margin-top: 8px; font: 500 clamp(48px, 5vw, 60px)/1 var(--serif); color: #fff; font-variant-numeric: lining-nums tabular-nums; letter-spacing: -.01em; }
.ch-cuota small { font: 500 16px var(--sans); color: var(--ch-claro); letter-spacing: 0; }
.ch-cuota.ch-cuota-txt { font-size: clamp(38px, 4vw, 46px); }
.ch-sub { margin-top: 8px; font-size: 13.5px; line-height: 1.5; color: var(--ch-claro); }
.ch-lista { margin: 16px 0 0; border-top: 1px solid var(--ch-linea); }
.ch-fila-r { display: flex; justify-content: space-between; align-items: baseline; gap: 14px; padding: 8px 0; border-bottom: 1px solid var(--ch-linea); }
.ch-fila-r dt { min-width: 0; font-size: 14px; color: #e6e9ef; }
.ch-fila-r dt span { font-size: 13px; color: var(--ch-claro); }
.ch-fila-r dd { margin: 0; font-weight: 600; font-size: 15px; color: #fff; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.ch-fila-r.clave { border-bottom: 0; padding-top: 10px; }
.ch-fila-r.clave dt { font-weight: 600; color: #fff; }
.ch-fila-r.clave dd { font: 600 22px/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.ch-estado { display: flex; gap: 10px; align-items: flex-start; margin-top: 8px; margin-bottom: 20px; font-size: 13.5px; line-height: 1.5; color: #e6e9ef; }
.ch-ico { flex: none; margin-top: 1px; }
.ch-estado.bien .ch-ico { color: var(--oro-suave, #b4965a); }
.ch-estado.aviso .ch-ico { color: #e0a458; }
.ch-estado.info .ch-ico { color: var(--ch-claro); }
.ch-res .boton { align-self: flex-start; margin-top: auto; box-shadow: 0 12px 26px -14px rgba(0, 0, 0, .7); }
/* la letra pequeña, debajo de las dos columnas */
.ch-letra { grid-column: 1 / -1; margin-top: -4px; font-size: 13px; line-height: 1.55; color: var(--tinta2); }
.ch-letra a { color: var(--tinta2); }
.ch-letra a:hover { color: var(--oro); }

/* el tipo y la comunidad, uno debajo del otro cuando la columna es estrecha */
@media (max-width: 1100px) { .ch-arriba { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 900px) {
  .ch-form { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ch-resumen { position: sticky; bottom: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px -26px -24px; padding: 10px 20px calc(10px + env(safe-area-inset-bottom, 0px)); border-radius: 16px 16px var(--radio, 20px) var(--radio, 20px); background: var(--ch-noche); color: var(--ch-claro); font-size: 14px; line-height: 1.35; text-decoration: none; box-shadow: 0 -10px 24px -16px rgba(16, 24, 42, .55); }
  .ch-resumen strong { font: 600 19px var(--serif); color: #fff; font-variant-numeric: lining-nums tabular-nums; }
  .ch-resumen-ver { flex: none; display: inline-flex; align-items: center; min-height: 44px; color: var(--oro-suave, #b4965a); font-weight: 500; }
  .ch-resumen:hover { color: var(--ch-claro); }
}
@media (max-width: 640px) {
  .ch-entradas { padding: 20px 18px; }
  .ch-resumen { margin: 4px -18px -20px; padding-left: 18px; padding-right: 18px; }
  .ch-res { padding: 24px 20px 22px; }
  .ch-par { gap: 14px 16px; }
  .ch-num input { width: 5.8em; }
  .ch-par .ch-num input { width: 2.4em; }
  /* el % del ahorro y el de lo que pides, debajo de su nombre */
  .ch-chip { display: block; margin-top: 2px; }
  .ch-chip:not(:empty)::before { content: none; }
  .ch-fila-r.clave dt span { display: block; }
}
@media (max-width: 400px) {
  .ch-par { grid-template-columns: minmax(0, 1fr); }
  .ch-par .ch-num input { width: 3em; }
}
@media (prefers-reduced-motion: reduce) { .ch-seg span { transition: none; } }
@media print { .ch-resumen, .ch-res .boton { display: none; } }
