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

*, h1, h2, h3, h4, h5, h6, .modal, .form-control, .form-select, .btn, .badge {
    font-family: 'Inter', system-ui, -apple-system, sans-serif !important;
}

.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: 250px;
    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.45rem 1rem;
    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;
}

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

/* ----- 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 {
    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.8rem;
    text-transform: none !important;
    padding: 1rem 1.5rem !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: 1rem 1.5rem !important;
    border-bottom: 1px solid #e0e4e8 !important;
    vertical-align: middle;
}

#app-content .table tbody tr:hover td {
    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;
}

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

/* ----- Estilos Globales de Modales (CRM Estilo XHability) ----- */
.modal-content {
    border: none !important;
    border-radius: 8px !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
}

.modal-header {
    background-color: #ffffff !important;
    color: #202124 !important;
    border-bottom: 1px solid #e0e4e8 !important;
    padding: 1.25rem 1.5rem !important;
}

.modal-header .modal-title {
    font-size: 1.15rem !important;
    font-weight: 500 !important;
    color: #202124 !important;
}

.modal-header i {
    color: #5f6368 !important; /* Desactiva el forzado blanco anterior */
}

.modal-header .btn-close {
    filter: invert(0) grayscale(100%) brightness(0%) opacity(50%) !important; /* Fuerza volver la X de blanca a negra/gris */
    margin-right: -0.5rem;
}

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

.modal-body .form-control, 
.modal-body .form-select {
    background-color: #f8f9fa !important;
    border: 1px solid #f1f3f4 !important;
    border-radius: 6px !important;
    padding: 0.6rem 0.8rem !important;
    color: #3c4043 !important;
    font-size: 0.9rem !important;
    box-shadow: none !important;
    transition: border-color 0.2s;
}

.modal-body .form-control:focus, 
.modal-body .form-select:focus {
    border-color: #1a73e8 !important;
    background-color: #ffffff !important;
}

.modal-body .form-label {
    font-size: 0.85rem !important;
    font-weight: 500 !important;
    color: #5f6368 !important;
    margin-bottom: 0.4rem !important;
}

.modal-footer {
    background-color: #ffffff !important;
    border-top: 1px solid #e0e4e8 !important;
    padding: 1rem 1.5rem !important;
}

.modal-footer .btn {
    padding: 0.5rem 1.5rem !important;
    font-weight: 500 !important;
    border-radius: 6px !important;
    font-size: 0.9rem;
    letter-spacing: 0.2px;
}

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

.modal-footer .btn-secondary:hover, 
.modal-footer .btn-light:hover,
.modal-footer .btn-danger:hover {
    background-color: #f1f3f4 !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) ===== */
.btn,
.btn.rounded-pill,
.btn.rounded,
.btn.rounded-3 {
    border-radius: 4px !important;
}

/* Los del modal también */
.modal-footer .btn {
    border-radius: 4px !important;
}

/* ===== Tamaño Unificado de Botones ===== */
.btn {
    font-size: 0.82rem !important;
    padding: 0.4rem 0.9rem !important;
}

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

/* ===== Ocultar Título de Modales ===== */
.modal-title {
    display: none !important;
}

.modal-header {
    justify-content: flex-end !important;
    padding: 0.6rem 1rem !important;
    min-height: auto !important;
}

.modal-header .btn-close {
    display: none !important;
}

/* ===== Tarjetas Unificadas (Estilo Dashboard) ===== */
.card {
    background-color: #ffffff !important;
    border: 1px solid #e0e4e8;
    border-radius: 8px;
    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: 1rem 1.25rem !important;
    color: #3c4043;
}

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

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

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