/* Serrucho, dirección "Recibo térmico".
   Móvil primero. Fondo blanco; el modo oscuro es navy de nodeluck.
   Montos en tipografía de caja registradora, separadores punteados como papel térmico,
   y el serrucho como barra de avance. */

@font-face {
    font-family: "Archivo";
    src: url("../fonts/archivo.woff2") format("woff2");
    font-weight: 100 900;
    font-stretch: 62% 125%;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-500.woff2") format("woff2");
    font-weight: 500;
    font-display: swap;
}
@font-face {
    font-family: "JetBrains Mono";
    src: url("../fonts/jetbrains-mono-700.woff2") format("woff2");
    font-weight: 700;
    font-display: swap;
}

:root {
    --fondo: #ffffff;
    --texto: #112F5F;
    --tenue: #5D6A7F;
    --linea: #e6ebf2;
    --punteado: #d6deea;
    --campo: #f3f6fa;
    --azul: #2062A0;
    --sol: #F6DB14;
    --oro: #E3A914;
    --papel: #fffbe0;
    --banda: #112F5F;
    --banda-tenue: #b9c8e2;
    --peligro: #b4232c;
    --ok: #1a7f4b;
    --diente-vacio: #e6ebf2;
    --letra: "Archivo", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    --cifra: "JetBrains Mono", ui-monospace, Consolas, monospace;
    color-scheme: light;
}
:root[data-theme="oscuro"] {
    --fondo: #112F5F;
    --texto: #ffffff;
    --tenue: #b9c8e2;
    --linea: #24467d;
    --punteado: #2f5490;
    --campo: #0c2550;
    --azul: #9cc3f0;
    --papel: #0b2046;
    --banda: #0b2046;
    --banda-tenue: #9fb3d6;
    --peligro: #ff9aa0;
    --ok: #6fe0a8;
    --diente-vacio: #24467d;
    color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; background: var(--fondo); color: var(--texto); }
body { font: 17px/1.5 var(--letra); }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--sol); outline-offset: 2px; }
h1, h2, p { margin: 0; }
.cifra { font-family: var(--cifra); font-variant-numeric: tabular-nums; }

.app {
    max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
    display: flex; flex-direction: column;
    padding-left: max(20px, env(safe-area-inset-left, 0px));
    padding-right: max(20px, env(safe-area-inset-right, 0px));
}

/* ---------- Barra superior ---------- */
.barra-sup {
    position: sticky; top: 0; z-index: 5; background: var(--fondo);
    padding-top: calc(env(safe-area-inset-top, 0px) + 10px); padding-bottom: 6px;
    display: flex; align-items: center; gap: 6px;
    margin-left: -8px;
}
.paso-texto { flex: 1; font-size: .95rem; color: var(--tenue); }

/* Avance: 6 dientes de serrucho */
.avance { display: block; width: 100%; height: 14px; margin-top: 2px; }
.avance .lleno { fill: var(--sol); }
.avance .vacio { fill: var(--diente-vacio); }

.icono {
    width: 44px; height: 44px; border-radius: 50%; border: 0; background: transparent; cursor: pointer;
    display: grid; place-items: center; color: inherit; flex: none;
}
.icono svg { width: 24px; height: 24px; }
.icono:disabled { opacity: .3; }

/* ---------- Inicio: franja navy con dientes ---------- */
.franja {
    background: var(--banda); color: #ffffff; position: relative;
    margin-left: calc(-1 * max(20px, env(safe-area-inset-left, 0px)));
    margin-right: calc(-1 * max(20px, env(safe-area-inset-right, 0px)));
    padding: calc(env(safe-area-inset-top, 0px) + 18px) max(20px, env(safe-area-inset-right, 0px)) 40px max(20px, env(safe-area-inset-left, 0px));
    display: flex; flex-direction: column; gap: 22px;
}
.franja .fila { display: flex; align-items: center; gap: 10px; }
.franja .logo { width: 32px; height: 32px; flex: none; }
.franja .nombre-app { font-size: 1.25rem; font-weight: 800; letter-spacing: -.02em; flex: 1; }
.franja .icono { color: #ffffff; }
.deben { display: flex; flex-direction: column; gap: 2px; }
.deben .etiqueta { color: var(--banda-tenue); font-size: .95rem; }
.deben .monto { font-family: var(--cifra); font-weight: 700; font-size: clamp(2rem, 10vw, 2.6rem); letter-spacing: -.03em; color: var(--sol); line-height: 1.15; }
.dientes { position: absolute; left: 0; bottom: -1px; width: 100%; height: 16px; display: block; }
.dientes path { fill: var(--fondo); }

/* ---------- Contenido ---------- */
.contenido { flex: 1; padding-block: 18px 120px; display: flex; flex-direction: column; gap: 22px; }
.titulo { font-size: 2rem; font-weight: 800; font-stretch: 75%; letter-spacing: -.01em; line-height: 1.05; text-wrap: balance; }
.ayuda { color: var(--tenue); font-size: .95rem; margin-top: -14px; }

/* ---------- Barra inferior fija ---------- */
.barra-inf {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; background: var(--fondo);
    padding: 12px max(20px, env(safe-area-inset-right, 0px)) calc(14px + env(safe-area-inset-bottom, 0px)) max(20px, env(safe-area-inset-left, 0px));
}
.barra-inf .dentro { max-width: 520px; margin: 0 auto; display: flex; gap: 10px; }
.barra-inf .btn.primario { flex: 1; }

/* ---------- Botones ---------- */
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    min-height: 56px; padding: 0 20px; border-radius: 6px; border: 0; cursor: pointer;
    font-weight: 800; font-size: 1.05rem;
}
.btn:disabled { opacity: .4; cursor: not-allowed; }
.btn.primario { background: var(--sol); color: #112F5F; font-stretch: 112%; }
.btn.primario:active { background: var(--oro); }
.btn.secundario { background: transparent; color: var(--texto); border: 2px solid var(--texto); font-weight: 700; flex: none; }
.btn svg { width: 24px; height: 24px; }
.enlace {
    background: none; border: 0; padding: 8px 0; color: var(--azul); font-weight: 700; cursor: pointer; text-align: left;
    min-height: 44px; align-self: flex-start;
}
.enlace.peligro { color: var(--peligro); }

/* ---------- Campos ---------- */
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > span { font-size: .85rem; color: var(--tenue); }
input, select {
    width: 100%; min-width: 0; min-height: 50px; padding: 0 14px; border-radius: 6px; border: 2px solid transparent;
    background: var(--campo); color: var(--texto); font-size: 1.05rem;
}
input:focus { border-color: var(--texto); outline: none; }
input::placeholder { color: var(--tenue); opacity: .8; }
input[type="number"] { font-family: var(--cifra); font-variant-numeric: tabular-nums; }

/* ---------- Inicio: lista de cuentas ---------- */
.lista { list-style: none; margin: 0; padding: 0; }
.lista li { border-bottom: 2px dashed var(--punteado); }
.fila-cuenta {
    width: 100%; background: none; border: 0; padding: 14px 0; cursor: pointer; text-align: left; color: inherit;
    display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: baseline;
}
.fila-cuenta .nombre { font-weight: 700; font-size: 1.1rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-cuenta .monto { font-family: var(--cifra); font-weight: 700; font-variant-numeric: tabular-nums; }
.fila-cuenta .meta { font-size: .875rem; color: var(--tenue); }
.fila-cuenta .estado-txt { font-size: .875rem; text-align: right; color: var(--tenue); }
.fila-cuenta .estado-txt.falta { color: var(--peligro); font-weight: 600; }
.fila-cuenta .estado-txt.listo { color: var(--ok); font-weight: 600; }
.vacio { padding-block: 10px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.vacio p { color: var(--tenue); }

/* ---------- Paso factura ---------- */
.escanear { width: 100%; min-height: 64px; font-size: 1.1rem; }
.o { text-align: center; color: var(--tenue); font-size: .9rem; }
.foto { display: flex; gap: 12px; align-items: center; }
.foto img { width: 64px; height: 64px; object-fit: cover; border-radius: 4px; }
.foto p { font-size: .9rem; color: var(--tenue); }

/* ---------- Paso ítems ---------- */
.items { display: flex; flex-direction: column; }
.fila-item { display: flex; flex-direction: column; gap: 8px; padding-block: 14px; border-bottom: 2px dashed var(--punteado); }
.fila-item:first-child { padding-top: 0; }
.fila-item .nums { display: grid; grid-template-columns: 1fr 1.4fr 1fr 44px; gap: 8px; align-items: end; }
.fila-item .nums .campo > span { font-size: .75rem; }
.fila-item .nums input { min-height: 46px; padding: 0 10px; }

/* ---------- Opciones (radio en filas grandes) ---------- */
.pregunta { display: flex; flex-direction: column; gap: 6px; }
.pregunta > p { font-weight: 700; font-size: 1.05rem; }
.opciones { display: flex; flex-direction: column; }
.opcion {
    display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 2px; cursor: pointer;
    border-bottom: 1px solid var(--linea);
}
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion .marca-radio {
    width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--tenue); flex: none; display: grid; place-items: center;
}
.opcion.activo .marca-radio { border-color: var(--texto); }
.opcion.activo .marca-radio::after { content: ""; width: 11px; height: 11px; border-radius: 50%; background: var(--texto); }
.opcion.activo { font-weight: 700; }
.opcion:focus-within { outline: 3px solid var(--sol); outline-offset: -3px; }

/* ---------- Paso personas ---------- */
.fila-persona { display: flex; align-items: center; gap: 12px; min-height: 58px; border-bottom: 1px solid var(--linea); }
.inicial {
    width: 36px; height: 36px; border-radius: 4px; display: grid; place-items: center; font-weight: 800; flex: none;
}
.fila-persona .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-persona .rol { font-size: .8rem; color: var(--tenue); }
.agregar-persona { display: flex; gap: 8px; }

/* ---------- Paso asignar ---------- */
.estado { align-self: flex-start; font-size: .85rem; font-weight: 700; margin-top: -10px; color: var(--peligro); }
.estado.bloqueada { color: var(--ok); }
.aviso { background: var(--papel); padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; }
.aviso .enlace { padding: 0; min-height: 36px; }
.bloque-item { display: flex; flex-direction: column; gap: 10px; }
.bloque-item .cab { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.bloque-item .cab strong { font-size: 1.15rem; }
.libres { font-family: var(--cifra); font-size: .85rem; font-weight: 700; color: var(--peligro); white-space: nowrap; }
.libres.cero { color: var(--ok); }
.unidades { display: grid; grid-template-columns: repeat(auto-fill, minmax(30px, 1fr)); gap: 4px; }
.unidad {
    height: 34px; display: grid; place-items: center; font-weight: 800; font-size: .8rem;
    border: 2px dashed var(--punteado); color: var(--tenue);
}
.unidad.tomada { border: 0; }
.unidades .mas-de { grid-column: 1 / -1; font-size: .8rem; color: var(--tenue); }
.fila-asig { display: flex; align-items: center; gap: 10px; min-height: 54px; border-bottom: 1px solid var(--linea); }
.fila-asig .nombre { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fila-asig .nombre.cero { color: var(--tenue); }
.fila-asig .n { width: 1.9em; text-align: center; font-family: var(--cifra); font-weight: 700; font-size: 1.1rem; font-variant-numeric: tabular-nums; }
.fila-asig .n.cero { color: var(--tenue); font-weight: 500; }
.paso-btn {
    width: 44px; height: 44px; border-radius: 4px; cursor: pointer; font-size: 1.4rem; font-weight: 700;
    display: grid; place-items: center;
}
.paso-btn.menos { border: 2px solid var(--texto); background: transparent; color: var(--texto); }
.paso-btn.mas { border: 0; background: var(--texto); color: var(--fondo); }
.paso-btn:disabled { opacity: .25; cursor: not-allowed; }

/* Mini recibo con lo que lleva cada uno */
.mini-recibo {
    background: var(--papel); padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px;
    font-family: var(--cifra); font-size: .95rem; font-variant-numeric: tabular-nums;
}
.mini-recibo .linea { color: var(--texto); }
.mini-recibo .linea.falta { color: var(--peligro); }
.mini-recibo .linea span:last-child { font-weight: 700; }

/* ---------- Resumen ---------- */
.recibo {
    background: var(--papel); padding: 18px 16px 26px; display: flex; flex-direction: column; gap: 14px;
    position: relative;
}
/* Borde cortado del papel: medios círculos del color del fondo */
.recibo::after {
    content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 8px; pointer-events: none;
    background: radial-gradient(circle 6px at 50% 100%, var(--fondo) 98%, transparent) 0 0 / 16px 8px repeat-x;
}
.fila-resumen { padding-bottom: 12px; border-bottom: 2px dashed var(--punteado); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.fila-resumen .nombre { font-weight: 700; font-size: 1.1rem; }
.fila-resumen .monto { font-family: var(--cifra); font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; }
.fila-resumen .detalle { grid-column: 1 / -1; font-size: .85rem; color: var(--tenue); font-variant-numeric: tabular-nums; }
.fila-resumen.pendiente .monto { color: var(--peligro); }
.totales { display: flex; flex-direction: column; gap: 4px; font-family: var(--cifra); }
.linea { display: flex; justify-content: space-between; gap: 10px; color: var(--tenue); font-size: .95rem; }
.linea span:last-child { font-family: var(--cifra); font-variant-numeric: tabular-nums; }
.linea.total { color: var(--texto); font-weight: 700; font-size: 1.1rem; padding-top: 8px; margin-top: 4px; border-top: 2px solid var(--texto); }

/* ---------- Pantallas de sesión, perfil, compartir, amigo y grupos ---------- */
.subtitulo { font-size: 1.35rem; font-weight: 800; font-stretch: 75%; margin-bottom: -10px; }
.ayuda-suelta { color: var(--tenue); font-size: .95rem; }
.ok-txt { color: var(--ok); font-weight: 600; }
.falta-txt { color: var(--peligro); font-weight: 600; }
.enlaces { display: flex; flex-wrap: wrap; gap: 0 22px; }
.enlaces.columna { flex-direction: column; }
.enlace-texto { color: var(--azul); font-weight: 700; }
.formulario { display: flex; flex-direction: column; gap: 14px; }
.campo small { color: var(--tenue); font-size: .8rem; }
.btn.ancho { width: 100%; }
.btn.chico { min-height: 44px; padding: 0 14px; font-size: .92rem; font-weight: 700; background: transparent; color: var(--texto); border: 2px solid var(--texto); text-decoration: none; }
.escanear.deshabilitado { opacity: .7; pointer-events: none; }
.aviso.error { background: var(--peligro); color: #fff; }
.aviso.exito { background: var(--papel); }
.aviso.error .enlace { color: #fff; }

.marca-mini { display: flex; align-items: center; gap: 8px; padding-left: 8px; font-size: 1.15rem; font-weight: 800; }
.marca-mini .logo { width: 28px; height: 28px; }

.links { display: flex; flex-direction: column; }
.fila-link { display: flex; flex-direction: column; gap: 10px; padding-block: 14px; border-bottom: 2px dashed var(--punteado); }
.fila-link .cab { display: flex; align-items: center; gap: 12px; }
.fila-link .nombre { flex: 1; min-width: 0; }
.fila-link .monto { font-weight: 700; }
.fila-link .botones { display: flex; flex-wrap: wrap; gap: 8px; }

.datos-banco {
    background: var(--papel); padding: 16px; display: flex; flex-direction: column; gap: 2px;
}
.cifra.grande { font-family: var(--cifra); font-size: 1.4rem; font-weight: 700; letter-spacing: .02em; word-break: break-all; }
.fila-resumen .monto.negativo { color: var(--peligro); }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---------- Menú de inicio ---------- */
.menu { display: flex; flex-direction: column; margin-top: -8px; border-top: 2px dashed var(--banda-tenue); }
.item-menu {
    background: none; border: 0; color: #ffffff; text-align: left; font-weight: 700; font-size: 1.05rem;
    min-height: 48px; padding: 0; cursor: pointer; border-bottom: 2px dashed rgba(255, 255, 255, .18);
}
.item-menu:last-child { border-bottom: 0; }

/* ---------- Deslizar para borrar ---------- */
.lista li { position: relative; overflow: hidden; }
.fila-cuenta { touch-action: pan-y; background: var(--fondo); position: relative; z-index: 1; }
.lista li.deslizando { background: var(--peligro); }
.lista li.deslizando::before {
    content: attr(data-borrar); position: absolute; top: 50%; transform: translateY(-50%);
    color: #ffffff; font-weight: 800; right: 20px;
}
.lista li.deslizando[data-lado="izq"]::before { left: 20px; right: auto; }
.ayuda-suelta.chica { font-size: .85rem; margin-top: -12px; }

/* ---------- Foto anexa ---------- */
.clip { display: inline-block; width: 16px; height: 16px; margin-right: 6px; vertical-align: -2px; color: var(--tenue); }
.clip svg { width: 16px; height: 16px; }
.miniatura { border: 0; padding: 0; background: none; cursor: pointer; flex: none; }
.foto .enlaces { gap: 0 16px; }
.visor {
    position: fixed; inset: 0; z-index: 20; background: rgba(6, 18, 40, .94);
    display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 56px 12px 12px;
}
.visor img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.visor .icono { position: absolute; top: calc(env(safe-area-inset-top, 0px) + 8px); right: 8px; color: #ffffff; }

/* ---------- Casillas (términos y marketing del amigo) ---------- */
.casilla { display: flex; gap: 12px; align-items: flex-start; font-size: .95rem; cursor: pointer; }
.casilla input { width: 22px; height: 22px; min-height: 0; flex: none; margin-top: 2px; accent-color: var(--azul); }
.btn.deshabilitado { opacity: .6; pointer-events: none; }
