/* ==========================================================
   PROLABEN · Estilos del sistema
   ========================================================== */
:root {
    --guinda: #7a1a14;
    --guinda-2: #5c130f;
    --dorado: #c8962e;
    --verde: #1f8a4c;
    --crema: #f6f2ea;
    --tinta: #2b2b2b;
    --gris: #6c757d;
    --borde: #e7e1d6;
    --sidebar-w: 248px;
    --bs-primary: #7a1a14;
    --bs-primary-rgb: 122, 26, 20;
    --bs-link-color: #7a1a14;
    --bs-link-hover-color: #5c130f;
    --bs-body-font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

body { background: var(--crema); color: var(--tinta); font-size: .94rem; }
a { text-decoration: none; }

/* ── Botones de marca ── */
.btn-primary { --bs-btn-bg: var(--guinda); --bs-btn-border-color: var(--guinda); --bs-btn-hover-bg: var(--guinda-2); --bs-btn-hover-border-color: var(--guinda-2); --bs-btn-active-bg: var(--guinda-2); --bs-btn-disabled-bg: var(--guinda); --bs-btn-disabled-border-color: var(--guinda); }
.btn-outline-primary { --bs-btn-color: var(--guinda); --bs-btn-border-color: var(--guinda); --bs-btn-hover-bg: var(--guinda); --bs-btn-hover-border-color: var(--guinda); --bs-btn-active-bg: var(--guinda); }
.btn-success { --bs-btn-bg: var(--verde); --bs-btn-border-color: var(--verde); }
.btn-icono { width: 38px; height: 38px; display: inline-flex; align-items: center; justify-content: center; border-radius: 10px; background: #fff; border: 1px solid var(--borde); }
.form-control:focus, .form-select:focus { border-color: #c98a84; box-shadow: 0 0 0 .2rem rgba(122, 26, 20, .12); }
.form-check-input:checked { background-color: var(--guinda); border-color: var(--guinda); }
.page-link { color: var(--guinda); }
.active > .page-link, .page-link.active { background-color: var(--guinda); border-color: var(--guinda); }

/* ── Estructura ── */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); background: linear-gradient(180deg, #4a0f0b 0%, var(--guinda) 100%);
    color: #fff; position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 1040;
    transition: transform .25s ease; overflow-y: auto;
}
.marca { display: flex; align-items: center; gap: 10px; padding: 16px 16px 14px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.12); }
.marca img { border-radius: 50%; background: #fff; }
.marca b { display: block; font-size: 1.05rem; letter-spacing: .5px; }
.marca small { display: block; font-size: .68rem; opacity: .75; line-height: 1.2; }
.sidebar nav { padding: 8px 10px 16px; flex: 1; }
.nav-titulo { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; opacity: .55; margin: 14px 8px 4px; }
.nav-item { display: flex; align-items: center; gap: 11px; color: rgba(255,255,255,.86); padding: 8px 10px; border-radius: 9px; font-size: .9rem; margin-bottom: 1px; }
.nav-item i { width: 18px; text-align: center; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.1); color: #fff; }
.nav-item.activo { background: #fff; color: var(--guinda); font-weight: 600; }
.nav-item .punto { width: 8px; height: 8px; border-radius: 50%; margin-left: auto; }
.punto.verde { background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.25); }
.punto.gris { background: rgba(255,255,255,.35); }
.sidebar-pie { font-size: .7rem; opacity: .45; padding: 10px 18px; }
.sidebar-fondo { display: none; }

.contenido { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.barra { position: sticky; top: 0; z-index: 1030; background: rgba(246,242,234,.92); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 12px; padding: 12px 24px; border-bottom: 1px solid var(--borde); }
.barra-titulo { font-size: 1.2rem; font-weight: 700; margin: 0; color: var(--guinda); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.btn-usuario { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 1px solid var(--borde); border-radius: 30px; padding: 4px 12px 4px 4px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--guinda); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; }
.estado-caja { align-items: center; gap: 6px; font-size: .8rem; padding: 6px 12px; border-radius: 30px; font-weight: 600; }
.estado-caja.abierta { background: #e3f6ea; color: var(--verde); }
.estado-caja.cerrada { background: #eee; color: var(--gris); }
.principal { padding: 20px 24px 60px; }
.acciones-pagina { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; margin-bottom: 14px; }

@media (max-width: 991.98px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.abierto { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.35); }
    .sidebar.abierto + .sidebar-fondo { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 1035; }
    .contenido { margin-left: 0; }
    .barra { padding: 10px 16px; }
    .principal { padding: 16px 16px 60px; }
    .acciones-pagina { justify-content: stretch; }
    .acciones-pagina > * { flex: 1 1 auto; }
}

/* ── Tarjetas ── */
.tarjeta { background: #fff; border: 1px solid var(--borde); border-radius: 14px; box-shadow: 0 1px 2px rgba(60,40,20,.04); }
.tarjeta-cab { padding: 14px 18px; border-bottom: 1px solid var(--borde); display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tarjeta-cab h2, .tarjeta-cab h3 { font-size: 1rem; font-weight: 700; margin: 0; }
.tarjeta-cuerpo { padding: 16px 18px; }
.kpi { background: #fff; border: 1px solid var(--borde); border-radius: 14px; padding: 14px 16px; height: 100%; position: relative; overflow: hidden; container-type: inline-size; }
.kpi .etq { font-size: .72rem; text-transform: uppercase; letter-spacing: .5px; color: var(--gris); font-weight: 600; }
.kpi:has(.ico) .etq { padding-right: 44px; }
.kpi .val { font-size: clamp(.82rem, 12.5cqw, 1.45rem); font-weight: 800; margin-top: 2px; line-height: 1.15; white-space: nowrap; }
.ico-gris { background: #eee; color: #666; }
@media (max-width: 575.98px) {
    .kpi .ico { display: none !important; }
    .kpi:has(.ico) .etq { padding-right: 0; }
    .filtros > div { flex: 1 1 calc(50% - 8px); }
    .filtros .form-control, .filtros .form-select { min-width: 0; width: 100%; }
}
.kpi .sub { font-size: .78rem; color: var(--gris); margin-top: 2px; }
.kpi .ico { position: absolute; right: 12px; top: 12px; width: 38px; height: 38px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.ico-guinda { background: #f6e3e1; color: var(--guinda); }
.ico-verde { background: #e3f6ea; color: var(--verde); }
.ico-dorado { background: #fbf0d9; color: #a3740f; }
.ico-azul { background: #e3eefc; color: #1d5fbf; }
.ico-rojo { background: #fde6e4; color: #b03a2e; }

/* ── Tablas ── */
.tabla { margin: 0; }
.tabla thead th { background: #faf7f1; color: #5b5146; font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; font-weight: 700; border-bottom: 1px solid var(--borde); white-space: nowrap; }
.tabla td, .tabla th { padding: .6rem .75rem; vertical-align: middle; }
.tabla tbody tr:hover { background: #fcfaf6; }
.tabla .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tabla-vacia { text-align: center; color: var(--gris); padding: 32px 12px !important; }
.fila-anulada td { color: #a0a0a0; text-decoration: line-through; }
.fila-anulada td.no-tachar { text-decoration: none; }

/* ── Insignias ── */
.chip { display: inline-flex; align-items: center; gap: 4px; font-size: .72rem; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.chip-verde { background: #e3f6ea; color: var(--verde); }
.chip-rojo { background: #fde6e4; color: #b03a2e; }
.chip-dorado { background: #fbf0d9; color: #8a6210; }
.chip-gris { background: #eee; color: #666; }
.chip-guinda { background: #f6e3e1; color: var(--guinda); }
.chip-azul { background: #e3eefc; color: #1d5fbf; }

/* ── Filtros ── */
.filtros { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.filtros .form-control, .filtros .form-select { min-width: 140px; }
.filtros label { font-size: .72rem; color: var(--gris); font-weight: 600; text-transform: uppercase; margin-bottom: 2px; }

/* ── Formularios de venta ── */
.renglon { background: #faf7f1; border: 1px solid var(--borde); border-radius: 10px; padding: 10px; margin-bottom: 8px; }
.renglon .ayuda { font-size: .75rem; min-height: 1em; }
.total-grande { font-size: 1.6rem; font-weight: 800; color: var(--guinda); }

/* ── Login ── */
.login-fondo { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; background: radial-gradient(circle at 20% 20%, #9b2a22 0, transparent 45%), linear-gradient(135deg, #4a0f0b, #7a1a14 60%, #a3740f); }
.login-caja { width: 100%; max-width: 400px; background: #fff; border-radius: 20px; padding: 30px 28px; box-shadow: 0 25px 60px rgba(0,0,0,.3); }

/* ── Documento ── */
.doc-acciones { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 16px 0; }

@media print {
    .sidebar, .barra, .acciones-pagina, .no-print, .alert { display: none !important; }
    .contenido { margin: 0; }
    .principal { padding: 0; }
    body { background: #fff; }
    .tarjeta { border: 0; box-shadow: none; }
}

.cursor-pointer { cursor: pointer; }
.text-guinda { color: var(--guinda) !important; }
.text-verde { color: var(--verde) !important; }
.min-w-0 { min-width: 0; }
.toast-app { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: #1f2937; color: #fff; padding: 12px 18px; border-radius: 10px; z-index: 2000; max-width: 92%; font-size: .9rem; box-shadow: 0 6px 20px rgba(0,0,0,.25); }

/* ==========================================================
   Estilo visual (v2.1): recupera el aspecto del sistema original
   (tarjetas de color, encabezados con degradado, accesos rápidos)
   con la estructura y la rapidez de la versión nueva.
   ========================================================== */
body { background: #f3efe8; }
.tarjeta { border: 0; border-radius: 16px; box-shadow: 0 4px 18px rgba(60,40,20,.07); transition: box-shadow .25s ease; }
.tarjeta:hover { box-shadow: 0 8px 26px rgba(60,40,20,.11); }

/* Encabezados de tarjeta con degradado de marca (no aplica a las barras de filtros) */
.tarjeta-cab:not(.filtros) { background: linear-gradient(135deg, var(--guinda-2), var(--guinda) 55%, #a3392e); color: #fff; border-bottom: 0; border-radius: 16px 16px 0 0; }
.tarjeta-cab:not(.filtros) :is(h2, h3, span, b, strong, i) { color: #fff !important; }
.tarjeta-cab:not(.filtros) small { color: rgba(255,255,255,.78) !important; }
.tarjeta-cab:not(.filtros) a:not(.btn) { color: #fff; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); padding: 3px 12px; border-radius: 20px; font-size: .78rem; }
.tarjeta-cab:not(.filtros) a:not(.btn):hover { background: rgba(255,255,255,.3); }
.tarjeta-cab:not(.filtros) .btn-primary { --bs-btn-bg: #fff; --bs-btn-color: var(--guinda); --bs-btn-border-color: #fff; --bs-btn-hover-bg: #f6e3e1; --bs-btn-hover-color: var(--guinda); --bs-btn-hover-border-color: #f6e3e1; }
.tarjeta-cab:not(.filtros) .btn-primary i { color: var(--guinda) !important; }
.tarjeta-cab:not(.filtros) .btn-outline-primary, .tarjeta-cab:not(.filtros) .btn-outline-secondary { --bs-btn-color: #fff; --bs-btn-border-color: rgba(255,255,255,.6); --bs-btn-hover-bg: #fff; --bs-btn-hover-color: var(--guinda); --bs-btn-hover-border-color: #fff; }
.tarjeta-cab.cab-verde { background: linear-gradient(135deg, #17693a, var(--verde) 60%, #2fae67); }
.tarjeta-cab.cab-azul { background: linear-gradient(135deg, #1b4f8a, #2980b9 60%, #3c99d6); }
.tarjeta-cab.cab-dorado { background: linear-gradient(135deg, #8a5d0b, #b07d1a 60%, #c9952b); }
.tarjeta-cab.cab-rojo { background: linear-gradient(135deg, #922b21, #c0392b 60%, #e05a4b); }
.tarjeta-cab.cab-gris { background: linear-gradient(135deg, #4d5656, #7f8c8d); }
.tarjeta-cab.filtros { background: #fbf8f3; border-radius: 16px 16px 0 0; }

/* Tarjetas de indicadores (KPI) a todo color, como el panel original */
.kpi { border: 0; border-radius: 18px; padding: 16px 18px; color: #fff; background: linear-gradient(135deg, #6c3483, #9b59b6); box-shadow: 0 8px 24px rgba(0,0,0,.14); transition: transform .25s ease, box-shadow .25s ease; }
.kpi::after { content: ''; position: absolute; right: -22px; bottom: -22px; width: 90px; height: 90px; border-radius: 50%; background: rgba(255,255,255,.08); pointer-events: none; }
a > .kpi:hover { transform: translateY(-3px); box-shadow: 0 14px 32px rgba(0,0,0,.2); }
.kpi .etq, .kpi .sub { color: rgba(255,255,255,.88); }
.kpi .val, .kpi [class*="text-"] { color: #fff !important; }
.kpi .sub [class*="text-"] { background: rgba(255,255,255,.2); padding: 0 7px; border-radius: 12px; }
.kpi .ico { background: rgba(255,255,255,.2) !important; color: #fff !important; width: 42px; height: 42px; font-size: 1.15rem; border-radius: 12px; }
.kpi:has(.ico-guinda) { background: linear-gradient(135deg, var(--guinda-2), var(--guinda) 50%, #b03a2e); }
.kpi:has(.ico-verde) { background: linear-gradient(135deg, #17693a, #27ae60); }
.kpi:has(.ico-dorado) { background: linear-gradient(135deg, #8a5d0b, #c9952b); }
.kpi:has(.ico-azul) { background: linear-gradient(135deg, #1b4f8a, #3498db); }
.kpi:has(.ico-rojo) { background: linear-gradient(135deg, #922b21, #e74c3c); }
.kpi:has(.ico-gris) { background: linear-gradient(135deg, #4d5656, #7f8c8d); }

/* Tablas: encabezado con tinte de marca */
.tabla thead th { background: #f6e9e4; color: var(--guinda); }
.tabla tbody tr:hover { background: #fdf7f3; }

/* Panel: bienvenida y accesos rápidos */
.bienvenida { position: relative; overflow: hidden; border-radius: 20px; padding: 24px 28px; color: #fff; margin-bottom: 18px;
    background: linear-gradient(135deg, #4a0f0b, var(--guinda) 50%, #a3740f); box-shadow: 0 10px 30px rgba(122,26,20,.32); }
.bienvenida .marca-agua { position: absolute; right: 26px; top: 50%; transform: translateY(-50%); font-size: 5.5rem; opacity: .12; pointer-events: none; }
.bienvenida h2 { font-weight: 800; font-size: 1.45rem; margin: 6px 0 2px; }
.bienvenida p { margin: 0; opacity: .85; font-size: .9rem; }
.bienvenida .fecha-chip { display: inline-block; background: rgba(255,255,255,.18); padding: 3px 12px; border-radius: 20px; font-size: .75rem; }
.bienvenida .estado-chip { display: inline-flex; align-items: center; gap: 6px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.3); color: #fff; padding: 6px 14px; border-radius: 30px; font-size: .82rem; font-weight: 600; position: relative; z-index: 1; }
.bienvenida .estado-chip:hover { background: rgba(255,255,255,.3); color: #fff; }
.acceso { display: block; text-align: center; background: #fff; border-radius: 16px; padding: 16px 10px; box-shadow: 0 4px 16px rgba(60,40,20,.07); transition: transform .25s ease, box-shadow .25s ease; color: #444; height: 100%; }
.acceso:hover { transform: translateY(-4px); box-shadow: 0 10px 26px rgba(60,40,20,.14); color: var(--guinda); }
.acceso .ic { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; margin: 0 auto 8px; color: #fff; font-size: 1.3rem; }
.acceso span { font-size: .8rem; font-weight: 700; }
.alerta-franja { display: flex; align-items: center; gap: 12px; border-radius: 14px; padding: 12px 16px; color: #fff; margin-bottom: 16px; background: linear-gradient(135deg, #d35400, #f39c12); }
.alerta-franja.roja { background: linear-gradient(135deg, #922b21, #e74c3c); }
.alerta-franja a { margin-left: auto; color: #fff; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35); border-radius: 20px; padding: 3px 12px; font-size: .8rem; white-space: nowrap; }

/* Dinero disponible (caja y banco) */
.saldo-cuenta { border-radius: 18px; padding: 18px 20px; color: #fff; position: relative; overflow: hidden; height: 100%; box-shadow: 0 8px 24px rgba(0,0,0,.14); }
.saldo-cuenta .etq { font-size: .75rem; text-transform: uppercase; letter-spacing: .5px; opacity: .88; font-weight: 700; }
.saldo-cuenta .val { font-size: clamp(1.4rem, 5vw, 2rem); font-weight: 800; line-height: 1.1; margin: 4px 0; }
.saldo-cuenta .sub { font-size: .8rem; opacity: .88; }
.saldo-cuenta > i { position: absolute; right: 18px; top: 50%; transform: translateY(-50%); font-size: 3.6rem; opacity: .15; }
.saldo-caja { background: linear-gradient(135deg, #17693a, #27ae60); }
.saldo-caja.cerrada { background: linear-gradient(135deg, #4d5656, #7f8c8d); }
.saldo-banco { background: linear-gradient(135deg, #1b4f8a, #3498db); }
.saldo-negativo { background: linear-gradient(135deg, #922b21, #e74c3c) !important; }

/* Pagos a proveedores: tarjetas por proveedor */
.prov-card { background: #fff; border-radius: 16px; padding: 16px 16px 14px; box-shadow: 0 4px 18px rgba(60,40,20,.07); height: 100%; display: flex; flex-direction: column; transition: transform .25s ease, box-shadow .25s ease; border-top: 4px solid var(--verde); }
.prov-card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(60,40,20,.13); }
.prov-card.deuda { border-top-color: #e74c3c; }
.prov-card.sel { outline: 3px solid var(--guinda); outline-offset: 2px; }
.prov-card .nombre { font-weight: 700; font-size: .98rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prov-card .cifras { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; text-align: center; margin: 12px 0 8px; }
.prov-card .cifras small { display: block; font-size: .66rem; color: var(--gris); text-transform: uppercase; letter-spacing: .3px; }
.prov-card .cifras b { font-size: .86rem; white-space: nowrap; }
.prov-card .progress { height: 7px; border-radius: 10px; background: #f0ebe3; }
.prov-card .pie { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 8px; margin-top: auto; padding-top: 10px; font-size: .75rem; color: var(--gris); }
.prov-card .pie > span:last-child { margin-left: auto; }
.insignia-deuda { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; }
.insignia-dia { background: linear-gradient(135deg, #27ae60, #2ecc71); color: #fff; }
.btn-pagar { background: linear-gradient(135deg, #e74c3c, #c0392b); color: #fff; border: 0; border-radius: 20px; padding: 5px 14px; font-size: .8rem; font-weight: 700; white-space: nowrap; }
.btn-pagar:hover { color: #fff; filter: brightness(1.08); }
.total-caja { background: linear-gradient(135deg, var(--guinda-2), var(--guinda)); color: #fff; border-radius: 12px; padding: 12px 14px; text-align: center; height: 100%; }
.total-caja.verde { background: linear-gradient(135deg, #17693a, #27ae60); }
.total-caja.rojo { background: linear-gradient(135deg, #922b21, #e74c3c); }
.total-caja small { display: block; opacity: .85; font-size: .75rem; }
.total-caja b { font-size: 1.2rem; }
.metodo-opcion { position: relative; }
.metodo-opcion input { position: absolute; opacity: 0; }
.metodo-opcion label { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 6px; border: 2px solid var(--borde); border-radius: 12px; cursor: pointer; font-size: .78rem; font-weight: 600; text-align: center; background: #fff; transition: all .15s ease; height: 100%; }
.metodo-opcion label i { font-size: 1.2rem; color: var(--gris); }
.metodo-opcion label small { font-weight: 400; color: var(--gris); font-size: .68rem; }
.metodo-opcion input:checked + label { border-color: var(--guinda); background: #fbeeea; color: var(--guinda); }
.metodo-opcion input:checked + label i { color: var(--guinda); }
.metodo-opcion input:focus-visible + label { outline: 2px solid var(--guinda); outline-offset: 2px; }

/* Botón flotante de nueva venta en celular */
.fab { position: fixed; right: 18px; bottom: 20px; z-index: 1020; width: 56px; height: 56px; border-radius: 50%; display: none; align-items: center; justify-content: center; color: #fff; font-size: 1.35rem;
    background: linear-gradient(135deg, var(--guinda), #b03a2e); box-shadow: 0 6px 20px rgba(122,26,20,.45); }
.fab:hover { color: #fff; }

/* ── Celular ── */
@media (max-width: 991.98px) {
    .fab { display: flex; }
    .principal { padding-bottom: 96px; }
}
@media (max-width: 767.98px) {
    /* Las tablas se apilan: cada fila es una tarjeta con la etiqueta de su columna */
    .tabla-apilable thead { display: none; }
    .tabla-apilable, .tabla-apilable tbody, .tabla-apilable tfoot { display: block; width: 100%; }
    .tabla-apilable tr { display: block; margin: 10px; border: 1px solid var(--borde); border-radius: 12px; background: #fff; box-shadow: 0 2px 8px rgba(60,40,20,.05); overflow: hidden; }
    .tabla-apilable tbody tr:hover { background: #fff; }
    .tabla-apilable > :not(caption) > * > td { display: flex; justify-content: flex-end; flex-wrap: wrap; align-items: center; gap: 4px 6px; text-align: right; border: 0; border-bottom: 1px solid #f3eee6; padding: .5rem .8rem; white-space: normal; min-width: 0; }
    .tabla-apilable td::before { content: attr(data-label); font-weight: 700; color: var(--guinda); font-size: .7rem; text-transform: uppercase; letter-spacing: .3px; text-align: left; margin-right: auto; padding-right: 8px; }
    .tabla-apilable td > div { flex-basis: 100%; text-align: right; }
    .tabla-apilable td[data-label=""]::before { display: none; }
    .tabla-apilable td[data-label=""] { justify-content: flex-end; flex-wrap: wrap; gap: 6px; }
    .tabla-apilable td:last-child { border-bottom: 0; }
    .tabla-apilable td.tabla-vacia { display: block; text-align: center; }
    .tabla-apilable td.tabla-vacia::before { display: none; }
    .tabla-apilable tr.fila-anulada { opacity: .75; }
    .table-responsive:has(> .tabla-apilable) { overflow: visible; }
}
@media (max-width: 575.98px) {
    .barra-titulo { font-size: 1.05rem; }
    .bienvenida { padding: 18px; }
    .bienvenida h2 { font-size: 1.2rem; }
    .bienvenida .marca-agua { font-size: 3.6rem; right: 12px; }
    .kpi { padding: 13px 14px; }
    .tarjeta-cab { padding: 12px 14px; }
    .tarjeta-cuerpo { padding: 14px; }
    .modal-dialog { margin: .5rem; }
    .doc-acciones .btn { flex: 1 1 45%; }
}

/* ═════════ v2.2 ═════════ */

/* Buscador en listas desplegables */
.buscador { position: relative; }
.buscador-oculto { position: absolute !important; opacity: 0; pointer-events: none; height: 0 !important; width: 0 !important; padding: 0 !important; border: 0 !important; }
.buscador-input { padding-right: 2rem; background: #fff url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 512 512'%3e%3cpath fill='%23999' d='M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7a32 32 0 0 1-45.3 45.3L330.7 376A208 208 0 1 1 416 208zM208 352a144 144 0 1 0 0-288 144 144 0 1 0 0 288z'/%3e%3c/svg%3e") no-repeat right .7rem center / .85rem; }
.buscador-lista { display: none; position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 1060; background: #fff; border: 1px solid var(--borde); border-radius: 10px; box-shadow: 0 12px 30px rgba(60,40,20,.18); max-height: 280px; overflow-y: auto; padding: 4px; }
.buscador.abierto .buscador-lista { display: block; }
.buscador-op { padding: 9px 10px; border-radius: 7px; cursor: pointer; font-size: .92rem; line-height: 1.25; }
.buscador-op:hover, .buscador-op.activo { background: #fbeeea; color: var(--guinda); }
.buscador-op.sel { font-weight: 700; color: var(--guinda); }
.buscador-op.deshab { color: #aaa; cursor: not-allowed; background: none; }
.buscador-nada { padding: 9px 10px; color: var(--gris); font-size: .85rem; font-style: italic; }
.filtros .buscador { min-width: 170px; }

/* Pie de página con versión y desarrollador */
.pie-app { margin-top: 32px; padding: 14px 4px 0; border-top: 1px solid var(--borde); display: flex; flex-wrap: wrap; gap: 4px 18px; justify-content: center; font-size: .76rem; color: var(--gris); text-align: center; }
.pie-app a { color: var(--guinda); text-decoration: none; }
.pie-app a:hover { text-decoration: underline; }
.sidebar-pie a { color: inherit; font-weight: 700; }
.login-pie { margin-top: 14px; padding-top: 12px; border-top: 1px solid #eee; text-align: center; font-size: .72rem; color: #888; line-height: 1.6; }
.login-pie a { color: var(--guinda); text-decoration: none; }

/* Metas */
.meta-barra { position: relative; height: 16px; border-radius: 10px; background: #f0ebe3; overflow: visible; }
.meta-barra > div { height: 100%; border-radius: 10px; background: linear-gradient(90deg, #1f8a4c, #2ecc71); transition: width .6s ease; }
.meta-barra > div.dorado { background: linear-gradient(90deg, #c8962e, #f1c40f); }
.meta-barra > div.rojo { background: linear-gradient(90deg, #c0392b, #e74c3c); }
.meta-barra .marca-hoy { position: absolute; top: -4px; bottom: -4px; width: 3px; margin-left: -1px; background: var(--guinda); border-radius: 2px; opacity: .7; }
.mini-dato { background: #faf6ef; border: 1px solid var(--borde); border-radius: 12px; padding: 10px 8px; height: 100%; }
.mini-dato small { display: block; font-size: .68rem; text-transform: uppercase; letter-spacing: .3px; color: var(--gris); }
.mini-dato b { font-size: 1rem; }
.meta-panel { border-left: 5px solid var(--guinda); transition: box-shadow .2s; }
.meta-panel:hover { box-shadow: 0 8px 22px rgba(60,40,20,.12); }

/* Plazos de crédito (botones rápidos) */
[data-dias].active { background: var(--guinda); color: #fff; }

/* Cartera: deuda sin vencer en dorado */
.prov-card.deuda.por-vencer { border-top-color: #c8962e; }
.prov-card a.nombre:hover { color: var(--guinda) !important; }

/* Barra inferior (celular) */
.barra-inferior { display: none; }
.instalar-app { position: fixed; left: 10px; right: 10px; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 1045; display: flex; align-items: center; gap: 10px; padding: 10px 12px;
    background: linear-gradient(135deg, #4a0f0b, var(--guinda)); color: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,.3); }
.instalar-app img { border-radius: 50%; background: #fff; }
.instalar-app small { display: block; opacity: .85; font-size: .75rem; line-height: 1.25; }
@media (max-width: 991.98px) {
    .barra-inferior { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 1030; background: rgba(255,255,255,.97); backdrop-filter: blur(10px);
        border-top: 1px solid var(--borde); box-shadow: 0 -4px 18px rgba(60,40,20,.08); padding: 4px 4px calc(4px + env(safe-area-inset-bottom)); justify-content: space-around; align-items: flex-end; }
    .barra-inferior a, .barra-inferior button { flex: 1 1 0; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 2px 4px; border: 0; background: none; color: #7d746b; font-size: .66rem; font-weight: 600; text-decoration: none; border-radius: 12px; min-width: 0; }
    .barra-inferior i { font-size: 1.15rem; }
    .barra-inferior .activo { color: var(--guinda); }
    .barra-inferior .activo i { transform: translateY(-1px); }
    .barra-inferior a.central { flex: 0 0 auto; width: 62px; margin-top: -24px; }
    .barra-inferior a.central i { width: 54px; height: 54px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 1.3rem;
        background: linear-gradient(135deg, var(--guinda), #b03a2e); box-shadow: 0 6px 16px rgba(122,26,20,.4); border: 3px solid #fff; }
    .barra-inferior a.central span { color: var(--guinda); }
    .fab { display: none !important; }
    .principal { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
    .pie-app { margin-bottom: 4px; }
    /* Encabezado compacto y botones más cómodos para el dedo */
    .barra { padding: 8px 12px; gap: 8px; }
    .btn-usuario { padding: 3px; }
    .form-control, .form-select { min-height: 42px; font-size: 16px; } /* 16px evita el zoom automático del iPhone */
    .form-control-sm, .form-select-sm { min-height: 36px; font-size: 15px; }
    .btn { min-height: 38px; }
    .btn-sm { min-height: 34px; }
    .modal-footer { flex-wrap: wrap; }
    .modal-footer > .btn { flex: 1 1 auto; }
    .toast-app { bottom: calc(90px + env(safe-area-inset-bottom)) !important; }
}
@media (max-width: 575.98px) {
    .modal-dialog.modal-lg, .modal-dialog { margin: 0; max-width: none; min-height: 100%; }
    .modal-dialog-scrollable { height: 100%; }
    .modal-content { border-radius: 0; min-height: 100%; }
    .prov-card .cifras b { font-size: .8rem; }
    .pie-app { font-size: .72rem; gap: 2px 12px; }
    .acciones-pagina .btn { font-size: .88rem; }
}
/* App instalada: respeta la muesca del teléfono */
@media (display-mode: standalone) {
    .barra { padding-top: calc(8px + env(safe-area-inset-top)); }
    .sidebar { padding-top: env(safe-area-inset-top); }
}
@media (max-width: 575.98px) {
    .total-caja { padding: 8px 6px; border-radius: 10px; }
    .total-caja small { font-size: .62rem; line-height: 1.2; }
    .total-caja b { font-size: .88rem; white-space: nowrap; }
    .metodo-opcion label small { font-size: .6rem; }
}

/* Contadores rojos de pendientes (estilo notificación) */
.contador { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px;
            background: #e53935; color: #fff; font-size: .7rem; font-weight: 700; line-height: 1; box-shadow: 0 0 0 2px rgba(255,255,255,.9); }
.nav-item .contador { margin-left: auto; }
.nav-item .contador + .punto { margin-left: 6px; }
.barra-inferior a, .barra-inferior button { position: relative; }
.barra-inferior .contador { position: absolute; top: 2px; left: calc(50% + 4px); min-width: 18px; height: 18px; font-size: .62rem; padding: 0 5px; }

/* Cartera de trabajadores (adelantos por descontar) en Nómina */
.cartera-banner { display: flex; flex-wrap: wrap; gap: 12px; align-items: stretch; background: #fff8ea; border: 1px solid #f1d9a6; border-radius: 14px; padding: 12px; }
.cartera-total { display: flex; align-items: center; gap: 12px; padding: 4px 14px 4px 6px; border-right: 1px solid #f1d9a6; color: #8a6210; }
.cartera-total i { font-size: 1.6rem; }
.cartera-total small { display: block; font-size: .72rem; text-transform: uppercase; letter-spacing: .03em; }
.cartera-total b { display: block; font-size: 1.35rem; line-height: 1.1; color: #6d4c0b; }
.cartera-lista { display: flex; flex-wrap: wrap; gap: 8px; flex: 1; align-items: center; }
.cartera-item { display: grid; grid-template-columns: auto auto; column-gap: 10px; text-align: left; background: #fff; border: 1px solid #ecd9ae; border-radius: 10px; padding: 6px 10px; font-size: .85rem; }
.cartera-item:hover:not([disabled]) { border-color: #c99a2e; box-shadow: 0 1px 4px rgba(0,0,0,.08); }
.cartera-item .nom { font-weight: 600; }
.cartera-item .val { font-weight: 700; color: #8a6210; text-align: right; }
.cartera-item .det { grid-column: 1 / -1; font-size: .72rem; color: #777; }
.cartera-item.alto { border-color: #e6a39b; background: #fdf3f2; }
.cartera-item.alto .val, .cartera-item.alto .det { color: #b03a2e; }
@media (max-width: 576px) { .cartera-total { border-right: 0; border-bottom: 1px solid #f1d9a6; width: 100%; padding-bottom: 8px; } }
