/* ─────────────────────────────────────────────────────────────────────────
   Tusolofirma · sistema visual
   Tinta profunda + índigo, superficies lavanda muy claras, esquinas amables.
   ───────────────────────────────────────────────────────────────────────── */
:root {
  --tinta: #16133a;
  --tinta-2: #3b3866;
  --suave: #6b6890;
  --tenue: #9c99b8;
  --linea: #e7e5f4;
  --linea-2: #d8d5ec;
  --fondo: #fbfaff;
  --fondo-2: #f4f2fd;
  --blanco: #ffffff;
  --acento: #4f46e5;
  --acento-2: #6d63ff;
  --acento-fondo: #eeecff;
  --rosa: #db2777;
  --ok: #15a34a;
  --ok-fondo: #e9f8ef;
  --aviso: #d97706;
  --aviso-fondo: #fff5e6;
  --error: #dc2626;
  --error-fondo: #fdeeee;
  --radio: 14px;
  --radio-s: 10px;
  --sombra-s: 0 1px 2px rgba(22, 19, 58, .06), 0 1px 1px rgba(22, 19, 58, .04);
  --sombra: 0 10px 30px -12px rgba(22, 19, 58, .18), 0 2px 6px rgba(22, 19, 58, .05);
  --sombra-l: 0 30px 60px -20px rgba(49, 39, 160, .35), 0 8px 20px -8px rgba(22, 19, 58, .12);
  --fuente: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --manuscrita: 'Caveat', 'Segoe Script', cursive;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; font-family: var(--fuente); color: var(--tinta); background: var(--fondo);
  font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--acento); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.15; letter-spacing: -.02em; margin: 0 0 .4em; }
h1 { font-size: clamp(1.8rem, 3.2vw, 2.4rem); font-weight: 800; }
h2 { font-size: 1.35rem; font-weight: 750; }
h3 { font-size: 1.05rem; font-weight: 700; }
p { margin: 0 0 1em; }
small, .peq { font-size: .85rem; }
.suave { color: var(--suave); }
.tenue { color: var(--tenue); }
.mono { font-family: ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: .8rem; word-break: break-all; }
.oculto { display: none !important; }
.centro { text-align: center; }
.fila { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.fila-sep { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.pila > * + * { margin-top: 14px; }
.contenedor { width: 100%; max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.estrecho { max-width: 560px; }

/* ── Marca ─────────────────────────────────────────────────────────────── */
.marca { display: inline-flex; align-items: baseline; gap: 0; font-weight: 800; font-size: 1.2rem;
  color: var(--tinta); letter-spacing: -.03em; position: relative; text-decoration: none !important; }
.marca b { color: var(--acento); font-weight: 800; }
.marca svg { position: absolute; left: 34%; bottom: -7px; width: 66%; height: 10px; overflow: visible; }
.marca svg path { stroke: var(--rosa); stroke-width: 2.4; fill: none; stroke-linecap: round;
  stroke-dasharray: 120; stroke-dashoffset: 120; animation: trazo 1.2s .3s ease forwards; }
@keyframes trazo { to { stroke-dashoffset: 0; } }

/* ── Botones ───────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 650; font-size: .95rem; line-height: 1; padding: 12px 18px;
  border-radius: 999px; border: 1px solid transparent; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, box-shadow .2s ease, background .2s ease, color .2s;
  text-decoration: none !important; }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-pri { background: linear-gradient(135deg, var(--acento), var(--acento-2)); color: #fff;
  box-shadow: 0 8px 20px -8px rgba(79, 70, 229, .7); }
.btn-pri:hover { box-shadow: 0 12px 26px -8px rgba(79, 70, 229, .8); }
.btn-sec { background: var(--blanco); color: var(--tinta); border-color: var(--linea-2); box-shadow: var(--sombra-s); }
.btn-sec:hover { border-color: var(--acento); color: var(--acento); }
.btn-fant { background: transparent; color: var(--suave); }
.btn-fant:hover { background: var(--fondo-2); color: var(--tinta); }
.btn-peligro { background: var(--blanco); color: var(--error); border-color: #f3c9c9; }
.btn-peligro:hover { background: var(--error-fondo); }
.btn-g { padding: 16px 26px; font-size: 1.02rem; }
.btn-s { padding: 8px 12px; font-size: .85rem; }
.btn-bloque { width: 100%; }
.icono { width: 18px; height: 18px; flex: none; }

/* ── Formularios ───────────────────────────────────────────────────────── */
label.campo { display: block; }
label.campo > span { display: block; font-weight: 600; font-size: .85rem; margin-bottom: 6px; color: var(--tinta-2); }
.input, textarea.input, select.input {
  width: 100%; font: inherit; color: var(--tinta); background: var(--blanco);
  border: 1px solid var(--linea-2); border-radius: var(--radio-s); padding: 11px 13px;
  transition: border-color .15s, box-shadow .15s; }
.input:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-fondo); }
.input::placeholder { color: var(--tenue); }
textarea.input { resize: vertical; min-height: 80px; }

.interruptor { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; user-select: none; }
.interruptor input { position: absolute; opacity: 0; pointer-events: none; }
.interruptor .pista { flex: none; width: 40px; height: 24px; border-radius: 99px; background: var(--linea-2);
  position: relative; transition: background .2s; margin-top: 1px; }
.interruptor .pista::after { content: ''; position: absolute; left: 3px; top: 3px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; box-shadow: var(--sombra-s); transition: transform .2s; }
.interruptor input:checked + .pista { background: var(--acento); }
.interruptor input:checked + .pista::after { transform: translateX(16px); }
.interruptor input:focus-visible + .pista { box-shadow: 0 0 0 4px var(--acento-fondo); }
.interruptor b { display: block; font-size: .92rem; }
.interruptor small { color: var(--suave); }

.segmento { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 5px;
  background: var(--fondo-2); border-radius: 14px; }
.segmento label { cursor: pointer; }
.segmento input { position: absolute; opacity: 0; pointer-events: none; }
.segmento .op { display: block; padding: 10px 12px; border-radius: 10px; transition: all .15s; border: 1px solid transparent; }
.segmento .op b { display: flex; align-items: center; gap: 6px; font-size: .9rem; }
.segmento .op small { display: block; color: var(--suave); font-size: .76rem; line-height: 1.35; margin-top: 2px; }
.segmento input:checked + .op { background: var(--blanco); box-shadow: var(--sombra-s); border-color: var(--linea); }
.segmento input:checked + .op b { color: var(--acento); }

/* ── Tarjetas, pastillas ───────────────────────────────────────────────── */
.tarjeta { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio);
  box-shadow: var(--sombra-s); padding: 22px; }
.tarjeta-l { box-shadow: var(--sombra); }
.pastilla { display: inline-flex; align-items: center; gap: 6px; font-size: .75rem; font-weight: 700;
  padding: 4px 10px; border-radius: 99px; background: var(--fondo-2); color: var(--suave); white-space: nowrap; }
.pastilla::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.p-borrador { background: #f1f0f7; color: #6b6890; }
.p-enviado  { background: var(--aviso-fondo); color: var(--aviso); }
.p-visto    { background: #e8f3ff; color: #2563eb; }
.p-completado, .p-firmado { background: var(--ok-fondo); color: var(--ok); }
.p-rechazado, .p-anulado { background: var(--error-fondo); color: var(--error); }
.p-pendiente { background: #f1f0f7; color: #6b6890; }
.p-nivel { background: var(--acento-fondo); color: var(--acento); }
.p-nivel::before { display: none; }

.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center;
  color: #fff; font-weight: 700; font-size: .78rem; letter-spacing: .02em; }

/* ── Avisos (flash) ────────────────────────────────────────────────────── */
.toasts { position: fixed; top: 16px; left: 50%; transform: translateX(-50%); z-index: 90;
  display: flex; flex-direction: column; gap: 8px; width: min(520px, calc(100% - 32px)); }
.toast { background: var(--tinta); color: #fff; padding: 12px 16px; border-radius: 12px; box-shadow: var(--sombra-l);
  font-size: .92rem; display: flex; gap: 10px; align-items: center; animation: entra .35s ease; }
.toast.error { background: var(--error); }
.toast.ok::before { content: '✓'; font-weight: 800; color: #86efac; }
@keyframes entra { from { opacity: 0; transform: translateY(-8px); } }

/* ── Barra superior del panel ──────────────────────────────────────────── */
.barra { position: sticky; top: 0; z-index: 30; background: rgba(251, 250, 255, .85);
  backdrop-filter: saturate(1.5) blur(12px); border-bottom: 1px solid var(--linea); }
.barra .contenedor { display: flex; align-items: center; gap: 20px; height: 64px; }
.barra nav { display: flex; gap: 4px; margin-left: 8px; }
.barra nav a { color: var(--suave); font-weight: 600; font-size: .9rem; padding: 8px 12px; border-radius: 99px; }
.barra nav a:hover, .barra nav a.activo { background: var(--fondo-2); color: var(--tinta); text-decoration: none; }
.barra .usuario { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: .88rem; }
.barra .usuario .quien { text-align: right; line-height: 1.2; }
.barra .usuario .quien small { display: block; color: var(--tenue); font-size: .75rem; }
.principal { padding: 32px 0 80px; }

/* ── Dashboard ─────────────────────────────────────────────────────────── */
.cabecera { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; }
.cabecera p { margin: 0; color: var(--suave); }
.subida { position: relative; display: grid; grid-template-columns: auto 1fr auto; gap: 20px; align-items: center;
  padding: 22px 24px; border: 2px dashed var(--linea-2); border-radius: 18px; background:
  radial-gradient(1200px 200px at 0% 0%, var(--acento-fondo), transparent 60%), var(--blanco);
  transition: border-color .2s, background .2s, transform .2s; cursor: pointer; }
.subida:hover, .subida.encima { border-color: var(--acento); }
.subida.encima { transform: scale(1.01); }
.subida .icono-grande { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--acento), var(--rosa)); color: #fff; box-shadow: var(--sombra); }
.subida input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.subida h3 { margin: 0; }
.subida p { margin: 2px 0 0; color: var(--suave); font-size: .9rem; }
.subida .acciones { position: relative; z-index: 2; display: flex; gap: 10px; align-items: center; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin: 22px 0; }
.stat { display: block; padding: 16px 18px; border-radius: var(--radio); background: var(--blanco);
  border: 1px solid var(--linea); color: var(--tinta); transition: all .15s; }
.stat:hover { text-decoration: none; border-color: var(--linea-2); box-shadow: var(--sombra-s); }
.stat.activo { border-color: var(--acento); box-shadow: 0 0 0 3px var(--acento-fondo); }
.stat b { display: block; font-size: 1.7rem; font-weight: 800; letter-spacing: -.03em; }
.stat span { color: var(--suave); font-size: .85rem; font-weight: 600; }

.lista { background: var(--blanco); border: 1px solid var(--linea); border-radius: var(--radio); overflow: hidden; }
.lista-fila { display: grid; grid-template-columns: 44px minmax(0, 1fr) 150px 120px 110px; gap: 16px;
  align-items: center; padding: 14px 18px; border-top: 1px solid var(--linea); color: var(--tinta); }
.lista-fila:first-child { border-top: 0; }
a.lista-fila:hover { background: var(--fondo); text-decoration: none; }
.lista-fila .doc-ico { width: 40px; height: 48px; border-radius: 8px; background: var(--fondo-2);
  display: grid; place-items: center; color: var(--acento); position: relative; }
.lista-fila .doc-ico::after { content: 'PDF'; position: absolute; bottom: 5px; font-size: .55rem; font-weight: 800; letter-spacing: .05em; }
.lista-fila .titulo { font-weight: 650; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lista-fila .meta { font-size: .8rem; color: var(--tenue); }
.progreso { height: 6px; border-radius: 99px; background: var(--fondo-2); overflow: hidden; margin-top: 6px; }
.progreso i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--acento), var(--ok)); }
.avatares { display: flex; }
.avatares .avatar { width: 28px; height: 28px; font-size: .68rem; border: 2px solid #fff; margin-left: -8px; }
.avatares .avatar:first-child { margin-left: 0; }
.vacio { text-align: center; padding: 60px 20px; color: var(--suave); }
.vacio svg { width: 120px; height: auto; margin-bottom: 12px; }

/* ── Editor de documento ───────────────────────────────────────────────── */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) 380px; height: calc(100vh - 64px); }
.editor-visor { overflow: auto; background: #eceaf6; padding: 28px 20px 120px; position: relative; }
.editor-lado { background: var(--blanco); border-left: 1px solid var(--linea); display: flex; flex-direction: column; min-height: 0; }
.editor-lado .scroll { overflow: auto; padding: 22px; flex: 1; }
.editor-lado .pie { padding: 16px 22px; border-top: 1px solid var(--linea); background: var(--fondo); }
.seccion { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--linea); }
.seccion:last-child { border-bottom: 0; }
.seccion > h3 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--tenue); margin-bottom: 12px; display: flex; justify-content: space-between; align-items: center; }
.titulo-doc { font-size: 1.15rem; font-weight: 750; border: 0; padding: 4px 0; width: 100%; font-family: inherit; color: var(--tinta); background: transparent; border-bottom: 1px dashed transparent; }
.titulo-doc:hover, .titulo-doc:focus { outline: none; border-bottom-color: var(--linea-2); }

.firmante { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px;
  border: 1px solid var(--linea); border-radius: 12px; margin-bottom: 8px; background: var(--blanco); transition: all .15s; }
.firmante.activo { border-color: var(--c, var(--acento)); box-shadow: 0 0 0 3px color-mix(in srgb, var(--c) 18%, transparent); }
.firmante .datos input { border: 0; padding: 2px 0; font: inherit; width: 100%; background: transparent; color: var(--tinta); }
.firmante .datos input:focus { outline: none; }
.firmante .datos input.n { font-weight: 650; font-size: .92rem; }
.firmante .datos input.e { font-size: .8rem; color: var(--suave); }
.firmante .datos input.invalido { color: var(--error); }
.firmante .acc { display: flex; gap: 2px; }
.icono-btn { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px; border: 0; background: transparent; color: var(--tenue); cursor: pointer; }
.icono-btn:hover { background: var(--fondo-2); color: var(--tinta); }
.icono-btn.colocar { color: var(--c); }
.contador-campos { font-size: .72rem; font-weight: 700; color: var(--c); background: color-mix(in srgb, var(--c) 12%, transparent); padding: 2px 7px; border-radius: 99px; }
.ayuda-colocar { font-size: .82rem; color: var(--suave); background: var(--fondo-2); border-radius: 10px; padding: 10px 12px; margin-top: 10px; }

/* Páginas del PDF y recuadros */
.paginas { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.pagina { position: relative; background: #fff; box-shadow: 0 2px 4px rgba(22, 19, 58, .08), 0 18px 40px -18px rgba(22, 19, 58, .3);
  border-radius: 4px; max-width: 100%; }
.pagina canvas { display: block; width: 100%; height: auto; border-radius: 4px; }
.pagina .capa { position: absolute; inset: 0; }
.pagina .num { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .72rem; color: var(--tenue); font-weight: 600; }
.modo-colocar .pagina .capa { cursor: crosshair; }
.caja { position: absolute; border: 2px solid var(--c); background: color-mix(in srgb, var(--c) 12%, transparent);
  border-radius: 8px; display: flex; align-items: center; justify-content: center; font-size: .75rem; font-weight: 700;
  color: var(--c); cursor: move; user-select: none; touch-action: none; }
.caja .etq { background: #fff; padding: 2px 8px; border-radius: 99px; box-shadow: var(--sombra-s); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 90%; pointer-events: none; }
.caja .x { position: absolute; top: -10px; right: -10px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: var(--tinta); color: #fff; font-size: 13px; line-height: 1; cursor: pointer; display: none; }
.caja:hover .x { display: block; }
.caja .tirador { position: absolute; right: -6px; bottom: -6px; width: 14px; height: 14px; border-radius: 4px; background: var(--c); cursor: nwse-resize; }
.cargando-pdf { display: grid; place-items: center; height: 60vh; color: var(--suave); }
.girando { width: 28px; height: 28px; border: 3px solid var(--linea-2); border-top-color: var(--acento); border-radius: 50%; animation: gira .8s linear infinite; }
@keyframes gira { to { transform: rotate(360deg); } }

/* ── Detalle ───────────────────────────────────────────────────────────── */
.detalle { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 24px; align-items: start; }
.firmante-estado { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 14px 0; border-top: 1px solid var(--linea); }
.firmante-estado:first-of-type { border-top: 0; }
.linea-tiempo { list-style: none; margin: 0; padding: 0; position: relative; }
.linea-tiempo::before { content: ''; position: absolute; left: 7px; top: 8px; bottom: 8px; width: 2px; background: var(--linea); }
.linea-tiempo li { position: relative; padding: 0 0 16px 28px; font-size: .88rem; }
.linea-tiempo li::before { content: ''; position: absolute; left: 2px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--blanco); border: 2px solid var(--acento); }
.linea-tiempo li.t-firmado::before, .linea-tiempo li.t-completado::before { background: var(--ok); border-color: var(--ok); }
.linea-tiempo li.t-rechazado::before, .linea-tiempo li.t-anulado::before, .linea-tiempo li.t-otp_fallido::before { border-color: var(--error); }
.linea-tiempo li small { display: block; color: var(--tenue); font-size: .76rem; }
.sello-ok { display: flex; gap: 12px; align-items: center; padding: 14px; border-radius: 12px; background: var(--ok-fondo); color: #166534; font-size: .88rem; }
.sello-ok.mal { background: var(--error-fondo); color: #991b1b; }

/* ── Pantalla del firmante ─────────────────────────────────────────────── */
.firma-cab { position: sticky; top: 0; z-index: 30; background: rgba(255, 255, 255, .92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--linea); }
.firma-cab .contenedor { display: flex; align-items: center; gap: 16px; min-height: 64px; padding-top: 10px; padding-bottom: 10px; }
.firma-cab .info { min-width: 0; flex: 1; }
.firma-cab .info b { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.firma-cab .info small { color: var(--suave); }
.firma-cuerpo { padding: 24px 12px 140px; background: #eceaf6; min-height: calc(100vh - 64px); }
.barra-firma { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; padding: 14px 16px calc(14px + env(safe-area-inset-bottom));
  background: var(--blanco); border-top: 1px solid var(--linea); box-shadow: 0 -10px 30px -12px rgba(22, 19, 58, .18); }
.barra-firma .contenedor { display: flex; gap: 12px; align-items: center; justify-content: space-between; }
.caja-firmar { position: absolute; border: 2px dashed var(--acento); background: rgba(79, 70, 229, .08); border-radius: 8px;
  display: grid; place-items: center; cursor: pointer; animation: late 1.8s ease-in-out infinite; }
.caja-firmar span { background: var(--acento); color: #fff; font-weight: 700; font-size: .78rem; padding: 5px 12px; border-radius: 99px; box-shadow: var(--sombra); white-space: nowrap; }
.caja-firmar.hecha { animation: none; border-style: solid; border-color: var(--ok); background: rgba(21, 163, 74, .05); }
.caja-firmar.hecha img { max-width: 100%; max-height: 100%; object-fit: contain; }
.caja-otro { position: absolute; border: 1.5px dashed var(--tenue); border-radius: 8px; background: rgba(156, 153, 184, .08);
  display: grid; place-items: center; font-size: .7rem; color: var(--tenue); font-weight: 600; pointer-events: none; }
@keyframes late { 50% { box-shadow: 0 0 0 8px rgba(79, 70, 229, .12); } }

.pantalla-centro { min-height: calc(100vh - 64px); display: grid; place-items: center; padding: 30px 16px; background:
  radial-gradient(800px 400px at 80% -10%, #e6e3ff, transparent 60%), radial-gradient(600px 300px at -10% 110%, #fde7f3, transparent 60%), var(--fondo); }
.pantalla-centro .tarjeta { width: 100%; max-width: 460px; padding: 32px; text-align: center; }
.icono-circulo { width: 72px; height: 72px; border-radius: 50%; margin: 0 auto 18px; display: grid; place-items: center; }
.icono-circulo svg { width: 34px; height: 34px; }
.ic-acento { background: var(--acento-fondo); color: var(--acento); }
.ic-ok { background: var(--ok-fondo); color: var(--ok); }
.ic-error { background: var(--error-fondo); color: var(--error); }
.ic-aviso { background: var(--aviso-fondo); color: var(--aviso); }
.otp { display: flex; gap: 8px; justify-content: center; margin: 18px 0; }
.otp input { width: 48px; height: 58px; text-align: center; font-size: 1.5rem; font-weight: 700; border: 1.5px solid var(--linea-2);
  border-radius: 12px; font-family: inherit; color: var(--tinta); }
.otp input:focus { outline: none; border-color: var(--acento); box-shadow: 0 0 0 4px var(--acento-fondo); }
.dev-aviso { background: #fffbeb; border: 1px dashed #f59e0b; color: #92400e; padding: 8px 12px; border-radius: 10px; font-size: .8rem; }

/* Check animado */
.check-anim circle { stroke-dasharray: 160; stroke-dashoffset: 160; animation: trazo .6s ease forwards; }
.check-anim path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: trazo .4s .5s ease forwards; }

/* ── Modal ─────────────────────────────────────────────────────────────── */
.modal-fondo { position: fixed; inset: 0; z-index: 80; background: rgba(22, 19, 58, .45); backdrop-filter: blur(3px);
  display: grid; place-items: end center; animation: aparece .2s ease; }
@media (min-width: 640px) { .modal-fondo { place-items: center; } }
.modal { background: var(--blanco); width: 100%; max-width: 560px; border-radius: 22px 22px 0 0; padding: 22px;
  box-shadow: var(--sombra-l); animation: sube .28s cubic-bezier(.2, .9, .3, 1.1); max-height: 94vh; overflow: auto; }
@media (min-width: 640px) { .modal { border-radius: 22px; } }
@keyframes aparece { from { opacity: 0; } }
@keyframes sube { from { transform: translateY(30px); opacity: 0; } }
.pestanas { display: inline-flex; background: var(--fondo-2); border-radius: 99px; padding: 4px; gap: 2px; }
.pestanas button { border: 0; background: transparent; font: inherit; font-weight: 650; font-size: .85rem; padding: 7px 14px; border-radius: 99px; color: var(--suave); cursor: pointer; }
.pestanas button.activo { background: var(--blanco); color: var(--tinta); box-shadow: var(--sombra-s); }
.lienzo { position: relative; border: 1.5px solid var(--linea-2); border-radius: 16px; background:
  linear-gradient(transparent calc(100% - 52px), transparent calc(100% - 52px)), #fff; margin: 14px 0 10px; overflow: hidden; }
.lienzo canvas { display: block; width: 100%; height: 200px; touch-action: none; cursor: crosshair; }
.lienzo .guia { position: absolute; left: 24px; right: 24px; bottom: 48px; border-bottom: 1.5px dashed var(--linea-2); pointer-events: none; }
.lienzo .guia::before { content: '✕'; position: absolute; left: -2px; bottom: 2px; color: var(--tenue); font-size: .9rem; }
.lienzo .pista-txt { position: absolute; inset: 0; display: grid; place-items: center; color: var(--tenue); pointer-events: none; font-weight: 600; font-size: .95rem; transition: opacity .2s; }
.lienzo.con-trazo .pista-txt { opacity: 0; }
.escrita-prev { font-family: var(--manuscrita); font-size: 3rem; text-align: center; height: 200px; display: grid; place-items: center; color: #1e1b4b; }
.acepto { display: flex; gap: 10px; align-items: flex-start; font-size: .86rem; color: var(--tinta-2); cursor: pointer; }
.acepto input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--acento); flex: none; }

/* ── Público ───────────────────────────────────────────────────────────── */
.pub-cab { position: sticky; top: 0; z-index: 30; background: rgba(251, 250, 255, .8); backdrop-filter: blur(12px); }
.pub-cab .contenedor { display: flex; align-items: center; gap: 20px; height: 72px; }
.pub-cab nav { margin-left: auto; display: flex; gap: 8px; align-items: center; }
.pub-cab nav a:not(.btn) { color: var(--tinta-2); font-weight: 600; font-size: .92rem; padding: 8px 12px; }
.heroe { position: relative; overflow: hidden; padding: 60px 0 90px; }
.heroe::before { content: ''; position: absolute; inset: -40% -20% auto auto; width: 900px; height: 900px;
  background: radial-gradient(closest-side, rgba(109, 99, 255, .18), transparent); pointer-events: none; }
.heroe::after { content: ''; position: absolute; left: -200px; bottom: -300px; width: 700px; height: 700px;
  background: radial-gradient(closest-side, rgba(219, 39, 119, .10), transparent); pointer-events: none; }
.heroe .contenedor { position: relative; display: grid; grid-template-columns: 1.05fr .95fr; gap: 50px; align-items: center; }
.heroe h1 { font-size: clamp(2.4rem, 5.2vw, 3.9rem); line-height: 1.03; letter-spacing: -.045em; }
.heroe h1 em { font-style: normal; font-family: var(--manuscrita); color: var(--acento); font-size: 1.2em; font-weight: 700; letter-spacing: 0; }
.heroe .lema { font-size: 1.15rem; color: var(--tinta-2); max-width: 520px; margin: 18px 0 28px; }
.heroe .garantias { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 22px; color: var(--suave); font-size: .86rem; font-weight: 600; }
.heroe .garantias span::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.chip-eyebrow { display: inline-flex; gap: 8px; align-items: center; font-size: .8rem; font-weight: 700; color: var(--acento);
  background: var(--acento-fondo); padding: 6px 12px; border-radius: 99px; margin-bottom: 18px; }
.demo { position: relative; }
.demo .hoja { background: #fff; border-radius: 16px; box-shadow: var(--sombra-l); padding: 30px 30px 26px; transform: rotate(1.5deg); }
.demo .hoja .l { height: 9px; border-radius: 99px; background: var(--fondo-2); margin-bottom: 11px; }
.demo .hoja .zona { margin-top: 22px; border: 2px dashed var(--acento); border-radius: 12px; height: 110px; position: relative; background: rgba(79, 70, 229, .04); }
.demo .hoja .zona svg { position: absolute; inset: 10px 20px; width: calc(100% - 40px); height: calc(100% - 20px); }
.demo .hoja .zona path { fill: none; stroke: #1e1b4b; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 900; stroke-dashoffset: 900; animation: firma-demo 5s ease-in-out infinite; }
@keyframes firma-demo { 0% { stroke-dashoffset: 900; } 45%, 85% { stroke-dashoffset: 0; } 100% { stroke-dashoffset: 0; opacity: 0; } }
.demo .flotante { position: absolute; background: #fff; border-radius: 14px; box-shadow: var(--sombra); padding: 12px 14px; display: flex; gap: 10px; align-items: center; font-size: .82rem; }
.demo .flotante b { display: block; font-size: .86rem; }
.demo .f1 { left: -34px; top: 34px; animation: flota 6s ease-in-out infinite; }
.demo .f2 { right: -20px; bottom: -26px; animation: flota 6s 1.5s ease-in-out infinite; }
@keyframes flota { 50% { transform: translateY(-8px); } }

.banda { padding: 80px 0; }
.banda-alt { background: var(--blanco); border-top: 1px solid var(--linea); border-bottom: 1px solid var(--linea); }
.banda h2 { font-size: clamp(1.7rem, 3vw, 2.3rem); text-align: center; letter-spacing: -.035em; }
.banda .intro { text-align: center; color: var(--suave); max-width: 600px; margin: 0 auto 44px; font-size: 1.05rem; }
.pasos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; counter-reset: paso; }
.paso { padding: 26px; border-radius: 18px; background: var(--fondo); border: 1px solid var(--linea); position: relative; }
.paso::before { counter-increment: paso; content: counter(paso); position: absolute; top: 22px; right: 24px; font-size: 3rem; font-weight: 800; color: var(--acento-fondo); line-height: 1; }
.paso .ico { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--blanco); box-shadow: var(--sombra-s); color: var(--acento); margin-bottom: 16px; }
.paso p { color: var(--suave); margin: 0; }
.niveles { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; max-width: 920px; margin: 0 auto; }
.nivel { padding: 30px; border-radius: 20px; background: var(--blanco); border: 1px solid var(--linea); }
.nivel.destacado { background: linear-gradient(160deg, #1e1a52, #16133a); color: #fff; border: 0; box-shadow: var(--sombra-l); }
.nivel.destacado .suave, .nivel.destacado li { color: #c9c6ea; }
.nivel ul { list-style: none; padding: 0; margin: 18px 0 0; }
.nivel li { padding: 7px 0 7px 28px; position: relative; color: var(--tinta-2); font-size: .93rem; }
.nivel li::before { content: ''; position: absolute; left: 0; top: 10px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--ok-fondo) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315a34a' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center/11px no-repeat; }
.nivel.destacado li::before { background-color: rgba(134, 239, 172, .15); }
.nivel .ley { font-size: .78rem; margin-top: 14px; opacity: .8; }
.cta-final { text-align: center; padding: 70px 24px; border-radius: 28px; color: #fff;
  background: radial-gradient(600px 300px at 90% 0%, rgba(219, 39, 119, .45), transparent 60%), linear-gradient(135deg, #4f46e5, #2e1f9e); box-shadow: var(--sombra-l); }
.cta-final h2 { color: #fff; }
.cta-final p { color: #dcd9ff; font-size: 1.05rem; }
.cta-final .btn-sec { border: 0; }
.pie-pub { padding: 34px 0 50px; color: var(--tenue); font-size: .85rem; }

/* Auth */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.auth-lado { background: linear-gradient(160deg, #221c6b, #16133a); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.auth-lado::after { content: ''; position: absolute; right: -200px; top: -200px; width: 600px; height: 600px; background: radial-gradient(closest-side, rgba(219, 39, 119, .35), transparent); }
.auth-lado .marca { color: #fff; }
.auth-lado blockquote { margin: 0; font-size: 1.6rem; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; position: relative; z-index: 1; max-width: 440px; }
.auth-lado blockquote em { font-family: var(--manuscrita); font-style: normal; color: #a5b4fc; font-size: 1.25em; }
.auth-form { display: grid; place-items: center; padding: 40px 20px; }
.auth-form form { width: 100%; max-width: 400px; }

/* Verificar */
.resultado { display: flex; gap: 16px; padding: 20px; border-radius: 16px; align-items: flex-start; }
.resultado.ok { background: var(--ok-fondo); }
.resultado.mal { background: var(--error-fondo); }

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .heroe .contenedor, .detalle, .auth { grid-template-columns: 1fr; }
  .demo { max-width: 460px; margin: 20px auto 0; }
  .auth-lado { display: none; }
  .editor { grid-template-columns: 1fr; height: auto; }
  .editor-visor { order: 2; padding: 16px 8px 40px; max-height: none; }
  .editor-lado { order: 1; border-left: 0; border-bottom: 1px solid var(--linea); }
  .pasos, .niveles { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
  body { font-size: 14.5px; }
  .contenedor { padding: 0 16px; }
  .barra nav { display: none; }
  .barra .usuario .quien { display: none; }
  .subida { grid-template-columns: auto 1fr; }
  .subida .acciones { grid-column: 1 / -1; }
  .stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .stat { padding: 12px; }
  .stat b { font-size: 1.3rem; }
  .lista-fila { grid-template-columns: 40px minmax(0, 1fr) auto; }
  .lista-fila .col-firm, .lista-fila .col-fecha { display: none; }
  .pub-cab nav a:not(.btn) { display: none; }
  .demo .f1 { left: -6px; }
  .demo .f2 { right: -6px; }
  .otp input { width: 42px; height: 52px; }
  .banda { padding: 56px 0; }
}
