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

.navbar {
    background: white;
    height: var(--app-topbar-height);
    min-height: var(--app-topbar-height);
    max-height: var(--app-topbar-height);
    padding: 0 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* Panel admin American Canalium: sin logo/marca en topbar (/agente usa .main-header) */
.navbar.navbar--no-brand .navbar-brand img,
.navbar.navbar--no-brand .navbar-brand-text {
    display: none !important;
}

.navbar.navbar--no-brand:not(:has(.navbar-brand h2)) {
    justify-content: flex-end;
}

.navbar.navbar--no-brand .navbar-brand:empty {
    display: none;
}

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

.navbar-brand img {
    width: 26px;
    height: 26px;
    object-fit: contain;
    flex-shrink: 0;
}

.navbar-brand-text {
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.3px;
    color: #1b68d8;
    line-height: 1;
    text-transform: uppercase;
}

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

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.85rem;
    height: 100%;
}

.user-info .language-selector {
    padding: 4px 8px;
    font-size: 0.8rem;
    margin-right: 0;
    height: 28px;
    line-height: 1;
}

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

.log-btn {
    padding: 5px 9px;
    background: #ffc107;
    color: #212529;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    margin-right: 4px;
    font-size: 0.82rem;
    line-height: 1.1;
}

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

.logout-btn {
    padding: 5px 9px;
    background: #e85aa8;
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    font-size: 0.82rem;
    line-height: 1.1;
}

/* ══════════════════════════════════════════════════
   SIDEBAR IZQUIERDO (fijo, plegable)
══════════════════════════════════════════════════ */

/* Contenedor raíz con barra lateral (dashboard, reportes, etc.) */
.app-with-sidebar,
.dashboard {
    --sidebar-width-expanded: 260px;
    --sidebar-width-collapsed: 72px;
    --sidebar-width: var(--sidebar-width-expanded);
    --app-topbar-height: 56px;
}

.app-with-sidebar.sidebar-collapsed,
.dashboard.sidebar-collapsed {
    --sidebar-width: var(--sidebar-width-collapsed);
}

.app-with-sidebar .navbar,
.app-with-sidebar .main-content,
.dashboard .navbar,
.dashboard .main-content {
    margin-left: var(--sidebar-width);
    width: calc(100% - var(--sidebar-width));
    max-width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                width 0.28s cubic-bezier(0.4, 0, 0.2, 1),
                max-width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.sidebar-toggle-icon--expand {
    display: none;
}

.app-with-sidebar.sidebar-collapsed .sidebar-toggle-icon--collapse,
.dashboard.sidebar-collapsed .sidebar-toggle-icon--collapse {
    display: none;
}

.app-with-sidebar.sidebar-collapsed .sidebar-toggle-icon--expand,
.dashboard.sidebar-collapsed .sidebar-toggle-icon--expand {
    display: inline-block;
}

/* Sidebar siempre visible */
.left-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: #ffffff;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.08);
    z-index: 1200;
    display: flex;
    flex-direction: column;
    transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
}

/* Cabecera azul: toda la zona abre/cierra el sidebar */
.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: var(--app-topbar-height);
    min-height: var(--app-topbar-height);
    max-height: var(--app-topbar-height);
    padding: 0 20px;
    background: #1b68d8;
    color: white;
    flex-shrink: 0;
    gap: 8px;
    cursor: pointer;
    user-select: none;
    border: none;
    width: 100%;
    box-sizing: border-box;
    transition: background 0.2s;
}

.sidebar-header:hover {
    background: #1859c0;
}

.sidebar-header:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: -2px;
}

.left-sidebar.is-collapsed .sidebar-header {
    justify-content: center;
    padding: 0 10px;
}

.sidebar-title {
    font-size: 1em;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    max-width: 200px;
    transition: opacity 0.2s, max-width 0.28s;
    text-align: center;
}

.left-sidebar.is-collapsed .sidebar-title {
    opacity: 0;
    max-width: 0;
    padding: 0;
}

.sidebar-header-logo {
    position: absolute;
    right: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 30px;
    border-radius: 6px;
    background: rgba(255, 255, 255, 0.18);
    flex-shrink: 0;
    transition: background 0.2s;
    overflow: hidden;
}

.sidebar-header:hover .sidebar-header-logo {
    background: rgba(255, 255, 255, 0.28);
}

.sidebar-header-logo img {
    width: 22px;
    height: 22px;
    object-fit: contain;
}

.left-sidebar.is-collapsed .sidebar-header-logo {
    position: static;
    margin: 0 auto;
}

/* Lista de navegación */
.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 10px 0;
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-nav li {
    margin: 0;
}

.sidebar-divider {
    height: 1px;
    background: #e8edf3;
    margin: 8px 16px;
    transition: margin 0.28s;
}

.left-sidebar.is-collapsed .sidebar-divider {
    margin: 8px 12px;
}

.sidebar-nav-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 13px 20px;
    color: #2d3748;
    font-size: 0.95em;
    font-weight: 500;
    cursor: pointer;
    text-decoration: none;
    border-radius: 0;
    transition: background 0.15s, color 0.15s, padding 0.28s, gap 0.28s;
    border-left: 3px solid transparent;
    user-select: none;
}

.left-sidebar.is-collapsed .sidebar-nav-item {
    justify-content: center;
    padding: 12px 10px;
    gap: 0;
}

.sidebar-nav-item:hover {
    background: #f0f5ff;
    color: #1b68d8;
    border-left-color: #1b68d8;
}

.left-sidebar.is-collapsed .sidebar-nav-item:hover {
    padding-left: 10px;
}

.left-sidebar:not(.is-collapsed) .sidebar-nav-item:hover {
    padding-left: 24px;
}

/* Iconos con color de fondo */
.sidebar-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95em;
    flex-shrink: 0;
    transition: transform 0.15s;
    background: #eaf2ff;
    color: #1b68d8;
}

.sidebar-nav-item:hover .sidebar-icon {
    transform: scale(1.08);
}

.sidebar-label {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    opacity: 1;
    max-width: 180px;
    transition: opacity 0.2s, max-width 0.28s;
}

.left-sidebar.is-collapsed .sidebar-label {
    opacity: 0;
    max-width: 0;
    flex: 0;
}

.sidebar-ext-icon {
    font-size: 0.72em;
    color: #aab;
    flex-shrink: 0;
    opacity: 1;
    transition: opacity 0.2s;
}

.left-sidebar.is-collapsed .sidebar-ext-icon {
    opacity: 0;
    width: 0;
    overflow: hidden;
}

/* Item especial: Canalium Calls */
.sidebar-nav-item--calls {
    color: #2d3748;
}

.sidebar-nav-item--calls:hover {
    background: #f0f5ff;
    color: #1b68d8;
    border-left-color: #1b68d8;
}

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

.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);
}

/* ── WhatsApp API Manager modal ── */
.whatsapp-manager-modal .modal-content {
    border: none;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 24px 48px rgba(27, 104, 216, 0.15);
}

.whatsapp-manager-modal .wm-modal-header {
    background: linear-gradient(135deg, #1b68d8 0%, #2a5298 100%);
    color: #fff;
    border: none;
    padding: 1.25rem 1.5rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
}

.whatsapp-manager-modal .wm-modal-header__brand {
    display: flex;
    align-items: center;
    gap: 14px;
    min-width: 0;
}

.whatsapp-manager-modal .wm-modal-header__icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.2);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}

.whatsapp-manager-modal .wm-modal-subtitle {
    font-size: 0.85rem;
    opacity: 0.9;
    margin-top: 2px;
}

.whatsapp-manager-modal .wm-modal-close {
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    border: none;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.2);
    color: #fff;
    font-size: 1.15rem;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s, transform 0.15s;
    padding: 0;
    line-height: 1;
}

.whatsapp-manager-modal .wm-modal-close:hover {
    background: rgba(255, 255, 255, 0.35);
    color: #fff;
    transform: scale(1.05);
}

.whatsapp-manager-modal .wm-modal-close:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.85);
    outline-offset: 2px;
}

.whatsapp-manager-modal .wm-modal-body {
    padding: 1.5rem;
    background: #f5f7fb;
}

.whatsapp-manager-modal .wm-panel {
    background: #fff;
    border: 1px solid #e8edf3;
    border-radius: 12px;
    overflow: hidden;
    height: 100%;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

.whatsapp-manager-modal .wm-panel__head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: #f8fafc;
    border-bottom: 1px solid #e8edf3;
    font-weight: 600;
    font-size: 0.95rem;
    color: #1b68d8;
}

.whatsapp-manager-modal .wm-panel__head i {
    width: 20px;
    text-align: center;
    opacity: 0.9;
}

.whatsapp-manager-modal .wm-panel__body {
    padding: 1.25rem 1.25rem 1.5rem;
}

.whatsapp-manager-modal .wm-panel .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: #4a5568;
    margin-bottom: 0.35rem;
}

.whatsapp-manager-modal .wm-panel .form-control {
    border-radius: 8px;
    border: 1px solid #dde3ec;
    padding: 0.65rem 0.85rem;
    font-size: 0.9rem;
}

.whatsapp-manager-modal .wm-panel .form-control:focus {
    border-color: #1b68d8;
    box-shadow: 0 0 0 3px rgba(27, 104, 216, 0.15);
}

.whatsapp-manager-modal .wm-status-card {
    background: #f8fafc;
    border: 1px solid #e8edf3;
    border-radius: 10px;
    padding: 1rem 1.15rem;
    margin-bottom: 1.25rem;
    min-height: 52px;
    display: flex;
    align-items: center;
}

.whatsapp-manager-modal .wm-status-card--success {
    background: #edf9f6;
    border-color: #b8e8dc;
}

.whatsapp-manager-modal .wm-status-card--error {
    background: #fef2f6;
    border-color: #f5c6d8;
}

.whatsapp-manager-modal .wm-actions-grid {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.whatsapp-manager-modal .wm-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 0.7rem 1rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    border: none;
    transition: transform 0.15s, box-shadow 0.15s;
}

.whatsapp-manager-modal .wm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.whatsapp-manager-modal .wm-btn--primary {
    background: #1b68d8;
    color: #fff;
}

.whatsapp-manager-modal .wm-btn--success {
    background: #4ab8a6;
    color: #fff;
}

.whatsapp-manager-modal .wm-btn--warning {
    background: #f0ad4e;
    color: #fff;
}

.whatsapp-manager-modal .wm-panel--logs .wm-panel__head {
    border-radius: 12px 12px 0 0;
}

.whatsapp-manager-modal .wm-logs {
    height: 220px;
    overflow-y: auto;
    padding: 1rem 1.15rem;
    background: #1e293b;
    color: #e2e8f0;
    font-family: ui-monospace, 'Cascadia Code', 'Consolas', monospace;
    font-size: 0.82rem;
    line-height: 1.55;
    border-radius: 0 0 12px 12px;
}

.whatsapp-manager-modal .wm-logs__placeholder {
    color: #94a3b8 !important;
    font-style: italic;
}

.whatsapp-manager-modal .wm-log-line {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.whatsapp-manager-modal .wm-log-line .wm-log-time {
    color: #64748b;
    margin-right: 8px;
}

.whatsapp-manager-modal .wm-modal-footer {
    background: #fff;
    border-top: 1px solid #e8edf3;
    padding: 1rem 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .navbar {
        padding: 0 16px;
    }
    
    .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;
}

.agents-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;
}

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

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

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

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

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

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

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

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

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

.agents-list-name-cell {
    display: flex;
    align-items: center;
    gap: 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;
}

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

.status-badge.status-available {
    background: #17a2b8;
    color: white;
}

.user-avatar-small {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    aspect-ratio: 1 / 1;
    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;
    line-height: 1;
    overflow: hidden;
}

.agent-avatar-small {
    width: 32px;
    height: 32px;
    min-width: 32px;
    min-height: 32px;
    max-width: 32px;
    max-height: 32px;
    aspect-ratio: 1 / 1;
    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;
    position: relative;
    line-height: 1;
    overflow: hidden;
    box-sizing: border-box;
}

.agent-avatar-small .avatar-initials {
    display: block;
    line-height: 1;
    letter-spacing: -0.02em;
    white-space: nowrap;
    pointer-events: none;
}

.agent-avatar-small.has-two-letters {
    font-size: 0.72em;
}

.agents-list-table .agent-avatar-small .agent-status-indicator {
    width: 10px;
    height: 10px;
    bottom: -1px;
    right: -1px;
    border-width: 1px;
}

.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;
    }
}

/* Header violeta solo para gestión de empresas */
.users-manager-section--companies .users-header {
    background: linear-gradient(135deg, #7c3aed, #5b21b6);
}

/* 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;
}

/* 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;
}

/* Vista TV embebida en dashboard — 2 columnas (Asignados | Cola) */
.conversations-tv-grid {
    padding: 12px;
    background: #eef1f5;
}

.conversations-tv-grid .tv-columns--dashboard {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    min-height: 520px;
    height: calc(100vh - 420px);
    max-height: 900px;
}

.conversations-tv-grid .tv-column {
    min-height: 0;
}

.conversations-tv-grid .tv-column-body .conversation-item {
    cursor: default;
}

.conversations-tv-grid .tv-column-body .conversation-item:hover {
    transform: none;
}

@media (max-width: 1100px) {
    .conversations-tv-grid .tv-columns--dashboard {
        grid-template-columns: 1fr;
        height: auto;
        max-height: none;
    }

    .conversations-tv-grid .tv-column {
        min-height: 320px;
    }
}

/* Columnas TV embebidas — reutiliza clases de agente-tv sin estilos globales de página completa */
.conversations-tv-grid .tv-column {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 0;
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
    overflow: hidden;
}

.conversations-tv-grid .tv-column--queue {
    border: 2px solid rgba(232, 90, 168, 0.35);
}

.conversations-tv-grid .tv-column-header {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: linear-gradient(135deg, #1b68d8 0%, #2d7ee8 100%);
    color: #fff;
}

.conversations-tv-grid .tv-column--queue .tv-column-header {
    background: linear-gradient(135deg, #e85aa8 0%, #d63384 100%);
}

.admin-panel .conversations-tv-grid .tv-column-header h2,
.admin-panel .conversations-tv-grid .tv-column-header h2 span {
    margin: 0;
    margin-bottom: 0;
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    text-align: left;
}

.conversations-tv-grid .tv-column-count {
    background: rgba(255, 255, 255, 0.25);
    padding: 4px 12px;
    border-radius: 14px;
    font-size: 0.9rem;
    font-weight: 800;
    font-variant-numeric: tabular-nums;
}

.conversations-tv-grid .tv-column-body {
    flex: 1;
    overflow-y: auto;
    background: #fff;
}

.conversations-tv-grid .tv-empty-column {
    text-align: center;
    padding: 32px 16px;
    color: #888;
    font-size: 0.95rem;
}

.conversations-tv-grid .tv-contact-company-row {
    margin: 6px 0 2px;
    padding: 0 4px;
}

.conversations-tv-grid .tv-contact-company {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 700;
    color: #4a3f8c;
    background: linear-gradient(135deg, #f0ecff 0%, #e8e2ff 100%);
    border: 1px solid rgba(92, 77, 158, 0.35);
    border-radius: 8px;
    padding: 5px 10px;
    line-height: 1.3;
    word-break: break-word;
    max-width: 100%;
}

.conversations-tv-grid .tv-column--queue .conversation-item.juju-sla-item {
    background: linear-gradient(135deg, #fff0f0 0%, #ffe0e0 45%, #ffd0d0 100%);
    border-left: 7px solid #dc3545;
    box-shadow:
        0 0 0 3px rgba(220, 53, 69, 0.45),
        0 6px 20px rgba(220, 53, 69, 0.35);
    animation: dashboard-juju-queue-pulse 1.6s ease-in-out infinite;
    border-radius: 10px;
    margin: 8px 6px;
}

.conversations-tv-grid .tv-juju-queue-badge {
    display: inline-flex;
    align-items: center;
    margin-left: 8px;
    padding: 3px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    color: #fff;
    background: linear-gradient(135deg, #dc3545 0%, #a71d2a 100%);
    box-shadow: 0 2px 8px rgba(167, 29, 42, 0.45);
    vertical-align: middle;
}

@keyframes dashboard-juju-queue-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 3px rgba(220, 53, 69, 0.4),
            0 6px 18px rgba(220, 53, 69, 0.3);
    }
    50% {
        box-shadow:
            0 0 0 5px rgba(220, 53, 69, 0.65),
            0 8px 24px rgba(220, 53, 69, 0.45);
    }
}

.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.conv-dashboard-row {
    cursor: pointer;
}

.conversations-grid tbody tr.conv-dashboard-row:hover {
    background: #eef5ff;
}

.conversations-grid tbody tr.conv-dashboard-row:active {
    background: #e3edff;
}

.conversations-grid tbody tr.conv-dashboard-actions,
.conversations-grid tbody td.conv-dashboard-actions {
    cursor: default;
}

.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; }

/* Pantalla de carga (logo Canalium) */
.app-loading-screen {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 99999;
    background: #f8f9fa;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}
.app-loading-screen.hiding {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}
.app-loading-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}
.app-loading-logo {
    max-width: 200px;
    height: auto;
    object-fit: contain;
}
.app-loading-spinner {
    width: 40px;
    height: 40px;
    border: 4px solid #e1e5e9;
    border-top-color: #1b68d8;
    border-radius: 50%;
    animation: app-loading-spin 0.9s linear infinite;
}
@keyframes app-loading-spin {
    to { transform: rotate(360deg); }
}
.app-loading-text {
    margin: 0;
    font-size: 14px;
    color: #666;
    font-weight: 500;
}
