:root {
  --fondo: #f1f4f7; --tarjeta: #ffffff; --texto: #1c1d33; --suave: #5f6679; --borde: #dce1ea;
  --marca: #222457; --marca-2: #29b574; --marca-texto: #ffffff; --ok: #12805c; --ok-fondo: #e2f5ec;
  --error: #c0321f; --error-fondo: #fdebe8; --aviso: #8a5a00; --aviso-fondo: #fff3d6;
  --radio: 16px; --sombra: 0 10px 30px rgba(15, 35, 80, .08), 0 2px 6px rgba(15, 35, 80, .05);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --fondo: #0d1220; --tarjeta: #161d2e; --texto: #e8edf7; --suave: #9aa6bd; --borde: #2a344a;
    --marca: #3a3e8f; --marca-2: #36c985; --marca-texto: #ffffff; --ok: #4ade80; --ok-fondo: #12301f;
    --error: #ff8a7a; --error-fondo: #3a1712; --aviso: #f5c451; --aviso-fondo: #33290d;
    --sombra: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; background: var(--fondo); color: var(--texto);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
button, input, select { font: inherit; color: inherit; }

.cabecera { position: sticky; top: 0; z-index: 10; background: var(--tarjeta); color: var(--texto);
  border-bottom: 1px solid var(--borde);
  padding: calc(.7rem + env(safe-area-inset-top)) 1rem .7rem; display: flex; align-items: center; gap: 1rem; }
.marca { display: flex; align-items: center; gap: .45rem; font-weight: 700; font-size: 1.2rem; letter-spacing: .18em; }
.marca img { height: 34px; width: auto; display: block; }
@media (prefers-color-scheme: dark) { .marca img { background: #fff; border-radius: 8px; padding: 2px; } }
.pasos { margin-left: auto; display: flex; gap: 6px; align-items: center; }
.pasos .punto { width: 20px; height: 6px; border-radius: 4px; background: var(--borde); transition: background .3s, width .3s; }
.pasos .punto.hecho { background: var(--marca-2); }
.pasos .punto.actual { background: var(--marca); width: 30px; }
.banda-prueba { background: #b45309; color: #fff; text-align: center; font-size: .8rem; padding: .35rem; font-weight: 600; }

main { max-width: 640px; margin: 0 auto; padding: 1rem 1rem calc(6.5rem + env(safe-area-inset-bottom)); }
.tarjeta { background: var(--tarjeta); border-radius: var(--radio); box-shadow: var(--sombra); padding: 1.25rem;
  margin-bottom: 1rem; animation: entrar .35s ease; }
@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
h1 { font-size: 1.45rem; line-height: 1.25; margin: 0 0 .4rem; }
h2 { font-size: 1.05rem; margin: 0 0 .6rem; }
p { margin: .4rem 0; }
.suave { color: var(--suave); }
.chico { font-size: .86rem; }
.paso-de { font-size: .8rem; text-transform: uppercase; letter-spacing: .08em; color: var(--marca-2); font-weight: 700; }
.exito .logo-grande { width: 120px; margin: 0 auto .5rem; display: block; }

.plan { display: grid; grid-template-columns: 1fr auto; gap: .35rem 1rem; margin-top: .8rem; padding: .9rem 1rem;
  border-radius: 12px; background: var(--fondo); }
.plan .grande { font-size: 1.25rem; font-weight: 800; grid-column: 1 / -1; }
.plan .monto { text-align: right; font-weight: 600; }
.lista-pasos { list-style: none; padding: 0; margin: 1rem 0 0; display: grid; gap: .55rem; }
.lista-pasos li { display: flex; gap: .7rem; align-items: center; }
.lista-pasos .num { width: 28px; height: 28px; border-radius: 50%; background: var(--fondo); display: grid;
  place-items: center; font-weight: 700; font-size: .85rem; flex: none; }

/* lectura del contrato */
.lectura { height: calc(100vh - 360px); height: calc(100dvh - 360px); min-height: 220px; overflow-y: auto;
  padding: .25rem .9rem .25rem .1rem; font-size: .93rem; border-top: 1px solid var(--borde); border-bottom: 1px solid var(--borde); }
.lectura h3 { font-size: .98rem; margin: 1rem 0 .3rem; }
.lectura h2 { font-size: 1.05rem; margin: .8rem 0 .3rem; }
.lectura p { text-align: justify; hyphens: auto; }
.avance { height: 6px; border-radius: 4px; background: var(--fondo); overflow: hidden; margin: .7rem 0 .3rem; }
.avance > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--marca), var(--marca-2)); transition: width .15s; }
.check { display: flex; gap: .7rem; align-items: flex-start; padding: .75rem; border-radius: 12px; border: 1px solid var(--borde);
  margin-top: .6rem; cursor: pointer; }
.check input { width: 22px; height: 22px; margin: .1rem 0 0; flex: none; accent-color: var(--marca-2); }
.barra .columna { display: flex; flex-direction: column; gap: .5rem; width: 100%; }
.barra .casillas { display: grid; gap: .4rem; }
.barra .check { margin: 0; padding: .55rem .7rem; font-size: .9rem; background: var(--tarjeta); animation: entrar .3s ease; }

/* formulario */
.campos { display: grid; gap: .8rem; }
.dos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
label { display: block; font-size: .85rem; color: var(--suave); margin-bottom: .25rem; font-weight: 500; }
input[type=text], input[type=email], input[type=tel], input[inputmode] {
  width: 100%; padding: .8rem .9rem; border-radius: 12px; border: 1.5px solid var(--borde); background: var(--tarjeta);
  font-size: 1rem; transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--marca-2); box-shadow: 0 0 0 4px color-mix(in srgb, var(--marca-2) 18%, transparent); }
.campo.error input { border-color: var(--error); background: var(--error-fondo); }
.campo.aviso input { border-color: var(--aviso); }
.nota { font-size: .8rem; margin-top: .25rem; min-height: 0; }
.campo.error .nota { color: var(--error); }
.campo.aviso .nota { color: var(--aviso); }
.codigo { font-size: 2rem !important; letter-spacing: .5em; text-align: center; font-weight: 700; padding: .7rem !important; }

/* DNI */
.fotos { display: grid; grid-template-columns: 1fr 1fr; gap: .8rem; }
.foto { border: 2px dashed var(--borde); border-radius: 14px; aspect-ratio: 1.58; display: grid; place-items: center;
  text-align: center; cursor: pointer; overflow: hidden; position: relative; background: var(--fondo); padding: .5rem; }
.foto img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.foto.lista { border-style: solid; border-color: var(--ok); }
.foto .marca-ok { position: absolute; top: 6px; right: 6px; background: var(--ok); color: #fff; border-radius: 999px;
  padding: .1rem .5rem; font-size: .75rem; font-weight: 700; z-index: 2; }
.foto .icono { font-size: 1.8rem; }
.foto input { display: none; }
.subiendo::after { content: ""; position: absolute; inset: 0; background: rgba(255, 255, 255, .55); z-index: 1; }

/* firma */
.pad { position: relative; border-radius: 14px; border: 1.5px solid var(--borde); background: #fff; touch-action: none; }
.pad canvas { display: block; width: 100%; height: 220px; border-radius: 14px; cursor: crosshair; }
.pad .linea { position: absolute; left: 8%; right: 8%; bottom: 52px; border-bottom: 1.5px dashed #b7c0d1; pointer-events: none; }
.pad .guia { position: absolute; left: 0; right: 0; bottom: 18px; text-align: center; color: #9aa6bd; font-size: .85rem; pointer-events: none; }

.resumen { display: grid; grid-template-columns: auto 1fr; gap: .3rem .9rem; font-size: .93rem; }
.resumen dt { color: var(--suave); }
.resumen dd { margin: 0; overflow-wrap: anywhere; font-weight: 500; }
.firma-mini { max-height: 70px; max-width: 100%; background: #fff; border-radius: 8px; padding: 4px; }

.barra { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: color-mix(in srgb, var(--fondo) 88%, transparent);
  backdrop-filter: blur(10px); padding: .75rem 1rem calc(.75rem + env(safe-area-inset-bottom)); border-top: 1px solid var(--borde); }
.barra .dentro { max-width: 640px; margin: 0 auto; display: flex; gap: .6rem; }
.boton { flex: 1; border: 0; border-radius: 14px; padding: .95rem 1rem; font-weight: 700; font-size: 1.02rem; cursor: pointer;
  background: var(--marca); color: var(--marca-texto); box-shadow: 0 4px 14px color-mix(in srgb, var(--marca) 30%, transparent); transition: transform .1s, opacity .2s; }
.boton:active { transform: scale(.98); }
.boton:disabled { opacity: .4; cursor: default; }
.boton.secundario { background: var(--tarjeta); color: var(--texto); border: 1.5px solid var(--borde); flex: 0 0 auto; }
.link { background: none; border: 0; color: var(--marca); font-weight: 600; padding: .3rem 0; cursor: pointer; }

.cartel { border-radius: 12px; padding: .75rem .9rem; margin: .7rem 0; font-size: .92rem; }
.cartel.error { background: var(--error-fondo); color: var(--error); }
.cartel.ok { background: var(--ok-fondo); color: var(--ok); }
.cartel.aviso { background: var(--aviso-fondo); color: var(--aviso); }
.exito { text-align: center; padding: 1.5rem 1.25rem; }
.exito .tilde { width: 76px; height: 76px; border-radius: 50%; background: var(--ok); color: #fff; display: grid;
  place-items: center; font-size: 2.4rem; margin: .5rem auto 1rem; animation: latido .6s ease; }
@keyframes latido { 0% { transform: scale(.4); } 70% { transform: scale(1.08); } 100% { transform: scale(1); } }
.hash { font-family: ui-monospace, monospace; font-size: .72rem; word-break: break-all; color: var(--suave); }
@media (max-width: 380px) { .dos, .fotos { grid-template-columns: 1fr; } }
