/* Tokens de DISENO.md */
:root {
  --primary: #9fe870;
  --primary-active: #cdffad;
  --primary-pale: #e2f6d5;
  --canvas: #ffffff;
  --canvas-soft: #e8ebe6;
  --ink: #0e0f0c;
  --ink-deep: #163300;
  --body: #454745;
  --mute: #868685;
  --positive-deep: #054d28;
  --warning: #ffd11a;
  --warning-content: #4a3b1c;
  --negative: #d03238;
  --negative-darkest: #a7000d;

  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 24px;
  --r-pill: 9999px;

  --s-xs: 4px;
  --s-sm: 8px;
  --s-md: 12px;
  --s-lg: 16px;
  --s-xl: 24px;
  --s-2xl: 32px;
  --s-3xl: 48px;

  --foco: 0 0 0 3px var(--primary);
  color-scheme: light;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--canvas-soft);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-feature-settings: 'calt';
  font-size: 16px;
  line-height: 24px;
}

[hidden] {
  display: none !important;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

/* Barra superior (nav-bar) */
.barra {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--s-md) var(--s-lg);
  background: var(--canvas);
}

.marca {
  display: inline-flex;
  align-items: center;
  gap: var(--s-sm);
  padding: 0;
  border: 0;
  background: none;
  font-size: 1.5rem;
  font-weight: 900;
  letter-spacing: -0.02em;
  cursor: pointer;
}

.bandera {
  width: 42px;
  height: 28px;
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(14, 15, 12, 0.12);
}

.contenedor {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: var(--s-2xl) var(--s-lg) var(--s-3xl);
}

.vista {
  animation: aparecer 0.25s ease-out;
}

@keyframes aparecer {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

/* Títulos: peso 900 para el momento de marca, 600 para lo demás */
h1 {
  margin: 0 0 var(--s-lg);
  font-size: clamp(2.25rem, 9.5vw, 4rem);
  font-weight: 900;
  line-height: 0.95;
}

h2 {
  margin: var(--s-sm) 0 var(--s-xl);
  font-size: 2.25rem;
  font-weight: 900;
  line-height: 1;
}

h3 {
  margin: 0 0 var(--s-lg);
  font-size: 1.5rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: -0.02em;
}

/* badge-positive */
.insignia {
  display: inline-block;
  margin: 0 0 var(--s-lg);
  padding: var(--s-xs) var(--s-md);
  border-radius: var(--r-pill);
  background: var(--primary-pale);
  color: var(--positive-deep);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.intro {
  margin: 0 0 var(--s-xl);
  color: var(--body);
  font-size: 1.25rem;
  line-height: 1.5;
}

/* Inicio */
.perfiles {
  display: grid;
  gap: var(--s-md);
}

.perfil,
.opcion {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  width: 100%;
  padding: var(--s-xl) var(--s-lg);
  border: 1px solid transparent;
  border-radius: var(--r-xl);
  background: var(--canvas);
  color: var(--ink);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.15s;
}

.perfil:hover,
.opcion:hover {
  border-color: var(--ink);
  transform: translateY(-2px);
}

.perfil-icono {
  display: grid;
  place-items: center;
  flex: none;
  width: 48px;
  height: 48px;
  border-radius: var(--r-pill);
  background: var(--primary-pale);
  font-size: 1.5rem;
}

.perfil-texto {
  display: grid;
  gap: var(--s-xs);
  flex: 1;
}

.perfil-texto strong {
  font-size: 1.125rem;
  font-weight: 600;
}

.perfil-texto span {
  color: var(--body);
  font-size: 14px;
  line-height: 20px;
}

/* button-icon-circular */
.flecha {
  display: grid;
  place-items: center;
  flex: none;
  width: 36px;
  height: 36px;
  border-radius: var(--r-pill);
  background: var(--canvas-soft);
  font-weight: 600;
}

.ventajas {
  display: grid;
  gap: var(--s-md);
  margin: var(--s-2xl) 0 0;
  padding: 0;
  list-style: none;
  color: var(--body);
}

.ventajas li {
  position: relative;
  padding-left: 40px;
  line-height: 28px;
}

.ventajas li::before {
  content: '✓';
  position: absolute;
  top: 0;
  left: 0;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: var(--r-pill);
  background: var(--primary-pale);
  color: var(--positive-deep);
  font-size: 14px;
  font-weight: 900;
}

.ventajas strong {
  color: var(--ink);
  font-weight: 600;
}

/* Términos legales: un toque abre la explicación */
.termino {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  font: inherit;
  color: inherit;
  text-align: inherit;
  text-decoration: underline dotted;
  text-decoration-thickness: 2px;
  text-underline-offset: 0.18em;
  cursor: help;
}

.termino::after {
  content: '?';
  display: inline-grid;
  place-items: center;
  width: 18px;
  height: 18px;
  margin-left: 4px;
  border-radius: var(--r-pill);
  background: var(--canvas-soft);
  color: var(--ink);
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  vertical-align: 0.15em;
}

.termino.solo-icono {
  text-decoration: none;
}

.termino.solo-icono::after {
  margin-left: 2px;
}

.glosario {
  width: min(480px, calc(100% - 32px));
  padding: var(--s-xl);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--canvas);
  color: var(--ink);
}

.glosario::backdrop {
  background: rgba(14, 15, 12, 0.55);
}

.glosario p {
  margin: 0 0 var(--s-xl);
  color: var(--body);
}

.glosario form {
  margin: 0;
}

#estado-tasa a {
  color: var(--ink);
  font-weight: 600;
}

/* card-content */
.tarjeta {
  margin-bottom: var(--s-lg);
  padding: var(--s-xl);
  border-radius: var(--r-xl);
  background: var(--canvas);
}

/* Formulario */
.campo {
  display: grid;
  gap: var(--s-sm);
  min-width: 0;
  margin: 0 0 var(--s-xl);
  padding: 0;
  border: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.campo legend {
  margin-bottom: var(--s-sm);
  padding: 0;
}

.campo small {
  color: var(--mute);
  font-weight: 400;
}

/* text-input */
input[type='date'],
input[type='text'],
select {
  width: 100%;
  min-height: 48px;
  padding: var(--s-md) var(--s-lg);
  border: 1px solid var(--ink);
  border-radius: var(--r-md);
  background: var(--canvas);
  font-size: 16px;
  font-weight: 400;
}

input::placeholder {
  color: var(--mute);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: var(--foco);
}

input:disabled {
  border-color: var(--mute);
  background: var(--canvas-soft);
  color: var(--body);
}

.monto {
  display: flex;
  gap: var(--s-sm);
}

.monto input {
  flex: 1;
  min-width: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.monto select {
  width: 116px;
  flex: none;
}

select:invalid {
  color: var(--mute);
}

/* Campo con error */
.invalido {
  border-color: var(--negative) !important;
  box-shadow: 0 0 0 1px var(--negative);
}

.casilla.no-se {
  margin: 0;
  font-size: 13px;
  font-weight: 400;
}

.casilla.no-se input {
  width: 18px;
  height: 18px;
}

.ayuda {
  margin: 0 0 var(--s-xs);
  color: var(--body);
  font-weight: 400;
}

.dos-columnas {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-md);
}

.dos-columnas .campo {
  margin: 0;
}

.casilla {
  display: flex;
  align-items: center;
  gap: var(--s-md);
  margin: calc(var(--s-md) * -1) 0 var(--s-xl);
  color: var(--body);
  font-size: 14px;
  cursor: pointer;
}

.casilla input {
  width: 20px;
  height: 20px;
  accent-color: var(--ink);
}

.segmentos {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--s-xs);
  padding: var(--s-xs);
  border-radius: var(--r-pill);
  background: var(--canvas-soft);
}

.segmentos input {
  position: absolute;
  opacity: 0;
}

.segmentos span {
  display: block;
  padding: var(--s-sm) var(--s-md);
  border-radius: var(--r-pill);
  text-align: center;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}

.segmentos input:checked + span {
  background: var(--canvas);
  box-shadow: inset 0 0 0 1px var(--ink);
}

.segmentos input:focus-visible + span {
  box-shadow: var(--foco);
}

.error {
  margin: 0 0 var(--s-lg);
  padding: var(--s-md) var(--s-lg);
  border: 1px solid var(--negative);
  border-radius: var(--r-md);
  color: var(--negative-darkest);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

/* button-primary */
.boton {
  display: block;
  width: 100%;
  min-height: 48px;
  padding: var(--s-md) var(--s-xl);
  border: 0;
  border-radius: var(--r-xl);
  background: var(--primary);
  color: var(--ink-deep);
  font-size: 16px;
  font-weight: 600;
  line-height: 24px;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.boton:hover {
  background: var(--primary-active);
}

/* button-tertiary */
.boton.secundario {
  border: 1px solid var(--ink);
  background: var(--canvas);
  color: var(--ink);
}

.boton.secundario:hover {
  background: var(--canvas-soft);
}

.boton.enlace {
  background: none;
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

.volver {
  padding: var(--s-xs) 0;
  border: 0;
  background: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

/* Resultado: card-feature-dark */
.destacado {
  margin-top: var(--s-sm);
  padding: var(--s-2xl) var(--s-xl);
  background: var(--ink);
  color: var(--canvas-soft);
  text-align: center;
}

.etiqueta {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.total {
  margin: var(--s-md) 0 var(--s-sm);
  color: var(--primary);
  font-size: clamp(2.5rem, 12vw, 4rem);
  font-weight: 900;
  line-height: 1;
  overflow-wrap: anywhere;
}

.resumen {
  margin: 0;
  color: var(--mute);
  font-size: 14px;
  line-height: 20px;
}

.desglose {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin: 0;
}

.desglose dt,
.desglose dd {
  padding: var(--s-md) 0;
  border-bottom: 1px solid var(--canvas-soft);
}

.desglose dt {
  color: var(--body);
}

.desglose dd {
  margin: 0;
  padding-left: var(--s-lg);
  font-weight: 600;
  text-align: right;
}

.desglose .fila-total {
  padding-top: var(--s-lg);
  border-top: 1px solid var(--ink);
  border-bottom: 0;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 900;
}

/* card-feature-green */
.nota {
  margin: var(--s-lg) 0 0;
  padding: var(--s-md) var(--s-lg);
  border-radius: var(--r-lg);
  background: var(--primary-pale);
  color: var(--ink-deep);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.aviso {
  margin-bottom: var(--s-xl);
  padding: var(--s-xl);
  border-radius: var(--r-xl);
  background: var(--canvas);
}

/* Píldora de advertencia */
.aviso strong {
  display: inline-block;
  padding: var(--s-xs) var(--s-md);
  border-radius: var(--r-pill);
  background: var(--warning);
  color: var(--warning-content);
  font-size: 14px;
  font-weight: 600;
  line-height: 20px;
}

.aviso p {
  margin: var(--s-md) 0 0;
  color: var(--body);
  font-size: 14px;
  line-height: 20px;
}

.acciones {
  display: grid;
  gap: var(--s-md);
}

/* Siguiente paso */
.destacado.compacto {
  padding: var(--s-xl);
}

.destacado.compacto .total {
  margin-bottom: 0;
  font-size: clamp(2rem, 9vw, 3rem);
}

.opciones {
  display: grid;
  gap: var(--s-md);
  margin-bottom: var(--s-xl);
}

.opcion .perfil-icono {
  font-size: 1.4rem;
}

/* footer */
.pie {
  padding: var(--s-3xl) var(--s-xl);
  background: var(--ink);
  color: var(--canvas-soft);
  font-size: 14px;
  line-height: 20px;
  text-align: center;
}

/* Computadora: inicio dividido (título a la izquierda, opciones a la derecha) */
@media (min-width: 1024px) {
  .barra {
    padding: var(--s-md) var(--s-xl);
  }

  .contenedor {
    max-width: 1120px;
    padding: var(--s-3xl) var(--s-xl);
  }

  #vista-inicio {
    display: grid;
    grid-template-columns: 1fr 440px;
    grid-template-areas:
      'texto perfiles'
      'ventajas perfiles';
    column-gap: var(--s-3xl);
    align-items: center;
    min-height: 60vh;
  }

  .hero-texto {
    grid-area: texto;
    align-self: end;
  }

  .perfiles {
    grid-area: perfiles;
  }

  .ventajas {
    grid-area: ventajas;
    align-self: start;
    margin-top: var(--s-sm);
  }

  #vista-datos,
  #vista-resultado {
    max-width: 560px;
    margin: 0 auto;
  }
}

/* Al guardar en PDF solo sale el resultado */
@media print {
  body {
    background: var(--canvas);
  }

  .barra {
    position: static;
  }

  /* El PDF se pide desde "Siguiente paso", así que se muestra el resultado aunque esté oculto */
  #vista-resultado[hidden] {
    display: block !important;
  }

  .volver,
  .acciones,
  .termino::after,
  .vista:not(#vista-resultado) {
    display: none !important;
  }

  .tarjeta {
    break-inside: avoid;
  }

  .destacado,
  .pie {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}
