﻿body {
}

.Enlace {
    /*    color: #00f;*/
    text-decoration: underline;
    cursor: pointer
}

.table th {
    text-transform: initial;
    letter-spacing: 1px;
}



/* ========================================
   LOADING - VERSIÓN CORREGIDA
   Elimina opacidad correctamente al ocultar
   ======================================== */

#dvLoading {
    background: url(../imagenes/loading.gif) no-repeat center;
    background-color: #000;
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0.3;
}

    /* Cuando JavaScript pone display: none, forzar opacidad 0 */
    #dvLoading[style*="display: none"],
    #dvLoading[style*="display:none"] {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

#dvLoading-partial {
    background: url(../imagenes/loadingSol.gif) no-repeat center;
    background-color: #000;
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    opacity: 0.3;
}

    /* Cuando JavaScript pone display: none, forzar opacidad 0 */
    #dvLoading-partial[style*="display: none"],
    #dvLoading-partial[style*="display:none"] {
        opacity: 0 !important;
        visibility: hidden !important;
        pointer-events: none !important;
    }

border: 1px solid rgba(0,0,0,.125);
position: absolute;
top: -12px;
background-color: white;
padding-left: 10px;
padding-right: 10px;
color: #6f6f6f;
}

.color-header-card {
    background: #F6F6F6;
}

.popover-body {
}

.warning-intenso {
    background-color: #FB9514
}

label.error {
    color: #dc3545;
    width: 100%;
    padding-left: 5px;
}

.btn-sm {
    line-height: 1.0 !important
}

/*totales ventas y compras*/
.totales {
    background-color: #EEEEEE;
    display: block;
    border-bottom: 1px solid #6c757d;
    text-align: right;
}

.title-totales {
    color: rgba(0, 0, 0, 0.6)
}
/* ************************ */

/*Datatable*/
/*th {
    font-style: normal;
    font-weight: normal;
}*/
table.dataTable > thead .sorting:before,
table.dataTable > thead .sorting:after,
table.dataTable > thead .sorting_asc:before,
table.dataTable > thead .sorting_asc:after,
table.dataTable > thead .sorting_desc:before,
table.dataTable > thead .sorting_desc:after,
table.dataTable > thead .sorting_asc_disabled:before,
table.dataTable > thead .sorting_asc_disabled:after,
table.dataTable > thead .sorting_desc_disabled:before,
table.dataTable > thead .sorting_desc_disabled:after {
    bottom: .1em;
}

table.dataTable {
    margin-top: 0px !important;
}

.rowSelected {
    background: #1e88e5 !important;
    color: white !important;
}

.modal-footer {
    background-color: #FAFAFA
}

table td {
    padding-top: 1px !important;
    padding-bottom: 2px !important;
}

/**datepicker*/
.datepicker table th {
    font-weight: bold;
}

input.date-picker + .input-group-text {
    border-left: 0px;
    border-radius: 0;
}

.form-check-input-large {
    width: 1.4em !important;
    height: 1.4em !important;
}


.text-campo {
    color: #545454;
    font-family: Tahoma,Verdana,Arial;
    font-size: 12px;
    font-weight: normal;
}

.text-categoria {
    color: #0B5197;
    font-weight: bold;
    font-size: 12px;
}

.text-categoria-padre {
    color: #0B5197;
    font-weight: bold;
    font-size: 13px;
}

.text-grupo {
    font-family: 'Trebuchet MS', Verdana, Tahoma, Arial;
    font-size: 14px;
    font-weight: bold;
    color: #0B5197;
}

.custom-clear {
    margin-left: -34px !important;
    z-index: 100;
    height: initial !important;
    padding-right: 15px;
}

.size-card-login {
    width: 410px;
}
/*Chosen*/
.chosen-custom ~ .chosen-container {
    /*    width: 300px !important*/
}

.chosen-custom ~ .chosen-container-single .chosen-single div:after {
    height: 31px !important;
}

.chosen-custom ~ .chosen-container a.chosen-single {
    height: 31px !important;
}

.chosen-custom ~ .chosen-container .chosen-single span {
    height: 31px !important;
    line-height: 2;
    font-size: 13px;
}

.form-select-sm.chosen-custom ~ .chosen-container .chosen-single span {
    line-height: 2.5;
    font-size: 0.75rem;
}

.chosen-container .chosen-results {
    font-size: 13px;
}

.chosen-container-single.chosen-disabled .chosen-single:not(.chosen-single-with-deselect) div:after {
    background-color: #eceef1 !important;
    box-shadow: initial;
}

.chosen-disabled {
    OPACITY: initial !important;
}

    .chosen-disabled a {
        background-color: #eceef1 !important;
        color: #697a8d;
    }

        .chosen-disabled a div {
            background-color: #eceef1 !important;
        }

.chosen-container-single.chosen-disabled .chosen-single:not(.chosen-single-with-deselect) div:after {
    background-color: #eceef1 !important;
    box-shadow: initial;
}

.chosen-single.is-invalid {
    background-color: rgb(255, 205, 210);
    border-color: #dc3545;
}

.list-group-item.node-tree {
    padding-top: 5px !important;
    padding-bottom: 5px !important;
}

.item-succes {
    color: #155724 !important;
    background-color: #d4edda !important;
    border-color: #c3e6cb !important;
}

.item-alert {
    color: #856404 !important;
    background-color: #fff3cd !important;
    border-color: #ffeeba !important;
}

.item-disabled {
    color: #697a8d !important;
    background-color: #eceef1 !important;
    border: 1px solid #d9dee3 !important;
}

.span-requerido {
    font-size: 10px;
    color: #ff3e1d;
}

.swal2-toast.swal2-icon-success {
    background: #DDFFBB !important;
    border: 1px solid rgba(0,0,0,.125);
}

.swal2-toast .swal2-success-circular-line-left {
    background-color: transparent !important;
}

.swal2-toast .swal2-success-fix {
    background-color: transparent !important;
}

.swal2-toast .swal2-success-circular-line-right {
    background-color: transparent !important;
}

.fs-7 {
    font-size: 12px;
}

/* ========================================
   MEJORAS RESPONSIVE PARA DASHBOARD
   Fecha: 16/12/2024
   ======================================== */

/* --- ESTILOS BASE PARA RESPONSIVE --- */

/* Prevenir scroll horizontal global */
* {
    box-sizing: border-box;
}

html, body {
    overflow-x: hidden;
    width: 100%;
    position: relative;
}

/* Imágenes responsive por defecto */
img {
    max-width: 100%;
    height: auto;
}

/* --- SIDEBAR RESPONSIVE --- */

/* Overlay para cerrar sidebar en móvil */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1040;
}

    .sidebar-overlay.show {
        display: block;
    }

/* --- DASHBOARD COMPONENTS --- */

/* Contenedor de estadísticas/métricas */
.dashboard-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-bottom: 20px;
}

/* Progreso circular */
.circular-progress {
    position: relative;
    width: 120px;
    height: 120px;
    margin: 20px auto;
}

    .circular-progress svg {
        transform: rotate(-90deg);
    }

.progress-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
}

.progress-value {
    font-size: 24px;
    font-weight: bold;
    color: #333;
}

.progress-label {
    font-size: 12px;
    color: #666;
    margin-top: 5px;
}

/* Montos de ejecución */
.execution-amount {
    text-align: center;
    padding: 15px 10px;
    background: #f8f9fa;
    border-radius: 8px;
    margin: 15px 0;
}

    .execution-amount .amount {
        font-size: 16px;
        font-weight: bold;
        color: #333;
        display: block;
        margin: 5px 0;
    }

    .execution-amount .divider {
        font-size: 12px;
        color: #666;
        display: block;
        margin: 3px 0;
    }

/* Gráficos responsive */
.chart-container {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* Utilidades responsive */
.hide-mobile {
    display: block;
}

.show-mobile {
    display: none;
}

/* Corrección de texto superpuesto */
.text-overlay-fix {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ========================================
   MEDIA QUERIES - TABLETS Y MÓVILES
   ======================================== */

/* --- TABLETS (577px - 991px) --- */
@media (min-width: 577px) and (max-width: 991px) {

    /* Sidebar flotante en tablets */
    .sidebar {
        width: 250px;
    }

    /* Contenido principal con margen para sidebar */
    .main-content {
        margin-left: 260px;
    }

    /* Cards con mejor espaciado */
    .card-body {
        padding: 15px;
    }

    /* Tablas con mejor legibilidad */
    table {
        font-size: 12px;
    }

        table th,
        table td {
            padding: 6px 8px !important;
        }
}

/* --- MÓVILES Y TABLETS PEQUEÑAS (≤768px) --- */
@media (max-width: 768px) {

    /* Body y contenedores generales */
    body {
        overflow-x: hidden;
        width: 100%;
        padding: 0;
        margin: 0;
    }

    .container-fluid,
    .container {
        padding-left: 10px;
        padding-right: 10px;
    }

    .container,
    .container-fluid,
    .container-sm,
    .container-md,
    .container-lg,
    .container-xl {
        padding-left: 10px;
        padding-right: 10px;
    }

    .row {
        margin-left: -10px;
        margin-right: -10px;
    }

    .col,
    [class*="col-"] {
        padding-left: 10px;
        padding-right: 10px;
    }

    /* Cards y paneles */
    .card {
        margin-bottom: 15px;
        border-radius: 8px;
        overflow: visible;
    }

    .card-body {
        padding: 12px;
        overflow-x: auto;
    }

    /* Header del sidebar y cards */
    .card-header {
        padding: 10px;
        font-size: 14px;
    }

        .card-header h6,
        .card-header h5,
        .card-header h4 {
            font-size: 13px;
            margin-bottom: 0;
            line-height: 1.3;
        }

    /* Progreso circular - Ajustar tamaño */
    .circular-progress,
    .progress-circle {
        width: 120px !important;
        height: 120px !important;
        margin: 15px auto;
    }

        /* Texto del porcentaje en el círculo */
        .progress-value,
        .circular-progress .percentage {
            font-size: 22px !important;
            font-weight: bold;
        }

    /* Texto de "Ejecución" debajo del círculo */
    .progress-label {
        font-size: 11px;
        margin-top: 5px;
    }

    /* Montos de ejecución */
    .execution-amount,
    .budget-info {
        font-size: 13px;
        text-align: center;
        padding: 8px 5px;
        line-height: 1.4;
    }

        .execution-amount strong,
        .execution-amount .amount {
            font-size: 14px;
            display: block;
            margin: 3px 0;
        }

    /* Tablas responsive */
    .table-responsive {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -12px;
        padding: 0 12px;
    }

    table {
        font-size: 11px;
        min-width: 100%;
    }

        table th {
            font-size: 10px;
            padding: 6px 4px !important;
            white-space: nowrap;
        }

        table td {
            padding: 4px 4px !important;
            font-size: 11px;
        }

    /* Columna de montos en tabla */
    .table td:last-child,
    .table th:last-child {
        text-align: right;
        padding-right: 8px !important;
    }

    /* Ajuste para los títulos de tabla */
    .table-header-title,
    table caption,
    .table thead th {
        font-size: 12px;
        font-weight: bold;
    }

    /* Totales más compactos */
    .totales {
        padding: 8px;
        font-size: 12px;
    }

    /* Botones */
    .btn {
        font-size: 12px;
        padding: 6px 12px;
    }

    .btn-sm {
        font-size: 11px;
        padding: 4px 8px;
    }

    /* Navegación superior */
    .navbar {
        padding: 8px 10px;
    }

    .navbar-brand {
        font-size: 16px;
    }

    /* Menu hamburguesa */
    .navbar-toggler {
        padding: 4px 8px;
        font-size: 18px;
    }

    .navbar .container-fluid {
        padding: 0 10px;
    }

    .navbar-nav {
        margin-top: 10px;
    }

        .navbar-nav .nav-item {
            margin-bottom: 5px;
        }

    /* Sidebar colapsable */
    .sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        height: 100vh;
        width: 280px;
        transition: left 0.3s ease;
        z-index: 1050;
        background: white;
        box-shadow: 2px 0 5px rgba(0,0,0,0.1);
    }

        .sidebar.show {
            left: 0;
        }

    /* Ajuste del contenido principal */
    .main-content {
        margin-left: 0;
        padding: 15px 10px;
    }

    /* Dashboard stats en columna */
    .dashboard-stats {
        flex-direction: column;
        gap: 10px;
    }

        .dashboard-stats .card {
            width: 100%;
        }

    /* Gráficos más pequeños */
    .chart-container {
        height: 250px;
    }

    /* Corrección para elementos flotantes */
    .float-left,
    .float-right,
    .float-end,
    .float-start {
        float: none !important;
    }

    .CabExpandir,
    .Expandible {
        float: none !important;
        display: inline-block;
        margin-right: 5px;
    }

    /* Mejora de legibilidad de textos */
    .text-campo,
    .fs-7 {
        font-size: 11px;
    }

    .text-categoria,
    .text-categoria-padre {
        font-size: 11px;
    }

    .text-grupo {
        font-size: 12px;
    }

    /* Modales responsive */
    .modal-dialog {
        margin: 10px;
        max-width: calc(100% - 20px);
    }

    .modal-content {
        border-radius: 8px;
    }

    .modal-header,
    .modal-footer {
        padding: 10px 15px;
    }

    .modal-body {
        padding: 15px;
    }

    /* Datepickers en móvil */
    .datepicker {
        font-size: 12px;
    }

        .datepicker table th,
        .datepicker table td {
            padding: 4px;
            font-size: 11px;
        }

    /* Chosen select en móvil */
    .chosen-container {
        width: 100% !important;
        font-size: 13px;
    }

    .chosen-container-single .chosen-single {
        height: 35px !important;
        line-height: 35px !important;
    }

    .chosen-container .chosen-results {
        font-size: 12px;
    }

    /* Loading overlay más pequeño */
    #dvLoading,
    #dvLoading-partial {
        background-size: 30px 30px;
    }

    /* Utilidades */
    .hide-mobile {
        display: none;
    }

    .show-mobile {
        display: block;
    }

    .text-overlay-fix {
        white-space: normal;
        word-wrap: break-word;
    }

    /* Mejorar size-card-login existente */
    .size-card-login {
        width: 90%;
        max-width: 380px;
        margin: 0 auto;
    }
}

/* --- MÓVILES PEQUEÑOS (≤576px) --- */
@media (max-width: 576px) {

    /* Reducir más el tamaño de fuente */
    body {
        font-size: 13px;
    }

    /* Headers más pequeños */
    h1, .h1 {
        font-size: 20px;
    }

    h2, .h2 {
        font-size: 18px;
    }

    h3, .h3 {
        font-size: 16px;
    }

    h4, .h4 {
        font-size: 14px;
    }

    h5, .h5 {
        font-size: 13px;
    }

    h6, .h6 {
        font-size: 12px;
    }

    /* Cards más compactos */
    .card {
        border-radius: 6px;
    }

    .card-body {
        padding: 10px;
    }

    /* Progreso circular más pequeño */
    .circular-progress,
    .progress-circle {
        width: 100px !important;
        height: 100px !important;
    }

        .progress-value,
        .circular-progress .percentage {
            font-size: 18px !important;
        }

    /* Montos más compactos */
    .execution-amount {
        font-size: 11px;
        padding: 5px 3px;
    }

        .execution-amount .amount {
            font-size: 13px;
        }

    /* Tabla aún más compacta */
    table {
        font-size: 10px;
    }

        table th {
            font-size: 9px;
            padding: 4px 2px !important;
        }

        table td {
            padding: 3px 2px !important;
            font-size: 10px;
        }

    /* Reducir espacio de totales */
    .totales {
        padding: 5px;
        font-size: 11px;
    }

    /* Botones más compactos */
    .btn {
        font-size: 11px;
        padding: 5px 10px;
    }

    /* Ajuste mejorado del formulario de login */
    .size-card-login {
        width: 95%;
        max-width: 320px;
        margin: 0 auto;
    }
}

/* ========================================
   FIN DE MEJORAS RESPONSIVE
   ======================================== */
/* ========================================
   CORRECCIÓN DE SUPERPOSICIÓN DE GRÁFICOS
   ======================================== */
/* Asegurar espacio suficiente para el título del gráfico */
#divChartLine,
#divChartPie,
#growthChart {
    position: relative;
    overflow: visible !important;
}

/* Ajustar contenedor de gráfico de línea */
#divChartLine {
    padding-top: 15px;
    min-height: 365px;
}

/* Ajustar contenedor de gráfico pie */
#divChartPie {
    padding: 15px 10px;
    min-height: 244.7px;
}

/* Ajustar contenedor de gráfico radial */
#growthChart {
    padding: 10px 5px;
}

/* Asegurar que el card tenga espacio para contenido */
.card-body {
    overflow: visible;
}

/* Evitar que el título del gráfico se corte */
.apexcharts-title-text {
    max-width: 100%;
    overflow: visible !important;
    white-space: normal !important;
    word-wrap: break-word;
}

/* Ajustar leyendas en móvil */
.apexcharts-legend {
    overflow: visible !important;
    max-width: 100%;
}

.apexcharts-legend-series {
    display: inline-block !important;
    margin: 2px 5px !important;
}

/* Evitar superposición de data labels */
.apexcharts-datalabel {
    pointer-events: none;
}

/* Ajustes específicos para móvil */
@media (max-width: 768px) {

    /* Más espacio vertical en móvil */
    #divChartLine {
        padding-top: 10px;
        min-height: 320px !important;
    }

    #divChartPie {
        padding: 10px 5px;
        min-height: 280px !important;
    }

    #growthChart {
        padding: 5px;
        min-height: 220px !important;
    }

    /* Reducir tamaño de texto en gráficos */
    .apexcharts-text {
        font-size: 10px !important;
    }

    .apexcharts-legend-text {
        font-size: 10px !important;
        max-width: 80px;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    /* Título más compacto */
    .apexcharts-title-text {
        font-size: 12px !important;
    }

    /* Data labels más pequeños */
    .apexcharts-datalabel {
        font-size: 9px !important;
    }

    /* Ajustar card header */
    .card-header h5 {
        font-size: 13px;
        line-height: 1.3;
        margin-bottom: 5px;
    }

    /* Texto de ejecución más compacto */
    #DetEjecucion {
        font-size: 12px !important;
        line-height: 1.5;
        padding: 5px 0;
    }

    #tituloEjecucion {
        font-size: 13px !important;
        line-height: 1.3;
    }

    /* Ajustar márgenes entre cards */
    .card {
        margin-bottom: 15px;
    }
}

@media (max-width: 576px) {

    /* Aún más compacto en móviles pequeños */
    #divChartLine {
        min-height: 300px !important;
        padding: 8px 5px;
    }

    #divChartPie {
        min-height: 260px !important;
        padding: 8px 3px;
    }

    #growthChart {
        min-height: 200px !important;
    }

    /* Texto muy pequeño */
    .apexcharts-text,
    .apexcharts-legend-text {
        font-size: 9px !important;
    }

    .apexcharts-title-text {
        font-size: 11px !important;
    }

    .apexcharts-datalabel {
        font-size: 8px !important;
    }

    /* Reducir padding de cards */
    .card-body {
        padding: 10px;
    }

    .card-header {
        padding: 8px 10px;
    }

    #DetEjecucion {
        font-size: 11px !important;
    }

    #tituloEjecucion {
        font-size: 12px !important;
    }
}

/* Corrección para leyendas largas en pie chart */
.apexcharts-legend.apexcharts-align-center {
    justify-content: center !important;
    flex-wrap: wrap !important;
    padding: 5px 0 !important;
}

/* Asegurar que los tooltips se vean correctamente */
.apexcharts-tooltip {
    z-index: 1000 !important;
}

/* Prevenir overflow en el contenedor principal */
.content-wrapper {
    overflow-x: hidden;
}

/* Ajuste para que los gráficos no se corten */
.apexcharts-canvas {
    overflow: visible !important;
}

.apexcharts-inner {
    overflow: visible !important;
}

/* Corrección específica para evitar superposición del título en gráfico de línea */
@media (max-width: 768px) {
    .apexcharts-title-text {
        transform: translateY(0) !important;
        padding-bottom: 5px;
    }

    /* Asegurar espacio para el título */
    .apexcharts-canvas svg {
        overflow: visible;
    }

    /* Padding adicional en el contenedor del gráfico */
    #divChartLine .apexcharts-canvas {
        margin-top: 0 !important;
    }
}

/* Corrección para leyendas del pie chart que se superponen */
@media (max-width: 768px) {
    .apexcharts-legend-series {
        max-width: 48% !important;
        margin: 3px 1% !important;
        text-align: center;
    }

    /* Truncar texto largo */
    .apexcharts-legend-text {
        display: inline-block;
        max-width: 100%;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
}

@media (max-width: 576px) {
    .apexcharts-legend-series {
        max-width: 45% !important;
    }
}



/* ========================================
   CORRECCIÓN FINAL - TABLAS RESPONSIVE
   
   - Sin sombras (sin rayas verticales)
   - TODAS las columnas con accion-btn son sticky
   - Posiciones dinámicas basadas en cantidad
   
   Versión: Final v7
   ======================================== */

.table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    width: 100% !important;
    position: relative !important;
}

    .table-responsive > table {
        margin-bottom: 0;
        width: 100% !important;
        table-layout: auto !important;
    }

/* --- DESKTOP (>768px) - TODO NORMAL --- */

@media (min-width: 769px) {
    .table-responsive table thead tr th,
    .table-responsive table tbody tr td {
        position: static !important;
        box-shadow: none !important;
        left: auto !important;
        right: auto !important;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: normal !important;
        overflow: visible !important;
        text-overflow: clip !important;
    }
}

/* --- MÓVIL (≤768px) - CON SCROLL Y STICKY --- */

@media (max-width: 768px) {

    .table-responsive > table {
        min-width: 600px !important;
        width: auto !important;
    }

    .table-responsive th,
    .table-responsive td {
        white-space: nowrap !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        min-width: 80px !important;
    }

        .table-responsive th:first-child,
        .table-responsive td:first-child {
            min-width: 40px !important;
            max-width: 40px !important;
        }

        .table-responsive th.accion-btn,
        .table-responsive td.accion-btn {
            min-width: 50px !important;
            max-width: 50px !important;
        }

    /* --- TODAS LAS COLUMNAS CON accion-btn SON STICKY --- */

    /* Base para todas las columnas accion-btn */
    .table-responsive table thead tr th.accion-btn,
    .table-responsive table tbody tr td.accion-btn {
        position: sticky !important;
        position: -webkit-sticky !important;
        background-color: #ffffff !important;
        z-index: 10 !important;
        box-shadow: none !important; /* ⭐ SIN SOMBRAS */
    }

    .table-responsive table thead tr th.accion-btn {
        background-color: #f8f9fa !important;
    }

        /* --- POSICIONES DINÁMICAS PARA COLUMNAS accion-btn --- */

        /* Si hay 1 columna accion-btn (última) */
        .table-responsive table thead tr th.accion-btn:last-child:nth-last-child(1),
        .table-responsive table tbody tr td.accion-btn:last-child:nth-last-child(1) {
            right: 0 !important;
        }

        /* Si hay 2 columnas accion-btn */
        .table-responsive table thead tr th.accion-btn:nth-last-child(1),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(1) {
            right: 0 !important; /* Última */
        }

        .table-responsive table thead tr th.accion-btn:nth-last-child(2),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(2) {
            right: 50px !important; /* Penúltima */
        }

        /* Si hay 3 columnas accion-btn */
        .table-responsive table thead tr th.accion-btn:nth-last-child(3),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(3) {
            right: 100px !important; /* Antepenúltima */
        }

        /* Si hay 4 columnas accion-btn */
        .table-responsive table thead tr th.accion-btn:nth-last-child(4),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(4) {
            right: 150px !important;
        }

        /* Si hay 5 columnas accion-btn */
        .table-responsive table thead tr th.accion-btn:nth-last-child(5),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(5) {
            right: 200px !important;
        }

        /* Si hay 6 columnas accion-btn */
        .table-responsive table thead tr th.accion-btn:nth-last-child(6),
        .table-responsive table tbody tr td.accion-btn:nth-last-child(6) {
            right: 250px !important;
        }

    /* --- CHECKBOX STICKY A LA IZQUIERDA --- */

    .table-responsive table thead tr th:first-child,
    .table-responsive table tbody tr td:first-child {
        position: sticky !important;
        position: -webkit-sticky !important;
        left: 0 !important;
        background-color: #ffffff !important;
        z-index: 10 !important;
        box-shadow: none !important; /* ⭐ SIN SOMBRAS */
    }

    .table-responsive table thead tr th:first-child {
        background-color: #f8f9fa !important;
    }

    /* --- ESTILOS PARA FILAS --- */

    .table-responsive table tbody tr.rowSelected td.accion-btn,
    .table-responsive table tbody tr.rowSelected td:first-child {
        background-color: #1e88e5 !important;
    }

    .table-responsive table tbody tr:hover td.accion-btn,
    .table-responsive table tbody tr:hover td:first-child {
        background-color: rgba(0, 0, 0, 0.05) !important;
    }

    .table-responsive .table-striped tbody tr:nth-of-type(odd) td.accion-btn,
    .table-responsive .table-striped tbody tr:nth-of-type(odd) td:first-child {
        background-color: rgba(0, 0, 0, 0.02) !important;
    }

    .table-responsive th,
    .table-responsive td {
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

        .table-responsive th.accion-btn,
        .table-responsive td.accion-btn {
            padding: 4px 2px !important;
            text-align: center !important;
        }

    .table-responsive .bx,
    .table-responsive .Icono {
        font-size: 16px !important;
        width: 18px !important;
        height: 18px !important;
    }
}

/* Scrollbar */
@media (max-width: 768px) {
    .table-responsive {
        scrollbar-width: thin;
        scrollbar-color: #999 #f1f1f1;
    }

        .table-responsive::-webkit-scrollbar {
            height: 10px !important;
        }

        .table-responsive::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }

        .table-responsive::-webkit-scrollbar-thumb {
            background: #999;
            border-radius: 4px;
        }

            .table-responsive::-webkit-scrollbar-thumb:hover {
                background: #666;
            }
}

/* Indicador de scroll - SIN SOMBRA */
@media (max-width: 768px) {
    .table-responsive:not(.scrolled-right)::after {
        content: '';
        position: absolute;
        top: 0;
        right: 0;
        bottom: 0;
        width: 30px;
        background: linear-gradient(to left, rgba(0,0,0,0.1), transparent);
        pointer-events: none;
        z-index: 5;
    }

    .table-responsive.scrolled-right::after {
        display: none !important;
    }
}

@media (max-width: 768px) {
    #divTabla {
        margin: 0 -10px;
        padding: 0 10px;
        overflow: visible;
    }
}

@media (max-width: 576px) {
    .table-responsive th,
    .table-responsive td {
        padding: 4px 2px !important;
        font-size: 10px !important;
        min-width: 60px !important;
    }

        .table-responsive th:first-child,
        .table-responsive td:first-child {
            min-width: 35px !important;
            max-width: 35px !important;
        }

        .table-responsive th.accion-btn,
        .table-responsive td.accion-btn {
            min-width: 45px !important;
            max-width: 45px !important;
        }

    .table-responsive > table {
        min-width: 500px !important;
    }

    .table-responsive .bx,
    .table-responsive .Icono {
        font-size: 14px !important;
        width: 16px !important;
        height: 16px !important;
    }
}

/* ========================================
   FIN DE CORRECCIÓN
   ======================================== */

/* ========================================
   FIX SECCIÓN SUBIR ARCHIVOS - RESPONSIVE
   
   PROBLEMA 1: Vista previa al lado derecho en móvil (debería estar debajo)
   PROBLEMA 2: Tabla de documentos distorsionada en móvil
   
   Fecha: 17/12/2024 - Fix Subir Archivos
   ======================================== */

/* --- FIX LAYOUT RESPONSIVE SUBIR ARCHIVOS --- */

/* En móvil, ambas cards deben ser full-width (una debajo de otra) */
@media (max-width: 991.98px) {
    /* Card "Subir archivos" - Full width en móvil */
    .card:has(#divTablaDocumento) {
        margin-bottom: 1rem !important;
    }

    /* Card "Vista previa" - Full width en móvil */
    .card:has(#imgFoto) {
        margin-bottom: 1rem !important;
    }

    /* Forzar que ambas columnas sean full-width */
    .row:has(#divTablaDocumento) > .col-10,
    .row:has(#divTablaDocumento) > .col-2 {
        flex: 0 0 100% !important;
        max-width: 100% !important;
        width: 100% !important;
        padding-left: 0.75rem !important;
        padding-right: 0.75rem !important;
    }
}

/* --- TABLA DE DOCUMENTOS ADJUNTOS RESPONSIVE --- */

/* Tabla dentro de #divTablaDocumento */
#divTablaDocumento .table-responsive {
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    display: block !important;
    width: 100% !important;
}

    #divTablaDocumento .table-responsive > table {
        width: 100% !important;
    }

/* Desktop - Todo normal */
@media (min-width: 992px) {
    #divTablaDocumento table thead tr th,
    #divTablaDocumento table tbody tr td {
        position: static !important;
        box-shadow: none !important;
    }
}

/* Móvil - Con scroll horizontal */
@media (max-width: 991.98px) {

    /* Forzar tabla más ancha */
    #divTablaDocumento .table-responsive > table {
        min-width: 700px !important;
        width: auto !important;
    }

    /* Celdas en una línea */
    #divTablaDocumento table th,
    #divTablaDocumento table td {
        white-space: nowrap !important;
        padding: 6px 4px !important;
        font-size: 11px !important;
    }

        /* Primera columna (checkbox/hidden) - ancho fijo */
        #divTablaDocumento table th:first-child,
        #divTablaDocumento table td:first-child {
            min-width: 30px !important;
            max-width: 30px !important;
        }

        /* Segunda columna (hidden) - ancho fijo */
        #divTablaDocumento table th:nth-child(2),
        #divTablaDocumento table td:nth-child(2) {
            min-width: 30px !important;
            max-width: 30px !important;
        }

        /* Columna Documento - ancho medio */
        #divTablaDocumento table th:nth-child(3),
        #divTablaDocumento table td:nth-child(3) {
            min-width: 200px !important;
        }

        /* Columna Progreso - ancho medio */
        #divTablaDocumento table th:nth-child(4),
        #divTablaDocumento table td:nth-child(4) {
            min-width: 150px !important;
        }

        /* Columna Observaciones - ancho medio */
        #divTablaDocumento table th:nth-child(5),
        #divTablaDocumento table td:nth-child(5) {
            min-width: 150px !important;
        }

    /* Últimas 3 columnas (botones de acción) - sticky y ancho fijo */
    #divTablaDocumento table thead tr th:nth-last-child(-n+3),
    #divTablaDocumento table tbody tr td:nth-last-child(-n+3) {
        min-width: 45px !important;
        max-width: 45px !important;
        padding: 4px 2px !important;
        text-align: center !important;
    }

    /* SOLO última columna sticky (Vista Previa) */
    #divTablaDocumento table thead tr th:last-child,
    #divTablaDocumento table tbody tr td:last-child {
        position: sticky !important;
        position: -webkit-sticky !important;
        right: 0 !important;
        background-color: #ffffff !important;
        z-index: 10 !important;
        box-shadow: none !important;
    }

    #divTablaDocumento table thead tr th:last-child {
        background-color: #f8f9fa !important;
    }

    /* Las otras 2 columnas (Descargar, Eliminar) NO son sticky */
    #divTablaDocumento table thead tr th:nth-last-child(2),
    #divTablaDocumento table tbody tr td:nth-last-child(2),
    #divTablaDocumento table thead tr th:nth-last-child(3),
    #divTablaDocumento table tbody tr td:nth-last-child(3) {
        position: static !important;
        box-shadow: none !important;
    }

    /* Botones más pequeños en móvil */
    #divTablaDocumento .btn-sm {
        padding: 0.25rem 0.4rem !important;
        font-size: 0.75rem !important;
    }

        #divTablaDocumento .btn-sm i {
            font-size: 14px !important;
        }

    /* Scrollbar visible */
    #divTablaDocumento .table-responsive {
        scrollbar-width: thin;
        scrollbar-color: #999 #f1f1f1;
    }

        #divTablaDocumento .table-responsive::-webkit-scrollbar {
            height: 8px !important;
        }

        #divTablaDocumento .table-responsive::-webkit-scrollbar-track {
            background: #f1f1f1;
            border-radius: 4px;
        }

        #divTablaDocumento .table-responsive::-webkit-scrollbar-thumb {
            background: #999;
            border-radius: 4px;
        }
}

/* --- CARD HEADER Y BODY RESPONSIVE --- */

@media (max-width: 576px) {
    /* Headers más compactos */
    .card:has(#divTablaDocumento) .card-header,
    .card:has(#imgFoto) .card-header {
        padding: 0.5rem !important;
        font-size: 0.875rem !important;
    }

    /* Body más compacto */
    .card:has(#divTablaDocumento) .card-body,
    .card:has(#imgFoto) .card-body {
        padding: 0.75rem !important;
    }

    /* Botón "Subir archivos" más pequeño */
    #btnSubirFile {
        font-size: 0.75rem !important;
        padding: 0.25rem 0.5rem !important;
    }

        #btnSubirFile i {
            font-size: 14px !important;
        }
}

/* --- FIX IMAGEN VISTA PREVIA EN MÓVIL --- */

@media (max-width: 991.98px) {
    /* Imagen más pequeña en móvil */
    #imgFoto {
        max-width: 200px !important;
        max-height: 200px !important;
    }

    /* Card Vista Previa con altura auto en móvil */
    .card:has(#imgFoto).h-100 {
        height: auto !important;
    }
}

/* ========================================
   FIN DE FIX SUBIR ARCHIVOS
   ======================================== */

.layout-wrapper:not(.layout-menu-expanded) .layout-overlay,
.layout-wrapper:not(.layout-menu-expanded) .content-backdrop {
    display: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Prevenir pseudo-elementos que causen overlay */
body::before,
body::after {
    content: none !important;
}

@media (max-width: 991.98px) {
    .layout-wrapper::before {
        content: none !important;
    }
}

/* --- FIX PARA BACKDROP FADE --- */

.backdrop-fade:not(.show),
.fade:not(.show):not(.modal) {
    display: none !important;
    opacity: 0 !important;
}

/* ========================================
   FIN DE FIX OVERLAY OSCURO
   ======================================== */
