/* Velix Finanzas · capa de marca Velix */
:root {
  --noche: #0A1428;
  --noche-2: #16233D;
  --noche-3: #2A3A5C;
  --azul: #1F5FE0;
  --azul-suave: #EAF0FD;
  --cian: #22C4E0;
  --fondo: #F4F6FA;
  --blanco: #FFFFFF;
  --borde: #DDE2EA;
  --borde-fuerte: #C9D2E0;
  --texto: #0A1428;
  --texto-2: #4B5568;
  --texto-3: #A9B4C8;
  --ok-fondo: #DDEFE4; --ok-texto: #14532D;
  --aviso-fondo: #FDEACB; --aviso-texto: #7A4105; --aviso: #F2A33A;
  --error-fondo: #F9DADA; --error-texto: #8A1F1F; --error-borde: #E8B4B4;
  --neutro: #E3E8EF;
  --display: Montserrat, "Segoe UI", system-ui, sans-serif;
  --cuerpo: "IBM Plex Sans", "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--fondo); color: var(--texto); font-family: var(--cuerpo); font-size: 15px; line-height: 1.45; }
a { color: var(--azul); }
h1, h2, h3 { font-family: var(--display); margin: 0; text-wrap: balance; }
h1 { font-size: 22px; font-weight: 700; }
h2 { font-size: 16px; font-weight: 700; }
.num { font-variant-numeric: tabular-nums; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--cian); outline-offset: 2px; }

/* ----- estructura ----- */
.app { min-height: 100vh; display: flex; }
.lateral { display: none; }
.contenido { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.barra-movil { background: var(--noche); color: #fff; padding: 12px 16px; display: flex; align-items: center; justify-content: space-between; gap: 10px; position: sticky; top: 0; z-index: 5; }
.marca { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; min-width: 0; }
.marca svg { flex: none; }
.marca-texto { display: flex; flex-direction: column; min-width: 0; }
.marca-velix { font-family: var(--display); font-weight: 700; font-size: 15px; letter-spacing: .06em; }
.marca-velix span { font-weight: 600; letter-spacing: 0; color: var(--cian); }
.marca-caja { font-size: 12px; color: var(--texto-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.avatar { width: 40px; height: 40px; border-radius: 20px; background: var(--noche-2); border: 1px solid var(--noche-3); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 600; font-size: 13px; text-decoration: none; flex: none; }
main { flex: 1; width: 100%; max-width: 1240px; padding: 16px 16px 112px; display: flex; flex-direction: column; gap: 16px; }
.nav-movil { position: fixed; left: 0; right: 0; bottom: 0; z-index: 6; background: var(--blanco); border-top: 1px solid var(--borde); display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); padding: 4px 4px calc(10px + env(safe-area-inset-bottom, 0px)); }
.nav-movil a { text-decoration: none; color: var(--texto-2); display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; min-height: 48px; justify-content: center; }
.nav-movil a.activo { color: var(--azul); font-weight: 600; }
.boton-flotante { position: fixed; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom, 0px)); z-index: 6; }

@media (min-width: 960px) {
  .lateral { display: flex; flex-direction: column; gap: 28px; width: 240px; flex: none; background: var(--noche); color: #fff; padding: 24px 16px; position: sticky; top: 0; height: 100vh; }
  .lateral nav { display: flex; flex-direction: column; gap: 4px; }
  .lateral nav a { text-decoration: none; color: #C9D2E0; display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; }
  .lateral nav a:hover { background: var(--noche-2); color: #fff; }
  .lateral nav a.activo { background: var(--noche-2); color: #fff; font-weight: 600; }
  .lateral nav a.activo svg { stroke: var(--cian); }
  .lateral .usuario { margin-top: auto; display: flex; align-items: center; gap: 10px; padding-top: 12px; border-top: 1px solid var(--noche-3); }
  .lateral .usuario form { margin-left: auto; }
  .lateral .salir { background: none; border: 0; color: var(--texto-3); font: inherit; font-size: 13px; cursor: pointer; padding: 6px; }
  .barra-movil, .nav-movil, .boton-flotante { display: none; }
  main { padding: 28px 32px 48px; gap: 20px; }
  h1 { font-size: 28px; }
}

/* ----- piezas ----- */
.cabecera { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px; }
.cabecera .sub { color: var(--texto-2); }
.acciones { display: flex; flex-wrap: wrap; gap: 10px; }
.volver { display: inline-flex; align-items: center; gap: 4px; color: var(--texto-2); text-decoration: none; font-size: 14px; min-height: 32px; }
.tarjeta { background: var(--blanco); border: 1px solid var(--borde); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.tarjeta.sin-relleno { padding: 0; gap: 0; }
.fila-flex { display: flex; flex-wrap: wrap; gap: 16px; }
.fila-flex > * { flex: 1 1 300px; min-width: 0; }
.grilla-kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi { background: var(--blanco); border: 1px solid var(--borde); border-radius: 14px; padding: 12px 14px; display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.kpi .etq { font-size: 12px; color: var(--texto-2); }
.kpi .valor { font-family: var(--display); font-weight: 700; font-size: 21px; font-variant-numeric: tabular-nums; }
.kpi .nota { font-size: 12px; color: var(--texto-2); }
.saldo { background: var(--noche); color: #fff; border-radius: 16px; padding: 20px; display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 16px; }
.saldo .etq { font-size: 12px; color: var(--texto-3); letter-spacing: .04em; text-transform: uppercase; }
.saldo .valor { font-family: var(--display); font-weight: 800; font-size: 42px; line-height: 1.05; font-variant-numeric: tabular-nums; }
.saldo .valor.negativo { color: #FCA5A5; }
.saldo .nota { font-size: 13px; color: var(--texto-3); }
@media (min-width: 960px) { .saldo { padding: 24px; } .saldo .valor { font-size: 52px; } }

.aviso { border-radius: 14px; padding: 14px 16px; display: flex; gap: 12px; align-items: flex-start; }
.aviso svg { flex: none; margin-top: 1px; }
.aviso .t { font-weight: 600; }
.aviso .d { font-size: 13px; }
.aviso.amarillo { background: var(--aviso-fondo); color: var(--aviso-texto); }
.aviso.rojo { background: var(--error-fondo); color: var(--error-texto); }
.aviso.neutro { background: var(--blanco); border: 1px solid var(--borde); }
.aviso.neutro .d { color: var(--texto-2); }
.aviso a { color: inherit; font-weight: 600; }

.lista { list-style: none; margin: 0; padding: 0; }
.lista > li + li { border-top: 1px solid var(--borde); }
.item { display: flex; gap: 12px; align-items: center; padding: 12px 16px; text-decoration: none; color: inherit; }
a.item:hover { background: #FAFBFC; }
.item .icono { flex: none; width: 34px; height: 34px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.item .cuerpo { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: flex-start; }
.item .titulo { font-weight: 500; overflow-wrap: anywhere; }
.item .meta { font-size: 12px; color: var(--texto-2); }
.item .monto { font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.item.anulado .titulo, .item.anulado .monto { text-decoration: line-through; color: var(--texto-3); }
.ic-ingreso { background: var(--azul-suave); color: var(--azul); }
.ic-entrega { background: var(--neutro); color: var(--texto); }
.ic-gasto { background: var(--aviso-fondo); color: var(--aviso-texto); }
.ic-anulado { background: var(--neutro); color: var(--texto-3); }
.grupo-fecha { font-size: 12px; font-weight: 600; color: var(--texto-2); letter-spacing: .04em; text-transform: uppercase; padding: 4px 2px; }

.pildora { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.p-aviso { background: var(--aviso-fondo); color: var(--aviso-texto); }
.p-ok { background: var(--ok-fondo); color: var(--ok-texto); }
.p-error { background: var(--error-fondo); color: var(--error-texto); }
.p-azul { background: var(--azul-suave); color: var(--azul); }
.p-neutro { background: var(--neutro); color: var(--texto); }

.boton { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px; border-radius: 12px; border: 1px solid var(--borde-fuerte); background: var(--blanco); color: var(--texto); font: 600 15px var(--cuerpo); text-decoration: none; cursor: pointer; }
.boton:hover { border-color: var(--texto-2); }
.boton.principal { background: var(--azul); border-color: var(--azul); color: #fff; }
.boton.principal:hover { background: #1A50C0; }
.boton.peligro { color: var(--error-texto); border-color: var(--error-borde); }
.boton.claro { background: transparent; color: #fff; border-color: var(--cian); }
.boton.ancho { width: 100%; min-height: 52px; font-size: 16px; }
.boton.pildora-boton { border-radius: 26px; min-height: 52px; padding: 0 20px; box-shadow: 0 6px 16px rgba(10, 20, 40, .22); }
.enlace { background: none; border: 0; padding: 0; color: var(--azul); font: 600 14px var(--cuerpo); cursor: pointer; text-decoration: none; }

/* ----- formularios ----- */
form.formulario { display: flex; flex-direction: column; gap: 18px; max-width: 560px; }
.campo { display: flex; flex-direction: column; gap: 6px; }
.campo > label, .campo > .etq-campo, fieldset legend { font-weight: 600; font-size: 14px; }
.campo .opcional { font-weight: 400; color: var(--texto-2); }
.ayuda { font-size: 12px; color: var(--texto-2); }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 48px; padding: 0 14px; border: 1px solid var(--borde-fuerte); border-radius: 12px; background: var(--blanco); font: 16px var(--cuerpo); color: var(--texto); }
textarea { padding: 12px 14px; min-height: 80px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--azul); box-shadow: 0 0 0 3px rgba(31, 95, 224, .18); }
.monto-grande { display: flex; align-items: center; gap: 6px; border: 2px solid var(--azul); border-radius: 12px; background: var(--blanco); padding: 0 14px; min-height: 60px; }
.monto-grande span { font-family: var(--display); font-weight: 700; font-size: 22px; color: var(--texto-2); }
.monto-grande input { border: 0; box-shadow: none; padding: 0; min-height: 56px; font: 700 24px var(--display); font-variant-numeric: tabular-nums; }
.monto-grande input:focus { box-shadow: none; }
.caja-suave { background: var(--blanco); border: 1px solid var(--borde); border-radius: 14px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset legend { padding: 0; margin-bottom: 8px; }
.opciones { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.opcion { position: relative; }
.opcion input { position: absolute; opacity: 0; pointer-events: none; }
.opcion span { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; border: 1px solid var(--borde-fuerte); border-radius: 12px; background: var(--blanco); cursor: pointer; min-height: 48px; justify-content: center; }
.opcion span b { font-weight: 600; }
.opcion span small { font-size: 12px; color: var(--texto-2); }
.opcion input:checked + span { border: 2px solid var(--azul); background: var(--azul-suave); padding: 9px 11px; }
.opcion input:focus-visible + span { outline: 3px solid var(--cian); outline-offset: 2px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; min-height: 36px; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--azul); }
.archivo { border: 1px dashed var(--borde-fuerte); border-radius: 12px; padding: 12px; background: var(--blanco); }
.archivo input { font: 14px var(--cuerpo); width: 100%; }
.pie-form { display: flex; flex-direction: column; gap: 8px; }
.chips-fecha { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.chip-fecha { flex: none; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; padding: 8px 12px; border: 1px solid var(--borde-fuerte); border-radius: 12px; background: var(--blanco); color: var(--texto); font: 13px var(--cuerpo); cursor: pointer; text-align: left; min-height: 44px; }
.chip-fecha b { font-weight: 600; font-size: 14px; }
.chip-fecha span { color: var(--texto-2); font-size: 12px; }
.chip-fecha.activo { border: 2px solid var(--azul); background: var(--azul-suave); padding: 7px 11px; }
.archivo-elegido { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 12px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--borde); }
.archivo-nombre { font-size: 14px; font-weight: 500; overflow-wrap: anywhere; min-width: 0; }
.archivo-quitar { min-height: 40px; font-size: 14px; }

.mensajes { display: flex; flex-direction: column; gap: 8px; }
.mensaje { border-radius: 12px; padding: 12px 14px; font-size: 14px; }
.mensaje.ok { background: var(--ok-fondo); color: var(--ok-texto); }
.mensaje.error { background: var(--error-fondo); color: var(--error-texto); }

/* ----- detalle ----- */
.filas-dato > div { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 14px 16px; }
.filas-dato > div + div { border-top: 1px solid var(--borde); }
.cuadro { width: 10px; height: 10px; border-radius: 3px; display: inline-block; flex: none; }
.barra-uso { height: 10px; border-radius: 5px; background: var(--neutro); display: flex; overflow: hidden; }
.historial { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; color: var(--texto-2); }
.historial li { display: flex; gap: 10px; }
.historial li::before { content: ""; flex: none; width: 8px; height: 8px; margin-top: 6px; border-radius: 4px; background: var(--borde-fuerte); }
.historial b { color: var(--texto); font-weight: 600; }
details.anular summary { cursor: pointer; color: var(--error-texto); font-weight: 600; list-style: none; min-height: 44px; display: flex; align-items: center; }
details.anular summary::-webkit-details-marker { display: none; }
.respaldo-img { max-width: 100%; max-height: 420px; border-radius: 10px; border: 1px solid var(--borde); object-fit: contain; background: var(--fondo); }

/* ----- tablas ----- */
.tabla-caja { overflow-x: auto; }
table.tabla { width: 100%; border-collapse: collapse; font-size: 14px; font-variant-numeric: tabular-nums; }
.tabla th { text-align: left; color: var(--texto-2); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; padding: 12px 8px; white-space: nowrap; }
.tabla td { padding: 12px 8px; border-top: 1px solid var(--borde); vertical-align: top; }
.tabla .der { text-align: right; }
.tabla tr.anulado td { color: var(--texto-3); }
.tabla tr.anulado .tachado { text-decoration: line-through; }
.tabla tfoot td { border-top: 2px solid var(--noche); font-weight: 600; }
.tabla a { text-decoration: none; font-weight: 500; color: var(--texto); }
.tabla a:hover { color: var(--azul); }
@media (max-width: 959px) { .solo-escritorio { display: none !important; } }
@media (min-width: 960px) { .solo-movil { display: none !important; } }

/* ----- calendario ----- */
.calendario { gap: 4px; padding: 12px; }
.cal-semana { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
.cal-semana:first-child span { text-align: center; font-size: 11px; font-weight: 600; color: var(--texto-2); padding: 2px 0 4px; }
.cal-dia { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 44px; border-radius: 10px; text-decoration: none; color: var(--texto-2); font-variant-numeric: tabular-nums; }
a.cal-dia:hover { background: var(--fondo); }
.cal-dia.con-mov { color: var(--texto); font-weight: 600; background: var(--fondo); }
.cal-dia.hoy .cal-num { box-shadow: 0 0 0 2px var(--azul); border-radius: 12px; padding: 0 6px; }
.cal-dia.elegido { background: var(--noche); color: #fff; }
.cal-dia.fuera { color: var(--borde-fuerte); }
.cal-num { font-size: 14px; line-height: 20px; }
.cal-puntos { display: flex; gap: 3px; height: 6px; }
.cal-puntos i, .cal-leyenda i { display: inline-block; width: 6px; height: 6px; border-radius: 3px; }
.pt-ingreso { background: var(--azul); }
.pt-entrega { background: var(--texto-2); }
.pt-gasto { background: var(--aviso); }
.cal-dia.elegido .pt-entrega { background: #fff; }
.cal-dia.elegido .pt-ingreso { background: var(--cian); }
.cal-leyenda { display: flex; flex-wrap: wrap; gap: 14px; justify-content: center; font-size: 12px; color: var(--texto-2); padding-top: 6px; }
.cal-leyenda span { display: inline-flex; align-items: center; gap: 6px; }
.cal-leyenda i { width: 8px; height: 8px; border-radius: 4px; }
.dia-elegido { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; background: var(--azul-suave); border-radius: 12px; padding: 10px 14px; font-size: 14px; }
@media (min-width: 960px) { .cal-dia { min-height: 52px; } }

.filtros { display: flex; flex-wrap: wrap; gap: 6px; }
.filtros a { padding: 7px 14px; border-radius: 16px; border: 1px solid var(--borde-fuerte); background: var(--blanco); color: var(--texto); font-size: 13px; text-decoration: none; }
.filtros a.activo { background: var(--noche); border-color: var(--noche); color: #fff; font-weight: 600; }
.selector-mes { display: inline-flex; align-items: center; background: var(--blanco); border: 1px solid var(--borde); border-radius: 12px; }
.selector-mes a, .selector-mes span.inactivo { width: 44px; height: 44px; display: flex; align-items: center; justify-content: center; color: var(--texto); }
.selector-mes span.inactivo { color: var(--texto-3); }
.selector-mes b { padding: 0 6px; font-size: 14px; }

/* ----- acceso ----- */
.acceso { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: var(--noche); }
.acceso .panel { width: 100%; max-width: 400px; background: var(--blanco); border-radius: 18px; padding: 28px 24px; display: flex; flex-direction: column; gap: 20px; }
.acceso .marca-acceso { display: flex; align-items: center; gap: 12px; }
.acceso .marca-acceso .marca-velix { color: var(--texto); font-size: 18px; }
.acceso .marca-acceso .marca-velix span { color: var(--azul); }
