/* Dashboard Styles */
.dashboard {
    display: none;
    width: 100%;
    min-height: 100vh;
    background: #f8f9fa;
    flex-direction: column;
}

.navbar {
    background: white;
    padding: 15px 30px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.navbar-brand {
    display: flex;
    align-items: center;
    gap: 15px;
}

.navbar-brand img {
    width: 230px;
    height: auto;
}

.navbar-brand h2 {
    color: #1b68d8;
    font-size: 1.5em;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 40px;
    height: 40px;
    background: #1b68d8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
}

.log-btn {
    padding: 8px 15px;
    background: #ffc107;
    color: #212529;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 10px;
}

.log-btn:hover {
    background: #e0a800;
}

.logout-btn {
    padding: 8px 15px;
    background: #e85aa8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
}

.main-content {
    padding: 30px;
    max-width: 1200px;
    margin: 0 auto;
}

.main-content h1 {
    color: #1b68d8;
    margin-bottom: 30px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

/* Responsive para el grid de estadísticas */
@media (max-width: 1200px) {
    .stats-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

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

@media (max-width: 900px) {
    .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
}

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

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

.stat-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    text-align: center;
    transition: transform 0.2s;
}

.stat-card:hover {
    transform: translateY(-2px);
}

.stat-number {
    font-size: 2.5em;
    font-weight: bold;
    color: #1b68d8;
    margin-bottom: 10px;
}

.stat-label {
    color: #666;
    font-size: 1.1em;
}

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

.feature-card {
    background: white;
    padding: 25px;
    border-radius: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-left: 4px solid #1b68d8;
    transition: transform 0.2s;
}

.feature-card:hover {
    transform: translateY(-2px);
}

.feature-card h3 {
    color: #1b68d8;
    margin-bottom: 15px;
    font-size: 1.3em;
}

.feature-card p {
    color: #666;
    line-height: 1.6;
    margin-bottom: 15px;
}

.feature-btn {
    margin-top: 15px;
    padding: 10px 20px;
    background: #1b68d8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: background 0.3s;
}

.feature-btn:hover {
    background: #2a5298;
}

.chat-preview {
    background: #f8f9fa;
    border: 1px solid #e1e5e9;
    border-radius: 8px;
    padding: 15px;
    margin-top: 15px;
}

.chat-message {
    background: white;
    padding: 10px;
    border-radius: 8px;
    margin-bottom: 10px;
    border-left: 3px solid #4ab8a6;
}

.chat-message.user {
    border-left-color: #1b68d8;
    background: #e3f2fd;
}

/* Admin Panel Styles */
.admin-panel {
    margin-top: 40px;
    padding: 30px;
    background: white;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.1);
}

.admin-panel h2 {
    color: #1b68d8;
    margin-bottom: 25px;
    text-align: center;
    font-size: 1.8em;
}

.admin-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 28px; /* mayor separación entre filas/columnas */
    row-gap: 28px;
}

.admin-card {
    display: flex;
    justify-content: center;
}

.admin-btn {
    width: 100%;
    height: 90px; /* más delgado para que quepan en una línea */
    background: #ffffff; /* unificar estilo blanco por defecto */
    border: 1px solid #e9ecef;
    border-radius: 15px;
    color: #1b68d8;
    font-weight: 600;
    font-size: 1em;
    cursor: pointer;
    transition: background 0.3s ease, color 0.3s ease, transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.admin-btn:hover {
    transform: translateY(-5px);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); /* morado al hover */
    color: #ffffff;
}

.admin-btn i {
    font-size: 1.6em; /* icono más pequeño para reducir grosor visual */
}
.admin-btn:hover i { color: #ffffff; }

/* En pantallas grandes, forzar 4 columnas para que queden en una sola línea */
@media (min-width: 992px) {
    .admin-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}

/* Modal Styles */
.modal-content {
    border-radius: 15px;
    border: none;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
}

.modal-header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border-radius: 15px 15px 0 0;
    border: none;
}

.modal-body {
    padding: 2rem;
}

.form-control, .form-select {
    border-radius: 10px;
    border: 2px solid #e9ecef;
    padding: 0.75rem 1rem;
    transition: all 0.3s ease;
}

.form-control:focus, .form-select:focus {
    border-color: #667eea;
    box-shadow: 0 0 0 0.2rem rgba(102, 126, 234, 0.25);
}

.btn-modal {
    border-radius: 10px;
    padding: 0.75rem 2rem;
    font-weight: 600;
    transition: all 0.3s ease;
}

.btn-modal:hover {
    transform: translateY(-2px);
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 15px 20px;
    }
    
    .navbar-brand h2 {
        font-size: 1.2em;
    }
    
    .main-content {
        padding: 20px;
    }
    
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .features-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .stat-number {
        font-size: 2em;
    }
    
    .admin-grid {
        grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
        gap: 15px;
    }
    
    .admin-btn {
        height: 100px;
        font-size: 1em;
    }
    
    .admin-btn i {
        font-size: 1.5em;
    }
}

/* =====================================================
   ESTILOS PARA EL DIRECTORIO DE CONTACTOS EN DASHBOARD
   ===================================================== */

.contacts-manager-container {
    max-width: 100%;
    margin: 0 auto;
}

.contacts-header {
    background: #1b68d8;
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.contacts-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.contacts-actions {
    display: flex;
    gap: 10px;
}

.contacts-search {
    margin-bottom: 20px;
}

.contacts-search input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.contacts-search input:focus {
    border-color: #1b68d8;
}

.contacts-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.contact-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.contact-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.contact-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.contact-info {
    flex: 1;
}

.contact-avatar {
    width: 50px;
    height: 50px;
    background: #1b68d8;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 10px;
}

.contact-name {
    font-size: 1.2em;
    font-weight: 600;
    color: #333;
    margin-bottom: 5px;
}

.contact-phone {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.contact-email {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.contact-company {
    color: #1b68d8;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 10px;
}

.contact-notes {
    color: #666;
    font-size: 0.8em;
    font-style: italic;
    margin-bottom: 15px;
    max-height: 40px;
    overflow: hidden;
    text-overflow: ellipsis;
}

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

.contact-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.3s;
    flex: 1;
    min-width: 80px;
}

.chat-btn {
    background: #4ab8a6;
    color: white;
}

.chat-btn:hover {
    background: #4ab8a6;
}

.call-btn {
    background: #17a2b8;
    color: white;
}

.call-btn:hover {
    background: #138496;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

.edit-btn:hover {
    background: #e0a800;
}

.contact-edit-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s;
}

.contact-edit-btn:hover {
    background: #f8f9fa;
    color: #1b68d8;
}

.no-contacts {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.no-contacts-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-contacts h3 {
    margin-bottom: 10px;
    color: #333;
}

.no-contacts p {
    margin-bottom: 20px;
}

/* Responsive para contactos en dashboard */
@media (max-width: 768px) {
    .contacts-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .contacts-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .contacts-actions {
        width: 100%;
        justify-content: center;
    }
    
    .contact-actions {
        flex-direction: column;
    }
    
    .contact-btn {
        flex: none;
        width: 100%;
    }
}

/* =====================================================
   ESTILOS PARA EL MÓDULO DE GESTIÓN DE AGENTES
   ===================================================== */

.agents-manager-container {
    max-width: 100%;
    margin: 0 auto;
}

.agents-header {
    background: #1b68d8;
    color: white;
    padding: 20px;
    border-radius: 10px 10px 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.agents-header h3 {
    margin: 0;
    font-size: 1.5em;
}

.agents-actions {
    display: flex;
    gap: 10px;
}

.agents-search {
    margin-bottom: 20px;
}

.agents-search input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.3s;
}

.agents-search input:focus {
    border-color: #1b68d8;
}

.agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
    gap: 20px;
    max-height: 500px;
    overflow-y: auto;
    padding: 10px;
}

.agent-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 10px;
    padding: 20px;
    transition: all 0.3s;
    position: relative;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.agent-card:hover {
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    transform: translateY(-2px);
}

.agent-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.agent-info {
    flex: 1;
}

.agent-avatar {
    width: 60px;
    height: 60px;
    background: linear-gradient(135deg, #1b68d8, #2a5298);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.4em;
    margin-bottom: 15px;
    position: relative;
}

.agent-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    border: 2px solid white;
}

.agent-status-indicator.active {
    background: #4ab8a6;
}

.agent-status-indicator.inactive {
    background: #6c757d;
}

.agent-status-indicator.busy {
    background: #ffc107;
}

.agent-status-indicator.available {
    background: #17a2b8;
}

.agent-name {
    font-size: 1.3em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.agent-email {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.agent-role {
    color: #1b68d8;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
}

.agent-employee-id {
    color: #1b68d8;
    font-size: 0.9em;
    font-weight: 500;
    margin-bottom: 5px;
}

.agent-department {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 5px;
}

.agent-conversations {
    color: #1b68d8;
    font-size: 0.8em;
    font-weight: 500;
    margin-bottom: 10px;
}

.agent-status {
    display: inline-block;
    padding: 4px 8px;
    border-radius: 12px;
    font-size: 0.8em;
    font-weight: 500;
    text-transform: uppercase;
    margin-bottom: 15px;
}

.agent-status.active {
    background: #d4edda;
    color: #155724;
}

.agent-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.agent-status.busy {
    background: #fff3cd;
    color: #856404;
}

.agent-status.available {
    background: #d1ecf1;
    color: #0c5460;
}

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

.agent-btn {
    padding: 8px 12px;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.8em;
    font-weight: 500;
    transition: all 0.3s;
    flex: 1;
    min-width: 80px;
}

.view-btn {
    background: #17a2b8;
    color: white;
}

.view-btn:hover {
    background: #138496;
}

.edit-btn {
    background: #ffc107;
    color: #333;
}

.edit-btn:hover {
    background: #e0a800;
}

.delete-btn {
    background: #e85aa8;
    color: white;
}

.delete-btn:hover {
    background: #e85aa8;
}

.btn-danger {
    background: #e85aa8;
    color: white;
    border-color: #e85aa8;
}

.btn-danger:hover {
    background: #e85aa8;
    border-color: #e85aa8;
    opacity: 0.9;
}

.agent-edit-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s;
}

.agent-edit-btn:hover {
    background: #f8f9fa;
    color: #1b68d8;
}

.no-agents {
    text-align: center;
    padding: 60px 20px;
    color: #666;
    grid-column: 1 / -1;
}

.no-agents-icon {
    font-size: 4em;
    margin-bottom: 20px;
    opacity: 0.5;
}

.no-agents h3 {
    margin-bottom: 10px;
    color: #333;
}

.no-agents p {
    margin-bottom: 20px;
}

/* Responsive para agentes en dashboard */
@media (max-width: 768px) {
    .agents-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .agents-header {
        flex-direction: column;
        gap: 15px;
        text-align: center;
    }
    
    .agents-actions {
        width: 100%;
        justify-content: center;
    }
    
    .agent-actions {
        flex-direction: column;
    }
    
    .agent-btn {
        flex: none;
        width: 100%;
    }
}

/* =====================================================
   ESTILOS PARA SECCIÓN INLINE DE GESTIÓN DE AGENTES
   ===================================================== */

/* Sección de gestión de agentes inline - posición abajo */
.agents-manager-section {
    width: 100%;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 30px 0;
    overflow: hidden;
    clear: both;
    display: block;
    position: relative;
    z-index: 10;
    flex: none;
    order: 999;
}

.agents-manager-section .agents-manager-container {
    padding: 0;
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

/* Header estilo directorio de contactos */
.agents-manager-section .agents-header {
    background: linear-gradient(135deg, #1b68d8, #2a5298);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
    border-radius: 0;
}

.agents-manager-section .agents-header h3 {
    color: white;
    font-size: 1.5em;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.agents-manager-section .agents-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.agents-manager-section .agents-actions .btn {
    padding: 8px 16px;
    border-radius: 6px;
    font-weight: 500;
    transition: all 0.3s ease;
    border: 1px solid rgba(255, 255, 255, 0.3);
    background: transparent;
    color: white;
}

.agents-manager-section .agents-actions .btn:hover {
    background: rgba(255, 255, 255, 0.1);
    transform: translateY(-1px);
}

.agents-manager-section .agents-actions .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border-color: rgba(255, 255, 255, 0.5);
}

.agents-manager-section .agents-actions .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* Búsqueda estilo directorio */
.agents-manager-section .agents-search {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e9ecef;
    margin: 0;
}

.agents-manager-section .agents-search input {
    padding: 12px 16px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 1em;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.agents-manager-section .agents-search input:focus {
    border-color: #1b68d8;
    box-shadow: 0 0 0 0.2rem rgba(30, 60, 114, 0.25);
    outline: none;
}

/* Grilla estilo directorio de contactos */
.agents-manager-section .agents-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px;
    background: white;
    max-height: 70vh;
    overflow-y: auto;
}

/* Tarjetas estilo directorio de contactos */
.agents-manager-section .agent-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.agents-manager-section .agent-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: #1b68d8;
}

/* Mantener estilos originales de contenido de tarjetas */

/* Responsive para modal doble ancho */
@media (max-width: 1400px) {
    #agentsManagerModal .modal-dialog {
        max-width: 96vw;
        width: 96vw;
        height: 92vh;
        margin: 4vh auto;
    }
}

@media (max-width: 1200px) {
    #agentsManagerModal .modal-dialog {
        max-width: 98vw;
        width: 98vw;
        height: 94vh;
        margin: 3vh auto;
    }
}

@media (max-width: 768px) {
    #agentsManagerModal .modal-dialog {
        max-width: 100vw;
        width: 100vw;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    #agentsManagerModal .modal-content {
        border-radius: 0;
        height: 100vh;
    }
    
    #agentsManagerModal .modal-header {
        border-radius: 0;
        padding: 15px 20px;
    }
    
    #agentsManagerModal .modal-body {
        padding: 20px;
    }
    
    .agents-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .agents-actions {
        width: 100%;
        justify-content: center;
    }
    
    .agents-grid {
        grid-template-columns: 1fr;
        gap: 15px;
    }
    
    .agent-actions {
        flex-direction: column;
    }
    
    .agent-btn {
        width: 100%;
    }
}

/* =====================================================
   ESTILOS PARA SECCIÓN INLINE DE GESTIÓN DE contactos
   ===================================================== */

/* Sección de gestión de contactos inline - posición abajo */
.users-manager-section {
    width: 100%;
    background: #f8f9fa;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin: 30px 0;
    overflow: hidden;
    clear: both;
    display: block;
    position: relative;
    z-index: 10;
    flex: none;
    order: 999;
}

.users-manager-section .users-manager-container {
    padding: 0;
    background: white;
    border-radius: 15px;
    overflow: hidden;
}

/* Header estilo directorio de contactos */
.users-manager-section .users-header {
    background: linear-gradient(135deg, #4ab8a6, #20c997);
    color: white;
    padding: 20px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 15px;
    margin: 0;
    border-radius: 0;
}

.users-manager-section .users-header h3 {
    color: white;
    font-size: 1.5em;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
}

.users-manager-section .users-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.users-manager-section .users-search {
    padding: 20px 30px;
    background: #f8f9fa;
    border-bottom: 1px solid #e1e5e9;
}

.users-manager-section .users-search input {
    width: 100%;
    padding: 12px 20px;
    border: 2px solid #e1e5e9;
    border-radius: 25px;
    font-size: 14px;
    outline: none;
    transition: all 0.3s ease;
    background: white;
    width: 100%;
}

.users-manager-section .users-search input:focus {
    border-color: #4ab8a6;
    box-shadow: 0 0 0 0.2rem rgba(40, 167, 69, 0.25);
    outline: none;
}

/* Grilla estilo directorio de contactos */
/* Estilos para vista de lista de usuarios */
.users-list-container {
    background: white;
    border-radius: 10px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow-x: auto;
    max-height: 70vh;
    overflow-y: auto;
}

.users-list-table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.users-list-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
}

.users-list-table thead {
    background: #f2f5fb;
    position: sticky;
    top: 0;
    z-index: 10;
}

.users-list-table thead th {
    padding: 12px 15px;
    text-align: left;
    font-weight: 600;
    color: #1b68d8;
    border-bottom: 2px solid #e1e5e9;
    white-space: nowrap;
}

.users-list-table tbody td {
    padding: 12px 15px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    color: #333;
}

.users-list-table tbody tr {
    transition: background-color 0.2s;
}

.users-list-table tbody tr:hover {
    background: #f8fafc;
}

.users-list-table tbody tr.inactive-row {
    opacity: 0.6;
    background-color: #f8f9fa;
}

.users-list-table tbody tr.inactive-row:hover {
    background: #f0f0f0;
}

.status-badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.85em;
    font-weight: 600;
}

.status-badge.status-active {
    background: #4ab8a6;
    color: white;
}

.status-badge.status-inactive {
    background: #e85aa8;
    color: white;
}

.status-badge.status-suspended {
    background: #ffc107;
    color: #212529;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: #1b68d8;
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    font-size: 0.85em;
    flex-shrink: 0;
}

.users-manager-section .users-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    padding: 30px;
    background: white;
    max-height: 70vh;
    overflow-y: auto;
}

/* Tarjetas estilo directorio de contactos */
.users-manager-section .user-card {
    background: white;
    border: 1px solid #e1e5e9;
    border-radius: 12px;
    padding: 20px;
    transition: all 0.3s ease;
    position: relative;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    min-height: 200px;
    display: flex;
    flex-direction: column;
}

.users-manager-section .user-card:hover {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
    border-color: #4ab8a6;
}

/* Estilos para el contenido de las tarjetas de contactos */
.users-manager-section .user-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 15px;
}

.users-manager-section .user-info {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.users-manager-section .user-avatar {
    width: 50px;
    height: 50px;
    background: linear-gradient(135deg, #4ab8a6, #20c997);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: bold;
    font-size: 1.2em;
    margin-bottom: 15px;
    position: relative;
}

.users-manager-section .user-status-indicator {
    position: absolute;
    bottom: 2px;
    right: 2px;
    width: 12px;
    height: 12px;
    border-radius: 50%;
    border: 2px solid white;
}

.users-manager-section .user-status-indicator.active {
    background: #4ab8a6;
}

.users-manager-section .user-status-indicator.inactive {
    background: #6c757d;
}

.users-manager-section .user-status-indicator.suspended {
    background: #e85aa8;
}

.users-manager-section .user-name {
    font-size: 1.1em;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.users-manager-section .user-email {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.users-manager-section .user-phone {
    color: #666;
    font-size: 0.9em;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.users-manager-section .user-role {
    color: #4ab8a6;
    font-size: 0.85em;
    font-weight: 500;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.users-manager-section .user-company {
    color: #666;
    font-size: 0.85em;
    margin-bottom: 8px;
    display: block;
    width: 100%;
}

.users-manager-section .user-status {
    font-size: 0.8em;
    padding: 2px 8px;
    border-radius: 12px;
    font-weight: 500;
    display: inline-block;
    margin-top: 5px;
}

.users-manager-section .user-status.active {
    background: #d4edda;
    color: #155724;
}

.users-manager-section .user-status.inactive {
    background: #f8d7da;
    color: #721c24;
}

.users-manager-section .user-status.suspended {
    background: #f8d7da;
    color: #721c24;
}

/* Botón de editar en la esquina */
.users-manager-section .user-edit-btn {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 1.2em;
    padding: 5px;
    border-radius: 3px;
    transition: all 0.3s;
}

.users-manager-section .user-edit-btn:hover {
    background: #f8f9fa;
    color: #4ab8a6;
}

/* Botones de acción */
.users-manager-section .user-actions {
    display: flex;
    gap: 8px;
    margin-top: auto;
    padding-top: 15px;
}

.users-manager-section .user-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    border-radius: 6px;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
}

.users-manager-section .user-btn.view-btn {
    background: #007bff;
    color: white;
}

.users-manager-section .user-btn.view-btn:hover {
    background: #0056b3;
}

.users-manager-section .user-btn.edit-btn {
    background: #ffc107;
    color: #212529;
}

.users-manager-section .user-btn.edit-btn:hover {
    background: #e0a800;
}

.users-manager-section .user-btn.delete-btn {
    background: #e85aa8;
    color: white;
}

.users-manager-section .user-btn.delete-btn:hover {
    background: #e85aa8;
}

/* Responsive para gestión de contactos */
@media (max-width: 768px) {
    .users-manager-section .users-grid {
        grid-template-columns: 1fr;
        gap: 15px;
        padding: 15px;
    }
    
    .users-manager-section .users-header {
        flex-direction: column;
        text-align: center;
        padding: 20px;
    }
    
    .users-manager-section .users-actions {
        width: 100%;
        justify-content: center;
    }
    
    .users-manager-section .users-search {
        padding: 15px;
    }
}

/* Switch Styles */
.switch-container {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 15px;
}

.switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: .4s;
    border-radius: 24px;
}

.slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: .4s;
    border-radius: 50%;
}

input:checked + .slider {
    background-color: #1b68d8;
}

input:checked + .slider:before {
    transform: translateX(26px);
}

.switch-label {
    font-size: 14px;
    color: #666;
    font-weight: 500;
}

/* Estilos para contactos inactivos */
.inactive-user {
    opacity: 0.6;
    background-color: #f8f9fa;
    border: 2px dashed #dee2e6;
}

.inactive-user .user-name {
    color: #6c757d;
}

.inactive-user .user-email {
    color: #6c757d;
}

.inactive-user .user-phone {
    color: #6c757d;
}

.inactive-user .user-company {
    color: #6c757d;
}

.inactive-badge {
    background-color: #e85aa8;
    color: white;
    font-size: 10px;
    font-weight: bold;
    padding: 2px 6px;
    border-radius: 10px;
    text-align: center;
    margin-top: 5px;
    display: inline-block;
}

/* Estilos para tarjetas clickeables */
.stat-card.clickable {
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
}

.stat-card.clickable:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
}

.stat-card.clickable:hover .stat-number {
    color: white;
}

.stat-card.clickable:hover .stat-label {
    color: white;
}

.stat-card.clickable::after {
    content: "👆";
    position: absolute;
    top: 10px;
    right: 10px;
    font-size: 1.2em;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.stat-card.clickable:hover::after {
    opacity: 1;
}

/* Estilos para el icono de reportes */
.stat-icon {
    font-size: 2.5em;
    margin-bottom: 10px;
    display: block;
}

/* Menú de acciones compacto para conversaciones */
.dropdown, .dropup { position: relative; display: inline-block; }
.dropdown-menu {
    display: none;
    position: absolute; /* se sobrescribe a fixed en runtime para flotar sobre la tabla */
    z-index: 1000;
    background: #ffffff;
    border: 1px solid #e9ecef;
    border-radius: 10px;
    min-width: 160px;
    padding: 6px 0;
    margin: 0;
    list-style: none;
    box-shadow: 0 8px 20px rgba(0,0,0,0.12);
}
.dropdown-menu.show { display: block; }
.dropdown .dropdown-menu { top: calc(100% + 6px); left: 0; right: auto; bottom: auto; }
.dropdown-menu li { list-style: none; }
.dropdown-menu .dropdown-divider { margin: 4px 0; border-top: 1px solid #e9ecef; }
.actions-menu {
    min-width: 180px;
    padding: 6px 0;
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(0,0,0,0.15);
}
.actions-menu .dropdown-item {
    padding: 8px 14px;
    font-size: 0.95em;
    text-align: center; /* centrado */
    color: #000 !important; /* texto en negro */
}
.actions-menu .dropdown-item:hover,
.actions-menu .dropdown-item:focus,
.actions-menu .dropdown-item:active {
    background: transparent !important; /* sin highlight */
    color: #000 !important;
    outline: none;
    box-shadow: none;
    text-decoration: none;
}

/* =====================================================
   ESTILOS PARA TABLA DE CONVERSACIONES (look Message Log)
   ===================================================== */
.conversations-section {
    margin-top: 24px;
}

.conversations-container {
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 6px 18px rgba(0,0,0,0.08);
    overflow: hidden;
}

.conversations-header {
    background: #1b68d8;
    color: #ffffff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.conversations-header h3 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}
.conversations-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}
.conversations-actions .form-control {
    border-radius: 8px;
    border: 1px solid #e1e5e9;
    padding: 8px 12px;
    min-width: 260px;
}
.conversations-actions .btn {
    border-radius: 8px;
}

.conversations-grid { /* cuerpo */
    padding: 16px;
}

.conversations-tabs {
    background: #ffffff;
    border-bottom: 1px solid #eef2f7;
    padding: 10px 16px;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.conversations-tabs .conv-tab {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 999px;
    border: 1px solid #e1e5e9;
    background: #f8fafc;
    color: #333;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    user-select: none;
}

.conversations-tabs .conv-tab.active {
    border-color: #1b68d8;
    background: #1b68d8;
    color: #fff;
}

.conversations-tabs .conv-tab .badge {
    background: rgba(255,255,255,0.2);
    color: inherit;
    border: 1px solid rgba(255,255,255,0.35);
    border-radius: 999px;
    padding: 2px 8px;
    font-size: 0.8rem;
}

.conversations-grid .table-wrapper {
    width: 100%;
    overflow-x: auto;
}

.conversations-grid table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
}

.conversations-grid thead th {
    background: #f2f5fb;
    color: #1b68d8;
    font-weight: 600;
    padding: 12px;
    border-bottom: 2px solid #e9ecef;
    white-space: nowrap;
}

.conversations-grid tbody td {
    padding: 12px;
    border-bottom: 1px solid #eef2f7;
    vertical-align: middle;
    color: #333;
}

.conversations-grid tbody tr:hover {
    background: #f8fafc;
}

.conversations-grid thead th:first-child { border-top-left-radius: 8px; }
.conversations-grid thead th:last-child { border-top-right-radius: 8px; }

/* Alinear el botón de acciones a la derecha si se desea aplicando text-end en td */
.conversations-grid td:last-child { white-space: nowrap; }
