/* ============ Libreta — estilos ============ */

@font-face { font-family: "Jakarta"; src: url("fuentes/jakarta-400.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("fuentes/jakarta-500.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("fuentes/jakarta-600.woff2") format("woff2"); font-weight: 600; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("fuentes/jakarta-700.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Jakarta"; src: url("fuentes/jakarta-800.woff2") format("woff2"); font-weight: 800; font-display: swap; }
@font-face { font-family: "Fraunces"; src: url("fuentes/fraunces-600-italic.woff2") format("woff2"); font-weight: 600; font-style: italic; font-display: swap; }

/* ---------- Temas ---------- */
:root {
  color-scheme: light;
  --bg: #F6F3EE;
  --card: rgba(255, 255, 255, .78);
  --card-fuerte: rgba(255, 255, 255, .9);
  --solido: #FFFFFF;
  --linea: rgba(255, 255, 255, .95);
  --borde: #E4DED3;
  --separador: #EEE8DE;
  --tinta: #15151C;
  --tinta-inv: #FFFFFF;
  --suave: #4A4A55;
  --gris: #F1ECE3;
  --gris-2: #E8E2D6;
  --oro: #8A5A12;
  --deuda: #B42318;
  --ok: #157A3C;
  --ok-btn: #157A3C;
  --ok-btn-tinta: #FFFFFF;
  --ok-fondo: #DCF5E4;
  --ok-tinta: #14532D;
  --sombra: 0 16px 40px rgba(30, 20, 60, .08);
  --sombra-2: 0 12px 30px rgba(30, 20, 60, .12);
  --brillo: rgba(255, 255, 255, .6);
  --blob1: #FFB59E; --blob2: #C9B6FF; --blob3: #9ED8FF; --blob-op: .55;
  --t-naranja: #FFF1EC; --t-naranja-tinta: #9A3412; --t-naranja-punto: #EA580C;
  --t-verde: #EAF7EF;   --t-verde-tinta: #166534;   --t-verde-punto: #16A34A;
  --t-morado: #F1EDFF;  --t-morado-tinta: #5B21B6;  --t-morado-punto: #7C3AED;
  --t-oro: #FFE9C7;     --t-oro-tinta: #6E4710;     --t-oro-punto: #D97706;
  --av0-bg: #FFE1D6; --av0: #9A3412;
  --av1-bg: #EDE6FF; --av1: #5B21B6;
  --av2-bg: #DDF0FF; --av2: #075985;
  --av3-bg: #FFF0C7; --av3: #854D0E;
  --av4-bg: #DCF5E4; --av4: #14532D;
  --av5-bg: #FCE7F3; --av5: #9D174D;
  --anillo-orb: rgba(255, 255, 255, .9);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) { --modo: oscuro; }
}

:root[data-theme="dark"],
:root[data-theme="auto"].auto-oscuro {
  color-scheme: dark;
  --bg: #0D0E13;
  --card: rgba(30, 31, 42, .72);
  --card-fuerte: rgba(34, 35, 47, .92);
  --solido: #1C1D26;
  --linea: rgba(255, 255, 255, .08);
  --borde: rgba(255, 255, 255, .12);
  --separador: rgba(255, 255, 255, .07);
  --tinta: #F3F1EC;
  --tinta-inv: #15151C;
  --suave: #B4B4C2;
  --gris: #2A2B36;
  --gris-2: #343542;
  --oro: #E7B65A;
  --deuda: #FF8A7A;
  --ok: #4ADE80;
  --ok-btn: #22C55E;
  --ok-btn-tinta: #052E16;
  --ok-fondo: rgba(34, 197, 94, .14);
  --ok-tinta: #86EFAC;
  --sombra: 0 16px 40px rgba(0, 0, 0, .35);
  --sombra-2: 0 12px 30px rgba(0, 0, 0, .45);
  --brillo: rgba(255, 255, 255, .09);
  --blob1: #FF6A3D; --blob2: #7C5CFF; --blob3: #1E90E0; --blob-op: .28;
  --t-naranja: rgba(255, 138, 91, .13); --t-naranja-tinta: #FDBA9A; --t-naranja-punto: #FB923C;
  --t-verde: rgba(34, 197, 94, .13);    --t-verde-tinta: #86EFAC;   --t-verde-punto: #4ADE80;
  --t-morado: rgba(139, 92, 246, .18);  --t-morado-tinta: #C4B5FD;  --t-morado-punto: #A78BFA;
  --t-oro: rgba(231, 182, 90, .16);     --t-oro-tinta: #F2C879;     --t-oro-punto: #FBBF24;
  --av0-bg: rgba(255, 138, 91, .2);  --av0: #FDBA9A;
  --av1-bg: rgba(139, 92, 246, .24); --av1: #C4B5FD;
  --av2-bg: rgba(56, 189, 248, .2);  --av2: #7DD3FC;
  --av3-bg: rgba(250, 204, 21, .18); --av3: #FCD34D;
  --av4-bg: rgba(34, 197, 94, .18);  --av4: #86EFAC;
  --av5-bg: rgba(236, 72, 153, .2);  --av5: #F9A8D4;
  --anillo-orb: rgba(13, 14, 19, .95);
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--tinta);
  font-family: "Jakarta", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .3s;
}
a { color: var(--oro); }
a:hover { opacity: .85; }
h1, h2, h3, p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
.serif { font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 600; color: var(--oro); }
.oculto-visual { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid #8B5CF6; outline-offset: 2px; border-radius: 8px; }

/* ---------- Fondo animado ---------- */
.fondo { position: fixed; inset: 0; overflow: hidden; pointer-events: none; z-index: 0; }
.blob { position: absolute; border-radius: 50%; filter: blur(60px); opacity: var(--blob-op); transition: background .4s, opacity .4s; }
.blob.b1 { width: 360px; height: 360px; left: -110px; top: -110px; background: var(--blob1); animation: deriva 11s ease-in-out infinite; }
.blob.b2 { width: 340px; height: 340px; right: -120px; top: 18vh; background: var(--blob2); animation: deriva2 13s ease-in-out infinite; }
.blob.b3 { width: 320px; height: 320px; left: 20vw; bottom: -120px; background: var(--blob3); animation: deriva 15s ease-in-out infinite reverse; }
@keyframes deriva  { 0%, 100% { transform: translate(0, 0) scale(1); } 50% { transform: translate(40px, -30px) scale(1.18); } }
@keyframes deriva2 { 0%, 100% { transform: translate(0, 0) scale(1.1); } 50% { transform: translate(-44px, 34px) scale(.94); } }
@keyframes tono { to { filter: hue-rotate(360deg); } }
@keyframes destello { 0%, 62% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }
@keyframes latido { 0% { transform: scale(1); opacity: .7; } 100% { transform: scale(2.6); opacity: 0; } }
@keyframes crecer { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes orbe { 0%, 100% { box-shadow: 0 0 0 6px var(--anillo-orb), 0 10px 30px rgba(99, 102, 241, .45); } 50% { box-shadow: 0 0 0 6px var(--anillo-orb), 0 10px 44px rgba(236, 72, 153, .6); } }
@keyframes flujo { from { background-position: 0% 50%; } to { background-position: 200% 50%; } }
@keyframes entrar { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes girar { to { transform: rotate(360deg); } }

/* ---------- Estructura ---------- */
.shell { position: relative; z-index: 1; display: flex; min-height: 100vh; min-height: 100dvh; max-width: 1360px; margin: 0 auto; }
.area { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.main { flex: 1; padding: 6px 16px calc(120px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; animation: entrar .35s ease both; }
.sin-nav .main { padding-bottom: calc(24px + env(safe-area-inset-bottom)); }

.topbar {
  position: sticky; top: 0; z-index: 20;
  margin: calc(10px + env(safe-area-inset-top)) 12px 8px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 8px 8px 10px; border-radius: 22px;
  background: var(--card); border: 1px solid var(--linea); box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
}
.marca { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--tinta); min-width: 0; }
.logo {
  width: 38px; height: 38px; flex: none; border-radius: 12px; color: #fff;
  background: linear-gradient(135deg, #FF8A5B, #8B5CF6 55%, #22A6F2);
  display: flex; align-items: center; justify-content: center;
  animation: tono 8s linear infinite; box-shadow: 0 6px 18px rgba(139, 92, 246, .35);
}
.marca-nombre { font-size: 17px; font-weight: 800; letter-spacing: -.3px; }
.sync { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--suave); white-space: nowrap; }
.punto-vivo { position: relative; width: 7px; height: 7px; flex: none; }
.punto-vivo::before, .punto-vivo::after { content: ""; position: absolute; inset: 0; border-radius: 50%; background: #16A34A; }
.punto-vivo::before { background: #22C55E; animation: latido 1.8s ease-out infinite; }
.punto-vivo.apagado::before { animation: none; opacity: 0; }
.punto-vivo.apagado::after { background: #D97706; }
.top-acciones { display: flex; align-items: center; gap: 6px; }
.btn-icono {
  width: 44px; height: 44px; flex: none; border-radius: 14px; border: 0;
  background: var(--gris); color: var(--tinta);
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none;
}
.btn-icono.vidrio { background: var(--card-fuerte); }
.avatar-yo { background: linear-gradient(135deg, #FFD7C2, #FFB59E); color: #7A2E12; font-weight: 800; font-size: 15px; }
.ico-sol { display: none; }
:root[data-theme="dark"] .ico-sol, :root.auto-oscuro .ico-sol { display: block; }
:root[data-theme="dark"] .ico-luna, :root.auto-oscuro .ico-luna { display: none; }

/* Menú lateral (tablet / computador) */
.rail { display: none; }

/* Barra inferior (celular) */
.nav-inferior {
  position: fixed; z-index: 30; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom));
  height: 72px; border-radius: 26px; max-width: 520px; margin: 0 auto;
  background: var(--card-fuerte); border: 1px solid var(--linea); box-shadow: var(--sombra-2);
  -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: center;
}
.nav-item { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: var(--suave); font-size: 11px; font-weight: 600; min-height: 56px; justify-content: center; }
.nav-item .pastilla { width: 44px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; transition: background .2s; }
.nav-item.activo { color: var(--tinta); font-weight: 700; }
.nav-item.activo .pastilla { background: var(--gris); }
.orbe-wrap { display: flex; justify-content: center; }
.orbe {
  position: relative; width: 62px; height: 62px; margin-top: -34px; border-radius: 50%; overflow: hidden;
  display: flex; align-items: center; justify-content: center; color: #fff; text-decoration: none;
  animation: orbe 4s ease-in-out infinite;
}
.orbe::before { content: ""; position: absolute; inset: 0; background: radial-gradient(circle at 30% 30%, #FFB59E, #8B5CF6 45%, #1E3A8A 85%); animation: tono 6s linear infinite; }
.orbe svg { position: relative; }

/* ---------- Tarjetas ---------- */
.card {
  border-radius: 24px; padding: 18px; background: var(--card); border: 1px solid var(--linea); box-shadow: var(--sombra);
  -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
}
.card.plana { box-shadow: none; }
.brillo { position: relative; overflow: hidden; }
.brillo::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(110deg, transparent 35%, var(--brillo) 50%, transparent 65%); transform: translateX(-120%); animation: destello 6s ease-in-out infinite; }
.etiqueta { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--suave); }
.cifra-gigante { font-size: 40px; font-weight: 800; letter-spacing: -1.5px; line-height: 1.1; margin-top: 6px; }
.cifra-grande { font-size: 26px; font-weight: 800; letter-spacing: -.8px; }
.sub { font-size: 13px; color: var(--suave); }
.sub b { color: var(--tinta); }
.fila-entre { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.pildora { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 5px 10px; border-radius: 999px; white-space: nowrap; }
.pildora.oro { background: var(--t-oro); color: var(--t-oro-tinta); }
.pildora.verde { background: var(--t-verde); color: var(--t-verde-tinta); }

.hero .tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.tile { padding: 10px; border-radius: 16px; min-width: 0; }
.tile .t-nombre { display: flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; white-space: nowrap; }
.tile .t-nombre::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.tile .t-valor { font-size: 15px; font-weight: 800; margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile.naranja { background: var(--t-naranja); } .tile.naranja .t-nombre { color: var(--t-naranja-tinta); }
.tile.verde { background: var(--t-verde); } .tile.verde .t-nombre { color: var(--t-verde-tinta); }
.tile.morado { background: var(--t-morado); } .tile.morado .t-nombre { color: var(--t-morado-tinta); }
.tile.oro { background: var(--t-oro); } .tile.oro .t-nombre { color: var(--t-oro-tinta); }

.kpis { display: none; }
.kpi { padding: 16px 18px; border-radius: 22px; background: var(--card); border: 1px solid var(--linea); min-width: 0; }
.kpi.oscuro { background: var(--tinta); color: var(--tinta-inv); border-color: transparent; }
.kpi.oscuro .etiqueta, .kpi.oscuro .sub { color: inherit; opacity: .8; }
.kpi .etiqueta { display: flex; align-items: center; gap: 6px; }
.kpi .punto { width: 7px; height: 7px; border-radius: 50%; }

/* ---------- Botones ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 18px; border-radius: 18px; border: 0;
  font-size: 15px; font-weight: 700; text-decoration: none; cursor: pointer; white-space: nowrap;
  transition: transform .12s ease, opacity .2s;
}
.btn:active { transform: scale(.97); }
.btn:hover { opacity: 1; }
.btn-principal { background: var(--tinta); color: var(--tinta-inv); box-shadow: 0 12px 26px rgba(21, 21, 28, .25); }
.btn-vidrio { background: var(--card-fuerte); color: var(--tinta); border: 1px solid var(--borde); }
.btn-ok { background: var(--ok-btn); color: var(--ok-btn-tinta); box-shadow: 0 10px 22px rgba(21, 122, 60, .25); }
.btn-ok-borde { background: var(--card-fuerte); color: var(--ok); border: 1.5px solid currentColor; }
.btn-wa { background: var(--ok-fondo); color: var(--ok-tinta); min-height: 48px; font-size: 14px; }
.btn-peligro { background: transparent; color: var(--deuda); border: 1.5px solid currentColor; }
.btn-bloque { width: 100%; }
.btn-grande { min-height: 60px; font-size: 16px; border-radius: 20px; }
.btn-columna { flex-direction: column; gap: 4px; min-height: 64px; font-size: 13px; padding: 0 6px; white-space: normal; text-align: center; }
.acciones-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.acciones-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }

/* ---------- Títulos de sección ---------- */
.seccion-titulo { display: flex; align-items: center; justify-content: space-between; margin-top: 4px; }
.seccion-titulo h2 { display: flex; align-items: center; gap: 8px; font-size: 17px; font-weight: 800; }
.seccion-titulo h2::before { content: ""; width: 4px; height: 18px; border-radius: 4px; background: linear-gradient(#FF8A5B, #8B5CF6); }
.seccion-titulo a { font-size: 13px; font-weight: 700; text-decoration: none; padding: 10px 0; }
.pagina-titulo { font-size: 28px; font-weight: 800; letter-spacing: -.8px; margin-top: 4px; }

/* ---------- Listas de clientes ---------- */
.lista { display: flex; flex-direction: column; gap: 8px; }
.fila-cliente {
  display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px;
  background: var(--card); border: 1px solid var(--linea); color: inherit; text-decoration: none;
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  transition: transform .12s;
}
.fila-cliente:active { transform: scale(.985); }
.fila-cliente .info { flex: 1; min-width: 0; }
.fila-cliente .nombre { font-weight: 700; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fila-cliente .monto { font-weight: 800; font-size: 15px; color: var(--deuda); white-space: nowrap; }
.fila-cliente .monto.cero { color: var(--ok); }
.fila-cliente .meta { font-size: 11px; color: var(--suave); margin-top: 4px; }
.avatar { position: relative; width: 42px; height: 42px; flex: none; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 15px; }
.avatar.xl { width: 60px; height: 60px; border-radius: 19px; font-size: 20px; }
.av0 { background: var(--av0-bg); color: var(--av0); } .av1 { background: var(--av1-bg); color: var(--av1); }
.av2 { background: var(--av2-bg); color: var(--av2); } .av3 { background: var(--av3-bg); color: var(--av3); }
.av4 { background: var(--av4-bg); color: var(--av4); } .av5 { background: var(--av5-bg); color: var(--av5); }
.puesto { position: absolute; top: -5px; left: -5px; width: 19px; height: 19px; border-radius: 50%; background: var(--tinta); color: var(--tinta-inv); font-size: 10px; font-weight: 800; display: flex; align-items: center; justify-content: center; border: 2px solid var(--bg); }
.puesto.p1 { background: linear-gradient(135deg, #FCD34D, #D97706); color: #3B2300; }
.barra { height: 6px; border-radius: 6px; background: var(--gris); margin-top: 6px; overflow: hidden; }
.barra > span { display: block; height: 100%; border-radius: 6px; transform-origin: left; animation: crecer 1.1s cubic-bezier(.2, .8, .2, 1) both; }
.g0 { background: linear-gradient(90deg, #FF8A5B, #E11D48); } .g1 { background: linear-gradient(90deg, #A78BFA, #7C3AED); }
.g2 { background: linear-gradient(90deg, #7DD3FC, #0284C7); } .g3 { background: linear-gradient(90deg, #FCD34D, #D97706); }
.g4 { background: linear-gradient(90deg, #86EFAC, #16A34A); } .g5 { background: linear-gradient(90deg, #F9A8D4, #DB2777); }
.halo { position: relative; flex: none; }
.halo::before { content: ""; position: absolute; inset: -3px; border-radius: 22px; background: conic-gradient(#FF8A5B, #8B5CF6, #22A6F2, #FF8A5B); animation: girar 6s linear infinite; }
.halo .avatar { border: 2px solid var(--solido); }

/* ---------- Movimientos ---------- */
.movs { display: flex; flex-direction: column; padding: 14px; border-radius: 22px; background: var(--card); border: 1px solid var(--linea); }
.dia-titulo { font-size: 11px; font-weight: 700; letter-spacing: 1.2px; text-transform: uppercase; color: var(--suave); padding: 10px 0 4px; }
.dia-titulo:first-child { padding-top: 0; }
.mov { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.mov + .mov { border-top: 1px solid var(--separador); }
.mov-icono { width: 38px; height: 38px; flex: none; border-radius: 12px; display: flex; align-items: center; justify-content: center; }
.mov-icono.fiado { background: var(--t-naranja); color: var(--t-naranja-tinta); }
.mov-icono.abono { background: var(--t-verde); color: var(--t-verde-tinta); }
.mov .info { flex: 1; min-width: 0; }
.mov .que { font-size: 14px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mov .quien { font-size: 11px; color: var(--suave); }
.mov .valor { font-size: 15px; font-weight: 800; white-space: nowrap; }
.mov .valor.abono { color: var(--ok); }
.mov.anulado .que, .mov.anulado .valor { text-decoration: line-through; opacity: .5; }
.mov-anular { width: 36px; height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--suave); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.mov-anular:hover { background: var(--gris); }
.mov-cliente { color: var(--tinta); text-decoration: none; }

/* ---------- Formularios ---------- */
.campo { display: flex; flex-direction: column; gap: 7px; }
.campo > label, .rotulo { font-size: 12px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; color: var(--suave); }
.rotulo .opcional { font-weight: 500; letter-spacing: 0; text-transform: none; }
.entrada {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 0 6px 0 16px;
  border-radius: 16px; background: var(--card-fuerte); border: 1px solid var(--borde); color: var(--suave);
  transition: border-color .2s, box-shadow .2s;
}
.entrada:focus-within { border-color: var(--tinta); box-shadow: 0 0 0 4px rgba(139, 92, 246, .15); }
.entrada input, .entrada select { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 16px; color: var(--tinta); min-height: 50px; }
.entrada input::placeholder { color: var(--suave); opacity: .8; }
.input-suelto { min-height: 50px; padding: 0 16px; border-radius: 16px; border: 1px solid var(--borde); background: var(--card-fuerte); font-size: 16px; color: var(--tinta); outline: 0; width: 100%; }
.input-suelto:focus { border-color: var(--tinta); }
.check { display: flex; align-items: center; gap: 8px; min-height: 44px; font-size: 14px; color: var(--tinta); cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--tinta); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 14px; border-radius: 999px;
  border: 1px solid var(--borde); background: var(--card-fuerte); color: var(--tinta);
  font-size: 13px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.chip.activo, .chip[aria-pressed="true"] { background: var(--tinta); color: var(--tinta-inv); border-color: var(--tinta); font-weight: 700; }
.chip.oro { background: var(--t-oro); color: var(--t-oro-tinta); border-color: transparent; font-weight: 700; }
.chip.punteado { border-style: dashed; background: transparent; font-weight: 700; }
.chip.punteado.activo { background: var(--tinta); color: var(--tinta-inv); border-style: solid; }
.chip .mini { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; margin-left: -8px; }
.chip.con-avatar { padding-left: 14px; }

.selector-clientes { display: flex; flex-direction: column; gap: 6px; max-height: 230px; overflow-y: auto; padding: 2px; margin: 0 -2px; overscroll-behavior: contain; }
.opcion-cliente { position: relative; }
.opcion-cliente input { position: absolute; opacity: 0; pointer-events: none; }
.opcion-cliente label {
  display: flex; align-items: center; gap: 12px; padding: 8px 12px; border-radius: 16px; cursor: pointer;
  background: var(--card-fuerte); border: 1.5px solid transparent; min-height: 52px;
}
.opcion-cliente label .avatar { width: 34px; height: 34px; border-radius: 11px; font-size: 12px; }
.opcion-cliente label .nombre { flex: 1; font-weight: 600; }
.opcion-cliente label .debe { font-size: 12px; font-weight: 700; color: var(--deuda); }
.opcion-cliente label .debe.cero { color: var(--suave); font-weight: 500; }
.opcion-cliente input:checked + label { border-color: var(--tinta); background: var(--solido); box-shadow: var(--sombra); }
.opcion-cliente input:checked + label::after { content: ""; width: 22px; height: 22px; border-radius: 50%; background: var(--tinta) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E") center / 14px no-repeat; flex: none; }
:root[data-theme="dark"] .opcion-cliente input:checked + label::after, :root.auto-oscuro .opcion-cliente input:checked + label::after { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2315151C' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E"); }
.opcion-cliente input:focus-visible + label { outline: 3px solid #8B5CF6; outline-offset: 2px; }
.crear-cliente { display: none; }
.crear-cliente.visible { display: flex; }

.monto-caja { padding: 18px; }
.monto-linea { display: flex; align-items: baseline; gap: 6px; margin-top: 6px; }
.monto-linea .signo { font-size: 28px; font-weight: 700; color: var(--suave); }
.monto-linea input { flex: 1; min-width: 0; width: 100%; border: 0; outline: 0; background: transparent; font-size: 48px; font-weight: 800; letter-spacing: -2px; color: var(--tinta); padding: 0; caret-color: #8B5CF6; }
.monto-linea input::placeholder { color: var(--gris-2); }
.flujo { height: 3px; border-radius: 3px; margin-top: 8px; background: linear-gradient(90deg, #FF8A5B, #8B5CF6, #22A6F2, #FF8A5B); background-size: 200% 100%; animation: flujo 4s linear infinite; }
.rapidos { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.rapido { min-height: 44px; border: 0; border-radius: 14px; background: var(--gris); font-size: 13px; font-weight: 700; color: var(--tinta); cursor: pointer; }
.rapido:active { transform: scale(.95); }
.fecha-auto { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 18px; background: var(--card); }
.fecha-auto .icono { width: 38px; height: 38px; border-radius: 12px; background: var(--t-morado); color: var(--t-morado-tinta); display: flex; align-items: center; justify-content: center; flex: none; }
.fecha-auto .info { flex: 1; min-width: 0; }
.btn-texto { background: none; border: 0; color: var(--oro); font-weight: 700; font-size: 13px; padding: 12px 6px; cursor: pointer; }
.guardar-fijo { position: sticky; bottom: 0; z-index: 10; margin: 0 -16px; padding: 22px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(to bottom, transparent, var(--bg) 38%); }
.btn-guardar { justify-content: space-between; padding: 0 8px 0 22px; }
.btn-guardar .total { min-height: 44px; padding: 0 14px; border-radius: 14px; background: rgba(255, 255, 255, .16); display: flex; align-items: center; font-weight: 800; }
:root[data-theme="dark"] .btn-guardar .total, :root.auto-oscuro .btn-guardar .total { background: rgba(0, 0, 0, .1); }

.seg { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- Cuenta del cliente ---------- */
.cuenta-cab { display: flex; align-items: center; gap: 14px; }
.cuenta-cab .nombre { font-size: 20px; font-weight: 800; letter-spacing: -.4px; }
.anillo { width: 78px; height: 78px; flex: none; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.anillo .centro { width: 62px; height: 62px; border-radius: 50%; background: var(--solido); display: flex; flex-direction: column; align-items: center; justify-content: center; }
.anillo .pct { font-size: 16px; font-weight: 800; }
.anillo .pagado { font-size: 9px; font-weight: 700; letter-spacing: .6px; color: var(--ok); }
.debe-cifra { font-size: 38px; font-weight: 800; letter-spacing: -1.5px; color: var(--deuda); line-height: 1.1; }
.debe-cifra.cero { color: var(--ok); }
.paz-salvo { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--ok-fondo); color: var(--ok-tinta); font-weight: 700; }

/* ---------- Diálogos ---------- */
dialog {
  border: 0; padding: 0; border-radius: 28px; width: min(440px, calc(100vw - 24px));
  background: var(--solido); color: var(--tinta); box-shadow: 0 30px 80px rgba(0, 0, 0, .35);
}
dialog::backdrop { background: rgba(10, 10, 20, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
dialog[open] { animation: entrar .25s ease both; }
.dialogo { padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialogo h2 { font-size: 20px; font-weight: 800; }

/* ---------- Avisos ---------- */
.aviso {
  position: fixed; z-index: 60; left: 12px; right: 12px; top: calc(14px + env(safe-area-inset-top));
  max-width: 460px; margin: 0 auto; padding: 14px 16px; border-radius: 18px; cursor: pointer;
  display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px;
  background: var(--tinta); color: var(--tinta-inv); box-shadow: var(--sombra-2);
  animation: entrar .3s ease both;
}
.aviso.error { background: #B42318; color: #fff; }
.aviso.ok .ic { color: #4ADE80; }
:root[data-theme="dark"] .aviso.ok .ic, :root.auto-oscuro .aviso.ok .ic { color: #157A3C; }
.aviso.saliendo { opacity: 0; transform: translateY(-10px); transition: all .3s; }
.error-inline { padding: 12px 14px; border-radius: 14px; background: rgba(180, 35, 24, .1); color: var(--deuda); font-weight: 600; font-size: 14px; }

.vacio { text-align: center; padding: 34px 20px; color: var(--suave); }
.vacio .grande { font-size: 18px; font-weight: 800; color: var(--tinta); margin-bottom: 6px; }

/* ---------- Ingreso ---------- */
.pantalla-simple { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; padding: calc(20px + env(safe-area-inset-top)) 22px calc(20px + env(safe-area-inset-bottom)); max-width: 460px; margin: 0 auto; }
.vista-previa { position: relative; height: 220px; margin-top: 18px; }
.vp-tarjeta { position: absolute; left: 18px; right: 18px; top: 8px; padding: 16px 18px; border-radius: 22px; background: var(--card-fuerte); border: 1px solid var(--linea); box-shadow: var(--sombra-2); transform: rotate(-2deg); animation: flotar 5s ease-in-out infinite; }
.vp-barras { display: flex; gap: 6px; margin-top: 12px; align-items: flex-end; height: 44px; }
.vp-barras span { flex: 1; border-radius: 6px; }
.vp-chip { position: absolute; display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-radius: 16px; background: var(--card-fuerte); box-shadow: var(--sombra-2); animation: flotar 6s ease-in-out 1s infinite; }
.vp-chip .ic { width: 30px; height: 30px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
@keyframes flotar { 0%, 100% { translate: 0 0; } 50% { translate: 0 -8px; } }
.bienvenida { font-size: 34px; line-height: 1.1; font-weight: 800; letter-spacing: -1px; margin-top: 18px; }
.nota-segura { margin-top: auto; padding-top: 18px; }
.nota-segura div { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: 16px; background: var(--card); font-size: 12px; line-height: 1.45; color: var(--suave); }
.nota-segura svg { flex: none; color: var(--ok); }

/* ---------- Reportes ---------- */
.grafico { display: flex; align-items: flex-end; gap: 3px; height: 160px; padding-top: 10px; }
.grafico .col { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; gap: 2px; height: 100%; min-width: 0; }
.grafico .col span { display: block; border-radius: 4px 4px 2px 2px; min-height: 0; transform-origin: bottom; animation: subir .9s cubic-bezier(.2, .8, .2, 1) both; }
.grafico .f { background: linear-gradient(#FF8A5B, #E11D48); }
.grafico .a { background: linear-gradient(#4ADE80, #15803D); }
.grafico .col.hoy { outline: 2px dashed var(--borde); outline-offset: 2px; border-radius: 6px; }
@keyframes subir { from { transform: scaleY(0); } to { transform: scaleY(1); } }
.ejes { display: flex; justify-content: space-between; font-size: 11px; color: var(--suave); margin-top: 6px; }
.leyenda { display: flex; gap: 14px; font-size: 12px; color: var(--suave); }
.leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.leyenda i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.tabla { width: 100%; border-collapse: collapse; font-size: 14px; }
.tabla th { text-align: left; font-size: 11px; letter-spacing: 1px; text-transform: uppercase; color: var(--suave); padding: 6px 4px; }
.tabla td { padding: 10px 4px; border-top: 1px solid var(--separador); }
.tabla .der { text-align: right; }

/* ---------- Responsive: tablet y computador ---------- */
.solo-tablet { display: none; }
.dos-col, .cuenta-grid, .cuenta-grid > .izq, .nuevo-grid, .nuevo-grid > div { display: flex; flex-direction: column; gap: 14px; }
.cuenta-grid > .izq { position: static; }

@media (min-width: 760px) {
  .main { padding: 6px 24px 130px; }
  .hero .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .acciones-2 { max-width: 560px; }
}

@media (min-width: 900px) {
  body { font-size: 15px; }
  .rail {
    display: flex; position: sticky; top: 18px; align-self: flex-start; flex-direction: column; align-items: center; gap: 8px;
    width: 96px; flex: none; margin: 18px 0 18px 18px; padding: 16px 0; height: calc(100vh - 36px); height: calc(100dvh - 36px);
    border-radius: 28px; background: var(--card); border: 1px solid var(--linea); box-shadow: var(--sombra);
    -webkit-backdrop-filter: blur(18px); backdrop-filter: blur(18px);
  }
  .rail .logo { width: 48px; height: 48px; border-radius: 15px; margin-bottom: 14px; }
  .rail-item { width: 76px; padding: 10px 0; border-radius: 16px; color: var(--suave); text-decoration: none; display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 600; border: 0; background: transparent; cursor: pointer; }
  .rail-item.activo { background: var(--tinta); color: var(--tinta-inv); font-weight: 700; }
  .rail-item.nuevo { background: linear-gradient(135deg, #FF8A5B, #8B5CF6 55%, #22A6F2); color: #fff; font-weight: 700; animation: tono 8s linear infinite; }
  .rail .abajo { margin-top: auto; display: flex; flex-direction: column; gap: 6px; }
  .nav-inferior { display: none; }
  .topbar { margin: 18px 24px 10px; position: relative; }
  .topbar .marca .logo { display: none; }
  .main { padding: 6px 24px 28px; }
  .solo-celular { display: none !important; }
  .solo-tablet { display: revert; }
  .kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
  .hero { display: none; }
  .dos-col { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 18px; align-items: start; }
  .dos-col.igual { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cuenta-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); gap: 18px; align-items: start; }
  .cuenta-grid > .izq { position: sticky; top: 18px; }
  .nuevo-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
  .selector-clientes { max-height: 420px; }
  .guardar-fijo { position: static; margin: 0; padding: 0; background: none; }
  .aviso { top: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; }
}
