/* ============================================================
   Ucreditmoon — sistema visual "dictamen"
   Documento técnico, no folleto comercial.
   Tinta monocroma + tres tintas de veredicto.
   ============================================================ */

:root {
  --papel:      #EFF0EC;
  --papel-alt:  #E5E7E1;
  --papel-hi:   #FFFFFF;
  --tinta:      #131A21;
  --tinta-70:   #47515B;
  --tinta-45:   #7E878F;
  --linea:      #CBCEC6;
  --linea-fina: #DCDED7;

  --verde:      #16624A;
  --verde-bg:   #E2EDE6;
  --ambar:      #8F5D00;
  --ambar-bg:   #F2EAD8;
  --rojo:       #8E2420;
  --rojo-bg:    #F2E2E0;

  --display: 'Archivo', system-ui, sans-serif;
  --texto:   'Source Serif 4', Georgia, serif;
  --dato:    'IBM Plex Mono', ui-monospace, monospace;

  --ancho: 68rem;
  --r: 3px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--papel);
  color: var(--tinta);
  font-family: var(--texto);
  font-size: 1.0625rem;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}

/* fondo de papel pautado, muy sutil */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: repeating-linear-gradient(
    to bottom,
    transparent 0,
    transparent 31px,
    rgba(19, 26, 33, 0.028) 31px,
    rgba(19, 26, 33, 0.028) 32px
  );
}

.env { position: relative; z-index: 1; }

.contenedor {
  width: 100%;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.contenedor--estrecho { max-width: 46rem; }

/* ---------- Tipografía ---------- */

h1, h2, h3, h4 {
  font-family: var(--display);
  font-weight: 700;
  letter-spacing: -0.022em;
  line-height: 1.12;
  margin: 0 0 0.6rem;
  text-wrap: balance;
}

h1 { font-size: clamp(2rem, 5.2vw, 3.1rem); }
h2 { font-size: clamp(1.5rem, 3.4vw, 2.05rem); margin-top: 2.6rem; }
h3 { font-size: 1.2rem; margin-top: 1.9rem; letter-spacing: -0.012em; }

p { margin: 0 0 1rem; }

a {
  color: var(--verde);
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
  font-weight: 600;
}
a:hover { color: var(--tinta); text-decoration-thickness: 2px; }

.rotulo {
  font-family: var(--display);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--tinta-45);
  display: block;
  margin-bottom: 0.7rem;
}

.entradilla {
  font-size: 1.2rem;
  line-height: 1.55;
  color: var(--tinta-70);
  max-width: 40em;
}

.dato { font-family: var(--dato); font-variant-numeric: tabular-nums; }

.nota {
  font-size: 0.9rem;
  color: var(--tinta-70);
  line-height: 1.55;
}

/* ---------- Cabecera ---------- */

.cab {
  border-bottom: 1px solid var(--linea);
  background: var(--papel);
  position: sticky;
  top: 0;
  z-index: 50;
}

.cab__fila {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 58px;
  max-width: var(--ancho);
  margin: 0 auto;
  padding: 0 1.25rem;
}

.marca {
  font-family: var(--display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--tinta);
  white-space: nowrap;
}
.marca span { color: var(--verde); }

.menu {
  display: flex;
  gap: 1.4rem;
  font-family: var(--display);
  font-size: 0.86rem;
  font-weight: 500;
}
.menu a { text-decoration: none; color: var(--tinta-70); }
.menu a:hover { color: var(--tinta); text-decoration: underline; }

@media (max-width: 720px) {
  .menu { display: none; }
}

/* ---------- Bloques ---------- */

.seccion { padding: 3.2rem 0; }
.seccion--filo { border-top: 1px solid var(--linea); }

.ficha {
  background: var(--papel-hi);
  border: 1px solid var(--linea);
  border-radius: var(--r);
  padding: 1.5rem;
}

.rejilla {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

/* Lista de expediente: numeración real de pasos */
.pasos { list-style: none; margin: 0; padding: 0; counter-reset: paso; }
.pasos li {
  counter-increment: paso;
  position: relative;
  padding: 0 0 1.1rem 3rem;
  border-left: 1px solid var(--linea);
  margin-left: 0.9rem;
}
.pasos li:last-child { border-left-color: transparent; padding-bottom: 0; }
.pasos li::before {
  content: counter(paso);
  position: absolute;
  left: -0.9rem;
  top: 0;
  width: 1.8rem;
  height: 1.8rem;
  display: grid;
  place-items: center;
  background: var(--tinta);
  color: var(--papel);
  font-family: var(--dato);
  font-size: 0.78rem;
  border-radius: 50%;
}
.pasos h4 {
  font-size: 1rem;
  margin: 0.15rem 0 0.3rem;
}
.pasos p { margin: 0 0 0.4rem; font-size: 0.97rem; }

/* ---------- Formulario ---------- */

.campo { margin-bottom: 1.4rem; }

.campo > label,
.campo__titulo {
  display: block;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1.02rem;
  margin-bottom: 0.25rem;
}

.campo__ayuda {
  display: block;
  font-size: 0.88rem;
  color: var(--tinta-70);
  margin-bottom: 0.6rem;
  line-height: 1.45;
}

input[type="number"],
input[type="text"],
select {
  width: 100%;
  font-family: var(--dato);
  font-size: 1rem;
  padding: 0.7rem 0.8rem;
  border: 1px solid var(--linea);
  border-radius: var(--r);
  background: var(--papel-hi);
  color: var(--tinta);
}

input:focus-visible,
select:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--verde);
  outline-offset: 2px;
}

.opciones { display: grid; gap: 0.5rem; }
.opciones--2 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

.opcion {
  display: flex;
  gap: 0.65rem;
  align-items: flex-start;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--linea);
  border-radius: var(--r);
  background: var(--papel-hi);
  cursor: pointer;
  font-size: 0.97rem;
  line-height: 1.4;
}
.opcion:hover { border-color: var(--tinta-45); }
.opcion input { margin: 0.25rem 0 0; accent-color: var(--verde); flex: 0 0 auto; }
.opcion:has(input:checked) {
  border-color: var(--verde);
  box-shadow: inset 0 0 0 1px var(--verde);
  background: var(--verde-bg);
}
.opcion small { display: block; color: var(--tinta-70); font-size: 0.83rem; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-family: var(--display);
  font-weight: 600;
  font-size: 0.98rem;
  padding: 0.8rem 1.4rem;
  border: 1px solid var(--tinta);
  border-radius: var(--r);
  background: var(--tinta);
  color: var(--papel);
  cursor: pointer;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease;
}
.btn:hover { background: #000; color: var(--papel); transform: translateY(-1px); }
.btn--sec { background: transparent; color: var(--tinta); }
.btn--sec:hover { background: var(--papel-alt); color: var(--tinta); }
.btn--ancho { width: 100%; }

.acciones { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.6rem; }

/* ---------- Progreso del cuestionario ---------- */

.progreso {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-family: var(--dato);
  font-size: 0.76rem;
  color: var(--tinta-45);
  margin-bottom: 1.6rem;
}
.progreso__barra {
  flex: 1;
  height: 2px;
  background: var(--linea);
  position: relative;
}
.progreso__relleno {
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--tinta);
  transition: width 260ms ease;
}

.paso-form { display: none; }
.paso-form.activo { display: block; animation: entra 240ms ease both; }

@keyframes entra {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: none; }
}

/* ---------- El sello: elemento firma ---------- */

.dictamen {
  position: relative;
  background: var(--papel-hi);
  border: 1px solid var(--tinta);
  border-radius: var(--r);
  padding: 1.9rem 1.6rem 1.6rem;
  overflow: hidden;
}

.dictamen__meta {
  font-family: var(--dato);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  color: var(--tinta-45);
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 1.2rem;
  border-bottom: 1px solid var(--linea-fina);
  padding-bottom: 0.8rem;
  margin-bottom: 1.3rem;
}

.sello {
  display: inline-block;
  transform: rotate(-3.5deg);
  border: 3px double currentColor;
  border-radius: 5px;
  padding: 0.55rem 1.1rem 0.45rem;
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(1.15rem, 3.6vw, 1.65rem);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  line-height: 1.05;
  opacity: 0.92;
  animation: sella 420ms cubic-bezier(.2,1.4,.4,1) both;
}
.sello small {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  font-weight: 500;
  opacity: 0.75;
  margin-bottom: 0.15rem;
}

@keyframes sella {
  from { opacity: 0; transform: rotate(-9deg) scale(1.5); }
  to   { opacity: 0.92; transform: rotate(-3.5deg) scale(1); }
}

.sello--verde { color: var(--verde); }
.sello--ambar { color: var(--ambar); }
.sello--rojo  { color: var(--rojo); }

/* ---------- Cifras del dictamen ---------- */

.cifras {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1px;
  background: var(--linea-fina);
  border: 1px solid var(--linea-fina);
  border-radius: var(--r);
  margin: 1.4rem 0;
  overflow: hidden;
}
.cifra { background: var(--papel-hi); padding: 0.95rem 1rem; }
.cifra__et {
  font-family: var(--display);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--tinta-45);
  display: block;
  margin-bottom: 0.3rem;
}
.cifra__v {
  font-family: var(--dato);
  font-size: 1.32rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: block;
  line-height: 1.1;
}
.cifra__nota { font-size: 0.8rem; color: var(--tinta-70); display: block; margin-top: 0.25rem; }

/* Barra de ratio */
.barra {
  height: 10px;
  background: var(--papel-alt);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
  margin: 0.5rem 0 0.35rem;
}
.barra__v { height: 100%; border-radius: 99px; transition: width 500ms ease; }
.barra__marca {
  position: absolute;
  top: -3px;
  bottom: -3px;
  width: 2px;
  background: var(--tinta);
}

/* ---------- Avisos ---------- */

.aviso {
  border-left: 3px solid var(--tinta);
  background: var(--papel-alt);
  padding: 0.9rem 1.1rem;
  border-radius: 0 var(--r) var(--r) 0;
  margin: 1.2rem 0;
  font-size: 0.97rem;
}
.aviso h4 { margin: 0 0 0.35rem; font-size: 1rem; }
.aviso p:last-child { margin-bottom: 0; }
.aviso--rojo  { border-color: var(--rojo);  background: var(--rojo-bg); }
.aviso--ambar { border-color: var(--ambar); background: var(--ambar-bg); }
.aviso--verde { border-color: var(--verde); background: var(--verde-bg); }

/* ---------- Tablas ---------- */

.tabla { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin: 1.1rem 0; }
.tabla th, .tabla td {
  text-align: left;
  padding: 0.6rem 0.7rem;
  border-bottom: 1px solid var(--linea-fina);
  vertical-align: top;
}
.tabla th {
  font-family: var(--display);
  font-size: 0.72rem;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--tinta-45);
  border-bottom: 1px solid var(--linea);
}
.tabla td.num { font-family: var(--dato); font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla-scroll { overflow-x: auto; }

/* ---------- Pie ---------- */

.pie {
  border-top: 1px solid var(--linea);
  margin-top: 3.5rem;
  padding: 2.4rem 0 3rem;
  font-size: 0.92rem;
  color: var(--tinta-70);
}
.pie a { color: var(--tinta-70); font-weight: 400; text-decoration: underline; }
.pie a:hover { color: var(--verde); }
.pie__cols { display: grid; gap: 1.6rem; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.pie h4 { font-size: 0.75rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--tinta-45); }
.pie ul { list-style: none; margin: 0; padding: 0; }
.pie li { margin-bottom: 0.35rem; }
.pie__legal {
  border-top: 1px solid var(--linea-fina);
  margin-top: 1.8rem;
  padding-top: 1.2rem;
  font-size: 0.82rem;
  color: var(--tinta-45);
  line-height: 1.55;
}

.oculto { display: none !important; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}

/* ============================================================
   Modo corto: móvil primero, lo secundario plegado
   ============================================================ */

.corto { font-size: 1.125rem; }
.corto h1 { font-size: clamp(1.75rem, 6.5vw, 2.5rem); margin-bottom: 0.5rem; }
.corto h2 { font-size: 1.35rem; margin-top: 2rem; }
.corto p { max-width: 34em; }

/* Bloque plegable para todo lo que no cabe en la primera pantalla */
details.mas {
  border-top: 1px solid var(--linea);
  padding: 0.9rem 0;
}
details.mas > summary {
  cursor: pointer;
  list-style: none;
  font-family: var(--display);
  font-weight: 600;
  font-size: 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
details.mas > summary::-webkit-details-marker { display: none; }
details.mas > summary::after {
  content: '+';
  font-family: var(--dato);
  font-size: 1.3rem;
  color: var(--tinta-45);
  line-height: 1;
}
details.mas[open] > summary::after { content: '–'; }
details.mas > summary:hover { color: var(--verde); }
details.mas > div { padding-top: 0.8rem; font-size: 1rem; }
details.mas p:last-child { margin-bottom: 0; }

/* Tarjetas de acceso: tienen que gritar que son pulsables */
.acceso {
  display: flex;
  align-items: center;
  gap: 1rem;
  text-decoration: none;
  border: 1px solid var(--linea);
  border-left: 4px solid var(--verde);
  border-radius: var(--r);
  background: var(--papel-hi);
  padding: 1.1rem 1.2rem;
  margin-bottom: 0.65rem;
  transition: border-color 140ms ease, background 140ms ease, transform 140ms ease;
}
.acceso__txt { flex: 1 1 auto; min-width: 0; }
.acceso b {
  font-family: var(--display);
  font-size: 1.12rem;
  color: var(--verde);
  display: block;
  margin-bottom: 0.15rem;
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
  text-decoration-color: rgba(22, 98, 74, 0.35);
}
.acceso span { color: var(--tinta-70); font-size: 0.96rem; display: block; }
.acceso::after {
  content: '→';
  flex: 0 0 auto;
  font-family: var(--dato);
  font-size: 1.3rem;
  color: var(--verde);
  transition: transform 140ms ease;
}
.acceso:hover {
  background: var(--verde-bg);
  border-color: var(--verde);
  transform: translateY(-1px);
}
.acceso:hover b { text-decoration-color: var(--verde); }
.acceso:hover::after { transform: translateX(4px); }
.acceso:active { transform: none; background: var(--papel-alt); }

/* Botones a tamaño dedo en móvil */
@media (max-width: 640px) {
  .btn { padding: 0.95rem 1.2rem; font-size: 1rem; }
  .opcion { padding: 0.95rem 1rem; font-size: 1rem; }
  .acciones .btn { flex: 1 1 100%; }
  .cifras { grid-template-columns: 1fr 1fr; }
  .seccion { padding: 2.2rem 0; }
}

/* Resultado: lo primero que se ve es el veredicto */
.remate {
  font-size: 1.15rem;
  line-height: 1.5;
  margin: 1.2rem 0 0;
}
.haz { list-style: none; margin: 1.2rem 0 0; padding: 0; }
.haz li {
  padding: 0.7rem 0 0.7rem 1.7rem;
  border-top: 1px solid var(--linea-fina);
  position: relative;
  font-size: 1rem;
}
.haz li::before {
  content: '→';
  position: absolute;
  left: 0;
  color: var(--verde);
  font-family: var(--dato);
}

/* ============================================================
   Chips: elegir de un toque, sin listas largas
   ============================================================ */
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--linea);
  border-radius: 999px;
  background: var(--papel-hi);
  font-size: 0.95rem;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  transition: background 120ms ease, border-color 120ms ease;
}
.chip:hover { border-color: var(--tinta-45); }
.chip input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip:has(input:checked) {
  background: var(--verde);
  border-color: var(--verde);
  color: var(--papel-hi);
  font-weight: 600;
}
.chip:has(input:focus-visible) { outline: 2px solid var(--verde); outline-offset: 2px; }

.fila-num { display: grid; gap: 0.9rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 520px) { .fila-num { grid-template-columns: 1fr; } }

.campo--junto { margin-bottom: 1.1rem; }
.campo--junto > label, .campo--junto > .campo__titulo { margin-bottom: 0.35rem; }

#vivo { transition: opacity 200ms ease; }
#vivo.espera { opacity: 0.45; }
