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

:root {
    --primary-color: #4f46e5;
    --primary-dark: #4338ca;
    --secondary-color: #06b6d4;
    --success-color: #10b981;
    --error-color: #ef4444;
    --text-primary: #1f2937;
    --text-secondary: #6b7280;
    --bg-light: #f9fafb;
    --bg-white: #ffffff;
    --border-color: #e5e7eb;
    --sidebar-bg: #1e293b;
    --sidebar-hover: #334155;
    --shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --sidebar-width: 260px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
    background: var(--bg-light);
    color: var(--text-primary);
}

/* Login Page Styles */
.container {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.login-box {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    animation: fadeInUp 0.5s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-header {
    text-align: center;
    margin-bottom: 32px;
}

.login-header h1 {
    color: var(--text-primary);
    font-size: 28px;
    margin-bottom: 8px;
    font-weight: 700;
}

.login-header p {
    color: var(--text-secondary);
    font-size: 14px;
}

.form-group {
    margin-bottom: 24px;
}

.form-group label {
    display: block;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    margin-bottom: 8px;
}

.form-group input {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.error-message {
    background-color: #fee2e2;
    color: var(--error-color);
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 20px;
    font-size: 14px;
    display: none;
    border-left: 4px solid var(--error-color);
}

.error-message.show {
    display: block;
    animation: shake 0.3s ease-out;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-login:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-login:active {
    transform: translateY(0);
}

.btn-login:disabled {
    background: var(--text-secondary);
    cursor: not-allowed;
    transform: none;
}

.loader {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top: 2px solid white;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

.login-footer {
    margin-top: 24px;
    text-align: center;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
}

.login-footer p {
    color: var(--text-secondary);
    font-size: 13px;
}

/* Dashboard Layout */
.dashboard-wrapper {
    display: flex;
    min-height: 100vh;
    background: var(--bg-light);
}

/* Sidebar */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    color: white;
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    overflow-y: auto;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-header {
    padding: 24px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.sidebar-header h2 {
    font-size: 22px;
    font-weight: 700;
    color: white;
}

.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 20px;
    height: 2px;
    background: white;
    transition: all 0.3s ease;
}

/* User Profile in Sidebar */
.user-profile {
    padding: 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-avatar {
    width: 48px;
    height: 48px;
    background: var(--primary-color);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 12px;
}

.user-info h4 {
    font-size: 15px;
    margin-bottom: 4px;
    color: white;
}

.user-info p {
    font-size: 13px;
    color: rgba(255, 255, 255, 0.6);
}

/* Sidebar Navigation */
.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.nav-menu {
    list-style: none;
}

.nav-item {
    margin-bottom: 4px;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    color: rgba(255, 255, 255, 0.8);
    text-decoration: none;
    transition: all 0.3s ease;
    gap: 12px;
    font-size: 15px;
    line-height: 1.5;
    min-height: 44px;
    box-sizing: border-box;
}

.nav-link:hover {
    background: var(--sidebar-hover);
    color: white;
}

.nav-link.active {
    background: var(--primary-color);
    color: white;
    border-left: 4px solid white;
}

.nav-icon {
    width: 20px;
    height: 20px;
    stroke-width: 2;
    flex-shrink: 0;
}

.nav-arrow {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
    margin-left: auto;
}

.nav-divider {
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
    margin: 16px 20px;
}

/* Main Content */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    max-width: 100%;
    overflow-x: hidden;
}

/* Top Navbar */
.navbar {
    background: var(--bg-white);
    padding: 16px 32px;
    box-shadow: var(--shadow);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 100;
}

.navbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
}

.navbar-left h1 {
    font-size: 24px;
    color: var(--text-primary);
}

.mobile-menu-btn {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    flex-direction: column;
    gap: 4px;
    padding: 8px;
}

.mobile-menu-btn span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s ease;
}

.navbar-right {
    display: flex;
    align-items: center;
    gap: 16px;
}

.btn-logout {
    padding: 10px 20px;
    background: var(--error-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-logout:hover {
    background: #dc2626;
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-primary svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

/* Content Area */
.content-area {
    flex: 1;
    padding: 32px;
}

/* Modules */
.module {
    display: block;
}

.module.active {
    display: block;
}

/* Loading y Error States */
.module-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 400px;
    padding: 40px;
}

.module-loading .loading-spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #f3f4f6;
    border-top-color: #3b82f6;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.module-error {
    padding: 40px;
    text-align: center;
}

.module-error h2 {
    color: var(--error-color);
    margin-bottom: 16px;
}

/* Los estilos de visibilidad se controlan desde JavaScript */

/* Los estilos específicos de elementos se controlan dinámicamente desde JavaScript */

/* ===== DASHBOARD ESTILO POWERBI ===== */

/* Contenedor principal del dashboard */
.powerbi-dashboard {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    padding: 20px;
    background: #f8fafc;
    min-height: 100vh;
}

/* KPIs con animaciones */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 15px;
    margin-bottom: 30px;
}

.kpi-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
}

.kpi-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 15px;
    font-size: 24px;
    transition: all 0.3s ease;
}

.kpi-card:hover .kpi-icon {
    transform: scale(1.1);
}

.kpi-label {
    font-size: 14px;
    color: #6b7280;
    margin: 0 0 8px 0;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: #1f2937;
    margin: 0;
    line-height: 1;
}

/* Gráficos estilo PowerBI */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
    gap: 20px;
    margin: 30px 0;
}

/* Gráficos específicos para módulo de eficiencia - 2 por fila en pantalla grande */
#module-eficiencia .charts-container {
    grid-template-columns: repeat(2, 1fr);
}

.chart-card {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    transition: all 0.3s ease;
}

.chart-card:hover {
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
}

.chart-card h4 {
    margin: 0 0 20px 0;
    font-size: 18px;
    font-weight: 600;
    color: #1f2937;
    text-align: center;
    padding-bottom: 15px;
    border-bottom: 2px solid #f3f4f6;
}

.chart-card canvas {
    max-height: 350px;
}

/* Tabla de rendimiento estilo PowerBI */
.performance-section {
    margin-top: 30px;
}

.performance-table-container {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
}

.performance-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.performance-table th {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 15px 12px;
    text-align: left;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    font-size: 12px;
}

.performance-table td {
    padding: 12px;
    border-bottom: 1px solid #f3f4f6;
    transition: background-color 0.2s ease;
}

.performance-table tbody tr:hover {
    background-color: #f8fafc;
}

/* Filas destacadas */
.top-performer {
    background: linear-gradient(90deg, #dbeafe, #f0f9ff);
    border-left: 4px solid #3b82f6;
}

.low-performer {
    background: linear-gradient(90deg, #fef2f2, #fef7f7);
    border-left: 4px solid #ef4444;
}

/* Celdas especiales */
.rank-cell {
    font-weight: 700;
    color: #3b82f6;
    text-align: center;
    width: 60px;
}

.user-cell {
    font-weight: 600;
    color: #1f2937;
}

.metric-cell {
    text-align: right;
    font-family: 'Courier New', monospace;
    font-weight: 500;
}

.status-cell {
    text-align: center;
    font-weight: 600;
}

.status-high {
    color: #059669;
}

.status-medium {
    color: #d97706;
}

.status-low {
    color: #dc2626;
}

/* Animaciones */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.kpi-card,
.chart-card,
.performance-table-container {
    animation: fadeInUp 0.6s ease-out;
}

/* Responsive para dashboard PowerBI */
@media (max-width: 1200px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .kpi-container {
        grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
        gap: 10px;
    }
    
    .kpi-card {
        padding: 15px;
    }
    
    .kpi-value {
        font-size: 24px;
    }
    
    .chart-card {
        padding: 20px;
    }
    
    .performance-table {
        font-size: 12px;
    }
    
    .performance-table th,
    .performance-table td {
        padding: 8px 6px;
    }
}

/* Efectos de hover mejorados */
.kpi-card:hover .kpi-icon {
    animation: pulse 0.6s ease-in-out;
}

@keyframes pulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Gradientes de fondo para diferentes secciones */
.results-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 20px;
}

.results-header h3 {
    margin: 0 0 10px 0;
    font-size: 24px;
    font-weight: 700;
}

.results-info {
    font-size: 14px;
    opacity: 0.9;
}

/* Botones estilo PowerBI */
.btn-powerbi {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 12px 24px;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-powerbi:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15);
}

.btn-powerbi:active {
    transform: translateY(0);
}

/* ===== GRÁFICO CON DOBLE ESCALA ===== */

/* Estilos específicos para gráfico con doble escala */
.chart-card h4 {
    position: relative;
}

.chart-card h4::after {
    content: '';
    position: absolute;
    bottom: -5px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 3px;
    background: linear-gradient(90deg, #3b82f6, #10b981);
    border-radius: 2px;
}

/* Indicadores de escala en el título */
.chart-card h4[data-double-scale="true"]::before {
    content: '📊';
    margin-right: 8px;
}

/* Tooltip personalizado para doble escala */
.chartjs-tooltip {
    background: rgba(0, 0, 0, 0.8) !important;
    border-radius: 8px !important;
    padding: 12px !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.chartjs-tooltip-body {
    color: white !important;
    font-weight: 500 !important;
}

/* Leyenda mejorada para doble escala */
.chartjs-legend {
    display: flex !important;
    justify-content: center !important;
    gap: 20px !important;
    margin-bottom: 20px !important;
}

.chartjs-legend-item {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
}

.chartjs-legend-item::before {
    content: '';
    width: 12px !important;
    height: 12px !important;
    border-radius: 3px !important;
    display: inline-block !important;
}

.chartjs-legend-item[data-label="Gestiones"]::before {
    background: #3b82f6 !important;
}

.chartjs-legend-item[data-label="Contactos"]::before {
    background: #10b981 !important;
}

/* Animación especial para gráfico de doble escala */
@keyframes slideInFromLeft {
    from {
        opacity: 0;
        transform: translateX(-30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes slideInFromRight {
    from {
        opacity: 0;
        transform: translateX(30px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* Aplicar animaciones a los ejes */
.chartjs-scale-left {
    animation: slideInFromLeft 0.8s ease-out;
}

.chartjs-scale-right {
    animation: slideInFromRight 0.8s ease-out;
}

/* Efectos hover mejorados para barras */
.chartjs-bar:hover {
    filter: brightness(1.1);
    transform: scaleY(1.05);
    transition: all 0.2s ease;
}

/* Indicador visual de doble escala */
.double-scale-indicator {
    position: absolute;
    top: 10px;
    right: 10px;
    background: linear-gradient(135deg, #3b82f6, #10b981);
    color: white;
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* Responsive para gráfico de doble escala */
@media (max-width: 768px) {
    .chart-card h4 {
        font-size: 16px;
    }
    
    .chartjs-legend {
        flex-direction: column !important;
        gap: 10px !important;
    }
    
    .double-scale-indicator {
        font-size: 8px;
        padding: 2px 6px;
    }
}

/* ===== GRÁFICO COMPROMISOS VS PAGOS ===== */

/* Estilos específicos para gráfico de compromisos vs pagos */
.chart-card h4[data-double-scale="true"] {
    background: linear-gradient(135deg, #f59e0b, #10b981);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-weight: 700;
}

/* Indicador especial para compromisos vs pagos */
.double-scale-indicator {
    background: linear-gradient(135deg, #f59e0b, #10b981) !important;
}

/* Tooltip personalizado para compromisos vs pagos */
.chartjs-tooltip[data-chart="compromisos-pagos"] {
    background: linear-gradient(135deg, rgba(245, 158, 11, 0.9), rgba(16, 185, 129, 0.9)) !important;
    border: 2px solid rgba(255, 255, 255, 0.3) !important;
}

/* Animación especial para compromisos vs pagos */
@keyframes compromisosSlideIn {
    from {
        opacity: 0;
        transform: translateX(-50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

@keyframes pagosSlideIn {
    from {
        opacity: 0;
        transform: translateX(50px) scale(0.8);
    }
    to {
        opacity: 1;
        transform: translateX(0) scale(1);
    }
}

/* Aplicar animaciones específicas */
.chartjs-bar[data-dataset="compromisos"] {
    animation: compromisosSlideIn 0.8s ease-out;
}

.chartjs-bar[data-dataset="pagos"] {
    animation: pagosSlideIn 0.8s ease-out;
}

/* Efectos hover mejorados para compromisos vs pagos */
.chartjs-bar[data-dataset="compromisos"]:hover {
    filter: brightness(1.2) saturate(1.3);
    transform: scaleY(1.1);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4);
}

.chartjs-bar[data-dataset="pagos"]:hover {
    filter: brightness(1.2) saturate(1.3);
    transform: scaleY(1.1);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.4);
}

/* Leyenda personalizada para compromisos vs pagos */
.chartjs-legend-item[data-label="Compromisos"]::before {
    background: linear-gradient(135deg, #f59e0b, #d97706) !important;
    box-shadow: 0 2px 4px rgba(245, 158, 11, 0.3) !important;
}

.chartjs-legend-item[data-label="Pagos ($)"]::before {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    box-shadow: 0 2px 4px rgba(16, 185, 129, 0.3) !important;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.module-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.module-header h2 {
    font-size: 28px;
    color: var(--text-primary);
}

.content-placeholder {
    background: var(--bg-white);
    padding: 60px 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    text-align: center;
    color: var(--text-secondary);
    font-size: 18px;
}

/* Welcome Section */
.welcome-section {
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease-out;
}

.welcome-section h2 {
    font-size: 32px;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.welcome-section p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* Stats Grid */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 24px;
    margin-bottom: 32px;
    animation: fadeInUp 0.5s ease-out 0.1s both;
}

.stat-card {
    background: var(--bg-white);
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 20px;
    transition: all 0.3s ease;
}

.stat-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.stat-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stat-icon svg {
    width: 28px;
    height: 28px;
    stroke-width: 2;
}

.stat-content h3 {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 4px;
    font-weight: 500;
}

.stat-number {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-primary);
}

/* User Info Card */
.user-info-card {
    background: var(--bg-white);
    padding: 32px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    animation: fadeInUp 0.5s ease-out 0.2s both;
}

.user-info-card h2 {
    color: var(--text-primary);
    font-size: 24px;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
}

.info-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-item span {
    font-size: 16px;
    color: var(--text-primary);
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 13px !important;
    font-weight: 600 !important;
    width: fit-content;
}

.badge.si {
    background: #d1fae5;
    color: var(--success-color);
}

.badge.no {
    background: #fee2e2;
    color: var(--error-color);
}

/* Responsive */
@media (max-width: 1024px) {
    .sidebar {
        transform: translateX(-100%);
    }
    
    .sidebar.active {
        transform: translateX(0);
    }
    
    .main-content {
        margin-left: 0;
    }
    
    .mobile-menu-btn {
        display: flex;
    }
    
    .navbar-left h1 {
        font-size: 20px;
    }
}

@media (max-width: 768px) {
    .login-box {
        padding: 32px 24px;
    }
    
    .navbar {
        padding: 16px 20px;
    }
    
    .navbar-right .btn-logout {
        padding: 8px 16px;
        font-size: 13px;
    }
    
    .content-area {
        padding: 20px 16px;
    }
    
    .welcome-section h2 {
        font-size: 24px;
    }
    
    .user-info-card {
        padding: 24px 20px;
    }
    
    .info-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .stats-grid {
        grid-template-columns: 1fr;
    }
    
    .module-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .module-header h2 {
        font-size: 22px;
    }
}

/* Import Module Styles */
.import-section {
    margin-bottom: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.import-form {
    max-width: 600px;
    margin: 0 auto;
}

.separator-selector {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.separator-selector select,
.separator-selector input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
}

.separator-input {
    display: none;
}

.separator-preview {
    padding: 10px 14px;
    background: #3b82f6;
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 13px;
    font-family: monospace;
}

.file-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}

.file-info {
    color: #059669;
    font-weight: 500;
    font-size: 14px;
}

.preview-header {
    margin-bottom: 24px;
}

.preview-header h3 {
    margin-bottom: 8px;
    color: #111827;
}

.preview-header p {
    color: #6b7280;
    font-size: 14px;
}

.preview-content {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.preview-table-container {
    overflow-x: auto;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    max-height: 400px;
    overflow-y: auto;
}

.fields-config-container {
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 20px;
    background: #f9fafb;
}

.fields-config-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 2px solid #e5e7eb;
}

.fields-config-header h4 {
    margin: 0;
    color: #111827;
}

.field-counter {
    display: flex;
    gap: 16px;
    font-size: 13px;
    color: #6b7280;
}

.field-counter strong {
    color: #3b82f6;
    font-weight: 600;
}

.field-actions {
    display: flex;
    gap: 8px;
}

.fields-config {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-height: 400px;
    overflow-y: auto;
}

.field-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 16px;
    padding: 14px;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    align-items: start;
}

.field-checkbox {
    display: flex;
    align-items: center;
    padding-top: 4px;
}

.field-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.field-name-edit {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-name-edit label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.field-name-edit input {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 14px;
}

.field-name-edit small {
    font-size: 11px;
    color: #9ca3af;
}

.field-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 180px;
}

.field-type label {
    font-size: 12px;
    font-weight: 500;
    color: #6b7280;
}

.field-type select {
    padding: 8px 10px;
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}

.table-config-form {
    margin-top: 24px;
    padding: 20px;
    background: white;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.form-section h3 {
    margin-bottom: 20px;
    color: #111827;
}

.import-options {
    margin-top: 16px;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

.result-container {
    text-align: center;
    padding: 40px 20px;
}

.result-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto 20px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.result-icon svg {
    width: 40px;
    height: 40px;
}

.result-message {
    margin: 20px 0;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
    color: #374151;
    line-height: 1.6;
}

.upload-card,
.preview-card,
.config-card,
.result-card {
    background: var(--bg-white);
    padding: 40px;
    border-radius: 16px;
    box-shadow: var(--shadow);
    margin-bottom: 24px;
}

.upload-card {
    text-align: center;
    padding: 60px 40px;
}

.upload-icon {
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.upload-icon svg {
    width: 40px;
    height: 40px;
    stroke: white;
    stroke-width: 2;
}

.upload-card h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.upload-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.btn-upload {
    padding: 14px 32px !important;
    font-size: 16px !important;
}

.separator-config {
    margin-bottom: 20px;
    text-align: left;
}

.separator-dual-input {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    margin-bottom: 12px;
}

.separator-shortcuts label,
.separator-input label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: var(--text-primary);
    font-size: 13px;
}

.separator-config select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    background: white;
    cursor: pointer;
    outline: none;
    transition: all 0.3s ease;
}

.separator-config select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.separator-input input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--primary-color);
    border-radius: 8px;
    font-size: 18px;
    font-family: monospace;
    font-weight: bold;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
    background: white;
}

.separator-input input:focus {
    border-color: var(--primary-dark);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.2);
}

.separator-input small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 11px;
}

.separator-preview {
    padding: 12px 16px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    font-size: 14px;
    font-family: monospace;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

@media (max-width: 768px) {
    .separator-dual-input {
        grid-template-columns: 1fr;
    }
}

.file-info {
    margin-top: 16px;
    color: var(--success-color);
    font-weight: 500;
}

.table-responsive {
    overflow-x: auto;
    margin-top: 16px;
}

.preview-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.preview-table th,
.preview-table td {
    padding: 12px;
    text-align: left;
    border: 1px solid var(--border-color);
}

.preview-table th {
    background: var(--bg-light);
    font-weight: 600;
    color: var(--text-primary);
}

.preview-table td {
    color: var(--text-secondary);
}

.preview-table tr:hover td {
    background: var(--bg-light);
}

.config-card h3,
.preview-card h3 {
    font-size: 20px;
    margin-bottom: 20px;
    color: var(--text-primary);
}

.form-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: 20px;
    margin-bottom: 20px;
}

.form-group input[type="text"] {
    width: 100%;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 15px;
    transition: all 0.3s ease;
    outline: none;
}

.form-group input[type="text"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.form-group small {
    display: block;
    margin-top: 6px;
    color: var(--text-secondary);
    font-size: 13px;
}

.fields-config {
    border: 2px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    max-height: 400px;
    overflow-y: auto;
}

.fields-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.fields-counter {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 6px 16px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.fields-counter span {
    font-size: 15px;
    font-weight: 700;
}

.fields-actions {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.btn-mini {
    padding: 6px 12px;
    background: var(--bg-white);
    color: var(--primary-color);
    border: 2px solid var(--primary-color);
    border-radius: 6px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-mini:hover {
    background: var(--primary-color);
    color: white;
}

.field-item {
    display: grid;
    grid-template-columns: auto 1fr 200px;
    gap: 12px;
    padding: 12px;
    background: var(--bg-light);
    border-radius: 8px;
    margin-bottom: 12px;
    align-items: start;
}

.field-item:last-child {
    margin-bottom: 0;
}

.field-checkbox {
    padding-top: 8px;
}

.field-checkbox input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.field-name-edit {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-name-edit label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.field-name-edit input {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    outline: none;
    transition: all 0.3s ease;
}

.field-name-edit input:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.field-name-edit small {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
}

.field-type {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.field-type label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
}

.field-type select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    cursor: pointer;
    transition: all 0.3s ease;
}

.field-type select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.import-option {
    background: var(--bg-light);
    padding: 12px 16px;
    border-radius: 8px;
    border: 2px solid var(--border-color);
}

.import-config-box {
    background: var(--bg-light);
    padding: 16px;
    border-radius: 8px;
    border: 2px solid var(--primary-color);
}

.import-config-box label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
}

.row-selector {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.row-selector input[type="number"] {
    width: 120px;
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    text-align: center;
    outline: none;
    transition: all 0.3s ease;
}

.row-selector input[type="number"]:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

.row-info {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: var(--text-secondary);
    padding: 6px 12px;
    background: white;
    border-radius: 6px;
    flex: 1;
}

.row-info svg {
    flex-shrink: 0;
    color: var(--primary-color);
}

.import-config-box small {
    display: block;
    color: var(--text-secondary);
    font-size: 12px;
    font-style: italic;
}

.btn-preview {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-preview:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 16px rgba(16, 185, 129, 0.3);
}

.btn-preview svg {
    width: 20px;
    height: 20px;
    stroke-width: 2;
}

.import-preview {
    background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
    border: 3px solid #10b981;
    border-radius: 12px;
    padding: 24px;
    margin-top: 20px;
    animation: slideDown 0.3s ease-out;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.import-preview h4 {
    color: #047857;
    font-size: 20px;
    font-weight: 700;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.import-preview h4 svg {
    width: 24px;
    height: 24px;
    stroke-width: 2;
}

.import-preview h5 {
    color: #065f46;
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 2px solid #10b981;
}

.preview-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.summary-item {
    background: white;
    padding: 12px 16px;
    border-radius: 8px;
    border-left: 4px solid #10b981;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.summary-item label {
    display: block;
    font-size: 12px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
}

.summary-item .highlight {
    font-size: 18px;
    font-weight: 700;
    color: #047857;
}

.preview-fields {
    background: white;
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 24px;
}

.fields-mapping {
    display: grid;
    gap: 8px;
}

.field-mapping-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    background: var(--bg-light);
    border-radius: 6px;
    border-left: 3px solid #10b981;
}

.field-mapping-item .original {
    flex: 1;
    color: var(--text-secondary);
    font-size: 13px;
}

.field-mapping-item .arrow {
    color: #10b981;
    font-weight: bold;
}

.field-mapping-item .new-name {
    flex: 1;
    color: var(--text-primary);
    font-weight: 600;
    font-size: 14px;
}

.field-mapping-item .type {
    background: #10b981;
    color: white;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
}

.preview-data {
    background: white;
    padding: 16px;
    border-radius: 8px;
}

/* Estilos del Módulo de Reportes */
.module-header .header-actions {
    display: flex;
    gap: 12px;
}

.report-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 80px 20px;
    background: white;
    border-radius: 16px;
    box-shadow: var(--shadow);
}

.loader-big {
    width: 60px;
    height: 60px;
    border: 6px solid var(--bg-light);
    border-top: 6px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 20px;
}

.report-loading p {
    color: var(--text-secondary);
    font-size: 16px;
}

/* KPIs */
.kpi-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 30px;
    max-width: 100%;
}

.kpi-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    display: flex;
    align-items: center;
    gap: 16px;
    transition: all 0.3s ease;
    min-width: 0;
}

.kpi-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.kpi-icon {
    width: 56px;
    height: 56px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.kpi-icon svg {
    width: 32px;
    height: 32px;
    stroke-width: 2;
    stroke: #1e40af;
}

.kpi-content {
    flex: 1;
}

.kpi-label {
    font-size: 11px;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    margin-bottom: 4px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.kpi-value {
    font-size: 24px;
    font-weight: 700;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
}

/* Gráficas */
.charts-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
    max-width: 100%;
}

.chart-card {
    background: white;
    padding: 20px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    min-width: 0;
    overflow: hidden;
}

.chart-card h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--border-color);
}

.chart-card canvas {
    max-height: 300px;
}

/* Filtros */
.filters-container {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
    margin-bottom: 30px;
}

.filters-container h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
}

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

.filter-item {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.filter-item label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
}

.filter-item input,
.filter-item select {
    padding: 10px 12px;
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
}

.filter-item input:focus,
.filter-item select:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
}

/* Tabla de Datos */
.data-table-container {
    background: white;
    padding: 24px;
    border-radius: 12px;
    box-shadow: var(--shadow);
}

.table-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 2px solid var(--border-color);
}

.table-header h4 {
    color: var(--text-primary);
    font-size: 16px;
    font-weight: 600;
}

.table-info {
    display: flex;
    align-items: center;
    gap: 16px;
}

.table-info span {
    color: var(--text-secondary);
    font-size: 14px;
    font-weight: 500;
}

.table-info select {
    padding: 6px 10px;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 13px;
    outline: none;
}

.report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13px;
}

.report-table th {
    background: var(--bg-light);
    padding: 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    border: 1px solid var(--border-color);
    position: sticky;
    top: 0;
    z-index: 10;
}

.report-table td {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    color: var(--text-secondary);
}

.report-table tr:hover td {
    background: var(--bg-light);
}

.report-table tr.efficiency-row td {
    transition: background-color 0.25s ease, color 0.25s ease;
    color: var(--text-primary);
}

.report-table tr.efficiency-high td {
    background: rgba(16, 185, 129, 0.12);
}

.report-table tr.efficiency-high:hover td {
    background: rgba(16, 185, 129, 0.18);
}

.report-table tr.efficiency-medium td {
    background: rgba(234, 179, 8, 0.12);
}

.report-table tr.efficiency-medium:hover td {
    background: rgba(234, 179, 8, 0.18);
}

.report-table tr.efficiency-low td {
    background: rgba(248, 113, 113, 0.12);
}

.report-table tr.efficiency-low:hover td {
    background: rgba(248, 113, 113, 0.18);
}

.efficiency-user {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.efficiency-user-name {
    font-weight: 600;
    color: var(--text-primary);
}

.efficiency-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    border: 1px solid transparent;
    background: rgba(148, 163, 184, 0.15);
    color: var(--text-secondary);
}

.efficiency-chip.efficiency-high {
    background: rgba(16, 185, 129, 0.18);
    border-color: rgba(16, 185, 129, 0.35);
    color: #047857;
}

.efficiency-chip.efficiency-medium {
    background: rgba(234, 179, 8, 0.18);
    border-color: rgba(234, 179, 8, 0.35);
    color: #92400e;
}

.efficiency-chip.efficiency-low {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.35);
    color: #b91c1c;
}

.efficiency-value {
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.efficiency-value.efficiency-high {
    color: #047857;
}

.efficiency-value.efficiency-medium {
    color: #92400e;
}

.efficiency-value.efficiency-low {
    color: #b91c1c;
}

/* Paginación */
.pagination-container {
    margin-top: 20px;
    display: flex;
    justify-content: center;
}

.pagination-buttons {
    display: flex;
    gap: 8px;
    align-items: center;
}

.pagination-buttons button {
    padding: 8px 12px;
    border: 2px solid var(--border-color);
    background: white;
    color: var(--text-primary);
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.pagination-buttons button:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.pagination-buttons button.active {
    background: var(--primary-color);
    color: white;
    border-color: var(--primary-color);
}

.pagination-buttons button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.pagination-buttons span {
    color: var(--text-secondary);
    padding: 0 8px;
}

/* Responsive para reportes */
@media (max-width: 768px) {
    .charts-container {
        grid-template-columns: 1fr;
    }
    
    .filter-row {
        grid-template-columns: 1fr;
    }
    
    .table-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }
    
    .report-table {
        font-size: 11px;
    }
    
    .report-table th,
    .report-table td {
        padding: 8px;
    }
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 15px;
    color: var(--text-primary);
}

.button-group {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.btn-secondary {
    padding: 12px 24px;
    background: var(--bg-light);
    color: var(--text-primary);
    border: 2px solid var(--border-color);
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.btn-secondary:hover {
    background: var(--border-color);
}

.result-card {
    text-align: center;
    padding: 60px 40px;
}

.result-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 24px;
}

.result-icon.success {
    background: #d1fae5;
}

.result-icon.error {
    background: #fee2e2;
}

.result-icon svg {
    width: 40px;
    height: 40px;
    stroke-width: 2;
}

.result-icon.success svg {
    stroke: var(--success-color);
}

.result-icon.error svg {
    stroke: var(--error-color);
}

.result-card h3 {
    font-size: 24px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.result-card p {
    color: var(--text-secondary);
    margin-bottom: 24px;
    font-size: 16px;
}

/* Scrollbar Styling */
.sidebar::-webkit-scrollbar {
    width: 6px;
}

.sidebar::-webkit-scrollbar-track {
    background: rgba(255, 255, 255, 0.1);
}

.sidebar::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.3);
    border-radius: 3px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.5);
}

.fields-config::-webkit-scrollbar {
    width: 6px;
}

.fields-config::-webkit-scrollbar-track {
    background: var(--bg-light);
}

.fields-config::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.fields-config::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* Filtros Avanzados */
.advanced-filters-panel {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.advanced-filters-panel h5 {
    margin: 0 0 15px 0;
    color: #1e293b;
    font-size: 16px;
    font-weight: 600;
}

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

.column-filter {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 12px;
}

.column-filter h6 {
    margin: 0 0 8px 0;
    color: #374151;
    font-size: 14px;
    font-weight: 600;
}

.filter-input {
    width: 100%;
    padding: 6px 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 13px;
    margin-bottom: 5px;
}

.filter-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.filter-values {
    max-height: 120px;
    overflow-y: auto;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    background: white;
}

.filter-value-item {
    display: flex;
    align-items: center;
    padding: 4px 8px;
    font-size: 12px;
    cursor: pointer;
    transition: background-color 0.2s;
}

.filter-value-item:hover {
    background: #f3f4f6;
}

.filter-value-item input[type="checkbox"] {
    margin-right: 6px;
}

.filter-value-item.selected {
    background: #dbeafe;
    color: #1e40af;
}

.filters-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border-color: #6b7280;
}

.btn-secondary:hover {
    background: #4b5563;
    border-color: #4b5563;
}

/* Encabezados ordenables */
.sortable-header {
    cursor: pointer;
    user-select: none;
    position: relative;
    transition: background-color 0.2s;
}

.sortable-header:hover {
    background-color: #f3f4f6;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.sort-icon {
    font-size: 12px;
    color: #6b7280;
    margin-left: 8px;
    min-width: 12px;
    text-align: center;
}

.sortable-header:hover .sort-icon {
    color: #374151;
}

.sortable-header.active .sort-icon {
    color: #3b82f6;
    font-weight: bold;
}

/* Indicador de ordenamiento */
.sort-info {
    color: #6b7280;
    font-size: 12px;
    font-style: italic;
    margin-left: 10px;
    padding: 2px 8px;
    background: #f3f4f6;
    border-radius: 4px;
    border: 1px solid #e5e7eb;
}

/* Submenús del sidebar */
.has-submenu {
    position: relative;
}

.has-submenu > .nav-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    font-size: 15px;
    line-height: 1.5;
    min-height: 44px;
    box-sizing: border-box;
}

.has-submenu > .nav-link > span {
    flex: 1;
}

.submenu-arrow {
    width: 16px;
    height: 16px;
    transition: transform 0.3s ease;
}

.has-submenu.open .submenu-arrow {
    transform: rotate(180deg);
}

.submenu {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 6px;
    margin: 2px 0;
    padding: 4px 0;
    list-style: none;
    position: relative;
    z-index: 10;
}

.submenu.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}

.submenu li {
    margin: 0;
    padding: 0;
}

.submenu a {
    display: block;
    padding: 6px 16px 6px 36px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 13px;
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 1px 8px;
    line-height: 1.4;
}

.submenu a:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-primary);
    transform: translateX(5px);
}

.submenu a.active {
    background: var(--primary-color);
    color: white;
}

/* Estilos específicos para el submenú de reportes */
#reportes-submenu {
    display: none !important;
    background: rgba(0, 0, 0, 0.1) !important;
    border-radius: 6px !important;
    margin: 2px 0 !important;
    padding: 4px 0 !important;
    list-style: none !important;
    position: relative !important;
    z-index: 1000 !important;
    border: 1px solid rgba(255, 255, 255, 0.15) !important;
}

#reportes-submenu.active {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    height: auto !important;
    overflow: visible !important;
}

#reportes-submenu li {
    margin: 0 !important;
    display: block !important;
    visibility: visible !important;
    padding: 0 !important;
}

#reportes-submenu a {
    display: block !important;
    padding: 6px 16px 6px 36px !important;
    color: rgba(255, 255, 255, 0.7) !important;
    text-decoration: none !important;
    font-size: 13px !important;
    transition: all 0.2s ease !important;
    border-radius: 4px !important;
    margin: 1px 8px !important;
    visibility: visible !important;
    opacity: 1 !important;
    line-height: 1.4 !important;
}

#reportes-submenu a:hover {
    background: rgba(255, 255, 255, 0.15) !important;
    color: white !important;
    transform: translateX(3px) !important;
}

#reportes-submenu a.active {
    background: var(--primary-color) !important;
    color: white !important;
    font-weight: 500 !important;
}

/* Estilos para el módulo de Eficiencia */
#module-eficiencia {
    max-width: 100%;
    overflow-x: hidden;
    padding: 20px;
    box-sizing: border-box;
}

.eficiencia-selectors {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
    max-width: 100%;
    box-sizing: border-box;
}

.selectors-row {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 20px;
    margin-bottom: 20px;
    max-width: 100%;
}

.selector-group {
    margin-bottom: 0;
}

.selector-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
    color: #374151;
}

.form-select,
.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    background: white;
    font-size: 14px;
    transition: border-color 0.2s;
}

.form-select:focus,
.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.form-select:disabled,
.form-input:disabled {
    background: #f3f4f6;
    color: #6b7280;
    cursor: not-allowed;
}

.selector-actions {
    margin-top: 20px;
    text-align: center;
}

.results-header {
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    margin-bottom: 20px;
}

.results-header h3 {
    margin: 0 0 10px 0;
    color: #1e293b;
    font-size: 18px;
}

.results-info {
    color: #6b7280;
    font-size: 14px;
}

.eficiencia-content {
    background: white;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 20px;
    min-height: 200px;
    max-width: 100%;
    overflow-x: auto;
}

/* Tabla de resultados de eficiencia */
#eficienciaTable {
    font-size: 13px;
}

#eficienciaTable th {
    background: #1e40af;
    color: white;
    font-weight: 600;
    padding: 10px 8px;
}

/* Responsive para módulo de eficiencia */
@media (max-width: 1200px) {
    .selectors-row {
        grid-template-columns: 1fr 1fr;
        gap: 15px;
    }
}

@media (max-width: 768px) {
    .selectors-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .eficiencia-selectors {
        padding: 15px;
    }
    
    .selector-group label {
        font-size: 13px;
    }
    
    .form-select,
    .form-input {
        padding: 8px 10px;
        font-size: 13px;
    }
}

#eficienciaTable th {
    text-align: center;
    white-space: nowrap;
}

#eficienciaTable td {
    padding: 8px;
    text-align: right;
}

#eficienciaTable td:first-child {
    text-align: left;
    font-weight: 500;
}

.table-wrapper {
    overflow-x: auto;
    border-radius: 8px;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
}

/* Sección de datos detallados */
.data-section {
    margin-top: 30px;
}

.data-section h4 {
    font-size: 18px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 15px;
    padding-bottom: 10px;
    border-bottom: 2px solid #e2e8f0;
}

.header-left h3 {
    margin: 0 0 5px 0;
    font-size: 24px;
    font-weight: 700;
    color: #1e293b;
}

/* Responsive para selectores de eficiencia */
@media (max-width: 1200px) {
    .kpi-container {
        grid-template-columns: repeat(3, 1fr);
    }
    
    .charts-container {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .selectors-row {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .kpi-container {
        grid-template-columns: repeat(2, 1fr);
        gap: 12px;
    }
    
    .kpi-card {
        padding: 16px;
        gap: 12px;
    }
    
    .kpi-icon {
        width: 48px;
        height: 48px;
    }
    
    .kpi-icon svg {
        width: 24px;
        height: 24px;
    }
    
    .kpi-value {
        font-size: 20px;
    }
    
    .charts-container {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .chart-card {
        padding: 16px;
    }
}

@media (max-width: 480px) {
    .kpi-container {
        grid-template-columns: 1fr;
        gap: 10px;
    }
    
    .kpi-card {
        padding: 14px;
    }
    
    .kpi-value {
        font-size: 18px;
    }
}

/* ==================== MÓDULO WHATSAPP ==================== */

.whatsapp-container {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.whatsapp-section {
    width: 100%;
}

.card {
    background: white;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    overflow: hidden;
    transition: all 0.3s ease;
}

.card:hover {
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.card-header {
    padding: 20px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: white;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.card-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

.card-body {
    padding: 24px;
}

/* Formulario de crear sesión */
.session-form {
    max-width: 500px;
}

.form-group {
    margin-bottom: 20px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
}

.form-group small {
    display: block;
    margin-top: 6px;
    font-size: 0.85rem;
    color: #6b7280;
}

.form-group textarea.form-input {
    resize: vertical;
    font-family: inherit;
}

.form-select[multiple] {
    height: auto;
    padding: 8px;
}

.form-select[multiple] option {
    padding: 8px 12px;
    margin: 2px 0;
    border-radius: 4px;
    cursor: pointer;
}

.form-select[multiple] option:hover {
    background: #e0f2fe;
}

.form-select[multiple] option:checked {
    background: #3b82f6;
    color: white;
}

.usuarios-badge {
    font-size: 0.85rem;
    line-height: 1.4;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    color: #374151;
}

.btn-create-session {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.btn-create-session svg {
    width: 20px;
    height: 20px;
}

/* Panel QR */
.qr-section {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    padding: 20px;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

.qr-card {
    max-width: 500px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
    animation: slideUp 0.3s ease;
}

@keyframes slideUp {
    from {
        transform: translateY(30px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.btn-close {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    color: white;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.btn-close:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.qr-body {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.qr-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px;
    background: #f9fafb;
    border-radius: 8px;
}

.qr-info p {
    margin: 0;
    color: #374151;
}

.status-badge {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.status-connecting {
    background: #fef3c7;
    color: #92400e;
}

.status-qr-ready {
    background: #dbeafe;
    color: #1e40af;
}

.status-connected {
    background: #d1fae5;
    color: #065f46;
}

.status-disconnected {
    background: #fee2e2;
    color: #991b1b;
}

.qr-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 300px;
    background: #f9fafb;
    border-radius: 12px;
    padding: 20px;
}

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

.spinner {
    width: 50px;
    height: 50px;
    border: 4px solid #e5e7eb;
    border-top-color: #25D366;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 0 auto 16px;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.qr-image {
    max-width: 300px;
    width: 100%;
    height: auto;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

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

.qr-success svg {
    width: 80px;
    height: 80px;
    stroke: #10b981;
    stroke-width: 2;
    margin-bottom: 16px;
}

.qr-success h3 {
    color: #10b981;
    margin: 0 0 8px 0;
}

.qr-success p {
    color: #6b7280;
    margin: 0;
}

.qr-instructions {
    background: #f9fafb;
    padding: 20px;
    border-radius: 8px;
}

.qr-instructions h4 {
    margin: 0 0 12px 0;
    color: #374151;
    font-size: 1rem;
}

.qr-instructions ol {
    margin: 0;
    padding-left: 20px;
    color: #6b7280;
}

.qr-instructions li {
    margin-bottom: 8px;
}

.qr-instructions strong {
    color: #374151;
}

/* Lista de sesiones */
.btn-refresh {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
}

.btn-refresh svg {
    width: 18px;
    height: 18px;
}

.sessions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

/* Tabs de sesiones */
.tabs-container {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
    border-bottom: 2px solid #e5e7eb;
    padding-bottom: 0;
}

.tab-button {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    transition: all 0.2s ease;
    position: relative;
    top: 2px;
}

.tab-button:hover {
    color: #25D366;
    background: rgba(37, 211, 102, 0.05);
}

.tab-button.active {
    color: #25D366;
    border-bottom-color: #25D366;
    font-weight: 600;
}

.tab-badge {
    background: #e5e7eb;
    color: #6b7280;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 600;
    min-width: 20px;
    text-align: center;
}

.tab-button.active .tab-badge {
    background: #25D366;
    color: white;
}

.tab-content {
    display: block;
}

.tab-content:not(.active) {
    display: none;
}

/* Listado de sesiones */
.sessions-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.session-list-item {
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    padding: 16px 20px;
    transition: all 0.2s ease;
}

.session-list-item:hover {
    border-color: #25D366;
    box-shadow: 0 2px 8px rgba(37, 211, 102, 0.1);
    transform: translateX(2px);
}

.session-list-item.connected {
    border-left: 4px solid #10b981;
}

.session-list-item.connecting,
.session-list-item.qr_ready {
    border-left: 4px solid #f59e0b;
}

.session-list-item.disconnected,
.session-list-item.saved {
    border-left: 4px solid #6b7280;
}

.session-list-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 20px;
}

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

.session-list-name {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 8px;
}

.session-list-name strong {
    font-size: 1.1rem;
    color: #111827;
    font-weight: 600;
}

.session-list-details {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 0.9rem;
    color: #6b7280;
}

.session-detail-item {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.session-list-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    flex-shrink: 0;
}

.no-sessions {
    text-align: center;
    padding: 60px 20px;
    color: #9ca3af;
}

.no-sessions svg {
    width: 64px;
    height: 64px;
    stroke-width: 1.5;
    margin-bottom: 16px;
}

.no-sessions p {
    font-size: 1.125rem;
    margin: 0 0 8px 0;
    color: #6b7280;
}

.no-sessions small {
    color: #9ca3af;
}

.no-sessions.error svg {
    stroke: #ef4444;
}

.session-card {
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
}

.session-card:hover {
    border-color: #25D366;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.1);
    transform: translateY(-2px);
}

.session-card.connected {
    border-color: #10b981;
    background: linear-gradient(to bottom right, #ffffff 0%, #f0fdf4 100%);
}

.session-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e5e7eb;
}

.session-header h4 {
    margin: 0;
    color: #111827;
    font-size: 1.125rem;
}

.session-status {
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 500;
}

.session-status.connected {
    background: #d1fae5;
    color: #065f46;
}

.session-status.connecting,
.session-status.reconnecting,
.session-status.qr_ready {
    background: #fef3c7;
    color: #92400e;
}

.session-status.disconnected,
.session-status.saved {
    background: #f3f4f6;
    color: #6b7280;
}

.session-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 16px;
}

.session-info {
    display: flex;
    align-items: center;
    gap: 8px;
    color: #6b7280;
    font-size: 0.9rem;
}

.session-info svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
}

.session-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 0.85rem;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
    font-weight: 500;
}

.btn-sm svg {
    width: 16px;
    height: 16px;
}

.btn-sm.btn-primary {
    background: #3b82f6;
    color: white;
}

.btn-sm.btn-primary:hover {
    background: #2563eb;
}

.btn-sm.btn-secondary {
    background: #6b7280;
    color: white;
}

.btn-sm.btn-secondary:hover {
    background: #4b5563;
}

.btn-sm.btn-success {
    background: #10b981;
    color: white;
}

.btn-sm.btn-success:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.btn-sm.btn-warning {
    background: #f59e0b;
    color: white;
}

.btn-sm.btn-warning:hover {
    background: #d97706;
}

.btn-sm.btn-danger {
    background: #ef4444;
    color: white;
}

.btn-sm.btn-danger:hover {
    background: #dc2626;
}

/* Responsive */
@media (max-width: 768px) {
    .qr-card {
        margin: 0;
    }
    
    .sessions-grid {
        grid-template-columns: 1fr;
    }
    
    .session-list-main {
        flex-direction: column;
        align-items: flex-start;
        gap: 16px;
    }
    
    .session-list-actions {
        width: 100%;
        justify-content: flex-start;
    }
    
    .session-actions {
        flex-direction: column;
    }
    
    .btn-sm {
        width: 100%;
        justify-content: center;
    }
    
    .session-list-details {
        flex-direction: column;
        gap: 8px;
    }
}

/* ==================== MÓDULO CHAT WHATSAPP ==================== */

/* Hacer que el módulo de chat ocupe todo el espacio disponible */
#module-chat {
    position: fixed;
    top: 60px;
    left: 280px;
    right: 0;
    bottom: 0;
    margin: 0;
    padding: 0;
    background: #f8fafc;
    z-index: 1;
}

.chat-container {
    display: flex;
    height: 100%;
    width: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    overflow: hidden;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

/* Sidebar de sesiones - Estilo claro */
.chat-sidebar {
    width: 420px;
    background: #ffffff;
    border-right: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.05);
    backdrop-filter: blur(10px);
}

.chat-header {
    padding: 18px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.chat-header h3 {
    margin: 0;
    color: white;
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.3px;
}

.btn-refresh {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.btn-refresh:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: rotate(180deg);
}

.btn-refresh svg {
    width: 18px;
    height: 18px;
}

.session-selector {
    padding: 18px 20px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.06);
    background: #ffffff;
}

.session-selector label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #374151;
    font-size: 14px;
}

.session-selector .form-select {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    font-size: 14px;
    color: #1e293b;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 500;
}

.session-selector .form-select:hover {
    border-color: #667eea;
    background: white;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
}

.session-selector .form-select:focus {
    outline: none;
    border-color: #667eea;
    background: white;
    box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
}

.chats-list {
    flex: 1;
    overflow-y: auto;
    background: white;
}

/* Tabs para cambiar entre chats y contactos */
.chat-tabs {
    display: none;
    flex-direction: row;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
    gap: 0;
}

.chat-tab {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border: none;
    border-bottom: 3px solid transparent;
    cursor: pointer;
    color: #64748b;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.3s ease;
}

.chat-tab:hover {
    background: #f1f5f9;
    color: #667eea;
}

.chat-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.chat-tab svg {
    width: 18px;
    height: 18px;
}

/* Tabs de filtrado de chats */
.chat-filter-tabs {
    display: flex;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    padding: 0;
    overflow-x: auto;
    scrollbar-width: thin;
}

.chat-filter-tabs::-webkit-scrollbar {
    height: 4px;
}

.chat-filter-tabs::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

.chat-filter-tab {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: #64748b;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    border-bottom: 2px solid transparent;
    white-space: nowrap;
    position: relative;
}

.chat-filter-tab:hover {
    background: #f1f5f9;
    color: #475569;
}

.chat-filter-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
    background: white;
}

.chat-filter-tab svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.filter-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    background: #ef4444;
    color: white;
    border-radius: 8px;
    font-size: 10px;
    font-weight: 600;
    margin-left: 3px;
}

.chat-filter-tab.active .filter-badge {
    background: #667eea;
}

/* Indicador de favorito */
.favorite-indicator {
    color: #fbbf24;
    font-size: 14px;
    margin-right: 4px;
}

.chat-name-actions {
    display: flex;
    align-items: center;
    gap: 4px;
}

.btn-toggle-favorite {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.chat-item:hover .btn-toggle-favorite {
    opacity: 1;
}

.btn-toggle-favorite:hover {
    background: #f1f5f9;
    color: #fbbf24;
}

.btn-toggle-favorite svg {
    width: 16px;
    height: 16px;
}

/* Buscador de chats/contactos */
.chat-search-container {
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
}

.chat-search-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.chat-search-icon {
    position: absolute;
    left: 12px;
    width: 18px;
    height: 18px;
    color: #94a3b8;
    pointer-events: none;
    z-index: 1;
}

.chat-search-input {
    width: 100%;
    padding: 10px 40px 10px 38px;
    border: 1px solid #e2e8f0;
    border-radius: 20px;
    background: white;
    font-size: 14px;
    color: #1e293b;
    transition: all 0.2s ease;
    outline: none;
}

.chat-search-input:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.chat-search-input::placeholder {
    color: #94a3b8;
}

.btn-clear-search {
    position: absolute;
    right: 8px;
    background: none;
    border: none;
    padding: 6px;
    border-radius: 50%;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    z-index: 1;
}

.btn-clear-search:hover {
    background: #f1f5f9;
    color: #64748b;
}

.btn-clear-search svg {
    width: 16px;
    height: 16px;
}

.no-search-results {
    text-align: center;
    padding: 40px 20px;
    color: #64748b;
}

.no-search-results svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    opacity: 0.5;
    color: #94a3b8;
}

.no-search-results p {
    margin: 0;
    font-size: 14px;
    color: #64748b;
}

/* Lista de contactos */
.contacts-list {
    flex: 1;
    overflow-y: auto;
    background: white;
    display: none;
}

.no-contacts {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    text-align: center;
    color: #94a3b8;
}

.no-contacts svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-contacts p {
    font-size: 14px;
    margin: 0;
}

.contacts-section {
    margin-bottom: 24px;
}

.contacts-section-title {
    font-size: 12px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 12px 20px 8px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    position: sticky;
    top: 0;
    z-index: 10;
}

.contact-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
}

.contact-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, transparent 100%);
    transform: translateX(4px);
}

.contact-item .contact-avatar {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 2px solid rgba(102, 126, 234, 0.2);
    margin-right: 12px;
}

.contact-item .contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.contact-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.contact-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.btn-edit-contact-name {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.contact-item:hover .btn-edit-contact-name {
    display: flex;
    opacity: 1;
}

.btn-edit-contact-name:hover {
    background: #f1f5f9;
    color: #667eea;
}

.btn-edit-contact-name svg {
    width: 16px;
    height: 16px;
}

.contact-phone {
    font-size: 13px;
    color: #64748b;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.contact-unread {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    font-size: 11px;
    font-weight: 600;
    padding: 4px 8px;
    border-radius: 12px;
    min-width: 20px;
    text-align: center;
    flex-shrink: 0;
    margin-left: 8px;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.chats-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 20px;
    background: #f8fafc;
    border-bottom: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 600;
    color: #64748b;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.chats-section-header svg {
    flex-shrink: 0;
}

.group-indicator {
    margin-right: 4px;
    font-size: 14px;
}

.group-avatar img {
    border-radius: 6px !important;
}

.no-chats {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 200px;
    color: #9ca3af;
    text-align: center;
    padding: 20px;
}

.no-chats svg {
    width: 48px;
    height: 48px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.no-chats p {
    margin: 0;
    font-size: 14px;
}

/* Estilos para el acordeón de chats */
.chat-accordion {
    width: 100%;
}

.accordion-item {
    border-bottom: 1px solid #e0e6ed;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    background: #f8fafc;
    cursor: pointer;
    transition: all 0.2s;
    border-bottom: 1px solid #e0e6ed;
}

.accordion-header:hover {
    background: #e2e8f0;
}

.accordion-title {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
}

.accordion-icon {
    width: 18px;
    height: 18px;
    color: #64748b;
}

.chat-count {
    background: #3b82f6;
    color: white;
    border-radius: 12px;
    padding: 2px 8px;
    font-size: 12px;
    font-weight: 500;
    min-width: 20px;
    text-align: center;
}

.accordion-arrow {
    width: 16px;
    height: 16px;
    color: #64748b;
    transition: transform 0.2s;
}

.accordion-content {
    display: none;
    background: white;
}

.accordion-content.show {
    display: block;
}

/* Estilos para las listas dentro del acordeón */
#individualChatsList,
#groupsChatsList {
    max-height: 300px;
    overflow-y: auto;
}

#individualChatsList::-webkit-scrollbar,
#groupsChatsList::-webkit-scrollbar {
    width: 4px;
}

#individualChatsList::-webkit-scrollbar-track,
#groupsChatsList::-webkit-scrollbar-track {
    background: transparent;
}

#individualChatsList::-webkit-scrollbar-thumb,
#groupsChatsList::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 2px;
}

#individualChatsList::-webkit-scrollbar-thumb:hover,
#groupsChatsList::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Responsive para el acordeón */
@media (max-width: 768px) {
    .accordion-header {
        padding: 12px 16px;
    }
    
    .accordion-title {
        font-size: 14px;
        gap: 8px;
    }
    
    .accordion-icon {
        width: 16px;
        height: 16px;
    }
    
    .chat-count {
        font-size: 11px;
        padding: 1px 6px;
    }
    
    #individualChatsList,
    #groupsChatsList {
        max-height: 250px;
    }
}

@media (max-width: 480px) {
    .accordion-header {
        padding: 10px 12px;
    }
    
    .accordion-title {
        font-size: 13px;
    }
    
    #individualChatsList,
    #groupsChatsList {
        max-height: 200px;
    }
}

/* Chat individual */
.chat-item {
    display: flex;
    align-items: center;
    padding: 14px 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    border-bottom: 1px solid rgba(0, 0, 0, 0.03);
    position: relative;
}

.chat-item:hover {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.08) 0%, transparent 100%);
    transform: translateX(4px);
}

.chat-item.active {
    background: linear-gradient(90deg, rgba(102, 126, 234, 0.15) 0%, rgba(102, 126, 234, 0.05) 100%);
    border-left: 4px solid #667eea;
}

.chat-item.active::before {
    display: none;
}

.chat-avatar {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    border: 3px solid rgba(102, 126, 234, 0.2);
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.chat-item.active .chat-avatar {
    border-color: #667eea;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.chat-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

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

.chat-name {
    font-weight: 600;
    color: #1e293b;
    font-size: 15px;
    margin-bottom: 4px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    letter-spacing: 0.2px;
}

.chat-name-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.chat-name {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.chat-item.active .chat-name {
    color: #667eea;
}

.btn-edit-chat-name {
    background: none;
    border: none;
    padding: 4px;
    border-radius: 4px;
    cursor: pointer;
    color: #94a3b8;
    transition: all 0.2s ease;
    display: none; /* Oculto por defecto */
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    opacity: 0;
}

.chat-item:hover .btn-edit-chat-name {
    display: flex;
    opacity: 1;
}

.btn-edit-chat-name:hover {
    background: #f1f5f9;
    color: #667eea;
}

.btn-edit-chat-name svg {
    width: 16px;
    height: 16px;
}

.chat-last-message {
    color: #64748b;
    font-size: 13px;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.chat-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.chat-time {
    color: #94a3b8;
    font-size: 12px;
    margin-left: 8px;
    flex-shrink: 0;
}

.chat-unread {
    background: #3b82f6;
    color: white;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: 500;
    margin-left: 8px;
    flex-shrink: 0;
}

/* Área principal de chat */
.chat-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    position: relative;
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #f8fafc 0%, #ffffff 100%);
}

.placeholder-content {
    text-align: center;
    color: #64748b;
}

.placeholder-content svg {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
    opacity: 0.5;
}

.placeholder-content h3 {
    margin: 0 0 8px 0;
    font-size: 18px;
    color: #374151;
}

.placeholder-content p {
    margin: 0;
    font-size: 14px;
}

/* Header del chat activo */
.chat-header-active {
    display: none;
    align-items: center;
    padding: 10px 20px;
    background: white;
    border-bottom: 1px solid #e0e6ed;
    position: relative;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.chat-contact-info {
    display: flex;
    align-items: center;
    gap: 12px;
}

.contact-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    overflow: hidden;
}

.contact-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.contact-details h4 {
    margin: 0 0 2px 0;
    font-size: 16px;
    color: #1e293b;
    font-weight: 600;
}

.contact-details p {
    margin: 0;
    font-size: 12px;
    color: #64748b;
}

.chat-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s;
}

.btn-action:hover {
    background: #e2e8f0;
    color: #475569;
}

.btn-action svg {
    width: 18px;
    height: 18px;
}

/* Área de mensajes */
.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 24px 24px 60px 24px;
    background: linear-gradient(180deg, #f8fafc 0%, #ffffff 100%);
    position: relative;
}

.chat-messages::-webkit-scrollbar {
    width: 8px;
}

.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb {
    background: rgba(102, 126, 234, 0.3);
    border-radius: 10px;
}

.chat-messages::-webkit-scrollbar-thumb:hover {
    background: rgba(102, 126, 234, 0.5);
}

.messages-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 900px;
    margin: 0 auto;
}

/* Mensaje individual */
.message {
    display: flex;
    margin-bottom: 8px;
    animation: messageSlideIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    padding: 2px 0;
}

.message:last-child {
    margin-bottom: 0;
}

@keyframes messageSlideIn {
    from {
        opacity: 0;
        transform: translateY(15px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.message.sent {
    justify-content: flex-end;
    margin-left: 15%;
}

.message.received {
    justify-content: flex-start;
    margin-right: 15%;
}

.message-bubble {
    max-width: 70%;
    padding: 10px 14px;
    border-radius: 18px;
    position: relative;
    word-wrap: break-word;
    font-size: 14.5px;
    line-height: 1.5;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.2s ease;
}

.message-bubble:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.message.sent .message-bubble {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-bottom-right-radius: 4px;
    margin-left: auto;
    margin-right: 0;
    box-shadow: 0 2px 12px rgba(102, 126, 234, 0.3);
}

.message.received .message-bubble {
    background: #ffffff;
    color: #1e293b;
    border-bottom-left-radius: 4px;
    margin-left: 0;
    margin-right: auto;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    border: 1px solid rgba(0, 0, 0, 0.05);
}

/* Puntas de las burbujas */
.message.sent .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    right: -6px;
    width: 0;
    height: 0;
    border-left: 6px solid #667eea;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

.message.received .message-bubble::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: -6px;
    width: 0;
    height: 0;
    border-right: 6px solid #ffffff;
    border-top: 6px solid transparent;
    border-bottom: 6px solid transparent;
}

/* Estilos para tipos de mensajes */
.message-audio {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* ==================== REPRODUCTOR DE AUDIO PERSONALIZADO ==================== */
.custom-audio-player {
    width: 100%;
    max-width: 300px;
}

.custom-audio-element {
    display: none;
}

.audio-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
}

.message.sent .audio-controls {
    background: rgba(255, 255, 255, 0.15);
}

.message.received .audio-controls {
    background: rgba(0, 0, 0, 0.05);
}

.audio-btn-play {
    background: none;
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.audio-btn-play:hover {
    background: rgba(102, 126, 234, 0.2);
    transform: scale(1.1);
}

.audio-btn-play svg {
    width: 20px;
    height: 20px;
    color: #667eea;
}

.message.sent .audio-btn-play svg {
    color: rgba(255, 255, 255, 0.9);
}

.audio-progress-container {
    flex: 1;
    min-width: 0;
}

.audio-progress-bar {
    height: 4px;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.message.sent .audio-progress-bar {
    background: rgba(255, 255, 255, 0.3);
}

.audio-progress {
    height: 100%;
    background: #667eea;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.message.sent .audio-progress {
    background: rgba(255, 255, 255, 0.9);
}

.audio-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: #64748b;
    white-space: nowrap;
    flex-shrink: 0;
}

.message.sent .audio-time {
    color: rgba(255, 255, 255, 0.8);
}

.audio-current-time,
.audio-duration {
    font-weight: 500;
}

.audio-separator {
    opacity: 0.5;
}

/* ==================== REPRODUCTOR DE VIDEO PERSONALIZADO ==================== */
.custom-video-player {
    position: relative;
    max-width: 300px;
    border-radius: 12px;
    overflow: hidden;
    background: #000;
}

.custom-video-element {
    width: 100%;
    height: auto;
    display: block;
    max-height: 400px;
}

.video-controls {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.8), transparent);
    padding: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    opacity: 0.7;
    transition: opacity 0.3s ease;
}

.custom-video-player:hover .video-controls {
    opacity: 1;
}

.video-btn-play,
.video-btn-volume,
.video-btn-fullscreen {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: all 0.3s ease;
    flex-shrink: 0;
}

.video-btn-play:hover,
.video-btn-volume:hover,
.video-btn-fullscreen:hover {
    background: rgba(255, 255, 255, 0.3);
    transform: scale(1.1);
}

.video-btn-play svg,
.video-btn-volume svg,
.video-btn-fullscreen svg {
    width: 18px;
    height: 18px;
    color: white;
}

.video-progress-container {
    flex: 1;
    min-width: 0;
}

.video-progress-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.video-progress {
    height: 100%;
    background: #667eea;
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.video-time {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    color: white;
    white-space: nowrap;
    flex-shrink: 0;
    font-weight: 500;
}

.video-current-time,
.video-duration {
    font-weight: 500;
}

.video-separator {
    opacity: 0.7;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px 0;
}

.message-file svg {
    width: 32px;
    height: 32px;
    color: #3b82f6;
    flex-shrink: 0;
}

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

.message-file-name {
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.message-file-size {
    font-size: 12px;
    opacity: 0.7;
    margin-top: 2px;
}

.message-file-download {
    display: inline-block;
    margin-top: 6px;
    padding: 4px 12px;
    background: #3b82f6;
    color: white;
    text-decoration: none;
    border-radius: 4px;
    font-size: 12px;
    transition: background 0.2s;
}

.message-file-download:hover {
    background: #2563eb;
}

.message.received .message-file-download {
    background: #10b981;
}

.message.received .message-file-download:hover {
    background: #059669;
}

.message-location {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 8px 0;
}

.message-contact {
    display: flex;
    align-items: center;
    padding: 4px 0;
}

.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.message-time {
    font-size: 11px;
    opacity: 0.75;
    font-weight: 500;
    letter-spacing: 0.3px;
    white-space: nowrap;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
}

.message.received .message-time {
    color: #94a3b8;
}

.message.received .message-footer {
    justify-content: flex-start;
}

.message-status {
    font-size: 11px;
    display: flex;
    align-items: center;
    gap: 2px;
    opacity: 0.8;
}

.message-status.sent {
    color: #9ca3af;
}

.message-status.delivered {
    color: #3b82f6;
}

.message-status.read {
    color: #3b82f6;
}

/* Input de mensaje */
.chat-input-container {
    display: none;
    position: relative; /* Necesario para que el panel de mensajes predeterminados se posicione correctamente */
    padding: 16px 24px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-top: 1px solid rgba(0, 0, 0, 0.06);
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
}

.chat-input-wrapper {
    display: flex;
    align-items: flex-end;
    background: #ffffff;
    border: 2px solid #e2e8f0;
    border-radius: 24px;
    padding: 10px 14px;
    gap: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.chat-input-wrapper:focus-within {
    border-color: #667eea;
    box-shadow: 0 4px 16px rgba(102, 126, 234, 0.2);
}

.btn-attach, .btn-emoji, .btn-send {
    background: none;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-attach:hover, .btn-emoji:hover {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1) 0%, rgba(118, 75, 162, 0.1) 100%);
    color: #667eea;
    transform: scale(1.1);
}

.btn-send {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.btn-send:hover {
    background: linear-gradient(135deg, #764ba2 0%, #667eea 100%);
    transform: scale(1.1);
    box-shadow: 0 6px 16px rgba(102, 126, 234, 0.4);
}

.btn-send:disabled {
    background: #9ca3af;
    cursor: not-allowed;
}

.btn-attach svg, .btn-emoji svg, .btn-send svg {
    width: 20px;
    height: 20px;
}

.message-input-wrapper {
    flex: 1;
    position: relative;
}

.message-input {
    width: 100%;
    border: none;
    background: none;
    resize: none;
    outline: none;
    font-size: 14.5px;
    line-height: 1.5;
    max-height: 120px;
    padding: 6px 0;
    font-family: inherit;
    color: #1e293b;
}

.message-input::placeholder {
    color: #94a3b8;
    font-weight: 400;
}

/* Responsive */
@media (max-width: 1024px) {
    #module-chat {
        left: 0;
        top: 0;
    }
}

/* Responsive para tablets */
@media (max-width: 1024px) {
    .chat-sidebar {
        width: 320px;
    }
    
    .message-bubble {
        max-width: 75%;
    }
}

/* Responsive para móviles */
@media (max-width: 768px) {
    #module-chat {
        left: 0;
        top: 60px;
    }
    
    .chat-container {
        height: 100%;
        flex-direction: column;
    }
    
    .chat-sidebar {
        width: 100%;
        border-right: none;
        border-bottom: 1px solid #e2e8f0;
        max-height: 100%;
    }
    
    .chat-header {
        padding: 12px 16px;
    }
    
    .chat-header h3 {
        font-size: 16px;
    }
    
    .session-selector {
        padding: 12px 16px;
    }
    
    .chat-item {
        padding: 12px 16px;
    }
    
    .chat-main {
        display: none;
        width: 100%;
        height: 100%;
    }
    
    .chat-main.active {
        display: flex;
        position: fixed;
        top: 60px;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 1000;
        background: #f8fafc;
    }
    
    .chat-header-active {
        padding: 12px 16px;
    }
    
    .contact-avatar img {
        width: 36px;
        height: 36px;
    }
    
    .contact-details h4 {
        font-size: 15px;
    }
    
    .contact-details p {
        font-size: 12px;
    }
    
    .chat-messages {
        padding: 12px;
    }
    
    .message-bubble {
        max-width: 85%;
        padding: 10px 14px;
        font-size: 14px;
    }
    
    .chat-input-container {
        padding: 12px 16px;
    }
    
    .chat-input-wrapper {
        padding: 6px 10px;
    }
    
    #messageInput {
        font-size: 14px;
    }
    
    .btn-attach svg,
    .btn-send svg {
        width: 20px;
        height: 20px;
    }
    
    .btn-quick-messages {
        background: none;
        border: none;
        padding: 10px;
        border-radius: 50%;
        cursor: pointer;
        color: #64748b;
        transition: all 0.3s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .btn-quick-messages:hover {
        background: #f1f5f9;
        color: #667eea;
    }
    
    .btn-quick-messages svg {
        width: 20px;
        height: 20px;
    }
    
    /* Botón para volver a la lista de chats */
    .chat-header-active::before {
        content: '←';
        position: absolute;
        left: 16px;
        font-size: 24px;
        cursor: pointer;
        color: #3b82f6;
        z-index: 10;
    }
}

/* Responsive para móviles pequeños */
@media (max-width: 480px) {
    .chat-sidebar {
        max-height: 50vh;
    }
    
    .message-bubble {
        max-width: 90%;
        padding: 8px 12px;
        font-size: 13px;
    }
    
    .chat-name {
        font-size: 14px;
    }
    
    .chat-last-message {
        font-size: 12px;
    }
    
    .chats-section-header {
        padding: 10px 16px;
        font-size: 11px;
    }
}

/* Estados de carga */
.loading-messages {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
    color: #64748b;
}

.loading-messages svg {
    width: 24px;
    height: 24px;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    from { transform: rotate(0deg); }
    to { transform: rotate(360deg); }
}

/* Archivos multimedia */
.message-media {
    max-width: 200px;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 8px;
    position: relative;
}

.message-media img {
    width: 100%;
    height: auto;
    display: block;
}

.message-media video {
    width: 100%;
    height: auto;
    display: block;
}

/* Contenedor de imagen con overlay */
.image-container {
    position: relative;
    cursor: pointer;
    overflow: hidden;
}

.image-container:hover .image-overlay {
    opacity: 1;
}

.image-container:hover .media-download-overlay {
    opacity: 1;
}

.image-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.zoom-icon {
    width: 32px;
    height: 32px;
    color: white;
    stroke-width: 2;
}

.media-download-overlay {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: 10;
}

.btn-download-media {
    background: rgba(255, 255, 255, 0.95);
    border: none;
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: all 0.3s ease;
    padding: 0;
}

.btn-download-media:hover {
    background: white;
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.btn-download-media svg {
    width: 18px;
    height: 18px;
    color: #667eea;
    stroke-width: 2;
}

/* Contenedor de video */
.video-container {
    position: relative;
    display: inline-block;
}

.video-container .btn-download-media {
    position: absolute;
    top: 8px;
    right: 8px;
    opacity: 0.8;
}

.video-container:hover .btn-download-media {
    opacity: 1;
}

/* Contenedor de audio */
.audio-wrapper {
    display: flex;
    align-items: center;
    gap: 8px;
    position: relative;
}

.audio-wrapper .btn-download-media {
    opacity: 0.7;
    flex-shrink: 0;
}

.audio-wrapper:hover .btn-download-media {
    opacity: 1;
}

.message-file {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 8px;
    position: relative;
}

.message.sent .message-file {
    background: rgba(255, 255, 255, 0.15);
}

.message.received .message-file {
    background: rgba(0, 0, 0, 0.03);
}

.message-file .file-icon {
    width: 32px;
    height: 32px;
    flex-shrink: 0;
    color: #667eea;
}

.message.sent .message-file .file-icon {
    color: rgba(255, 255, 255, 0.9);
}

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

.message-file-name {
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 4px;
}

.message.sent .message-file-name {
    color: rgba(255, 255, 255, 0.95);
}

.message.received .message-file-name {
    color: #1e293b;
}

.message-file-size {
    font-size: 11px;
    opacity: 0.7;
}

.message.sent .message-file-size {
    color: rgba(255, 255, 255, 0.7);
}

.message.received .message-file-size {
    color: #64748b;
}

.btn-download-file {
    background: rgba(102, 126, 234, 0.1);
    border: none;
    border-radius: 8px;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    flex-shrink: 0;
    padding: 0;
}

.message.sent .btn-download-file {
    background: rgba(255, 255, 255, 0.2);
}

.message.sent .btn-download-file:hover {
    background: rgba(255, 255, 255, 0.3);
}

.message.received .btn-download-file {
    background: rgba(102, 126, 234, 0.1);
}

.message.received .btn-download-file:hover {
    background: rgba(102, 126, 234, 0.2);
}

.btn-download-file svg {
    width: 18px;
    height: 18px;
    color: #667eea;
    stroke-width: 2;
}

.message.sent .btn-download-file svg {
    color: rgba(255, 255, 255, 0.9);
}

.message.received .btn-download-file svg {
    color: #667eea;
}

.btn-download-file:hover {
    transform: scale(1.1);
}

.message-file-download {
    display: none; /* Ocultar el link antiguo si existe */
}

/* Estilos para formato de WhatsApp en mensajes de texto */
.whatsapp-formatted-text {
    white-space: pre-wrap; /* Preservar saltos de línea y espacios */
    word-wrap: break-word;
    line-height: 1.5;
}

.whatsapp-bold {
    font-weight: 600;
    color: inherit;
}

.message.sent .whatsapp-bold {
    font-weight: 600;
}

.message.received .whatsapp-bold {
    font-weight: 600;
}

.whatsapp-italic {
    font-style: italic;
    color: inherit;
}

.whatsapp-strikethrough {
    text-decoration: line-through;
    color: inherit;
    opacity: 0.8;
}

.whatsapp-code {
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 4px 8px;
    border-radius: 4px;
    font-size: 0.9em;
    display: block;
    margin: 4px 0;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.message.sent .whatsapp-code {
    background: rgba(255, 255, 255, 0.2);
}

.message.received .whatsapp-code {
    background: rgba(0, 0, 0, 0.08);
}

.whatsapp-code-inline {
    font-family: 'Courier New', Courier, monospace;
    background: rgba(0, 0, 0, 0.1);
    padding: 2px 4px;
    border-radius: 3px;
    font-size: 0.9em;
    display: inline;
}

.message.sent .whatsapp-code-inline {
    background: rgba(255, 255, 255, 0.2);
}

.message.received .whatsapp-code-inline {
    background: rgba(0, 0, 0, 0.08);
}

/* Estilos específicos para PDFs */
.message-file-pdf {
    border-left: 3px solid #dc2626;
}

.message-file-pdf .pdf-icon {
    color: #dc2626;
}

.message.sent .message-file-pdf .pdf-icon {
    color: rgba(255, 255, 255, 0.9);
}

/* Estilos para el caption del documento (texto descriptivo) */
.message-file-caption {
    margin-top: 8px;
    padding-top: 8px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
}

.message.sent .message-file-caption {
    color: rgba(255, 255, 255, 0.95);
    border-top-color: rgba(255, 255, 255, 0.15);
}

.message.received .message-file-caption {
    color: #1e293b;
    border-top-color: rgba(0, 0, 0, 0.1);
}

.file-unavailable {
    font-size: 11px;
    color: #ef4444;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.message.sent .file-unavailable {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

/* Estilos específicos para PDFs */
.message-file-pdf {
    border-left: 3px solid #dc2626;
}

.message-file-pdf .pdf-icon {
    color: #dc2626;
}

.message.sent .message-file-pdf .pdf-icon {
    color: rgba(255, 255, 255, 0.9);
}

.file-unavailable {
    font-size: 11px;
    color: #ef4444;
    padding: 4px 8px;
    background: rgba(239, 68, 68, 0.1);
    border-radius: 4px;
    white-space: nowrap;
}

.message.sent .file-unavailable {
    color: rgba(255, 255, 255, 0.8);
    background: rgba(255, 255, 255, 0.15);
}

/* Scrollbar personalizado estilo claro */
.chats-list::-webkit-scrollbar,
.chat-messages::-webkit-scrollbar {
    width: 6px;
}

.chats-list::-webkit-scrollbar-track,
.chat-messages::-webkit-scrollbar-track {
    background: transparent;
}

.chats-list::-webkit-scrollbar-thumb,
.chat-messages::-webkit-scrollbar-thumb {
    background: #cbd5e1;
    border-radius: 3px;
}

.chats-list::-webkit-scrollbar-thumb:hover,
.chat-messages::-webkit-scrollbar-thumb:hover {
    background: #94a3b8;
}

/* Estados de mensaje mejorados */
.message-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 4px;
    margin-top: 4px;
}

.message.received .message-footer {
    justify-content: flex-start;
}

.message-time {
    font-size: 11px;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    opacity: 1;
}

.message.sent .message-time {
    color: rgba(255, 255, 255, 0.7);
    opacity: 1;
}

.message.received .message-time {
    color: #94a3b8;
    opacity: 0.75;
}

.message-status {
    font-size: 11px;
    margin-left: 4px;
    opacity: 0.8;
    color: rgba(255, 255, 255, 0.7);
    font-weight: 500;
    display: inline-flex;
    align-items: center;
}

.message.sent .message-status {
    color: rgba(255, 255, 255, 0.7);
    opacity: 0.8;
}

.message.sent .message-status.read {
    color: #53bdeb;
    opacity: 1;
}

.message.sent .message-status.delivered {
    color: rgba(255, 255, 255, 0.8);
    opacity: 0.9;
}

/* ==================== MÓDULO DE PERFILES ==================== */

.perfiles-container {
    display: grid;
    grid-template-columns: 1fr 400px;
    gap: 24px;
    margin-top: 24px;
}

.perfiles-list-container {
    min-width: 0;
}

.perfiles-list {
    display: grid;
    gap: 16px;
}

.perfil-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    box-shadow: var(--shadow);
}

.perfil-card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

.perfil-card.inactive {
    opacity: 0.6;
    background: #f9fafb;
}

.perfil-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.perfil-card-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.perfil-status {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.perfil-status.active {
    background: #d1fae5;
    color: #065f46;
}

.perfil-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.perfil-description {
    color: var(--text-secondary);
    font-size: 14px;
    margin-bottom: 16px;
    line-height: 1.5;
}

.perfil-stats {
    display: flex;
    gap: 24px;
    margin-bottom: 16px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.stat-item {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat-label {
    font-size: 12px;
    color: var(--text-secondary);
}

.stat-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--primary-color);
}

.perfil-actions {
    display: flex;
    gap: 8px;
}

.btn-action {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-white);
    color: var(--text-primary);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.btn-action:hover {
    background: var(--bg-light);
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.btn-action:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-action svg {
    width: 16px;
    height: 16px;
}

.perfil-detail-container {
    position: sticky;
    top: 24px;
    height: fit-content;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.perfil-info {
    margin-bottom: 24px;
}

.info-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-color);
}

.info-row:last-child {
    border-bottom: none;
}

.info-row label {
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 14px;
}

.info-row span {
    font-size: 14px;
    color: var(--text-primary);
    text-align: right;
}

.permisos-section {
    margin-top: 24px;
}

.permisos-section h4 {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.permisos-list {
    max-height: 400px;
    overflow-y: auto;
}

.modulo-permisos {
    margin-bottom: 20px;
    padding: 16px;
    background: var(--bg-light);
    border-radius: 8px;
}

.modulo-permisos h5 {
    font-size: 14px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.modulo-permisos ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.modulo-permisos li {
    padding: 8px 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-color);
}

.modulo-permisos li:last-child {
    border-bottom: none;
}

.permiso-name {
    font-size: 13px;
    color: var(--text-primary);
}

.permiso-code {
    font-size: 11px;
    color: var(--text-secondary);
    background: var(--bg-white);
    padding: 2px 8px;
    border-radius: 4px;
}

/* Formulario de perfil */
.perfil-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.permisos-selector {
    max-height: 600px;
    overflow-y: auto;
    border: 2px solid #e5e7eb;
    border-radius: 12px;
    padding: 20px;
    background: #f9fafb;
}

.modulo-group {
    margin-bottom: 24px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 10px;
    padding: 16px;
    transition: all 0.2s ease;
}

.modulo-group:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
}

.modulo-group.modulo-sin-permisos {
    opacity: 0.6;
    border-color: #d1d5db;
}

.modulo-group:last-child {
    margin-bottom: 0;
}

.modulo-header {
    margin-bottom: 12px;
}

.modulo-header-label {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    cursor: pointer;
    padding: 12px;
    background: #f3f4f6;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.modulo-header-label:hover {
    background: #e5e7eb;
}

.modulo-header-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.modulo-header-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.modulo-name {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    display: block;
}

.modulo-description {
    font-size: 13px;
    color: #6b7280;
    display: block;
}

.modulo-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #3b82f6;
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 12px;
    margin-top: 4px;
    align-self: flex-start;
}

.permisos-group {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 10px;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
    margin-top: 8px;
}

.permisos-group.permisos-empty {
    grid-template-columns: 1fr;
    padding: 20px;
    text-align: center;
}

.no-permisos-message {
    color: #9ca3af;
    font-size: 13px;
    margin: 0;
}

.permiso-checkbox-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.permiso-checkbox-label:hover {
    background: #f9fafb;
    border-color: #3b82f6;
    transform: translateY(-1px);
}

.permiso-checkbox-label.permiso-selected {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 2px 4px rgba(59, 130, 246, 0.1);
}

.permiso-checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
    margin-top: 2px;
    flex-shrink: 0;
}

.permiso-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.permiso-name {
    font-size: 14px;
    font-weight: 500;
    color: #111827;
    display: block;
}

.permiso-code {
    font-size: 12px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 4px;
    display: inline-block;
    align-self: flex-start;
    font-family: 'Courier New', monospace;
}

.permiso-desc {
    font-size: 12px;
    color: #9ca3af;
    display: block;
    margin-top: 2px;
}

.permisos-summary {
    margin-top: 16px;
    padding: 12px;
    background: #dbeafe;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    color: #1e40af;
}

.permisos-summary span {
    font-weight: 700;
    font-size: 16px;
}

.form-label-large {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 8px;
    display: block;
}

.form-help-text {
    font-size: 13px;
    color: #6b7280;
    margin-bottom: 16px;
    line-height: 1.5;
}

.no-modules-message {
    padding: 40px 20px;
    text-align: center;
    color: #9ca3af;
}

.no-modules-message p {
    margin: 0;
    font-size: 14px;
}

/* Modal de Perfil */
.perfil-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    animation: fadeIn 0.2s ease;
}

.perfil-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
}

.perfil-modal-content {
    position: relative;
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    animation: slideUp 0.3s ease;
    z-index: 1001;
}

.perfil-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.perfil-modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.btn-close-modal {
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    border-radius: 6px;
    color: #6b7280;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-modal:hover {
    background: #f3f4f6;
    color: #111827;
}

.btn-close-modal svg {
    width: 20px;
    height: 20px;
}

.perfil-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.perfil-modal-footer {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 24px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 0 0 12px 12px;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

/* Estilos para botón nuevo chat */
.chat-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.btn-manage-messages {
    background: rgba(255, 255, 255, 0.2);
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    color: white;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.btn-manage-messages:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-manage-messages svg {
    width: 18px;
    height: 18px;
}

.btn-new-chat {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: none;
    padding: 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px);
}

.btn-new-chat:hover {
    background: rgba(255, 255, 255, 0.3);
}

.btn-new-chat svg {
    width: 18px;
    height: 18px;
}

/* Modal para nuevo chat */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.2s ease;
}

.modal-content {
    background: white;
    border-radius: 12px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    width: 90%;
    max-width: 500px;
    animation: slideUp 0.3s ease;
}

/* Modal de creación de sesión WhatsApp - Más grande */
#createSessionModal .modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#createSessionModal .modal-header {
    flex-shrink: 0;
    padding: 24px 32px;
}

#createSessionModal .modal-header h3 {
    font-size: 24px;
    font-weight: 700;
}

#createSessionModal .modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

#createSessionModal form {
    padding: 32px;
    flex: 1;
    min-height: min-content;
}

#createSessionModal .whatsapp-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#createSessionModal .form-group {
    gap: 12px;
}

#createSessionModal .form-group label {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

#createSessionModal .form-input,
#createSessionModal .form-select {
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#createSessionModal .form-input:focus,
#createSessionModal .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#createSessionModal .form-select {
    min-height: 150px;
    padding: 12px;
}

#createSessionModal .form-help {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

#createSessionModal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

#createSessionModal .form-actions button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    min-width: 140px;
}

#createSessionModal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

#createSessionModal .checkbox-label:hover {
    background-color: #f9fafb;
}

#createSessionModal .checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6;
}

#createSessionModal .checkbox-label span {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
}

#createSessionModal .qr-section-in-modal {
    padding: 32px;
}

#createSessionModal .qr-section-in-modal h4 {
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

#createSessionModal .qr-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* Responsive para modal de creación */
@media (max-width: 768px) {
    #createSessionModal .modal-content {
        width: 98%;
        max-width: 98%;
        max-height: 95vh;
    }
    
    #createSessionModal .modal-header,
    #createSessionModal form,
    #createSessionModal .qr-section-in-modal {
        padding: 20px;
    }
    
    #createSessionModal .form-actions {
        flex-direction: column;
    }
    
    #createSessionModal .form-actions button {
        width: 100%;
    }
}

/* Modal de edición de sesión WhatsApp - Más grande */
#editSessionModal .modal-content {
    max-width: 800px;
    width: 95%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#editSessionModal .modal-header {
    flex-shrink: 0;
    padding: 24px 32px;
}

#editSessionModal .modal-header h3 {
    font-size: 24px;
    font-weight: 700;
}

#editSessionModal .modal-body {
    padding: 0;
    overflow-y: auto;
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0; /* Permite que el scroll funcione correctamente */
}

#editSessionModal form {
    padding: 32px;
    flex: 1;
    min-height: min-content; /* Asegura que el contenido determine la altura */
}

#editSessionModal .qr-section-in-modal {
    padding: 32px;
}

#editSessionModal .qr-section-in-modal h4 {
    margin-bottom: 20px;
    color: #1f2937;
    font-size: 18px;
    font-weight: 600;
}

#editSessionModal .qr-image {
    max-width: 100%;
    height: auto;
    border-radius: 12px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

#editSessionModal .whatsapp-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

#editSessionModal .form-group {
    gap: 12px;
}

#editSessionModal .form-group label {
    font-size: 15px;
    font-weight: 600;
    color: #1f2937;
}

#editSessionModal .form-input,
#editSessionModal .form-select {
    padding: 12px 16px;
    font-size: 15px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    transition: all 0.2s ease;
}

#editSessionModal .form-input:focus,
#editSessionModal .form-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.1);
}

#editSessionModal .form-select {
    min-height: 150px;
    padding: 12px;
}

#editSessionModal .form-help {
    font-size: 13px;
    color: #6b7280;
    margin-top: 4px;
}

#editSessionModal .form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding-top: 24px;
    margin-top: 8px;
    border-top: 1px solid #e5e7eb;
    flex-shrink: 0;
}

#editSessionModal .form-actions button {
    padding: 12px 24px;
    font-size: 15px;
    font-weight: 600;
    border-radius: 8px;
    min-width: 140px;
}

#editSessionModal .checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 12px;
    border-radius: 8px;
    transition: background-color 0.2s ease;
}

#editSessionModal .checkbox-label:hover {
    background-color: #f9fafb;
}

#editSessionModal .checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    cursor: pointer;
    accent-color: #3b82f6;
}

#editSessionModal .checkbox-label span {
    font-size: 15px;
    font-weight: 500;
    color: #374151;
}

/* Responsive para modal de edición */
@media (max-width: 768px) {
    #editSessionModal .modal-content {
        width: 98%;
        max-width: 98%;
        max-height: 95vh;
    }
    
    #editSessionModal .modal-header,
    #editSessionModal form {
        padding: 20px;
    }
    
    #editSessionModal .form-actions {
        flex-direction: column;
    }
    
    #editSessionModal .form-actions button {
        width: 100%;
    }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px 12px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #111827;
}

.modal-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
    border-radius: 6px;
    color: #6b7280;
    font-size: 24px;
    line-height: 1;
    transition: all 0.2s ease;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-close:hover {
    background: #f3f4f6;
    color: #111827;
}

.modal-body {
    padding: 24px;
}

/* Modal de edición de mensajes predeterminados - Con scroll */
#editQuickMessageModal .modal-content {
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

#editQuickMessageModal .modal-header {
    flex-shrink: 0;
    padding: 24px;
    border-bottom: 1px solid #e5e7eb;
}

#editQuickMessageModal .modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
    min-height: 0; /* Permite que el scroll funcione correctamente */
}

#editQuickMessageModal .modal-actions {
    flex-shrink: 0;
    margin-top: 0;
    padding-top: 16px;
}

/* Responsive para modal de edición de mensajes predeterminados */
@media (max-width: 768px) {
    #editQuickMessageModal .modal-content {
        width: 98%;
        max-width: 98%;
        max-height: 95vh;
    }
    
    #editQuickMessageModal .modal-header,
    #editQuickMessageModal .modal-body {
        padding: 20px;
    }
    
    #editQuickMessageModal .modal-actions {
        flex-direction: column;
    }
    
    #editQuickMessageModal .modal-actions button {
        width: 100%;
    }
}

.modal-actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 12px;
    padding-top: 16px;
    border-top: 1px solid #e5e7eb;
    margin-top: 24px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.form-group label {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

.form-input {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    font-size: 14px;
    transition: all 0.2s;
    font-family: inherit;
}

.form-input:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-help {
    font-size: 12px;
    color: #6b7280;
    margin-top: -4px;
}

/* Botones de formato WhatsApp */
.btn-format-whatsapp {
    background: white;
    border: 1px solid #d1d5db;
    border-radius: 6px;
    padding: 6px 12px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: #374151;
}

.btn-format-whatsapp:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
}

.btn-format-whatsapp:active {
    background: #e5e7eb;
}

.btn-format-whatsapp strong,
.btn-format-whatsapp em,
.btn-format-whatsapp code {
    font-size: 14px;
    font-weight: 600;
}

.btn-primary {
    background: #3b82f6;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #4b5563;
}

/* Listado de módulos mejorado */
.modulos-list-container {
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    background: #f9fafb;
    overflow: hidden;
}

.modulos-list-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 18px;
    background: white;
    border-bottom: 2px solid #e5e7eb;
}

.modulos-list-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
}

.modulos-list-count {
    font-size: 13px;
    color: #6b7280;
    background: #f3f4f6;
    padding: 4px 10px;
    border-radius: 12px;
}

/* Estilos para selector simple de módulos */
.modulos-selector-simple {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 16px;
    max-height: 400px;
    overflow-y: auto;
}

.modulo-checkbox-simple {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 14px 16px;
    background: white;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.modulo-checkbox-simple:hover {
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.1);
    transform: translateY(-1px);
}

.modulo-checkbox-simple.modulo-selected {
    background: #eff6ff;
    border-color: #3b82f6;
    box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
}

.modulo-checkbox-simple.modulo-disabled {
    opacity: 0.5;
    cursor: not-allowed;
    background: #f9fafb;
}

.modulo-checkbox-simple-input {
    width: 20px;
    height: 20px;
    margin-top: 2px;
    cursor: pointer;
    flex-shrink: 0;
}

.modulo-checkbox-simple.modulo-disabled .modulo-checkbox-simple-input {
    cursor: not-allowed;
}

.modulo-checkbox-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.modulo-checkbox-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

.modulo-checkbox-name {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    line-height: 1.4;
}

.modulo-checkbox-desc {
    font-size: 12px;
    color: #6b7280;
    line-height: 1.4;
}

.modulo-checkbox-badge {
    display: inline-block;
    font-size: 12px;
    font-weight: 500;
    color: #3b82f6;
    background: #dbeafe;
    padding: 4px 10px;
    border-radius: 12px;
    align-self: flex-start;
}

.modulo-checkbox-badge.badge-disabled {
    color: #9ca3af;
    background: #f3f4f6;
}

.modulos-summary {
    margin-top: 16px;
    padding: 12px;
    background: #dbeafe;
    border-radius: 8px;
    text-align: center;
    font-weight: 500;
    color: #1e40af;
}

.modulos-summary span {
    font-weight: 700;
    font-size: 16px;
}

.modulos-list-simple {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 12px;
    margin-top: 16px;
}

.modulo-item-simple {
    padding: 14px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.modulo-item-simple strong {
    font-size: 15px;
    color: #111827;
}

.modulo-desc {
    font-size: 13px;
    color: #6b7280;
}

.modulo-badge-count {
    font-size: 12px;
    color: #3b82f6;
    background: #dbeafe;
    padding: 4px 8px;
    border-radius: 6px;
    align-self: flex-start;
}

/* Responsive */
@media (max-width: 1024px) {
    .perfiles-container {
        grid-template-columns: 1fr;
    }
    
    .perfil-detail-container {
        position: static;
        max-height: none;
    }
}

.no-data {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-secondary);
}

.no-data svg {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;
    color: var(--text-secondary);
    opacity: 0.5;
}

.no-data p {
    font-size: 16px;
    margin-bottom: 8px;
}

.no-data small {
    font-size: 14px;
    color: var(--text-secondary);
}

/* ===== ESTILOS PARA MÓDULO DE CARGA DE GESTIONES ===== */
.carga-form {
    max-width: 800px;
    margin: 0 auto;
}

.form-section {
    background: white;
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.form-section h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 20px;
    padding-bottom: 12px;
    border-bottom: 2px solid var(--bg-light);
}

.form-group label .required {
    color: var(--error-color);
    margin-left: 4px;
}

.form-input,
.form-textarea {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e5e7eb;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    outline: none;
    font-family: inherit;
}

.form-input:focus,
.form-textarea:focus {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.form-textarea {
    resize: vertical;
    min-height: 100px;
}

.form-help {
    display: block;
    margin-top: 6px;
    color: #6b7280;
    font-size: 12px;
}

/* File Input Styling */
.file-input-wrapper {
    position: relative;
}

.form-file-input {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

.file-input-label {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 8px 16px;
    background: #f9fafb;
    border: 2px dashed #d1d5db;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    color: #6b7280;
    font-size: 13px;
    font-weight: 500;
    min-width: auto;
    width: auto;
}

.file-input-label:hover {
    background: #f3f4f6;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.file-input-label svg {
    width: 16px;
    height: 16px;
    stroke-width: 2;
    flex-shrink: 0;
}

.file-name-display {
    margin-top: 10px;
    padding: 10px;
    background: #ecfdf5;
    border: 1px solid #a7f3d0;
    border-radius: 6px;
    color: #065f46;
    font-size: 13px;
    font-weight: 500;
}

/* Form Actions */
.form-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 32px;
    padding-top: 24px;
    border-top: 1px solid #e5e7eb;
}

.btn-carga-submit {
    padding: 10px 20px;
    background: var(--primary-color);
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-carga-submit:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.btn-carga-submit:active {
    transform: translateY(0);
}

.btn-carga-submit:disabled {
    background: #9ca3af;
    cursor: not-allowed;
    transform: none;
}

.btn-carga-submit svg {
    width: 18px;
    height: 18px;
    stroke-width: 2;
}

.btn-carga-cancel {
    padding: 10px 20px;
    background: #6b7280;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-carga-cancel:hover {
    background: #4b5563;
    transform: translateY(-1px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Progress Section */
.carga-progress {
    margin-top: 24px;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.carga-progress h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 16px;
}

.progress-bar-container {
    width: 100%;
    height: 8px;
    background: #e5e7eb;
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 12px;
}

.progress-bar {
    height: 100%;
    background: linear-gradient(90deg, var(--primary-color), #60a5fa);
    transition: width 0.3s ease;
    border-radius: 4px;
}

.progress-text {
    font-size: 13px;
    color: #6b7280;
    text-align: center;
}

/* Result Section */
.carga-result {
    margin-top: 24px;
    padding: 24px;
    background: white;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    border-left: 4px solid #10b981;
}

.result-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #065f46;
    margin-bottom: 16px;
}

.result-details {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.result-details p {
    font-size: 14px;
    color: var(--text-primary);
    margin: 0;
}

.result-details strong {
    color: var(--text-primary);
    font-weight: 600;
    margin-right: 8px;
}

/* ==================== ESTILOS PARA MENSAJES PREDETERMINADOS ==================== */

/* Botón de mensajes predeterminados */
.btn-quick-messages {
    background: none;
    border: none;
    padding: 10px;
    border-radius: 50%;
    cursor: pointer;
    color: #64748b;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 8px;
    position: relative;
    z-index: 10;
    pointer-events: auto;
    -webkit-user-select: none;
    user-select: none;
}

.btn-quick-messages:hover {
    background: #f1f5f9;
    color: #667eea;
    transform: scale(1.05);
}

.btn-quick-messages svg {
    width: 20px;
    height: 20px;
    pointer-events: none;
}

/* Panel de mensajes predeterminados */
.quick-messages-panel {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 12px 12px 0 0;
    max-height: 300px;
    overflow-y: auto;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.1);
    z-index: 1000;
    margin-bottom: 8px;
}

.quick-messages-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: #f8fafc;
    position: sticky;
    top: 0;
    z-index: 10;
}

.quick-messages-header h4 {
    margin: 0;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.btn-close-panel, .btn-manage-messages {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-close-panel:hover, .btn-manage-messages:hover {
    background: #e2e8f0;
    color: #667eea;
}

.btn-close-panel svg, .btn-manage-messages svg {
    width: 18px;
    height: 18px;
}

/* Campo de búsqueda de mensajes predeterminados */
.quick-messages-search {
    position: relative;
    padding: 8px 12px;
    border-bottom: 1px solid #e2e8f0;
    background: #ffffff;
    display: flex;
    align-items: center;
    gap: 8px;
}

.quick-messages-search-input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    outline: none;
    transition: all 0.2s ease;
    background: #f8fafc;
}

.quick-messages-search-input:focus {
    border-color: #667eea;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.quick-messages-search-input::placeholder {
    color: #94a3b8;
}

.btn-clear-search-quick {
    background: none;
    border: none;
    padding: 6px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.btn-clear-search-quick:hover {
    background: #e2e8f0;
    color: #667eea;
}

.btn-clear-search-quick svg {
    width: 16px;
    height: 16px;
}

.quick-messages-list {
    padding: 8px;
    max-height: 220px;
    overflow-y: auto;
}

.quick-message-category {
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 8px 12px 4px;
    margin-top: 8px;
}

.quick-message-category:first-child {
    margin-top: 0;
}

.quick-message-item {
    display: flex;
    align-items: center;
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
    background: #ffffff;
    border: 1px solid #e2e8f0;
    position: relative;
}

.quick-message-item:hover {
    background: #f8fafc;
    border-color: #667eea;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.15);
    transform: translateY(-1px);
}

.quick-message-item:last-child {
    margin-bottom: 0;
}

.quick-message-content {
    flex: 1;
    min-width: 0;
    margin-right: 12px;
}

.quick-message-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.quick-message-text {
    font-size: 12px;
    color: #64748b;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-bottom: 4px;
}

.quick-message-type-badge {
    display: inline-block;
    font-size: 10px;
    font-weight: 600;
    color: #667eea;
    background: #eef2ff;
    padding: 2px 6px;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 4px;
}

.btn-use-message {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border: none;
    padding: 8px;
    border-radius: 50%;
    cursor: pointer;
    color: white;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 12px;
    flex-shrink: 0;
}

.btn-use-message:hover {
    transform: scale(1.1);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.btn-use-message svg {
    width: 16px;
    height: 16px;
}

.no-quick-messages {
    text-align: center;
    padding: 40px 20px;
    color: #94a3b8;
}

.no-quick-messages p {
    margin-bottom: 12px;
    font-size: 14px;
}

.btn-link {
    background: none;
    border: none;
    color: #667eea;
    cursor: pointer;
    text-decoration: underline;
    font-size: 14px;
    padding: 0;
}

.btn-link:hover {
    color: #764ba2;
}

/* ==================== ESTILOS PARA MÓDULO MASIVOS ==================== */

.masivos-cedente-select {
    width: 100%;
}

.masivos-combos-row {
    display: flex;
    flex-direction: row;
    gap: 24px;
    align-items: flex-start;
    flex-wrap: nowrap;
}

.masivos-combos-row .form-group-item {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.masivos-combos-row .form-group-item label {
    margin-bottom: 8px;
}

.masivos-combos-row .form-group-item .form-select {
    width: 100%;
}

/* Responsive para móviles */
@media (max-width: 768px) {
    .masivos-combos-row {
        flex-direction: column;
        gap: 16px;
    }
    
    .masivos-combos-row .form-group-item {
        width: 100%;
    }
}

/* Estilos para tabla de campañas */
.campanas-table {
    width: 100%;
    border-collapse: collapse;
}

.campanas-table tbody tr:hover {
    background: #f9fafb;
}

.campana-status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.campana-status-badge.status-active {
    background: #dbeafe;
    color: #1e40af;
}

.campana-status-badge.status-sent {
    background: #d1fae5;
    color: #065f46;
}

.campana-status-badge.status-draft {
    background: #f3f4f6;
    color: #6b7280;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ==================== FIN ESTILOS PARA MÓDULO MASIVOS ==================== */

/* Lista de gestión de mensajes */
.quick-messages-manage-list {
    max-height: 400px;
    overflow-y: auto;
}

.quick-message-manage-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    margin-bottom: 12px;
    background: #f8fafc;
}

.quick-message-manage-item:last-child {
    margin-bottom: 0;
}

.quick-message-manage-content {
    flex: 1;
}

.quick-message-manage-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 6px;
}

.quick-message-manage-text {
    font-size: 13px;
    color: #64748b;
    line-height: 1.5;
    margin-bottom: 4px;
}

.quick-message-manage-category {
    font-size: 11px;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.quick-message-manage-actions {
    display: flex;
    gap: 8px;
    margin-left: 16px;
}

.btn-edit-message, .btn-delete-message {
    background: none;
    border: none;
    padding: 8px;
    border-radius: 6px;
    cursor: pointer;
    color: #64748b;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-edit-message:hover {
    background: #dbeafe;
    color: #3b82f6;
}

.btn-delete-message:hover {
    background: #fee2e2;
    color: #ef4444;
}

.btn-edit-message svg, .btn-delete-message svg {
    width: 18px;
    height: 18px;
}

/* ========== ESTILOS PARA MÓDULO DE USUARIOS ========== */

.usuarios-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    padding: 20px;
}

.usuario-card {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.usuario-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.usuario-card.inactive {
    opacity: 0.7;
    background: #f9fafb;
}

.usuario-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e5e7eb;
}

.usuario-info h3 {
    margin: 0 0 5px 0;
    font-size: 18px;
    color: #1f2937;
    font-weight: 600;
}

.usuario-username {
    font-size: 14px;
    color: #6b7280;
    font-weight: 500;
}

.usuario-status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
}

.usuario-status.active {
    background: #d1fae5;
    color: #065f46;
}

.usuario-status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

.usuario-details {
    margin: 15px 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.detail-item {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 14px;
    color: #4b5563;
}

.detail-item svg {
    width: 18px;
    height: 18px;
    color: #9ca3af;
    flex-shrink: 0;
}

.usuario-actions {
    display: flex;
    gap: 8px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 1px solid #e5e7eb;
}

/* Modal de Usuario */
.usuario-modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    animation: fadeIn 0.3s ease;
}

.usuario-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(2px);
}

.usuario-modal-content {
    position: relative;
    background: white;
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 90vh;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: slideUp 0.3s ease;
    display: flex;
    flex-direction: column;
}

.usuario-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 24px 28px;
    border-bottom: 1px solid #e5e7eb;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.usuario-modal-header h3 {
    margin: 0;
    font-size: 24px;
    font-weight: 700;
}

.usuario-modal-body {
    padding: 28px;
    overflow-y: auto;
    flex: 1;
}

.usuario-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    padding: 20px 28px;
    border-top: 1px solid #e5e7eb;
    background: #f9fafb;
}

/* Formulario de Usuario */
.usuario-form {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.form-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.form-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    display: flex;
    align-items: center;
    gap: 8px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
}

.form-input, .form-select, .form-textarea {
    padding: 10px 14px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    transition: all 0.2s ease;
    font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.form-help {
    font-size: 12px;
    color: #6b7280;
}

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.checkbox-label span {
    font-size: 14px;
    font-weight: 500;
    color: #374151;
}

/* Detalle de Usuario */
.usuario-info-detail {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.info-section {
    background: #f9fafb;
    padding: 20px;
    border-radius: 12px;
    border: 1px solid #e5e7eb;
}

.info-section h4 {
    margin: 0 0 16px 0;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    padding-bottom: 12px;
    border-bottom: 2px solid #e5e7eb;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 16px;
}

.info-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.info-row label {
    font-size: 12px;
    font-weight: 600;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-row span {
    font-size: 14px;
    color: #1f2937;
    font-weight: 500;
}

.badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.badge-success {
    background: #d1fae5;
    color: #065f46;
}

.badge-danger {
    background: #fee2e2;
    color: #991b1b;
}

/* Responsive */
@media (max-width: 768px) {
    .usuarios-container {
        grid-template-columns: 1fr;
    }
    
    .usuario-modal-content {
        width: 95%;
        max-height: 95vh;
    }
    
    .form-grid, .info-grid {
        grid-template-columns: 1fr;
    }
}
