#sidebar {
    min-width: 160px;
    max-width: 160px;
    height: 100%;
    min-height: 100vh;
    z-index: 999;
    background-color: #060c2c;
    border-right: 1px solid #0d1d5c;
    overflow-y: auto;
    flex-shrink: 0;
}

#content {
    height: 100%;
    min-height: 100vh;
    background-color: #f4f4f4 !important;
    overflow-y: auto;
    flex-grow: 1;
}

.main-content {
    padding-top: 20px;
    padding-left: 20px;
    padding-right: 20px;
    background-color: #f4f4f4 !important;
}

.sidebar-header {
    padding-top: 20px;
}

.sidebar-header h3 {
    font-size: 1.5rem;
    padding: 15px 15px 0;
    color: #ecf0f1;
}

#sidebar .list-unstyled li a {
    font-size: 1.2rem;
    padding: 10px 15px;
    display: block;
    color: #ffffff;
}

#sidebar .list-unstyled li ul li a {
    font-size: 1.1rem;
    padding-left: 30px;
}

.page-title {
    margin-bottom: 20px;
}

@media (max-width: 768px) {
    #sidebar {
        margin-left: -160px;
    }

    #content {
        width: 100%;
    }
}

.sidebar-nav .nav-link {
    padding: .5rem 1rem;
    font-size: 1.1rem;
    color: #ffffff;
}

.sidebar-nav .nav-link:hover {
    background-color: #0d1d5c;
}

.sidebar-nav .nav-link[data-toggle="collapse"] {
    position: relative;
    padding-right: 1.5rem;
}

.sidebar-nav .nav-link i {
    font-size: 1.2rem;
    margin-right: 10px;
    color: #ffffff;
}

/* Estilos adicionales para la página de inicio de sesión */
html,
body {
    height: 100%;
    min-height: 100vh;
    overflow: hidden;
}

.container-fluid {
    min-height: 100%;
}

.btn-primary,
.btn-add {
    background-color: #060c2c;
    border-color: #060c2c;
}

.btn-primary:hover,
.btn-add:hover {
    background-color: #0d1d5c;
    border-color: #0d1d5c;
}

/* Estilo para los botones de agregar */
.btn-add,
.btn-primary {
    background-color: #0d1d5c;
    border-color: #0d1d5c;
    color: white;
}

.btn-add:hover,
.btn-primary:hover {
    background-color: #0d1d5c;
    border-color: #0d1d5c;
    color: white;
}

/* Estilos para el icono de bienvenida */
.sidebar-icon {
    width: 100%;
    height: 50%;
    display: block;
}

/* Ajustamos el padding del enlace que contiene el icono */
#sidebar .list-unstyled li a.nav-link-icon {
    padding: 5px;
    text-align: center;
}

/* Estilos para los subelementos del menú */
.nav-link-subitem {
    font-size: 0.9rem !important;
    padding-left: 45px !important;
}

/* Ajuste del padding para los elementos del menú */
#sidebar .list-unstyled li ul li a {
    padding-left: 30px;
}

#sidebar .list-unstyled li ul li ul li a {
    padding-left: 45px;
}

/* Estilos para los subelementos del menú de configuración */
#configuracionSubmenu .nav-link-subitem {
    font-size: 0.9rem !important;
    padding-left: 45px !important;
}

#sidebar .list-unstyled li ul li ul li a {
    padding-left: 45px;
}

/* Ajuste del padding para los elementos del menú de configuración */
#configuracionSubmenu .list-unstyled li a {
    padding-left: 30px;
}

#configuracionSubmenu .list-unstyled li ul li a {
    padding-left: 45px;
}

/* Ajuste para que todos los elementos del primer nivel del submenú tengan el mismo estilo */
#sidebar .list-unstyled li ul li a.nav-link {
    font-size: 1.1rem;
    padding: 10px 15px 10px 30px;
    display: block;
    color: #ecf0f1;
}

/* Ajuste para los subelementos */
#sidebar .list-unstyled li ul li ul li a {
    font-size: 0.9rem;
    padding-left: 45px;
}

/* Nuevo estilo para el contenedor flexible */
.sidebar-content {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    height: 100%;
}

.sidebar-top {
    flex-grow: 1;
}

.sidebar-bottom {
    margin-top: auto;
}

.card {
    height: 100%;
}

.table-responsive {
    width: 100%;
    margin: 0;
    padding: 0;
    background-color: transparent;
    box-shadow: none;
    /* Desactivar scroll en el wrapper para usar sólo el interno */
    max-height: none !important;
    overflow: visible !important;
}

.table {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
}

.table thead th {
    background-color: white;
    border-bottom: 2px solid #dee2e6;
}

.table-striped tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, .02);
}

.table-sm td,
.table-sm th {
    padding: 0.3rem;
}

#dashboard-table thead th {
    vertical-align: top;
    white-space: nowrap;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
}

#dashboard-table {
    font-size: 0.9rem;
}

#dashboard-table thead input {
    width: 100%;
    padding: 3px;
    box-sizing: border-box;
}

#dashboard-table thead th {
    padding: 10px 5px;
}

.column-search {
    font-size: 0.8rem;
}

#dashboard-table thead input[type="number"] {
    width: 100%;
    display: block;
    margin-bottom: 5px;
}

#dashboard-table thead input[type="number"]:last-child {
    margin-bottom: 0;
}

#dashboard-table thead th {
    padding-top: 5px;
    padding-bottom: 5px;
}

#dashboard-table th,
#dashboard-table td {
    width: 120px;
    max-width: 120px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.8rem;
    padding: 5px 3px;
}

/* Estilo para los encabezados de columna */
#dashboard-table thead th.sorting-header {
    vertical-align: top;
    white-space: normal;
    height: auto;
    padding: 5px 3px 25px;
    font-size: 0.85rem;
    line-height: 1.2;
    font-weight: bold;
    background-color: #f8f9fa;
    border-bottom: none;
    position: relative;
}

/* Estilo para la fila de filtros */
#dashboard-table thead tr.filter-row th {
    padding: 5px 3px;
    background-color: #f8f9fa;
    border-top: none;
}

/* Ajuste para los inputs de búsqueda */
#dashboard-table thead input {
    width: 100%;
    padding: 2px;
    box-sizing: border-box;
    font-size: 0.75rem;
    margin-top: 2px;
}

#dashboard-table thead input[type="number"],
#dashboard-table thead input[type="date"] {
    width: 100%;
    display: block;
    margin-bottom: 2px;
}

#dashboard-table thead input[type="number"]:last-child,
#dashboard-table thead input[type="date"]:last-child {
    margin-bottom: 0;
}

/* Estilo para los botones de ordenamiento */
#dashboard-table thead th.sorting_asc,
#dashboard-table thead th.sorting_desc,
#dashboard-table thead th.sorting {
    cursor: pointer;
    padding-right: 20px;
}

#dashboard-table thead th.sorting_asc::after,
#dashboard-table thead th.sorting_desc::after,
#dashboard-table thead th.sorting::after {
    position: absolute;
    right: 5px;
    top: 5px;
}

/* Quitar estilos de ordenamiento */
#dashboard-table thead th.sorting,
#dashboard-table thead th.sorting_asc,
#dashboard-table thead th.sorting_desc {
    background-image: none;
    cursor: default;
    padding-right: 5px;
}

#dashboard-table thead th.sorting::after,
#dashboard-table thead th.sorting_asc::after,
#dashboard-table thead th.sorting_desc::after {
    content: none;
}

/* Ajustar el estilo para los encabezados de columna */
#dashboard-table thead th.sorting-header {
    padding: 5px 3px 5px;
    position: relative;
}

/* Ajustar el estilo para la fila de filtros */
#dashboard-table thead tr.filter-row th {
    padding: 5px 3px;
    background-color: #f8f9fa;
    border-top: none;
}

/* Estilos para el overlay de carga */
#loadingOverlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(255, 255, 255, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 9999;
}

.loading-spinner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
}



.loading-text {
    color: #060c2c;
    font-size: 1.2rem;
}

.btn-warning {
    background-color: #ffc107;
    border-color: #ffc107;
    color: #212529;
}

.btn-warning:hover {
    background-color: #e0a800;
    border-color: #d39e00;
    color: #212529;
}

.custom-checkbox-cell {
    text-align: center;
}

/* Estilos para el checkbox personalizado */
.custom-checkbox {
    position: relative;
    display: inline-block;
    width: 24px;
    height: 24px;
}

.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}

.checkmark {
    position: absolute;
    top: 0;
    left: 0;
    width: 24px;
    height: 24px;
    background-color: white;
    border: 2px solid #000;
    border-radius: 2px;
}

.custom-checkbox input:checked~.checkmark {
    background-color: white;
}

.custom-checkbox input:checked~.checkmark:after {
    content: "";
    position: absolute;
    left: 8px;
    top: 4px;
    width: 5px;
    height: 10px;
    border: solid black;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.custom-checkbox-cell {
    text-align: center;
}


/* Estilos para el botón flotante de chat */
.chat-float-button {
    position: fixed;
    bottom: 30px;
    right: 30px;
    width: 60px;
    height: 60px;
    background-color: #060c2c;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    cursor: pointer;
    z-index: 1000;
    transition: all 0.3s ease;
}

.chat-float-button:hover {
    transform: scale(1.1);
    background-color: #0d1d5c;
}

.chat-float-button i {
    color: white;
    font-size: 24px;
}

/* Estilos para el modal de chat */
.chat-modal .modal-header {
    background-color: #060c2c;
    color: white;
}

.chat-modal .modal-title {
    font-weight: 500;
}

.chat-modal .form-control {
    border-radius: 4px;
    border: 1px solid #ced4da;
    padding: 10px;
}

.chat-modal textarea.form-control {
    min-height: 120px;
}

.chat-modal .btn-send {
    background-color: #060c2c;
    color: white;
    padding: 10px 20px;
    border-radius: 4px;
    border: none;
    transition: all 0.3s ease;
}

.chat-modal .btn-send:hover {
    background-color: #0d1d5c;
}

/* Unified table styles for all dashboard tables */
.dashboard-table {
    background-color: white;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
    margin-bottom: 0;
    font-size: 0.9rem;
}

.dashboard-table thead th {
    vertical-align: top;
    white-space: nowrap;
    background-color: #f8f9fa;
    position: sticky;
    top: 0;
    z-index: 1;
    border-bottom: 2px solid #dee2e6;
    padding: 0.3rem;
    font-size: 0.85rem;
    line-height: 1.2;
    font-weight: bold;
}

.dashboard-table tbody td {
    padding: 0.3rem;
    min-height: 50px;
    width: 120px;
    max-width: 120px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.dashboard-table tbody tr:nth-of-type(odd) {
    background-color: rgba(0, 0, 0, .02);
}

.dashboard-table thead .filter-row th {
    padding: 5px 3px;
    background-color: #f8f9fa;
    border-top: none;
}

.dashboard-table thead input {
    width: 100%;
    padding: 2px;
    box-sizing: border-box;
    font-size: 0.75rem;
    margin-top: 2px;
}

.dashboard-table thead input[type="number"],
.dashboard-table thead input[type="date"] {
    width: 100%;
    display: block;
    margin-bottom: 2px;
}

.dashboard-table thead th.sorting-header {
    padding: 5px 3px 25px;
    position: relative;
}

.dashboard-table thead th.sorting,
.dashboard-table thead th.sorting_asc,
.dashboard-table thead th.sorting_desc {
    background-image: none;
    cursor: default;
    padding-right: 5px;
}

.dashboard-table thead th.sorting::after,
.dashboard-table thead th.sorting_asc::after,
.dashboard-table thead th.sorting_desc::after {
    content: none;
}

.dashboard-table td .custom-checkbox {
    display: inline-block;
    vertical-align: middle;
}

.modal-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
}

/* Ajustar los estilos de la tabla para ocupar todo el ancho disponible */
.dashboard-table {
    width: 100% !important;
    margin-bottom: 0;
    font-size: 1rem;
}

/* Asegurar que las columnas se distribuyan uniformemente con ancho máximo */
.dashboard-table th,
.dashboard-table td {
    width: auto;
    max-width: 160px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
    font-size: 0.9rem;
    padding: 5px 3px;
    text-overflow: ellipsis;
    overflow: hidden;
}

/* Ajustar el texto largo para que se muestre en múltiples líneas */
.dashboard-table td {
    white-space: pre-wrap;
    line-height: 1.2;
}

/* Asegurar que los encabezados también respeten el ancho máximo */
.dashboard-table thead th {
    max-width: 160px;
    white-space: normal;
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Mantener los inputs de búsqueda dentro del ancho de la columna */
.dashboard-table thead input {
    max-width: 160px;
    width: 100%;
    font-size: 0.9rem;
}

#oportunidadesVentaCruzadaTable th,
#oportunidadesVentaCruzadaTable td {
    width: 33.33%;
    padding: 8px;
}

#oportunidadesVentaCruzadaTable {
    table-layout: fixed;
    width: 100%;
}

/* Estilos para submenús anidados */
.nav-link-subsubitem {
    padding-left: 3rem !important;
    font-size: 0.85rem;
    color: rgba(255, 255, 255, 0.8);
}

.nav-link-subsubitem:hover {
    color: #fff;
    background-color: rgba(255, 255, 255, 0.1);
}

/* Ajustar padding para submenús */
#espaciosCompartidosSubmenu .nav-link-subitem {
    padding-left: 2rem;
}

/* Estilo para el enlace "Ver todos" */
#espaciosCompartidosSubmenu li:last-child .nav-link-subitem {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin-top: 0.5rem;
    padding-top: 0.5rem;
}

.text-success {
    color: #53cd26;
}

.text-danger {
    color: #e51d10;
}

.text-warning {
    color: #f19534;
}

.text-info {
    color: #f4c416;
}

.num-success {
    color: #4a903c;
}

/* Estilos específicos para la tabla de Contribuciones detalle de riesgo */
#contribucionesDetalleRiesgoTable.table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    margin: 0;
}

#contribucionesDetalleRiesgoTable.table tbody tr:nth-child(odd) {
    background-color: #f8f9fa !important;
}

#contribucionesDetalleRiesgoTable.table tbody tr:nth-child(even) {
    background-color: white !important;
}

#contribucionesDetalleRiesgoTable.table th,
#contribucionesDetalleRiesgoTable.table td {
    padding: 8px 12px;
    text-align: left;
    border: none !important;
    background-color: transparent;
}

#contribucionesDetalleRiesgoTable.table th {
    font-weight: bold;
    background-color: white !important;
}

/* Eliminar cualquier estilo de hover que pueda estar interfiriendo */
#contribucionesDetalleRiesgoTable.table tr:hover {
    background-color: inherit !important;
}

/* Asegurarse que no haya bordes en las celdas */
#contribucionesDetalleRiesgoTable.table td,
#contribucionesDetalleRiesgoTable.table th {
    border: none !important;
}

.wrapper {
    display: flex;
    min-height: 100vh;
    transform: scale(0.7);
    transform-origin: top left;
    width: calc(100% / 0.7);
    height: calc(100vh / 0.7);
    overflow: hidden;
}

/* Asegurar que los dropup menus en tablas se muestren encima del encabezado sticky */
.table-responsive .dropup .dropdown-menu {
    z-index: 1030 !important;
}

/* Evitar scroll chaining en scroll interno de DataTables */
.dataTables_scroll, .dataTables_scrollBody {
    /* Prevenir propagación de scroll al body */
    overscroll-behavior: contain;
    overscroll-behavior-y: contain;
}

/* Sticky para controles de DataTables */
.dataTables_wrapper .top {
    position: sticky;
    top: 0;
    z-index: 1002;
    background-color: #fff;
}
.dataTables_wrapper .bottom {
    position: sticky;
    bottom: 0;
    z-index: 1002;
    background-color: #fff;
}

/* Overrides para DataTables: ocultar scroll externo, solo scroll en el cuerpo */
.table-responsive, .dataTables_scroll {
    overflow: hidden !important;
}
.dataTables_scrollBody {
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
}
/* Ocultar scrollbar en wrappers */
.dataTables_scroll::-webkit-scrollbar, .table-responsive::-webkit-scrollbar {
    display: none !important;
}
.dataTables_scroll, .table-responsive {
    -ms-overflow-style: none !important;
    scrollbar-width: none !important;
}

/* Styles for Melmacia loading icon */
.loading-spinner .melmacia-spinner {
    width: 3rem;
    height: 3rem;
    animation: spin 1s linear infinite;
}

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

/* Estilos para columnas ordenables en tablas de usuarios */
.sortable {
    user-select: none;
    transition: background-color 0.2s ease;
}

.sortable:hover {
    background-color: rgba(0, 123, 255, 0.1) !important;
}

.sort-icon {
    margin-left: 5px;
    opacity: 0.6;
    transition: opacity 0.2s ease;
}

.sortable:hover .sort-icon {
    opacity: 1;
}

.sort-icon.fa-sort-up,
.sort-icon.fa-sort-down {
    opacity: 1;
    color: #007bff;
}

/* Estilos para usuarios inactivos críticos (más de 2 meses sin conexión) */
.user-inactive-critical {
    background: linear-gradient(90deg, #fff2f2 0%, #fff8f8 100%) !important;
    border-left: 5px solid #dc3545 !important;
    position: relative;
    box-shadow: 0 1px 3px rgba(220, 53, 69, 0.1) !important;
    animation: subtle-warning-pulse 3s infinite;
}

.user-inactive-critical:hover {
    background: linear-gradient(90deg, #ffe6e6 0%, #fff0f0 100%) !important;
    box-shadow: 0 2px 6px rgba(220, 53, 69, 0.2) !important;
}

@keyframes subtle-warning-pulse {
    0%, 100% { 
        border-left-color: #dc3545;
        box-shadow: 0 1px 3px rgba(220, 53, 69, 0.1);
    }
    50% { 
        border-left-color: #ff6b6b;
        box-shadow: 0 2px 5px rgba(220, 53, 69, 0.15);
    }
}

.text-critical {
    color: #dc3545;
    font-weight: 600;
}



/* Agregar un indicador visual sutil en la primera celda */
.user-inactive-critical td:first-child {
    position: relative;
}

.user-inactive-critical td:first-child::before {
    content: "⚠️";
    position: absolute;
    left: -20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 0.9rem;
    opacity: 0.8;
}