html {
    font-size: 14px;
    /* Escala global unificada más pequeña */
}

body {
    background-color: #fafbfd;
    /* Gris ultra claro */
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    font-size: 0.85rem;
    color: #3c4043;
}

:root {
    --bs-font-sans-serif: 'Inter', system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif !important;
    --bs-body-font-family: var(--bs-font-sans-serif) !important;
}

body,
h1,
h2,
h3,
h4,
h5,
h6,
.modal,
.form-control,
.form-select,
.btn,
.badge,
.table,
th,
td,
p,
span,
div,
a {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

.bi,
.fas,
.far,
.fab,
.nav-icon {
    font-family: bootstrap-icons !important;
    /* Excluir iconos de la fuente Inter dura para evitar que se rompan */
}

.fade-in {
    animation: fadeIn 0.35s ease-out;
}

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

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ----- Sidebar ----- */
.sidebar {
    width: 220px;
    background-color: #ffffff;
    border-right: 1px solid #e0e4e8;
    z-index: 1000;
}

.brand-logo {
    width: 32px;
    height: 32px;
    background-color: #0d6efd;
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.1rem;
}

.nav-link.custom-nav {
    color: #5f6368;
    border-radius: 0.375rem;
    margin-bottom: 2px;
    font-weight: 500;
    font-size: 0.82rem;
    padding: 0.35rem 0.85rem;
    transition: background-color 0.2s, color 0.2s;
}

.nav-link.custom-nav:hover {
    background-color: #f1f3f4;
    color: #202124;
}

/* Item Activo (Estilo CRM Gris Claro) */
.nav-link.custom-nav.active-nav {
    background-color: #f1f3f4;
    color: #202124;
    font-weight: 600;
}

/* Ítems de submenú (hijos del acordeón) */
.nav-link.custom-nav.sub-nav {
    font-weight: 400;
    font-size: 0.82rem;
    color: #5f6368;
    padding-left: 0.6rem;
}

.nav-link.custom-nav.sub-nav i {
    margin-right: 0.65rem;
    opacity: 0.8;
}

.nav-link.custom-nav.sub-nav.active-nav {
    font-weight: 500;
    color: #202124;
}

.nav-icon {
    font-size: 0.9rem;
    margin-right: 0.65rem;
    opacity: 0.8;
    line-height: 1;
}

.sidebar-heading {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: #9aa0a6;
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
    letter-spacing: 0.5px;
}

/* ----- Encabezado estándar de vistas ----- */
.view-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: 45px !important;
    margin-bottom: 1.25rem !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
}

.view-header h5 {
    font-size: 0.9rem !important;
    font-weight: 600 !important;
    color: #3c4043 !important;
    margin-bottom: 0 !important;
}

.view-header h5 i {
    color: #1a73e8;
    font-size: 1.1rem;
}

/* ----- Top Bar (Panel Cabecera) ----- */
.top-header {
    background-color: #ffffff;
    border-bottom: 1px solid #e0e4e8;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.5rem;
}

.header-tabs {
    display: flex;
    height: 100%;
}

.header-tab {
    height: 100%;
    display: flex;
    align-items: center;
    padding: 0 1rem;
    color: #5f6368;
    font-weight: 500;
    font-size: 0.9rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    transition: all 0.2s;
}

.header-tab.active {
    color: #1a73e8;
    border-bottom: 3px solid #1a73e8;
    font-weight: 600;
}

.header-tab:hover {
    background-color: #f8f9fa;
}

.header-tools {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* ----- Footer de Usuario ----- */
.user-footer {
    border-top: 1px solid #e0e4e8;
    padding: 1rem;
    display: flex;
    align-items: center;
}

.user-avatar {
    width: 36px;
    height: 36px;
    background-color: #e8eaed;
    color: #5f6368;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 0.9rem;
    margin-right: 0.75rem;
}

.user-info {
    line-height: 1.2;
}

.user-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: #3c4043;
}

.user-email {
    font-size: 0.75rem;
    color: #80868b;
}

/* Rediseño de componentes nativos bootstrap de Asterisk PBX */
#app-content .card {
    border: 1px solid #e0e4e8 !important;
    box-shadow: none !important;
    border-radius: 8px;
}

#app-content .shadow-sm {
    box-shadow: 0 1px 2px 0 rgba(60, 64, 67, 0.05) !important;
}

#app-content .bg-primary {
    background-color: #1a73e8 !important;
    /* Azul Google Material */
}

/* ----- Estilos Globales de Tablas (CRM Estilo XHability) ----- */
#app-content .table {
    white-space: nowrap !important;
    border-collapse: separate;
    border-spacing: 0;
    width: 100%;
    margin-bottom: 0;
}

#app-content .table thead th {
    background-color: #fafbfd !important;
    color: #5f6368 !important;
    font-weight: 500 !important;
    font-size: 0.85rem;
    text-align: center !important;
    text-transform: none !important;
    padding: 0.5rem 0.8rem !important;
    border-bottom: 1px solid #e0e4e8 !important;
    border-top: none !important;
    letter-spacing: normal !important;
}

#app-content .table tbody td {
    background-color: #ffffff;
    color: #3c4043;
    font-size: 0.85rem;
    padding: 0.5rem 0.8rem !important;
    border-bottom: 1px solid #e0e4e8 !important;
    vertical-align: middle;
}

#app-content .table tbody tr:hover td {
    background-color: #f8f9fa !important;
}

/* Sticky Action Column */
#app-content .table .sticky-action {
    position: sticky;
    right: 0;
    z-index: 10;
    background-color: #ffffff !important;
    border-left: 1px solid #e0e4e8 !important;
    box-shadow: -6px 0 10px rgba(0, 0, 0, 0.05);
    width: 1%;
    white-space: nowrap;
}

#app-content .table thead th.sticky-action {
    background-color: #fafbfd !important;
    border-left: 1px solid #e0e4e8 !important;
    z-index: 11;
}

#app-content .table tbody tr:hover td.sticky-action {
    background-color: #f8f9fa !important;
}

#app-content .table-light {
    background-color: transparent !important;
}

/* ----- Estilos Globales de Badges (Pills CRM) ----- */
#app-content .badge {
    font-weight: 500;
    letter-spacing: 0.3px;
    padding: 0.4em 0.8em;
    border: 1px solid transparent;
    border-radius: 4px !important;
    box-shadow: none !important;
}

/* ----- Mini Sparklines Animados para Tarjetas Dashboard ----- */
.mini-wave {
    display: flex;
    align-items: flex-end;
    height: 28px;
    gap: 3px;
    opacity: 0.5;
    transition: opacity 0.3s ease;
}

.mini-wave.active {
    opacity: 0.8;
}

.mini-wave .bar {
    width: 4px;
    border-radius: 2px;
    background-color: currentColor;
    animation: wave-bounce 1.2s infinite ease-in-out;
}

.mini-wave.inactive .bar {
    animation-play-state: paused;
    height: 4px !important;
    transform: none !important;
}

.mini-wave .bar:nth-child(1) {
    animation-delay: -1.2s;
    height: 40%;
}

.mini-wave .bar:nth-child(2) {
    animation-delay: -1.0s;
    height: 100%;
}

.mini-wave .bar:nth-child(3) {
    animation-delay: -0.8s;
    height: 60%;
}

.mini-wave .bar:nth-child(4) {
    animation-delay: -0.6s;
    height: 80%;
}

.mini-wave .bar:nth-child(5) {
    animation-delay: -0.4s;
    height: 50%;
}

.mini-wave .bar:nth-child(6) {
    animation-delay: -0.2s;
    height: 90%;
}

.mini-wave .bar:nth-child(7) {
    animation-delay: 0s;
    height: 30%;
}

@keyframes wave-bounce {

    0%,
    100% {
        height: 20%;
    }

    50% {
        height: 100%;
    }
}

#app-content .bg-success,
#app-content .bg-success.bg-opacity-10 {
    background-color: #e6f4ea !important;
    color: #137333 !important;
    border-color: #ceead6 !important;
}

#app-content .bg-danger,
#app-content .badge.bg-danger {
    background-color: #fce8e6 !important;
    color: #c5221f !important;
    border-color: #fad2cf !important;
}

#app-content .bg-warning {
    background-color: #fef7e0 !important;
    color: #b06000 !important;
    border-color: #fce8b2 !important;
}

#app-content .bg-info {
    background-color: #e8f0fe !important;
    color: #1a73e8 !important;
    border-color: #d2e3fc !important;
}

#app-content .bg-secondary {
    background-color: #f1f3f4 !important;
    color: #5f6368 !important;
    border-color: #e0e4e8 !important;
}

::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: #dadce0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #bdc1c6;
}

/* ----- Modales Estilo Linear/Apple ----- */
.modal-backdrop.show {
    opacity: 0.4 !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    background-color: #000;
}

.modal-content {
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    border-radius: 16px !important;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12) !important;
    overflow: hidden;
    background-color: #ffffff;
}

.modal-header {
    background-color: #ffffff !important;
    color: #202124 !important;
    border-bottom: 1px solid #f1f3f4 !important;
    padding: 1.25rem 1.75rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    min-height: auto;
}

.modal-title {
    display: flex !important;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    letter-spacing: -0.3px;
    margin: 0 !important;
}

.modal-header .btn-close {
    display: block !important;
    font-size: 0.8rem !important;
    background-size: 0.8em;
    opacity: 0.4 !important;
    transition: opacity 0.2s;
    margin: 0;
}

.modal-header .btn-close:hover {
    opacity: 0.8 !important;
}

.modal-body {
    background-color: #ffffff !important;
    padding: 1.25rem !important;
}

/* Campos de texto estilo Apple/Linear */
.modal-body .form-label {
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    color: #4a4d52 !important;
    margin-bottom: 0.3rem !important;
}

.modal-body .form-control,
.modal-body .form-select {
    background-color: #fafbfc !important;
    border: 1px solid #e0e4e8 !important;
    padding: 0.4rem 0.65rem !important;
    color: #202124 !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) inset !important;
    transition: all 0.2s ease !important;
    font-size: 0.85rem !important;
}

.modal-body .form-control:focus,
.modal-body .form-select:focus {
    border-color: #0d6efd !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(13, 110, 253, 0.15) !important;
}

.modal-footer {
    background-color: #fafbfc !important;
    border-top: 1px solid #f1f3f4 !important;
    padding: 1rem 1.75rem !important;
    display: flex !important;
    justify-content: flex-end !important;
    gap: 0.5rem;
}

.modal-footer .btn {
    padding: 0.5rem 1.25rem !important;
    font-weight: 500 !important;
    letter-spacing: 0.2px;
}

.modal-footer .btn-secondary,
.modal-footer .btn-light {
    background-color: #ffffff !important;
    color: #5f6368 !important;
    border: 1px solid #e0e4e8 !important;
}

.modal-footer .btn-secondary:hover,
.modal-footer .btn-light:hover {
    background-color: #f8f9fa !important;
    color: #202124 !important;
}

/* Auxiliares de Tipografía Estricta (CRM Topbar match) */
.fs-7 {
    font-size: 0.85rem !important;
}

.fs-8 {
    font-size: 0.75rem !important;
}

.form-label,
.text-uppercase {
    letter-spacing: 0.3px !important;
}

.text-muted {
    color: #5f6368 !important;
    /* Mismo color del status badge */
}

.fw-bold {
    font-weight: 600 !important;
    /* Ajustar el 700 nativo de Bootstrap a un 600 mas suave */
}

/* Estandarizar Inputs como los Badges */
.form-control,
.form-select {
    font-family: 'Inter', sans-serif !important;
    font-weight: 500 !important;
}

/* ===== Botones Cuadrados (CRM Global removidos overrides locales) ===== */

/* ===== Tamaño Unificado de Botones ===== */
.btn {
    font-size: 0.8rem !important;
    padding: 0.35rem 0.75rem !important;
}

.btn-lg {
    font-size: 0.95rem !important;
    padding: 0.5rem 1.2rem !important;
}

/* ===== Ocultar Cabeceras de Modales (Por rediseño CRM) ===== */
.modal-header {
    display: none !important;
}

/* ===== Tarjetas Unificadas (Estilo Dashboard) ===== */
.card {
    background-color: #ffffff !important;
    border: 1px solid #e0e4e8;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
    transition: all 0.2s ease-in-out;
}

.card-header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #f0f2f4 !important;
    font-weight: 600;
    font-size: 0.82rem;
    padding: 0.75rem 1rem !important;
    color: #3c4043;
}

.card-body {
    padding: 1rem !important;
}

.card-footer {
    background-color: #f8f9fa !important;
    border-top: 1px solid #e0e4e8 !important;
    padding: 0.5rem 1rem !important;
}

.feature-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.10) !important;
}

/* Estilos para el Perfil de Usuario en el Sidebar */
.sidebar-profile {
    transition: all 0.2s ease;
    cursor: pointer;
}

.hover-bg:hover {
    background-color: rgba(0, 0, 0, 0.04) !important;
}

.dropdown-menu-custom {
    background-color: #ffffff;
    border: 1px solid #e0e4e8;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.dropdown-menu-custom .dropdown-item {
    font-size: 0.82rem;
    padding: 0.6rem 1rem;
    color: #3c4043;
}

.dropdown-menu-custom .dropdown-item:hover {
    background-color: #f8f9fa;
    color: #1a73e8;
}

.dropdown-menu-custom .dropdown-divider {
    border-top: 1px solid #f1f3f4;
}

.dropdown-toggle::after {
    display: none !important;
    /* Forzar ocultar la flecha por defecto */
}

/* Forzar diseño brutalista (Bordes completamente cuadrados) */
*,
.rounded,
.rounded-0,
.rounded-1,
.rounded-2,
.rounded-3,
.rounded-4,
.rounded-5,
.rounded-circle,
.rounded-pill,
.rounded-top,
.rounded-bottom,
.rounded-start,
.rounded-end,
.btn,
.btn.rounded-pill,
.btn.rounded-circle,
.btn.rounded,
.btn.rounded-3,
.btn.rounded-4,
.btn.rounded-5,
.card,
.modal-content,
.modal-footer .btn,
.form-control,
.form-select,
.input-group-text,
.badge {
    border-radius: 0 !important;
}

/* Excepción: Los interruptores (toggles) sí deben ser redondeados */
.form-switch .form-check-input {
    border-radius: 2em !important;
}

/* ===== Paginación Estilo Compacto y Gris para todo el CRM ===== */
.pagination {
    margin-bottom: 0 !important;
}

.pagination .page-link {
    font-size: 0.65rem !important;
    padding: 0.15rem 0.35rem !important;
    color: #6c757d !important;
    background-color: #f8f9fa !important;
}

.pagination .page-item.active .page-link,
.pagination .page-link.bg-primary {
    background-color: #6c757d !important;
    border-color: #6c757d !important;
    color: white !important;
    box-shadow: none !important;
}

.pagination .page-link:hover {
    background-color: #e2e6ea !important;
    color: #495057 !important;
}

.pagination .page-item.disabled .page-link {
    background-color: transparent !important;
    color: #ced4da !important;
    opacity: 0.7;
}
/* --- Estilos extraídos de public/login.php --- */
body { 
            background-color: #f8fafc; 
            min-height: 100vh;
            display: flex;
            align-items: center;
        }
        .login-wrapper {
            width: 100%;
            max-width: 900px;
            margin: 0 auto;
            background: #ffffff;
            border-radius: 4px; /* Cuadrado clásico (sin exagerar) */
            box-shadow: 0 10px 40px rgba(0,0,0,0.08);
            overflow: hidden;
            border: 1px solid rgba(0,0,0,0.05);
        }
        .bg-login-brand {
            background: linear-gradient(135deg, #0d6efd 0%, #0a58ca 100%);
            position: relative;
        }
        .bg-login-brand::after {
            content: '';
            position: absolute;
            top: 0; left: 0; right: 0; bottom: 0;
            background-image: url('data:image/svg+xml;utf8,<svg viewBox="0 0 100 100" xmlns="http://www.w3.org/2000/svg"><path fill="rgba(255,255,255,0.05)" d="M0 0h100v100H0z"/></svg>');
            background-size: cover;
        }
        .btn-login {
            border-radius: 4px !important; /* Estrictamente no redondeado como pidió el user, estilo corporativo cuadrado */
            font-size: 0.95rem;
            letter-spacing: 0.5px;
        }
        .form-control:focus {
            box-shadow: none;
            border-color: #dee2e6; /* Gris neutro en vez de azul */
        }
        .input-group > .input-group-text:first-child {
            border-radius: 4px 0 0 4px !important;
        }
        .input-group > .form-control:last-child {
            border-radius: 0 4px 4px 0 !important;
        }
        .input-group > .form-control:not(:last-child) {
            border-radius: 0 !important;
        }
        .input-group > .input-group-text:last-child {
            border-radius: 0 4px 4px 0 !important;
        }

/* ===== Ajuste global para Softphone en portátiles/pantallas pequeñas de escritorio ===== */
#softphone-widget {
    max-height: calc(100vh - 20px);
    display: flex;
    flex-direction: column;
}

#softphone-widget[style*="display: block"] {
    display: flex !important;
}

#softphone-widget > .p-3 {
    flex: 1;
    overflow-y: auto;
    min-height: 0 !important; /* Sobrescribe el min-height: 480px inline */
}

/* ===== Responsive Mobile Styles (max-width: 768px) ===== */
@media (max-width: 768px) {
    /* Ocultar Sidebar y convertirlo en Offcanvas */
    .sidebar {
        position: fixed !important;
        left: 0;
        top: 0;
        bottom: 0;
        transform: translateX(-100%);
        transition: transform 0.3s ease-in-out;
        z-index: 1040 !important;
        box-shadow: 4px 0 15px rgba(0,0,0,0.1) !important;
    }
    
    .sidebar.sidebar-open {
        transform: translateX(0);
    }

    #mobile-backdrop {
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100vh;
        background: rgba(0,0,0,0.5);
        z-index: 1030;
        transition: opacity 0.3s;
    }

    .top-header {
        padding: 0 0.75rem;
    }
    
    .top-header .header-tools {
        padding-right: 0 !important;
        gap: 0.5rem !important;
    }

    /* Redimensionar Softphone a Pantalla Completa */
    #softphone-widget {
        width: 100vw !important;
        height: 100dvh !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        border-radius: 0 !important;
        border: none !important;
        z-index: 9999 !important; /* Cubrir toda la pantalla */
        flex-direction: column;
    }

    /* Ocultar en caso de display none inline, el JS de softphone hace display: block que sobreescribe flex si no usamos clases. 
       Para evitar conflictos, cuando se abra, lo forzaremos a flex. */
    #softphone-widget[style*="display: block"] {
        display: flex !important;
    }

    #softphone-widget > .p-3 {
        flex-grow: 1;
        display: flex;
        flex-direction: column;
        min-height: auto !important;
    }
    
    #softphone-widget .sp-view {
        flex-grow: 1;
    }

    /* Adjust padding of app content */
    #app-content-wrapper {
        padding: 1rem 0.5rem !important;
    }

    /* Ocultar elementos secundarios en mobile */
    .d-none-mobile {
        display: none !important;
    }
}

/* --- Estilos extraídos de public/index.php --- */
.sp-view {
            transition: opacity 0.2s ease;
        }

        .dialpad-grid {
            max-width: 240px;
            margin: 0 auto;
            gap: 12px !important;
        }

        .dial-btn {
            width: 62px;
            height: 62px;
            border-radius: 50%;
            font-size: 22px;
            font-weight: 700;
            border: none;
            background: #f7f9fa;
            color: #1e293b;
            display: flex;
            flex-direction: column;
            align-items: center;
            justify-content: center;
            line-height: 1;
            transition: background 0.1s;
            outline: none;
        }

        .dial-btn:hover {
            background: #e2e8f0;
        }

        .dial-btn:active {
            background: #d3d9df;
            transform: scale(0.95);
        }

        .dial-btn .letters {
            font-size: 11px;
            font-weight: 700;
            color: #adb5bd;
            letter-spacing: 1.5px;
            margin-top: 3px;
        }

        .action-btn {
            width: 85px;
            height: 55px;
            border-radius: 8px;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: transform 0.1s;
            color: white;
            cursor: pointer;
        }

        .action-btn i {
            font-size: 24px;
        }

        .action-btn:active {
            transform: scale(0.92);
        }

        .btn-call {
            background-color: #508b62;
        }

        .btn-call:hover {
            background-color: #3f704e;
        }

        .btn-hangup {
            background-color: #cc504e;
        }

        .btn-hangup:hover {
            background-color: #a84240;
        }

        .tool-btn {
            width: 55px;
            height: 55px;
            border-radius: 50%;
            border: 1px solid #dee2e6;
            background: #fff;
            color: #495057;
            display: flex;
            align-items: center;
            justify-content: center;
            transition: all 0.2s;
            outline: none;
        }

        .tool-btn:hover {
            background: #f8f9fa;
            color: #0d6efd;
            border-color: #0d6efd;
            transform: scale(1.05);
        }

        .tool-btn.active {
            background: #0d6efd;
            color: #fff;
            border-color: #0d6efd;
        }

        .sp-status-bar {
            letter-spacing: 1px;
            font-size: 0.85rem;
            text-transform: uppercase;
            font-weight: 700;
            border-radius: 0 !important;
            color: white !important;
            padding: 10px !important;
        }

        #softphone-widget .bg-success {
            background-color: #508b62 !important;
        }

        #softphone-widget .bg-danger {
            background-color: #cc504e !important;
        }

        #softphone-widget .bg-secondary {
            background-color: #64748b !important;
        }

        /* Custom Toggle Apple-Like */
        .custom-toggle {
            width: 44px;
            height: 24px;
            background: #475569;
            border: none;
            border-radius: 24px !important;
            position: relative;
            cursor: pointer;
            appearance: none;
            outline: none;
            transition: 0.3s;
        }

        .custom-toggle::after {
            content: '';
            width: 20px;
            height: 20px;
            background: white;
            border-radius: 50% !important;
            position: absolute;
            top: 2px;
            left: 2px;
            transition: 0.3s;
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
        }

        .custom-toggle:checked {
            background: #0ea5e9;
        }

        .custom-toggle:checked::after {
            left: 22px;
        }

        .custom-toggle:disabled {
            opacity: 0.4;
            cursor: not-allowed;
            filter: grayscale(80%);
        }

        .custom-toggle:disabled~label {
            opacity: 0.5;
            cursor: not-allowed;
        }

        /* Ocultamiento para transiciones */
        .sp-hidden {
            display: none !important;
        }

/* --- Estilos extraídos de public/views/chat.php --- */
.chat-sidebar {
        border-right: 1px solid #ebebeb;
        background: #ffffff;
        display: flex;
        flex-direction: column;
        height: 100%;
        max-height: 100%;
    }

    .chat-list {
        overflow-y: auto;
        flex: 1;
        min-height: 0;
    }

    .chat-item {
        transition: all 0.2s;
        cursor: pointer;
        border-left: 3px solid transparent;
    }

    .chat-item:hover {
        background-color: #f8f9fa;
    }

    .chat-item.active {
        background-color: #eef2fa;
        border-left: 3px solid #0d6efd;
    }

    .chat-avatar {
        width: 45px;
        height: 45px;
        object-fit: cover;
        border-radius: 50%;
    }

    .chat-main {
        display: flex;
        flex-direction: column;
        background: #e5ddd5;
        height: 100%;
        max-height: 100%;
        overflow: hidden;
    }

    .chat-messages {
        flex-grow: 1;
        overflow-y: auto;
        padding: 1.5rem;
        height: 0;
        background-color: #e5ddd5;
        background-image: url("data:image/svg+xml,%3Csvg width='52' height='26' viewBox='0 0 52 26' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23d1c9c1' fill-opacity='0.4'%3E%3Cpath d='M10 10c0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6h2c0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4 3.314 0 6 2.686 6 6 0 2.21 1.79 4 4 4v2c-3.314 0-6-2.686-6-6 0-2.21-1.79-4-4-4-3.314 0-6-2.686-6-6zm25.464-1.95l8.486 8.486-1.414 1.414-8.486-8.486 1.414-1.414z' /%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    }

    .bubble {
        max-width: 75%;
        padding: 0.75rem 1rem;
        border-radius: 1rem;
        position: relative;
        font-size: 0.95rem;
        line-height: 1.4;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    }

    .bubble-received {
        background: #ffffff;
        color: #333;
        border-bottom-left-radius: 4px;
        align-self: flex-start;
    }

    .bubble-sent {
        background: #0d6efd;
        color: #ffffff;
        border-bottom-right-radius: 4px;
        align-self: flex-end;
    }

    .chat-input-area {
        background: #ffffff;
        border-top: 1px solid #ebebeb;
        padding: 1rem 1.5rem;
        position: relative;
    }

    .chat-right-panel {
        background: #ffffff;
        border-left: 1px solid #ebebeb;
        overflow-y: auto;
    }

    .channel-badge {
        position: absolute;
        bottom: 0;
        right: 0;
        width: 18px;
        height: 18px;
        border-radius: 50%;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 0.65rem;
        color: white;
        border: 2px solid white;
    }

    .bg-whatsapp {
        background-color: #25D366;
    }

    .bg-messenger {
        background-color: #0084FF;
    }

    .bg-instagram {
        background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285AEB 90%);
    }

    .bg-web {
        background-color: #6c757d;
    }
    
    .no-focus-outline:focus {
        border-color: #dee2e6 !important;
        box-shadow: none !important;
        outline: none !important;
    }

    .chat-list::-webkit-scrollbar,
    .chat-messages::-webkit-scrollbar,
    .chat-right-panel::-webkit-scrollbar {
        width: 6px;
    }

    .chat-list::-webkit-scrollbar-thumb,
    .chat-messages::-webkit-scrollbar-thumb,
    .chat-right-panel::-webkit-scrollbar-thumb {
        background-color: rgba(0, 0, 0, 0.1);
        border-radius: 10px;
    }

    /* Emojis */
    .emoji-popup {
        position: absolute;
        bottom: 70px;
        left: 20px;
        display: none;
        z-index: 1000;
        box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
        border-radius: 8px;
        background: white;
        height: 350px;
        width: 320px;
        overflow: hidden;
    }

    .emoji-popup.show {
        display: block;
    }

    emoji-picker {
        width: 100%;
        height: 100%;
        --num-columns: 8;
        --emoji-size: 1.5rem;
    }

/* --- Estilos extraídos de public/views/chatbot.php --- */
:root {
        --cb-bg: #f8fafc;
        --cb-canvas-bg: #f1f5f9;
        --cb-grid: rgba(0, 0, 0, 0.05);
        --cb-text: #0f172a;
        --cb-text-muted: #64748b;
        --cb-accent: #0ea5e9;
        --cb-accent-gradient: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
        --cb-node-bg: #ffffff;
        --cb-glass-bg: rgba(255, 255, 255, 0.85);
        --cb-border: rgba(0, 0, 0, 0.08);
        --cb-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    }

    .cb-builder { 
        font-family: 'Plus Jakarta Sans', sans-serif; 
        height: calc(100vh - 100px); 
        min-height: 600px;
        display: flex; 
        flex-direction: column; 
        color: var(--cb-text); 
    }

    /* Views */
    .cb-view { display: none; height: 100%; animation: cb-fade 0.3s ease; }
    .cb-view.active { display: block; }

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

    /* Dashboard */
    .cb-grid { padding: 10px; }
    .cb-card { 
        background: white; border-radius: 24px; border: 1px solid var(--cb-border); padding: 24px;
        transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1); cursor: pointer; position: relative;
    }
    .cb-card:hover { transform: translateY(-8px); box-shadow: 0 20px 30px -10px rgba(0, 0, 0, 0.1); border-color: var(--cb-accent); }
    .cb-card .cb-icon { width: 50px; height: 50px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 1.5rem; margin-bottom: 16px; color: white; }
    .cb-bg-wa { background: #25d366; }
    .cb-bg-fb { background: #1877f2; }
    .cb-bg-ig { background: linear-gradient(45deg, #f09433, #e6683c, #dc2743, #cc2366, #bc1888); }

    /* Canvas */
    .cb-canvas-container { 
        position: relative; 
        flex-grow: 1; 
        background: var(--cb-canvas-bg); 
        overflow: hidden; 
        border-radius: 24px; 
        border: 1px solid var(--cb-border);
        min-height: 500px; /* Added to prevent collapse in SPA */
    }
    #cb-flow-canvas { width: 10000px; height: 10000px; position: absolute; transform-origin: 0 0; background-image: radial-gradient(var(--cb-grid) 1px, transparent 1px); background-size: 40px 40px; }
    
    .cb-node {
        position: absolute; width: 220px; background: var(--cb-node-bg); border-radius: 16px; overflow: hidden;
        box-shadow: var(--cb-shadow); border: 1px solid var(--cb-border); z-index: 20; cursor: grab;
    }
    .cb-node-header { padding: 10px 14px; font-weight: 700; font-size: 0.75rem; text-transform: uppercase; color: white; display: flex; justify-content: space-between; align-items: center; }
    .cb-node-body { padding: 12px; font-size: 0.85rem; color: var(--cb-text-muted); }

    .cb-type-trigger .cb-node-header { background: #f59e0b; }
    .cb-type-message .cb-node-header { background: #10b981; }
    .cb-type-condition .cb-node-header { background: #0ea5e9; }
    .cb-type-action .cb-node-header { background: #64748b; }
    .cb-type-wait .cb-node-header { background: #a855f7; }

    /* Ports */
    .cb-port { width: 12px; height: 12px; background: white; border: 3px solid var(--cb-canvas-bg); border-radius: 50%; position: absolute; z-index: 30; transition: transform 0.2s; box-shadow: 0 0 5px rgba(0,0,0,0.1); }
    .cb-port-in { left: -6px; top: 50%; transform: translateY(-50%); }
    .cb-port-out { right: -6px; top: 50%; transform: translateY(-50%); cursor: crosshair; }
    .cb-port:hover { transform: translateY(-50%) scale(1.3); border-color: var(--cb-accent); }

    .cb-line { position: absolute; height: 3px; background: var(--cb-accent); transform-origin: 0 50%; pointer-events: none; z-index: 5; opacity: 0.6; border-radius: 2px; }

    /* Toolbar */
    .cb-toolbar { 
        position: absolute; bottom: 30px; left: 50%; transform: translateX(-50%); 
        background: white;
        padding: 10px; border-radius: 20px; border: 1px solid var(--cb-border); 
        display: flex; gap: 12px; box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1); 
        z-index: 1000;
    }
    .cb-toolbar-btn { 
        width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; 
        border: none; color: white; transition: all 0.2s; cursor: pointer; font-size: 1.25rem;
    }
    .cb-toolbar-btn:hover { transform: translateY(-4px); box-shadow: 0 5px 15px rgba(0,0,0,0.1); filter: brightness(1.1); }

    /* Zoom Controls */
    .cb-zoom-controls {
        position: absolute; bottom: 30px; right: 30px; 
        background: white; padding: 6px; border-radius: 12px; border: 1px solid var(--cb-border);
        display: flex; flex-direction: column; gap: 4px; box-shadow: var(--cb-shadow);
        z-index: 1000;
    }
    .cb-zoom-btn {
        width: 36px; height: 36px; border-radius: 8px; border: none; background: #f1f5f9;
        color: var(--cb-text); display: flex; align-items: center; justify-content: center;
        transition: all 0.2s; cursor: pointer; font-size: 1rem;
    }
    .cb-zoom-btn:hover { background: var(--cb-accent); color: white; }
    .cb-zoom-info { font-size: 0.65rem; font-weight: 700; text-align: center; color: var(--cb-text-muted); padding: 4px 0; }

/* --- Estilos extraídos de public/views/roles.php --- */
/* Brutalist custom check */
.custom-check .form-check-input {
    border-radius: 0 !important;
    border: 2px solid #adb5bd;
    cursor: pointer;
    width: 1.1rem;
    height: 1.1rem;
    margin-top: 0.15rem;
}
.custom-check .form-check-input:checked {
    background-color: #0d6efd;
    border-color: #0d6efd;
}

/* --- Estilos extraídos de public/views/campaigns.php --- */
/* Utilities */
.progress-bar-animated {
    transition: width 0.5s ease;
}
.pulse-anim {
    animation: pulse-op 1.5s infinite;
}
@keyframes pulse-op {
    0% { opacity: 1; }
    50% { opacity: 0.5; }
    100% { opacity: 1; }
}
