/**
 * GESTFACT WEBCOMUNICA - Hoja de estilos maestra
 *
 * Autor: Iñaki Serrano
 * Empresa: Webcomunica Solutions
 * Fecha: Octubre 2025
 *
 * Descripción:
 * Este archivo contiene todos los estilos de la plataforma GESTFACT WEBCOMUNICA.
 * Los colores corporativos han sido extraídos del logo oficial de Webcomunica.
 *
 * Paleta de colores:
 * - Azul principal: #0B7EB4 (color corporativo Webcomunica)
 * - Gris corporativo: #4A5D6B (texto secundario)
 * - Negro: #1a1a1a (texto principal)
 * - Blanco: #ffffff (fondos)
 * - Amarillo advertencia: #FFC107 (facturas con errores)
 * - Verde éxito: #28a745
 * - Rojo error: #dc3545
 */

/* ============================================
   RESET Y ESTILOS GENERALES
   ============================================ */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --color-azul-principal: #0B7EB4;
    --color-gris-corporativo: #4A5D6B;
    --color-negro: #1a1a1a;
    --color-blanco: #ffffff;
    --color-amarillo-advertencia: #FFC107;
    --color-verde-exito: #28a745;
    --color-rojo-error: #dc3545;
    --color-gris-claro: #f5f5f5;
    --color-gris-borde: #ddd;
    --fuente-principal: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

body {
    font-family: var(--fuente-principal);
    background-color: var(--color-gris-claro);
    color: var(--color-negro);
    line-height: 1.6;
    min-height: 100vh;
}

/* ============================================
   PÁGINA DE LOGIN
   ============================================ */

.contenedor-login {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, var(--color-azul-principal) 0%, var(--color-gris-corporativo) 100%);
    padding: 20px;
}

.caja-login {
    background-color: var(--color-blanco);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 35px 40px;
    width: 100%;
    max-width: 400px;
    text-align: center;
}

.caja-login .logo-login {
    max-width: 240px;
    height: auto;
    margin-bottom: 25px;
}

.grupo-formulario {
    margin-bottom: 18px;
    text-align: left;
}

.grupo-formulario label {
    display: block;
    color: var(--color-gris-corporativo);
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 6px;
}

.grupo-formulario input {
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--color-gris-borde);
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.2s ease;
}

.grupo-formulario input:focus {
    outline: none;
    border-color: var(--color-azul-principal);
    box-shadow: 0 0 0 3px rgba(11, 126, 180, 0.1);
}

.btn {
    padding: 12px 30px;
    border: none;
    border-radius: 5px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
}

.btn-azul {
    background-color: #0969da;
    color: var(--color-blanco);
    width: 100%;
    margin-top: 8px;
    padding: 11px 30px;
    font-size: 14px;
    font-weight: 500;
    border: 1px solid rgba(27, 31, 35, 0.15);
}

.btn-azul:hover {
    background-color: #0860ca;
    border-color: rgba(27, 31, 35, 0.15);
    box-shadow: 0 1px 0 rgba(27, 31, 35, 0.1);
}

.btn-verde {
    background-color: var(--color-verde-exito);
    color: var(--color-blanco);
}

.btn-verde:hover {
    background-color: #218838;
}

.btn-amarillo {
    background-color: var(--color-amarillo-advertencia);
    color: var(--color-negro);
    font-weight: 600;
    font-size: 12px;
}

.btn-amarillo:hover {
    background-color: #e0a800;
}

.btn-gris {
    background-color: var(--color-gris-corporativo);
    color: var(--color-blanco);
}

.btn-gris:hover {
    background-color: #3a4a57;
}

.mensaje-error {
    background-color: #f8d7da;
    color: #721c24;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #f5c6cb;
    margin-bottom: 18px;
    font-size: 13px;
}

.mensaje-exito {
    background-color: #d4edda;
    color: #155724;
    padding: 10px 12px;
    border-radius: 4px;
    border: 1px solid #c3e6cb;
    margin-bottom: 18px;
    font-size: 13px;
}

/* ============================================
   HEADER Y NAVEGACIÓN
   ============================================ */

.header-principal {
    background-color: var(--color-blanco);
    box-shadow: inset 0 -1px 0 #d1d5da;
    padding: 16px 0;
}

.contenedor-header {
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 20px;
}

.logo-header {
    max-width: 300px;
    height: auto;
}

.info-usuario {
    display: flex;
    align-items: center;
    gap: 20px;
}

.nombre-usuario {
    color: var(--color-gris-corporativo);
    font-weight: 500;
}

.menu-navegacion {
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.menu-navegacion select {
    padding: 10px 15px;
    border: 2px solid var(--color-azul-principal);
    border-radius: 5px;
    background-color: var(--color-blanco);
    color: var(--color-azul-principal);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    min-width: 200px;
}

.menu-navegacion select:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(11, 126, 180, 0.1);
}

/* ============================================
   CONTENEDOR PRINCIPAL
   ============================================ */

.contenedor-principal {
    max-width: 1400px;
    margin: 30px auto;
    padding: 0 20px;
}

.tarjeta {
    background-color: var(--color-blanco);
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(27, 31, 35, 0.12);
    border: 1px solid #d1d5da;
    overflow: hidden;
    margin-bottom: 30px;
}

.titulo-seccion {
    color: var(--color-azul-principal);
    font-size: 22px;
    margin-bottom: 25px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--color-azul-principal);
    font-weight: 600;
    letter-spacing: 0.5px;
}

/* ============================================
   TABLAS DE DATOS
   ============================================ */

.tabla-wrapper {
    overflow-x: auto;
}

.tabla-facturas {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

.tabla-facturas thead {
    background: #fafbfc;
    border-bottom: 2px solid #e1e4e8;
}

.tabla-facturas th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    font-size: 12px;
    color: #586069;
    white-space: nowrap;
}

.tabla-facturas td {
    padding: 16px 15px;
    border-bottom: 1px solid #e1e4e8;
    font-size: 14px;
    color: #24292e;
}

.tabla-facturas tbody tr {
    transition: background-color 0.15s ease;
}

.tabla-facturas tbody tr:hover {
    background-color: #f6f8fa;
}

.tabla-facturas tbody tr.fila-error {
    background-color: #fff3cd;
}

.tabla-facturas tbody tr.fila-error:hover {
    background-color: #ffe69c;
}

/* ============================================
   FORMULARIOS
   ============================================ */

.formulario-filtros {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.campo-formulario {
    display: flex;
    flex-direction: column;
}

.campo-formulario label {
    color: var(--color-gris-corporativo);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 5px;
}

.campo-formulario input,
.campo-formulario select {
    padding: 10px;
    border: 1px solid var(--color-gris-borde);
    border-radius: 5px;
    font-size: 14px;
}

.campo-formulario input:focus,
.campo-formulario select:focus {
    outline: none;
    border-color: var(--color-azul-principal);
}

/* ============================================
   ZONA DE SUBIDA DE ARCHIVOS
   ============================================ */

.zona-subida {
    border: 2px dashed var(--color-azul-principal);
    border-radius: 10px;
    padding: 40px;
    text-align: center;
    background-color: rgba(11, 126, 180, 0.05);
    cursor: pointer;
    transition: all 0.3s ease;
}

.zona-subida:hover {
    background-color: rgba(11, 126, 180, 0.1);
    border-color: #096892;
}

.zona-subida.arrastrando {
    background-color: rgba(11, 126, 180, 0.15);
    border-color: #096892;
}

.zona-subida .icono-subida {
    font-size: 48px;
    color: var(--color-azul-principal);
    margin-bottom: 15px;
}

.zona-subida p {
    color: var(--color-gris-corporativo);
    font-size: 16px;
    margin-bottom: 10px;
}

.zona-subida .formatos-aceptados {
    color: var(--color-gris-corporativo);
    font-size: 12px;
}

.lista-archivos-seleccionados {
    margin-top: 20px;
}

.archivo-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px;
    background-color: var(--color-gris-claro);
    border-radius: 5px;
    margin-bottom: 10px;
}

.archivo-item .nombre-archivo {
    color: var(--color-negro);
    font-size: 14px;
}

.archivo-item .btn-eliminar {
    background-color: var(--color-rojo-error);
    color: var(--color-blanco);
    border: none;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    font-size: 12px;
}

/* ============================================
   MODAL VALIDACIÓN DE FACTURA
   ============================================ */

.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-overlay.activo {
    display: flex;
}

.modal-contenido {
    background-color: var(--color-blanco);
    border-radius: 10px;
    width: 100%;
    max-width: 1400px;
    max-height: 90vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.modal-header {
    background-color: var(--color-azul-principal);
    color: var(--color-blanco);
    padding: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    font-size: 20px;
    font-weight: 600;
}

.btn-cerrar-modal {
    background: none;
    border: none;
    color: var(--color-blanco);
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
}

.modal-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    padding: 20px;
    overflow-y: auto;
}

.contenedor-preview {
    border: 1px solid var(--color-gris-borde);
    border-radius: 5px;
    padding: 15px;
    background-color: var(--color-gris-claro);
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 600px;
}

.preview-factura {
    max-width: 100%;
    max-height: 600px;
    object-fit: contain;
}

.contenedor-campos {
    overflow-y: auto;
    max-height: 600px;
    padding-right: 15px;
}

.modal-footer {
    padding: 20px;
    border-top: 1px solid var(--color-gris-borde);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================
   LOADER / SPINNER
   ============================================ */

.loader {
    border: 4px solid var(--color-gris-claro);
    border-top: 4px solid var(--color-azul-principal);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.cargando-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.9);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.cargando-overlay.activo {
    display: flex;
}

.cargando-texto {
    margin-top: 20px;
    color: var(--color-azul-principal);
    font-size: 16px;
    font-weight: 600;
}

/* ============================================
   BADGES Y ETIQUETAS
   ============================================ */

.badge {
    display: inline-block;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.3px;
    text-transform: uppercase;
}

.badge-ok {
    background-color: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.badge-error {
    background-color: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

.badge-warning {
    background-color: #fff3cd;
    color: #856404;
    border: 1px solid #ffeeba;
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */

/* Tablets (768px - 1023px) */
@media (max-width: 1023px) {
    .contenedor-header {
        flex-direction: column;
        align-items: flex-start;
    }

    .modal-body {
        grid-template-columns: 1fr;
    }

    .contenedor-preview {
        min-height: 400px;
    }

    .contenedor-campos {
        max-height: none;
        padding-right: 10px;
    }

    .formulario-filtros {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    }
}

/* Móviles (hasta 767px) */
@media (max-width: 767px) {
    .caja-login {
        padding: 30px 20px;
    }

    .caja-login h1 {
        font-size: 22px;
    }

    .logo-header {
        max-width: 150px;
    }

    .tarjeta {
        padding: 20px;
    }

    .titulo-seccion {
        font-size: 20px;
    }

    .tabla-facturas {
        font-size: 12px;
    }

    .tabla-facturas th,
    .tabla-facturas td {
        padding: 8px;
    }

    .zona-subida {
        padding: 25px;
    }

    .zona-subida .icono-subida {
        font-size: 36px;
    }

    .modal-contenido {
        max-height: 95vh;
    }

    .contenedor-preview {
        min-height: 300px;
    }

    .contenedor-campos {
        max-height: none;
        padding-right: 5px;
    }

    .preview-factura {
        max-height: 400px;
    }

    .formulario-filtros {
        grid-template-columns: 1fr;
    }

    .menu-navegacion {
        width: 100%;
    }

    .menu-navegacion select {
        width: 100%;
    }
}

/* Móviles pequeños (hasta 320px) */
@media (max-width: 320px) {
    .caja-login {
        padding: 20px 15px;
    }

    .tarjeta {
        padding: 15px;
    }
}

/* ============================================
   UTILIDADES
   ============================================ */

.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-10 {
    margin-top: 10px;
}

.mt-20 {
    margin-top: 20px;
}

.mb-10 {
    margin-bottom: 10px;
}

.mb-20 {
    margin-bottom: 20px;
}

.hidden {
    display: none;
}

.flex {
    display: flex;
}

.flex-center {
    display: flex;
    justify-content: center;
    align-items: center;
}

.flex-between {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.gap-10 {
    gap: 10px;
}

.gap-20 {
    gap: 20px;
}

/* ============================================
   EXPORTAR LISTADOS - FILTROS Y TABLA
   ============================================ */

.exportar-cabecera {
    margin-bottom: 25px;
}

.exportar-cabecera h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 5px 0;
}

.exportar-cabecera p {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.tarjeta-filtros {
    border-radius: 12px;
    margin-bottom: 25px;
}

.tarjeta-filtros-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
}

.tarjeta-filtros-header h2 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.tarjeta-filtros-body {
    padding: 20px 24px;
}

.filtros-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 12px;
    margin-bottom: 16px;
}

.filtros-grid label {
    display: block;
    font-weight: 600;
    font-size: 11px;
    color: #1a1a1a;
    margin-bottom: 4px;
}

.filtros-grid input {
    width: 100%;
    padding: 7px 8px;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    font-size: 12px;
}

.botones-filtros {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    flex-wrap: nowrap;
    align-items: center;
}

.btn-filtro {
    padding: 0 !important;
    margin: 0 !important;
    font-size: 13px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
    width: 120px !important;
    height: 38px !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    vertical-align: middle;
}

.resumen-resultados {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 16px 24px;
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.resumen-resultados span {
    font-size: 13px;
    color: #6B7280;
}

.resumen-resultados strong {
    font-size: 18px;
    margin-left: 8px;
}

.resumen-resultados .total-facturas-valor {
    color: #1a1a1a;
}

.resumen-resultados .suma-total-valor {
    color: #0B7EB4;
}

.contenedor-tabla-exportar {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}

.tabla-exportar {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla-exportar thead tr {
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.tabla-exportar th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.tabla-exportar th.clickable {
    cursor: pointer;
    user-select: none;
}

.tabla-exportar th svg {
    display: inline-block;
    vertical-align: middle;
    margin-left: 4px;
}

.tabla-exportar tbody tr {
    border-bottom: 1px solid #E5E7EB;
    transition: background 0.2s;
}

.tabla-exportar tbody tr:hover {
    background: #F9FAFB;
}

.tabla-exportar td {
    padding: 10px 12px;
    white-space: nowrap;
}

.tabla-exportar td.ellipsis {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabla-exportar td.numero-factura {
    font-weight: 600;
    color: #1a1a1a;
}

.tabla-exportar td.text-right {
    text-align: right;
}

.tabla-exportar td.text-center {
    text-align: center;
}

.tabla-exportar td.font-weight-600 {
    font-weight: 600;
}

.badge-estado-ok {
    display: inline-block;
    padding: 4px 10px;
    background: #D1FAE5;
    color: #065F46;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-estado-error {
    display: inline-block;
    padding: 4px 10px;
    background: #FED7AA;
    color: #7C2D12;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

/* ============================================
   SUGERENCIAS EMPRESAS (DROPDOWN)
   ============================================ */

.sugerencias-dropdown {
    display: none;
    position: fixed;
    background: white;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    max-height: 250px;
    overflow-y: auto;
    z-index: 999;
    min-width: 200px;
}

.sugerencia-item {
    padding: 10px 12px;
    cursor: pointer;
    border-bottom: 1px solid #E5E7EB;
    transition: background 0.2s;
}

.sugerencia-item:hover {
    background: #F9FAFB;
}

/* ============================================
   MODAL FILTRO RÁPIDO
   ============================================ */

.modal-filtro-rapido {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-filtro-contenido {
    background: white;
    border-radius: 12px;
    width: 90%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}

.modal-filtro-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-filtro-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.modal-filtro-header button {
    background: none;
    border: none;
    font-size: 24px;
    color: #6B7280;
    cursor: pointer;
    padding: 0;
    line-height: 1;
}

.modal-filtro-body {
    padding: 24px;
}

.modal-filtro-body label {
    display: block;
    font-weight: 600;
    font-size: 13px;
    color: #1a1a1a;
    margin-bottom: 8px;
}

.modal-filtro-body input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid #D1D5DB;
    border-radius: 8px;
    font-size: 14px;
    transition: border-color 0.2s;
}

.modal-filtro-body input:focus {
    border-color: #0B7EB4;
    outline: none;
}

.modal-filtro-sugerencias {
    margin-top: 16px;
    max-height: 300px;
    overflow-y: auto;
}

.modal-filtro-sugerencias .mensaje-info {
    padding: 16px;
    text-align: center;
    color: #9CA3AF;
    font-size: 14px;
}

.modal-filtro-sugerencias .mensaje-exito-filtro {
    padding: 16px;
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    border-radius: 8px;
    color: #0369A1;
    font-size: 14px;
}

.modal-filtro-sugerencias .mensaje-error-filtro {
    padding: 16px;
    text-align: center;
    color: #EF4444;
    font-size: 14px;
}

.modal-filtro-sugerencias .sugerencias-lista {
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    overflow: hidden;
}

.sugerencia-modal-item {
    padding: 12px 16px;
    cursor: pointer;
    border-bottom: 1px solid #E5E7EB;
    transition: background 0.2s;
    font-size: 14px;
}

.sugerencia-modal-item:hover {
    background: #F9FAFB;
}

.modal-filtro-footer {
    padding: 16px 24px;
    border-top: 1px solid #E5E7EB;
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.modal-filtro-footer .btn {
    padding: 10px 20px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

/* ============================================
   VALIDAR FACTURAS
   ============================================ */

.validar-cabecera {
    margin-bottom: 25px;
}

.validar-cabecera h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 5px 0;
}

.validar-cabecera p {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.contenedor-tabla-validar {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
}

.tabla-validar {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.tabla-validar thead tr {
    background: #F9FAFB;
    border-bottom: 1px solid #E5E7EB;
}

.tabla-validar th {
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    color: #1a1a1a;
    white-space: nowrap;
}

.tabla-validar tbody tr.fila-warning {
    background: #FFFBEB;
    border-bottom: 1px solid #FDE68A;
    transition: background 0.2s;
}

.tabla-validar tbody tr.fila-warning:hover {
    background: #FEF3C7;
}

.tabla-validar tbody tr.fila-ok {
    background: #E2F8E0;
    border-bottom: 1px solid #C7F1C2;
    transition: background 0.2s;
}

.tabla-validar tbody tr.fila-ok:hover {
    background: #C7F1C2;
}

.tabla-validar tbody tr.fila-vacia td {
    padding: 40px 20px;
    text-align: center;
    color: #6B7280;
}

.tabla-validar td {
    padding: 10px 12px;
    white-space: nowrap;
}

.tabla-validar td.ellipsis {
    max-width: 250px;
    overflow: hidden;
    text-overflow: ellipsis;
}

.tabla-validar td.numero-factura {
    font-weight: 600;
    color: #1a1a1a;
}

.tabla-validar td.text-right {
    text-align: right;
}

.tabla-validar td.text-center {
    text-align: center;
}

.tabla-validar td.font-weight-600 {
    font-weight: 600;
}

.badge-warning-estado {
    display: inline-block;
    padding: 4px 10px;
    background: #FCD34D;
    color: #78350F;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.badge-ok-estado {
    display: inline-block;
    padding: 4px 10px;
    background: #E2F8E0;
    color: #166534;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    white-space: nowrap;
}

.btn-validar-factura {
    padding: 6px 12px;
    font-size: 11px;
    font-weight: 600;
    border-radius: 6px;
    white-space: nowrap;
}

/* ============================================
   SUBIR FACTURAS
   ============================================ */

.subir-cabecera {
    margin-bottom: 25px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subir-cabecera h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 5px 0;
}

.subir-cabecera p {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.btn-historial {
    display: inline-block;
    padding: 12px 24px;
    background-color: #0B7EB4;
    color: white;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn-historial:hover {
    background-color: #095a82;
    color: white;
}

.contenedor-zona-subida {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
}

.contenedor-zona-subida-body {
    padding: 40px 24px;
}

.zona-subida-drag {
    border: 2px dashed #D1D5DB;
    border-radius: 12px;
    padding: 60px 40px;
    text-align: center;
    cursor: pointer;
    transition: all 0.3s ease;
    background: #F9FAFB;
}

.zona-subida-drag:hover {
    border-color: #0B7EB4;
    background: #F0F9FF;
}

.zona-subida-drag svg {
    margin: 0 auto 20px;
    display: block;
}

.zona-subida-drag .texto-principal {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.zona-subida-drag .texto-secundario {
    font-size: 14px;
    color: #6B7280;
    margin: 0 0 12px 0;
}

.zona-subida-drag .texto-formatos {
    font-size: 12px;
    color: #9CA3AF;
    margin: 0;
}

.input-archivos-oculto {
    display: none;
}

.lista-archivos-container {
    margin-top: 24px;
}

.boton-subir-container {
    margin-top: 24px;
    text-align: center;
}

.boton-subir-container .btn {
    padding: 12px 32px;
    font-size: 14px;
    font-weight: 600;
    border-radius: 8px;
}

.info-funcionamiento {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
}

.info-funcionamiento h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
}

.info-funcionamiento ol {
    padding-left: 20px;
    margin: 0;
    color: #4B5563;
    font-size: 14px;
    line-height: 1.8;
}

/* ============================================
   PANEL USUARIO - DASHBOARD
   ============================================ */

.info-usuario-container {
    position: relative;
}

.btn-menu-usuario {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
}

.btn-menu-usuario:hover {
    background: rgba(0,0,0,0.05);
}

.menu-usuario-desplegable {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 8px;
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    min-width: 280px;
    z-index: 1000;
}

.menu-usuario-desplegable.activo {
    display: block;
}

.menu-usuario-item {
    padding: 16px;
    border-bottom: 1px solid #E5E7EB;
}

.menu-usuario-item p.label {
    font-size: 12px;
    color: #6B7280;
    margin: 0 0 4px 0;
}

.menu-usuario-item p.valor {
    font-size: 14px;
    color: #1a1a1a;
    margin: 0;
    font-weight: 600;
}

.menu-usuario-footer {
    padding: 12px;
}

.menu-usuario-footer .btn {
    width: 100%;
    text-align: center;
    display: block;
}

.bienvenida-cabecera {
    margin-bottom: 35px;
}

.bienvenida-cabecera h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0 0 8px 0;
}

.bienvenida-cabecera p {
    font-size: 14px;
    color: #6B7280;
    margin: 0;
}

.grid-opciones {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 35px;
}

.tarjeta-opcion {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 10px;
    padding: 18px 16px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.tarjeta-opcion:hover {
    border-color: #0B7EB4;
    transform: translateY(-4px);
    box-shadow: 0 12px 24px rgba(11,126,180,0.15);
}

.tarjeta-opcion-icono {
    width: 48px;
    height: 48px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 14px;
}

/* Responsive: en pantallas más pequeñas volver al diseño flexible */
@media (max-width: 1400px) {
    .grid-opciones {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 1024px) {
    .grid-opciones {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 640px) {
    .grid-opciones {
        grid-template-columns: 1fr;
    }
}

.tarjeta-opcion-icono.azul {
    background: linear-gradient(135deg, #0B7EB4 0%, #0a6a9a 100%);
}

.tarjeta-opcion-icono.verde {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
}

.tarjeta-opcion-icono.morado {
    background: linear-gradient(135deg, #8b5cf6 0%, #7c3aed 100%);
}

.tarjeta-opcion-icono.naranja {
    background: linear-gradient(135deg, #FFC107 0%, #FF9800 100%);
}

.tarjeta-opcion h3 {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 12px 0;
}

.tarjeta-opcion p {
    font-size: 14px;
    color: #6B7280;
    line-height: 1.6;
    margin: 0;
}

.tarjeta-opcion-link {
    margin-top: 20px;
    display: flex;
    align-items: center;
    font-size: 14px;
    font-weight: 600;
}

.tarjeta-opcion-link.azul {
    color: #0B7EB4;
}

.tarjeta-opcion-link.verde {
    color: #10b981;
}

.tarjeta-opcion-link.morado {
    color: #8b5cf6;
}

.tarjeta-opcion-link.naranja {
    color: #FF9800;
}

.tarjeta-opcion-link svg {
    margin-left: 8px;
}

/* ============================================
   ÁRBOL DE DIRECTORIOS
   ============================================ */

.arbol-directorios-container {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 25px;
}

.arbol-directorios-header {
    padding: 20px 24px;
    border-bottom: 1px solid #E5E7EB;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.arbol-directorios-header h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0;
}

.btn-refrescar {
    background: none;
    border: 1px solid #D1D5DB;
    border-radius: 6px;
    padding: 8px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-refrescar:hover {
    background: #F9FAFB;
    border-color: #0B7EB4;
}

.btn-refrescar svg {
    stroke: #6B7280;
}

.btn-refrescar:hover svg {
    stroke: #0B7EB4;
}

.arbol-directorios-body {
    padding: 20px 24px;
    max-height: 600px;
    overflow-y: auto;
}

.cargando-arbol {
    text-align: center;
    padding: 40px 20px;
    color: #6B7280;
}

.cargando-arbol .loader {
    margin: 0 auto 20px;
}

.arbol-nodo {
    font-size: 14px;
}

.arbol-carpeta {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 6px;
    transition: background 0.2s;
    margin-bottom: 4px;
}

.arbol-carpeta.raiz {
    background: #F0F9FF;
    border: 1px solid #BAE6FD;
    font-weight: 600;
    color: #0B7EB4;
}

.arbol-carpeta.expandible {
    cursor: pointer;
}

.arbol-carpeta.expandible:hover {
    background: #F9FAFB;
}

.carpeta-nombre {
    flex: 1;
    color: #1a1a1a;
}

.carpeta-badge {
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
}

.carpeta-badge.pendiente {
    background: #FEF3C7;
    color: #92400E;
}

.carpeta-badge.procesada {
    background: #D1FAE5;
    color: #065F46;
}

.arbol-subcarpeta {
    margin-left: 24px;
}

.arbol-subcarpeta .arbol-archivos {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}

.arbol-subcarpeta.expandida .arbol-archivos {
    max-height: 2000px;
}

.arbol-subcarpeta .icono-toggle {
    transition: transform 0.3s ease;
}

.arbol-subcarpeta.expandida .icono-toggle {
    transform: rotate(180deg);
}

.arbol-archivo {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px 6px 36px;
    border-radius: 4px;
    transition: background 0.2s;
    margin-bottom: 2px;
}

.arbol-archivo:hover {
    background: #F9FAFB;
}

.archivo-nombre {
    flex: 1;
    color: #4B5563;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.archivo-tamano {
    font-size: 12px;
    color: #9CA3AF;
}

.mensaje-sin-archivos {
    text-align: center;
    padding: 60px 20px;
    color: #9CA3AF;
}

.mensaje-sin-archivos svg {
    margin: 0 auto 16px;
    display: block;
}

.mensaje-sin-archivos p {
    margin: 0;
    font-size: 14px;
}

.mensaje-error {
    padding: 20px;
    text-align: center;
    color: #dc3545;
    background: #f8d7da;
    border-radius: 6px;
}

/* ============================================
   MI CARPETA - NAVEGADOR DE ARCHIVOS
   ============================================ */

.micarpeta-cabecera {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.micarpeta-cabecera h1 {
    font-size: 24px;
    font-weight: 700;
    color: #1a1a1a;
    margin: 0;
}

.botones-cabecera {
    display: flex;
    gap: 12px;
}

.breadcrumb-navegacion {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    padding: 12px 20px;
    margin-bottom: 20px;
    font-size: 14px;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.breadcrumb-item {
    color: #0B7EB4;
    text-decoration: none;
    transition: color 0.2s;
}

.breadcrumb-item:hover {
    color: #096892;
    text-decoration: underline;
}

.breadcrumb-separador {
    color: #9CA3AF;
    font-weight: 600;
}

.contenedor-archivos {
    background: white;
    border: 1px solid #E5E7EB;
    border-radius: 12px;
    padding: 24px;
}

.mensaje-vacio {
    text-align: center;
    padding: 60px 20px;
    color: #9CA3AF;
}

.mensaje-vacio p {
    font-size: 16px;
    margin: 0;
}

.seccion-carpetas,
.seccion-archivos {
    margin-bottom: 32px;
}

.seccion-carpetas:last-child,
.seccion-archivos:last-child {
    margin-bottom: 0;
}

.seccion-carpetas h3,
.seccion-archivos h3 {
    font-size: 16px;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 16px 0;
    padding-bottom: 8px;
    border-bottom: 2px solid #E5E7EB;
}

.grid-carpetas {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
}

.item-carpeta {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    text-decoration: none;
    transition: all 0.2s;
    background: #F9FAFB;
}

.item-carpeta:hover {
    border-color: #0B7EB4;
    background: #F0F9FF;
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.05);
}

.icono-carpeta {
    font-size: 48px;
    margin-bottom: 12px;
}

.nombre-carpeta {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    text-align: center;
    margin-bottom: 4px;
}

.fecha-carpeta {
    font-size: 12px;
    color: #6B7280;
}

.grid-archivos {
    display: grid;
    gap: 12px;
}

.item-archivo {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    transition: all 0.2s;
    background: white;
    position: relative;
}

.item-archivo:hover {
    border-color: #0B7EB4;
    background: #F0F9FF;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.icono-archivo {
    font-size: 32px;
    flex-shrink: 0;
}

.info-archivo {
    flex: 1;
    min-width: 0;
}

.nombre-archivo {
    font-size: 14px;
    font-weight: 500;
    color: #1a1a1a;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.detalles-archivo {
    display: flex;
    gap: 16px;
    font-size: 12px;
    color: #6B7280;
}

.btn-descargar-archivo {
    background: #0B7EB4;
    color: white;
    padding: 8px 12px;
    border-radius: 6px;
    text-decoration: none;
    font-size: 18px;
    transition: all 0.2s;
    flex-shrink: 0;
}

.btn-descargar-archivo:hover {
    background: #096892;
    transform: scale(1.1);
}

/* Popup de miniatura */
.popup-miniatura {
    display: none;
    position: absolute;
    background: white;
    border: 2px solid #0B7EB4;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    padding: 12px;
    z-index: 9999;
    max-width: 400px;
    max-height: 400px;
}

.popup-miniatura-contenido {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
}

.popup-miniatura img {
    max-width: 100%;
    max-height: 380px;
    border-radius: 8px;
    object-fit: contain;
}

.popup-miniatura iframe {
    width: 380px;
    height: 380px;
    border: none;
    border-radius: 8px;
}

.popup-miniatura .spinner-carga {
    padding: 20px;
    color: #6B7280;
    font-size: 14px;
    text-align: center;
}

/* Responsive */
@media (max-width: 767px) {
    .micarpeta-cabecera {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }

    .grid-carpetas {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .breadcrumb-navegacion {
        font-size: 12px;
        padding: 10px 16px;
    }

    .popup-miniatura {
        max-width: 300px;
        max-height: 300px;
    }

    .popup-miniatura iframe {
        width: 280px;
        height: 280px;
    }
}

/* Botón rojo para cerrar sesión */
.btn-rojo {
    background-color: var(--color-rojo-error);
    color: var(--color-blanco);
}

.btn-rojo:hover {
    background-color: #bd2130;
}


/* Modal de columnas Excel */
.modal-columnas {
    max-width: 750px;
    max-height: 85vh;
    overflow-y: auto;
}

.modal-columnas .modal-body {
    padding: 24px;
}

.grid-columnas-excel {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-bottom: 16px;
}

.checkbox-columna {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border: 1px solid #E5E7EB;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s ease;
    background-color: #fff;
    white-space: nowrap;
}

.checkbox-columna:hover {
    background-color: #F9FAFB;
    border-color: var(--color-azul-corporativo);
}

.checkbox-columna input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--color-azul-corporativo);
    flex-shrink: 0;
}

.checkbox-columna span {
    font-size: 13px;
    color: #374151;
    user-select: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.checkbox-columna input[type="checkbox"]:checked + span {
    font-weight: 500;
    color: var(--color-azul-corporativo);
}

.contenedor-botones-columnas {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 2px solid #E5E7EB;
}

.btn-columnas {
    width: 100%;
    padding: 10px 20px !important;
    font-size: 14px !important;
    font-weight: 600;
    border-radius: 6px;
    text-align: center;
}

@media (max-width: 767px) {
    .modal-columnas {
        max-width: 95%;
        margin: 20px;
    }

    .grid-columnas-excel {
        grid-template-columns: 1fr;
    }
}

/* ============================================
   MODAL DE PROGRESO DE SUBIDA
   ============================================ */

.modal-progreso-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    z-index: 2000;
    justify-content: center;
    align-items: center;
    padding: 20px;
}

.modal-progreso-overlay.activo {
    display: flex;
}

.modal-progreso-contenido {
    background-color: var(--color-blanco);
    border-radius: 12px;
    width: 100%;
    max-width: 500px;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    overflow: hidden;
}

.modal-progreso-header {
    background-color: var(--color-azul-principal);
    color: var(--color-blanco);
    padding: 20px 24px;
}

.modal-progreso-header h3 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
}

.modal-progreso-body {
    padding: 32px 24px;
}

.progreso-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.progreso-texto {
    font-size: 14px;
    color: var(--color-gris-corporativo);
    font-weight: 500;
}

.progreso-porcentaje {
    font-size: 16px;
    font-weight: 700;
    color: var(--color-azul-principal);
}

.barra-progreso-container {
    width: 100%;
    height: 12px;
    background-color: #E5E7EB;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 20px;
}

.barra-progreso-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--color-azul-principal) 0%, #0a6a9a 100%);
    border-radius: 6px;
    width: 0%;
    transition: width 0.3s ease;
}

.progreso-detalle {
    text-align: center;
}

.progreso-archivos {
    font-size: 24px;
    font-weight: 700;
    color: var(--color-negro);
    margin-bottom: 4px;
}

.progreso-estado {
    font-size: 14px;
    color: var(--color-gris-corporativo);
}

.progreso-batch {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid #E5E7EB;
    text-align: center;
    font-size: 13px;
    color: #9CA3AF;
}

/* Responsive modal progreso */
@media (max-width: 767px) {
    .modal-progreso-contenido {
        max-width: 95%;
    }

    .modal-progreso-body {
        padding: 24px 20px;
    }

    .progreso-archivos {
        font-size: 20px;
    }
}
