/* Trapiche · estilos (colores y tipos del sistema de marca) */
:root {
  --surface-base: #0d0f0b;
  --surface-raised: #171a14;
  --line: #2a2f24;
  --ink: #eef2e6;
  --ink-muted: #9ba392;
  --jugo: #c8f25a;
  --gota: #c8f25a;
  --on-jugo: #0d0f0b;
  --jugo-ink: #c8f25a;
  --critico: #ff8a4c;
  --on-critico: #0d0f0b;
  --space-1: 4px; --space-2: 8px; --space-4: 16px; --space-6: 24px; --space-10: 40px;
  --radius-sm: 6px; --radius-md: 14px; --radius-pill: 999px;
  --sans: "Schibsted Grotesk", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --surface-base: #f4f5ef; --surface-raised: #ffffff; --line: #d9dccf;
    --ink: #13160f; --ink-muted: #5a6152; --jugo-ink: #4a6600; --gota: #5b7d00;
    --critico: #b8460e; --on-critico: #ffffff;
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html { touch-action: manipulation; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; background: var(--surface-base); color: var(--ink); font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { min-height: 100dvh; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--jugo-ink); }
:focus-visible { outline: 2px solid var(--jugo-ink); outline-offset: 2px; }
.oculto { display: none !important; }

.app { max-width: 560px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; padding: 0 var(--space-4); padding-top: env(safe-area-inset-top); }

/* Tipos */
.display { font-size: clamp(40px, 12vw, 56px); line-height: 1; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
.title { font-size: 28px; line-height: 32px; font-weight: 700; letter-spacing: -0.02em; margin: 0; }
.heading { font-size: 17px; line-height: 22px; font-weight: 600; margin: 0; }
.body { font-size: 15px; line-height: 22px; margin: 0; }
.small { font-size: 13px; line-height: 18px; color: var(--ink-muted); margin: 0; }
.tag { font-family: var(--mono); font-size: 12px; line-height: 16px; font-weight: 500; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-muted); }
.date { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.muted { color: var(--ink-muted); }

/* Marca */
.marca { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.marca svg { width: 28px; height: 28px; }

/* Botones */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: transparent; cursor: pointer; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--ink); }
.btn:active { background: var(--surface-raised); }
.btn-primario { background: var(--jugo); color: var(--on-jugo); border-color: var(--jugo); font-weight: 700; min-height: 56px; font-size: 17px; width: 100%; }
.btn-primario:disabled { opacity: .5; }
.btn-icono { width: 44px; height: 44px; padding: 0; background: var(--surface-raised); }
.btn svg { width: 18px; height: 18px; }

/* Chips */
.chips { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.chips.fila { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chip { flex-shrink: 0; min-height: 40px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--line); background: var(--surface-raised); cursor: pointer; font-size: 15px; display: inline-flex; align-items: center; gap: 6px; }
.chip[aria-pressed="true"] { background: var(--ink); color: var(--surface-base); border-color: var(--ink); font-weight: 600; }
.chips.fila .chip { background: transparent; min-height: 36px; font-size: 14px; }
.chips.fila .chip[aria-pressed="true"] { background: var(--ink); }

/* Campos */
.campo { display: flex; flex-direction: column; gap: var(--space-2); }
.campo > label, .etiqueta { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .04em; text-transform: uppercase; color: var(--ink-muted); }
.input { min-height: 48px; padding: 0 14px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-raised); font-size: 16px; width: 100%; }
textarea.input { padding: 12px 14px; min-height: 96px; resize: vertical; }

/* Bienvenida */
.bienvenida { flex: 1; display: flex; flex-direction: column; padding: 40px 8px 32px; gap: var(--space-6); position: relative; overflow: hidden; }
.bienvenida .rodillos { position: absolute; right: -70px; top: 90px; width: 240px; opacity: 1; pointer-events: none; }
.bienvenida .rodillos rect { fill: var(--surface-raised); }
.bienvenida .pie { margin-top: auto; display: flex; flex-direction: column; gap: var(--space-4); position: relative; }
.bienvenida > * { position: relative; }
.error { color: var(--critico); font-size: 14px; margin: 0; }

/* Encabezado */
.cabecera { display: flex; align-items: center; justify-content: space-between; padding: 20px 0 12px; position: sticky; top: 0; background: var(--surface-base); z-index: 5; }
.segmento { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius-pill); padding: 3px; gap: 2px; }
.segmento button { border: 0; background: transparent; min-height: 34px; padding: 0 14px; border-radius: var(--radius-pill); cursor: pointer; font-size: 14px; color: var(--ink-muted); }
.segmento button[aria-pressed="true"] { background: var(--surface-raised); color: var(--ink); font-weight: 600; }

/* Tarjetas */
.lista { display: flex; flex-direction: column; gap: 12px; padding-bottom: 96px; }
.seccion { margin: 12px 0 0; }
.tarjeta { display: flex; flex-direction: column; gap: 10px; padding: var(--space-4); border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--line); text-align: left; cursor: pointer; width: 100%; color: var(--ink); }
.tarjeta.es-critico { border-color: var(--critico); }
.tarjeta .abrir { all: unset; display: flex; flex-direction: column; gap: 10px; cursor: pointer; border-radius: var(--radius-sm); }
.tarjeta .abrir:focus-visible { outline: 2px solid var(--jugo-ink); outline-offset: 4px; }
.pie-tarjeta { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.btn-mini { min-height: 36px; padding: 0 12px; font-size: 13px; flex-shrink: 0; }
.tarjeta .fila-tags { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tarjeta .fila-tags .espacio { flex: 1; }
.tarjeta .titulo-fila { display: flex; gap: 8px; align-items: flex-start; }
.punto { width: 8px; height: 8px; border-radius: 99px; background: var(--jugo); margin-top: 7px; flex-shrink: 0; }
.pill-critico { font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .04em; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--critico); color: var(--on-critico); }
.vence { color: var(--critico); }
.vacio { text-align: center; padding: 48px 16px; color: var(--ink-muted); }

/* Hoja de detalle */
.velo { position: fixed; inset: 0; background: rgb(0 0 0 / .55); z-index: 20; display: flex; align-items: flex-end; justify-content: center; }
.hoja { background: var(--surface-base); border-top: 1px solid var(--line); border-radius: 20px 20px 0 0; width: 100%; max-width: 560px; max-height: 92dvh; overflow-y: auto; padding: 20px var(--space-4) calc(24px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: var(--space-4); }
.hoja .datos { border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.hoja .datos div { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.hoja .datos div:last-child { border-bottom: 0; }
.hoja .acciones { display: flex; gap: 8px; flex-wrap: wrap; }
.hoja .acciones .btn { flex: 1; }
.btn[aria-pressed="true"] { background: var(--ink); color: var(--surface-base); border-color: var(--ink); font-weight: 600; }
.fuente { display: flex; align-items: center; gap: 8px; }
.fuente svg { width: 16px; height: 16px; flex-shrink: 0; }

/* Navegación inferior */
.nav { position: fixed; left: 0; right: 0; bottom: 0; background: var(--surface-base); border-top: 1px solid var(--line); display: flex; justify-content: center; padding: 6px 8px calc(10px + env(safe-area-inset-bottom)); z-index: 10; }
.nav-inner { display: flex; width: 100%; max-width: 560px; }
.nav button { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px 0; border: 0; background: transparent; color: var(--ink-muted); font-size: 12px; cursor: pointer; }
.nav button[aria-current="page"] { color: var(--ink); font-weight: 600; }
.nav svg { width: 22px; height: 22px; }

/* Ajustes */
.ajustes { display: flex; flex-direction: column; gap: 28px; padding: 8px 0 120px; }
.opcion { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-raised); cursor: pointer; }
.opcion:has(input:checked) { border-color: var(--ink); }
.opcion input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--jugo); flex-shrink: 0; }
.caja { padding: 16px; border-radius: var(--radius-md); border: 1px solid var(--line); background: var(--surface-raised); display: flex; flex-direction: column; gap: 10px; }
.aviso-demo { margin: 12px 0 0; padding: 10px 14px; border-radius: var(--radius-md); border: 1px dashed var(--line); font-size: 13px; color: var(--ink-muted); }

/* Toast */
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); background: var(--ink); color: var(--surface-base); padding: 12px 16px; border-radius: var(--radius-md); font-size: 14px; z-index: 30; max-width: calc(100% - 32px); }

/* Panel */
.panel { max-width: 980px; }
.panel .rejilla { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.panel .cifra { padding: 16px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--line); }
.panel .cifra b { display: block; font-size: 32px; font-weight: 800; letter-spacing: -0.02em; }
.panel form { display: flex; flex-direction: column; gap: 16px; }
.panel .dos { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 520px) { .panel .dos { grid-template-columns: 1fr; } }
.check { display: flex; gap: 10px; align-items: center; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--jugo); }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th, .tabla td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.tabla th { font-family: var(--mono); font-size: 12px; font-weight: 500; color: var(--ink-muted); text-transform: uppercase; letter-spacing: .04em; }
.tabla td.num { font-family: var(--mono); text-align: right; }
.tabla-caja { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius-md); }

/* Cuándo y dónde */
.cuando-donde { display: flex; flex-wrap: wrap; gap: 4px 14px; color: var(--ink); }
.cuando-donde > span { display: inline-flex; align-items: center; gap: 6px; }
.cuando-donde svg { width: 15px; height: 15px; color: var(--ink-muted); }
.hoja .datos a.lugar { display: inline-flex; align-items: center; gap: 6px; color: var(--jugo-ink); text-decoration: none; font-size: 15px; text-align: right; min-height: 24px; }
.hoja .datos a.lugar span:last-child svg { width: 14px; height: 14px; }
.hoja .datos a.lugar:hover span:nth-child(2) { text-decoration: underline; }
.panel .grupo-extra { display: flex; flex-direction: column; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface-raised); }
.panel .ayuda { margin: -6px 0 0; }

/* Primera vez */
.btn-texto { border: 0; background: transparent; color: var(--ink-muted); min-height: 44px; }
.btn-texto:active { background: transparent; color: var(--ink); }
.puntos { display: flex; justify-content: center; gap: 6px; padding: 4px 0; }
.puntos span { width: 6px; height: 6px; border-radius: 99px; background: var(--line); transition: width .2s; }
.puntos span.hecho { background: var(--ink-muted); }
.puntos span.activo { width: 20px; background: var(--jugo); }
.lista-que-es { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 16px; }
.punto-que-es { display: flex; gap: 14px; align-items: flex-start; }
.icono-redondo { flex-shrink: 0; width: 40px; height: 40px; border-radius: 99px; background: var(--surface-raised); border: 1px solid var(--line); display: inline-flex; align-items: center; justify-content: center; color: var(--jugo-ink); }
.icono-redondo.grande { width: 56px; height: 56px; }
.icono-redondo.grande svg { width: 26px; height: 26px; }
.icono-redondo.enorme { width: 88px; height: 88px; background: var(--jugo); border-color: var(--jugo); color: var(--on-jugo); }
.icono-redondo.enorme svg { width: 40px; height: 40px; }
.pasos-instalar { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.paso-instalar { display: flex; gap: 14px; align-items: flex-start; padding: 16px; border-radius: var(--radius-md); background: var(--surface-raised); border: 1px solid var(--line); line-height: 30px; }
.paso-instalar .numero { flex-shrink: 0; width: 28px; height: 28px; border-radius: 99px; background: var(--ink); color: var(--surface-base); font-family: var(--mono); font-size: 13px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; margin-top: 1px; }
.chip-ui { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-sm); border: 1px solid var(--line); background: var(--surface-base); font-weight: 600; font-size: 14px; line-height: 24px; vertical-align: middle; white-space: nowrap; }
.chip-ui svg { width: 16px; height: 16px; color: var(--jugo-ink); }
.caja.centrada { align-items: center; text-align: center; padding: 28px 16px; }
.enlace-copiar { font-family: var(--mono); font-size: 13px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--surface-base); border: 1px solid var(--line); word-break: break-all; }
.notif-centro { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 16px; padding: 24px 0; }
.notif-muestra { width: 100%; display: flex; gap: 12px; align-items: flex-start; text-align: left; padding: 14px; border-radius: 18px; background: var(--surface-raised); border: 1px solid var(--line); margin: 8px 0; font-size: 14px; }
.notif-muestra > span:nth-child(2) { flex: 1; }
.notif-icono { width: 36px; height: 36px; border-radius: 9px; background: #0d0f0b; display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; }

/* ───────────────────────── Movimiento ─────────────────────────
   Rápido y con propósito: nada pasa de 0,45 s y todo se apaga con "Reducir movimiento". */
:root { --suave: cubic-bezier(.2, .8, .2, 1); --rebote: cubic-bezier(.34, 1.56, .64, 1); }

@keyframes aparecer { from { opacity: 0; } to { opacity: 1; } }
@keyframes subir { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
@keyframes bajar-entrar { from { opacity: 0; transform: translateY(-16px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes hoja-entrar { from { transform: translateY(100%); } to { transform: none; } }
@keyframes hoja-salir { from { transform: none; } to { transform: translateY(100%); } }
@keyframes velo-entrar { from { background-color: rgb(0 0 0 / 0); } to { background-color: rgb(0 0 0 / .55); } }
@keyframes velo-salir { from { background-color: rgb(0 0 0 / .55); } to { background-color: rgb(0 0 0 / 0); } }
@keyframes brillo { 0% { box-shadow: 0 0 0 0 rgb(200 242 90 / .55); border-color: var(--jugo); } 100% { box-shadow: 0 0 0 14px rgb(200 242 90 / 0); } }
@keyframes pop { 0% { transform: scale(1); } 40% { transform: scale(1.12); } 100% { transform: scale(1); } }
@keyframes pulgar { 0% { transform: rotate(0); } 35% { transform: rotate(-18deg) translateY(-2px); } 100% { transform: rotate(0); } }
@keyframes latido { 0%, 100% { transform: scale(1); opacity: 1; } 50% { transform: scale(1.35); opacity: .7; } }
@keyframes campana { 0%, 60%, 100% { transform: rotate(0); } 10% { transform: rotate(14deg); } 20% { transform: rotate(-12deg); } 30% { transform: rotate(8deg); } 40% { transform: rotate(-5deg); } }
@keyframes rodar { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-14px); } }
@keyframes brillar-esqueleto { from { background-position: 150% 0; } to { background-position: -50% 0; } }
@keyframes crecer { from { width: 6px; } to { width: 20px; } }
@keyframes check { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: none; } }
@keyframes toast-entrar { from { opacity: 0; transform: translate(-50%, 12px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes toast-salir { from { opacity: 1; } to { opacity: 0; transform: translate(-50%, 6px); } }

/* Pantallas de bienvenida: entran y sus partes aparecen en orden */
.bienvenida[data-entra] > * { animation: subir .45s var(--suave) both; }
.bienvenida[data-entra] > *:nth-child(2) { animation-delay: 40ms; }
.bienvenida[data-entra] > *:nth-child(3) { animation-delay: 90ms; }
.bienvenida[data-entra] > *:nth-child(4) { animation-delay: 140ms; }
.bienvenida[data-entra] > *:nth-child(5) { animation-delay: 190ms; }
.bienvenida[data-entra] > *:nth-child(n+6) { animation-delay: 230ms; }
.bienvenida[data-entra] > .rodillos { animation: aparecer .8s ease both; }
.bienvenida[data-entra] .lista-que-es li { animation: subir .45s var(--suave) both; }
.bienvenida[data-entra] .lista-que-es li:nth-child(1) { animation-delay: 220ms; }
.bienvenida[data-entra] .lista-que-es li:nth-child(2) { animation-delay: 290ms; }
.bienvenida[data-entra] .lista-que-es li:nth-child(3) { animation-delay: 360ms; }
.bienvenida[data-entra] .paso-instalar { animation: subir .4s var(--suave) both; }
.bienvenida[data-entra] .paso-instalar:nth-child(2) { animation-delay: 80ms; }
.bienvenida[data-entra] .paso-instalar:nth-child(3) { animation-delay: 160ms; }

/* Los rodillos de fondo giran despacio, como un trapiche */
.rodillos rect { animation: rodar 6s ease-in-out infinite; transform-box: fill-box; }
.rodillos rect:nth-child(2) { animation-delay: -2s; }
.rodillos rect:nth-child(3) { animation-delay: -4s; }

/* Indicador de pasos */
.puntos span.activo { animation: crecer .35s var(--suave) both; }

/* Pantalla de notificaciones */
.icono-redondo.enorme svg { animation: campana 2.4s ease-in-out .6s infinite; transform-origin: 50% 15%; }
.bienvenida[data-entra] .notif-muestra { animation: bajar-entrar .5s var(--suave) .45s both; }
.icono-redondo.grande svg { animation: check .4s var(--rebote) .15s both; }

/* Carga: tarjetas fantasma con brillo */
.tarjeta.esqueleto { cursor: default; gap: 12px; animation: aparecer .3s ease both; animation-delay: calc(var(--i) * 60ms); }
.esqueleto .linea { display: block; height: 14px; border-radius: 6px; width: 100%;
  background: linear-gradient(90deg, var(--line) 0%, var(--surface-base) 50%, var(--line) 100%); background-size: 200% 100%;
  animation: brillar-esqueleto 1.4s linear infinite; }
.esqueleto .linea.corta { width: 35%; height: 12px; }
.esqueleto .linea.media { width: 60%; }

/* Feed: las tarjetas entran escalonadas solo al llegar o cambiar de filtro */
.lista[data-entra] > * { animation: subir .4s var(--suave) both; animation-delay: calc(var(--i, 0) * 45ms); }
.tarjeta.recien { animation: bajar-entrar .45s var(--suave) both, brillo 1.6s ease-out .2s; }
.lista[data-entra] .punto, .recien .punto { animation: latido 1.6s ease-in-out .4s 2; }
.cabecera { transition: box-shadow .2s ease; }

/* Toques: todo responde al dedo */
.btn, .chip, .segmento button, .nav button, .tarjeta .abrir, .opcion {
  transition: transform .15s var(--suave), background-color .2s ease, color .2s ease, border-color .2s ease, opacity .2s ease; }
.btn:active, .chip:active, .segmento button:active { transform: scale(.96); }
.btn-primario:active { transform: scale(.98); }
.tarjeta { transition: border-color .25s ease, transform .2s var(--suave); }
.tarjeta:has(.abrir:active) { transform: scale(.985); }
.nav button svg { transition: transform .2s var(--suave); }
.nav button[aria-current="page"] svg { transform: translateY(-2px); }
.opcion:active { transform: scale(.99); }

/* "Me sirve" */
.boton-like.pop { animation: pop .35s var(--rebote); }
.boton-like.pop svg { animation: pulgar .45s var(--rebote); transform-origin: 30% 80%; }

/* Hoja de detalle */
.velo { animation: velo-entrar .25s ease both; }
.velo .hoja { animation: hoja-entrar .38s var(--suave) both; }
.velo.saliendo { animation: velo-salir .25s ease .05s both; }
.velo.saliendo .hoja { animation: hoja-salir .28s cubic-bezier(.4, 0, 1, 1) both; }
.hoja > * { animation: subir .35s var(--suave) both; }
.hoja > *:nth-child(2) { animation-delay: 60ms; }
.hoja > *:nth-child(3) { animation-delay: 90ms; }
.hoja > *:nth-child(4) { animation-delay: 120ms; }
.hoja > *:nth-child(n+5) { animation-delay: 150ms; }

/* Ajustes y panel */
.ajustes[data-entra] > * { animation: subir .4s var(--suave) both; }
.ajustes[data-entra] > *:nth-child(2) { animation-delay: 50ms; }
.ajustes[data-entra] > *:nth-child(3) { animation-delay: 100ms; }
.ajustes[data-entra] > *:nth-child(n+4) { animation-delay: 150ms; }
.panel .cifra { animation: subir .4s var(--suave) both; }
.grupo-extra { animation: subir .3s var(--suave) both; }

/* Mensajes */
.toast { animation: toast-entrar .3s var(--rebote) both; }
.toast.saliendo { animation: toast-salir .22s ease both; }

/* Quien pidió menos movimiento en su celular, no ve nada de esto */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
