/*
 * Checador Farid.
 *
 * Es una herramienta que se usa de pie, con prisa y a veces con una mano: la hora es lo mas
 * grande de la pantalla porque es lo que queda registrado, y el boton va donde llega el pulgar.
 * La jerarquia sale del tamano y el peso de la letra, no de cajas, lineas ni etiquetas.
 * El color solo dice algo: rojo = el boton que actua, verde = quedo registrado,
 * ambar = guardado en el celular, falta enviarlo.
 * Tipografia de la marca, servida desde la app para que tambien se vea sin senal:
 * Archivo en el ancho de Horizon para titulos y cifras, Figtree para el texto.
 */
@font-face { font-family: 'Archivo Farid'; src: url('/fuentes/archivo-marca.woff2') format('woff2'); font-weight: 500 900; font-display: swap; }
@font-face { font-family: 'Figtree'; src: url('/fuentes/figtree.woff2') format('woff2'); font-weight: 300 900; font-display: swap; }

:root {
  --rojo: #d3141c;
  --rojo-oscuro: #a80f15;
  --verde: #0b7a35;
  --ambar: #8a5a00;
  --tinta: #1c1c1c;
  --texto: #3f3b3a;
  --apagado: #77706e;
  --suave: #f3f0ee;
  --suave-2: #e9e5e2;
  --blanco: #ffffff;
  --titulo: 'Archivo Farid', 'Figtree', system-ui, sans-serif;
  --cuerpo: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
/* Sin zoom por doble toque: al teclear el PIN rapido el navegador lo tomaba como doble toque. */
html { -webkit-text-size-adjust: 100%; touch-action: manipulation; }
button, .tecla, .boton, .texto-boton { touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
body {
  margin: 0; min-height: 100svh; background: var(--blanco); color: var(--texto);
  font: 400 17px/1.5 var(--cuerpo); -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
button { font: inherit; color: inherit; -webkit-tap-highlight-color: transparent; }
h1, h2 { font-family: var(--titulo); color: var(--tinta); margin: 0; letter-spacing: -.01em; }
p { margin: 0; }

#app { max-width: 460px; min-height: 100svh; margin: 0 auto; display: flex; flex-direction: column; }
.cargando-inicial { padding: 3rem 1.5rem; color: var(--apagado); }

/* ---------- alta ---------- */

.logo { display: block; height: 38px; width: auto; }
.alta-cabeza { padding: calc(env(safe-area-inset-top) + 20px) 24px 20px; }
.alta-foto { display: block; width: 100%; height: auto; aspect-ratio: 1200 / 400; object-fit: cover; }
.alta { flex: 1; display: flex; flex-direction: column; padding: 28px 24px calc(env(safe-area-inset-bottom) + 24px); }
.alta h1 { font-size: 1.85rem; font-weight: 800; line-height: 1.1; }
.alta .lead { margin-top: .6rem; color: var(--texto); }
.alta form { display: flex; flex-direction: column; flex: 1; margin-top: 2rem; }
.campo-etiqueta { display: block; font-weight: 600; color: var(--tinta); margin-bottom: .5rem; }
.campo {
  width: 100%; border: 0; border-radius: 14px; background: var(--suave); color: var(--tinta);
  font: 700 1.75rem/1 var(--titulo); letter-spacing: .02em; padding: 1.05rem 1.1rem; font-variant-numeric: tabular-nums;
}
.campo::placeholder { color: #b9b2af; }
.campo:focus { outline: 2px solid var(--tinta); outline-offset: 0; }
.mensaje { min-height: 1.5em; margin-top: .65rem; font-weight: 600; color: var(--rojo-oscuro); }
.prueba { margin-top: 1.25rem; color: var(--ambar); font-weight: 600; }
.prueba b { font-family: var(--titulo); font-size: 1.2rem; letter-spacing: .12em; color: var(--tinta); }
.empuje { flex: 1; min-height: 1.5rem; }
.nota { color: var(--apagado); font-size: .95rem; margin-top: 1rem; }

/* Codigo de 6 digitos: un solo input invisible encima de seis casillas */
.codigo { position: relative; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.codigo span {
  height: 64px; border-radius: 12px; background: var(--suave); display: grid; place-items: center;
  font: 800 1.9rem/1 var(--titulo); color: var(--tinta);
}
.codigo span.actual { box-shadow: inset 0 0 0 2px var(--tinta); }
.codigo input { position: absolute; inset: 0; width: 100%; opacity: 0; font-size: 16px; border: 0; caret-color: transparent; }

/* ---------- botones ---------- */

.boton {
  display: flex; align-items: center; justify-content: center; width: 100%; min-height: 60px; padding: 0 1.25rem;
  border: 0; border-radius: 999px; background: var(--rojo); color: var(--blanco);
  font: 800 1.1rem/1 var(--titulo); letter-spacing: .005em; cursor: pointer;
  transition: transform .08s ease, background-color .15s ease;
}
.boton:active { transform: scale(.985); background: var(--rojo-oscuro); }
.boton:disabled { opacity: .55; }
.boton-claro { background: var(--suave); color: var(--tinta); }
.boton-claro:active { background: var(--suave-2); }
.boton-alto { min-height: 72px; font-size: 1.25rem; }
.texto-boton {
  display: block; margin: .9rem auto 0; padding: .7rem 1rem; background: none; border: 0;
  color: var(--tinta); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; cursor: pointer;
}

/* ---------- PIN ---------- */

.pin { display: flex; flex-direction: column; align-items: center; text-align: center; }
.pin h2 { font-size: 1.5rem; font-weight: 800; }
.pin .sub { margin-top: .35rem; color: var(--apagado); max-width: 19rem; }
.puntos { display: flex; gap: 18px; margin: 1.6rem 0 .4rem; }
.puntos i { width: 14px; height: 14px; border-radius: 50%; background: var(--suave-2); transition: background-color .12s ease, transform .12s ease; }
.puntos i.lleno { background: var(--tinta); transform: scale(1.08); }
.puntos.mal { animation: sacudir .38s; }
.puntos.mal i { background: var(--rojo); }
@keyframes sacudir { 20%, 60% { transform: translateX(-9px); } 40%, 80% { transform: translateX(9px); } }
.pin-error { min-height: 1.5em; color: var(--rojo-oscuro); font-weight: 600; margin-bottom: .6rem; }
.teclado { display: grid; grid-template-columns: repeat(3, 76px); gap: 14px 26px; justify-content: center; }
.tecla {
  width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--suave); color: var(--tinta);
  font: 600 1.85rem/1 var(--titulo); cursor: pointer; display: grid; place-items: center;
  transition: background-color .1s ease;
}
.tecla:active { background: var(--suave-2); }
.tecla-borrar { background: none; }
.tecla-borrar:active { background: var(--suave); }
.tecla svg { width: 30px; height: 30px; }

.pantalla-pin { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 24px 24px calc(env(safe-area-inset-bottom) + 28px); }

/* ---------- permiso ---------- */

.permiso { flex: 1; display: flex; flex-direction: column; padding: 24px 24px calc(env(safe-area-inset-bottom) + 24px); }
.permiso svg { width: 56px; height: 56px; color: var(--tinta); margin: 2rem 0 1.5rem; }
.permiso h1 { font-size: 1.85rem; font-weight: 800; line-height: 1.1; }
.permiso p { margin-top: .75rem; }

/* ---------- principal ---------- */

.cabeza {
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 18px) 24px 0;
}
.cabeza .logo { height: 34px; }
.conexion { display: flex; align-items: center; gap: .45rem; font-size: .92rem; font-weight: 600; color: var(--apagado); }
.conexion::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.conexion.si { color: var(--verde); }
.conexion.pendiente { color: var(--ambar); }

.principal { flex: 1; display: flex; flex-direction: column; padding: 30px 24px calc(env(safe-area-inset-bottom) + 24px); }
.saludo { font-weight: 600; color: var(--apagado); }
.reloj { display: flex; align-items: baseline; gap: .45rem; margin-top: .2rem; color: var(--tinta); }
.reloj strong { font: 800 5.6rem/.95 var(--titulo); letter-spacing: -.035em; font-variant-numeric: tabular-nums; }
.reloj span { font: 700 1.5rem/1 var(--titulo); }
.fecha { margin-top: .55rem; font-size: 1.05rem; color: var(--texto); }
.situacion { margin-top: 1.6rem; font-size: 1.15rem; font-weight: 700; color: var(--tinta); }
.situacion small { display: block; margin-top: .1rem; font-size: 1rem; font-weight: 500; color: var(--apagado); }

.acciones { display: grid; gap: 12px; margin-top: 2rem; }

.hoy { margin-top: 2.5rem; }
.hoy h2 { font-size: 1.1rem; font-weight: 800; margin-bottom: .6rem; }
.hoy ol { list-style: none; margin: 0; padding: 0; }
.hoy li { display: grid; grid-template-columns: 6.4rem 1fr auto; align-items: baseline; gap: .75rem; padding: .7rem 0; }
.hoy li + li { padding-top: .35rem; }
.hoy .h { font: 700 1.05rem/1.2 var(--titulo); color: var(--tinta); font-variant-numeric: tabular-nums; white-space: nowrap; }
.hoy .t { color: var(--texto); }
.hoy .e { display: flex; align-items: center; gap: .3rem; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.hoy .e svg { width: 16px; height: 16px; flex: none; }
.e-enviada { color: var(--verde); }
.e-pendiente { color: var(--ambar); }
.e-rechazada { color: var(--rojo-oscuro); }
.vacio { color: var(--apagado); }
.ayuda { margin-top: auto; padding-top: 2.5rem; font-size: .92rem; color: var(--apagado); }

/* ---------- hojas que suben desde abajo ---------- */

.fondo { position: fixed; inset: 0; z-index: 10; background: rgba(20, 18, 17, .45); display: flex; align-items: flex-end; justify-content: center; animation: aparecer .18s ease; }
.hoja {
  width: 100%; max-width: 460px; background: var(--blanco); border-radius: 26px 26px 0 0;
  padding: 10px 24px calc(env(safe-area-inset-bottom) + 22px); animation: subir .26s cubic-bezier(.2, .8, .2, 1);
}
.hoja::before { content: ''; display: block; width: 40px; height: 5px; border-radius: 3px; background: var(--suave-2); margin: 0 auto 18px; }
.hoja .opciones { display: grid; gap: 10px; margin-top: 1.25rem; }
.hoja h2 { font-size: 1.35rem; font-weight: 800; }
.hoja .sub { color: var(--apagado); margin-top: .25rem; }
@keyframes aparecer { from { opacity: 0; } }
@keyframes subir { from { transform: translateY(40px); opacity: .6; } }

.esperando { display: flex; flex-direction: column; align-items: center; gap: 1rem; padding: 3.5rem 0 3rem; color: var(--texto); font-weight: 600; }
.giro { width: 38px; height: 38px; border-radius: 50%; border: 4px solid var(--suave-2); border-top-color: var(--tinta); animation: girar .8s linear infinite; }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- confirmacion ---------- */

.listo {
  position: fixed; inset: 0; z-index: 20; background: var(--blanco); display: flex; flex-direction: column;
  padding: calc(env(safe-area-inset-top) + 24px) 24px calc(env(safe-area-inset-bottom) + 24px); animation: aparecer .2s ease;
}
.listo-centro { flex: 1; display: flex; flex-direction: column; justify-content: center; max-width: 460px; width: 100%; margin: 0 auto; }
.listo svg { width: 76px; height: 76px; }
.listo svg circle { fill: var(--verde); }
.listo.guardada svg circle { fill: var(--ambar); }
.listo svg path { fill: none; stroke: #fff; stroke-width: 6; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 48; stroke-dashoffset: 48; animation: trazo .35s .12s ease forwards; }
@keyframes trazo { to { stroke-dashoffset: 0; } }
.listo h1 { margin-top: 1.6rem; font-size: 1.6rem; font-weight: 800; }
.listo .grande { font: 800 4rem/1 var(--titulo); color: var(--tinta); letter-spacing: -.03em; margin-top: .4rem; font-variant-numeric: tabular-nums; }
.listo .grande span { font-size: 1.4rem; margin-left: .35rem; letter-spacing: 0; }
.listo ul { list-style: none; margin: 1.5rem 0 0; padding: 0; display: grid; gap: .45rem; }
.listo li { color: var(--texto); }
.listo .boton { max-width: 460px; margin: 0 auto; }

.aviso {
  position: fixed; left: 16px; right: 16px; bottom: calc(env(safe-area-inset-bottom) + 16px); z-index: 30;
  max-width: 428px; margin: 0 auto; padding: 1rem 1.1rem; border-radius: 16px;
  background: var(--tinta); color: var(--blanco); font-weight: 600; animation: subir .22s ease;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before { animation: none !important; transition: none !important; }
  .listo svg path { stroke-dashoffset: 0; }
}

/* ---------- vueltas y deshacer (2026-11-25) ---------- */
.acciones .boton-claro { min-height: 56px; }
.sugerencias { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 1.1rem; }
.sugerencia { border: 0; border-radius: 999px; background: var(--suave); color: var(--tinta); font-weight: 600; padding: .55rem 1rem; cursor: pointer; }
.sugerencia:active { background: var(--suave-2); }
.campo-texto { margin-top: 1rem; font: 600 1.15rem/1.3 var(--cuerpo); letter-spacing: 0; }
.hoja .mensaje { margin-top: .5rem; color: var(--rojo-oscuro); min-height: 1.2em; }
.hoy .t { display: flex; flex-direction: column; align-items: flex-start; }
.deshacer { border: 0; background: none; padding: .2rem 0 0; color: var(--rojo-oscuro); font-weight: 700; font-size: .92rem; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }
.listo-pie { max-width: 460px; width: 100%; margin: 0 auto; }

/* ---------- avisos push (2026-11-25) ---------- */
.avisos { margin-top: 1.6rem; padding: 1rem 0 0; border-top: 1px solid var(--suave-2); }
.avisos strong { display: block; color: var(--tinta); font-weight: 800; }
.avisos p { margin-top: .25rem; color: var(--texto); font-size: .95rem; }
.avisos .boton { margin-top: .8rem; min-height: 52px; }
