:root,
[data-theme-mode="light"],
[data-theme-mode="dark"] {
    --primary-rgb: 228, 50, 43 !important;
    --primary-color: rgb(228, 50, 43) !important;
}

/* =========================
   BOTONES
========================= */
.btn-bd-primary {
    --bs-btn-font-weight: 600;
    --bs-btn-color: #fff;
    --bs-btn-bg: var(--primary-color);
    --bs-btn-border-color: var(--primary-color);
    --bs-btn-border-radius: 0.5rem;
    --bs-btn-hover-color: #fff;
    --bs-btn-hover-bg: rgba(var(--primary-rgb), 0.9);
    --bs-btn-hover-border-color: rgba(var(--primary-rgb), 0.9);
    --bs-btn-active-color: #fff;
    --bs-btn-active-bg: rgba(var(--primary-rgb), 0.85);
    --bs-btn-active-border-color: rgba(var(--primary-rgb), 0.85);
}


/* =========================
   LOGIN
========================= */
.login-wrapper {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: flex;
    justify-content: center;
    align-items: center;
    background: #f5f6fa;
    overflow: hidden;
}

/* Contenedor para apilar rojo + blanco */
.login-stack {
    position: relative;
}

/* Card rojo detrás */
.login-back {
    position: absolute;
    width: 660px;
    height: 200px;
    background: #e4322b;
    border-radius: 10px;
    top: -50px;
    left: 50%;
    transform: translateX(-50%);
    box-shadow: 0 15px 40px rgba(0,0,0,.15);
    z-index: 1;
}

/* Card blanco */
.login-box {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 520px;
    padding: 2rem;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 15px 40px rgba(0,0,0,.15);
}

.login-logo {
    max-width: 260px;
    width: 100%;
    display: block;
    margin: 0 auto 1rem;
}


/* =========================
   SIDEBAR (YNEX)
========================= */
.app-sidebar,
.main-sidebar,
.sidebar,
[data-menu-styles="dark"],
.app-sidebar .main-sidebar {
    background-color: #263544 !important;
}

.main-sidebar-header {
    background-color: #263544 !important;
}

    .main-sidebar-header a {
        text-decoration: none;
        color: inherit;
    }

    .main-sidebar-header a span {
        font-size: 1.4rem;
    }

    [data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .main-sidebar-header a > span:last-child {
        display: none;
    }

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .slide__category.slide__category--menu-label:before {
    display: none;
}

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .slide__category.slide__category--menu-label {
    padding: 0.5rem 0.25rem;
    text-align: center;
}

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .slide__category.slide__category--menu-label .category-name {
    display: block !important;
    font-size: 0.55rem;
    letter-spacing: 0.04rem;
    line-height: 1.1;
    white-space: normal;
    word-break: break-word;
    text-align: center;
    opacity: 0.5;
}

/* Bootstrap .nav-link dentro del menú lateral anula display:flex de Ynex */
.app-sidebar .main-menu .side-menu__item {
    display: flex !important;
    align-items: flex-start;
}

.app-sidebar .side-menu__item .side-menu__icon {
    flex-shrink: 0;
    margin-top: 0.1rem;
}

.app-sidebar .side-menu__item .side-menu__label {
    flex: 1;
    min-width: 0;
    font-size: inherit;
    font-weight: inherit;
    line-height: 1.25;
    white-space: normal;
    word-break: break-word;
    overflow: visible;
    text-overflow: unset;
}

.app-sidebar .slide.has-sub > .side-menu__item .side-menu__label {
    padding-inline-end: 1.25rem;
}

/* Nombre de usuario: una sola línea */
.app-sidebar .main-menu > li:not(.slide) .side-menu__label {
    white-space: nowrap;
}

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .slide {
    padding-inline: 0.25rem;
}

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .side-menu__item {
    justify-content: center !important;
    padding-inline: 0.5rem;
}

[data-vertical-style=overlay][data-toggled=icon-overlay-close]:not([data-icon-overlay=open]) .app-sidebar .side-menu__icon {
    margin-inline: 0 !important;
    width: auto;
}

.brand-text {
    font-size: 1.6rem;
    font-weight: 600;
}


/* =========================
   CARD SISTEMA
========================= */
.card-sistema {
    cursor: pointer;
    transition: transform 0.2s ease;
    align-items: center;
    justify-content: center;
}

    .card-sistema:hover {
        transform: scale(1.03);
    }

.card-sistema-custom:hover {
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.15);
}

.card-title:hover {
    align-items:end;
}

/* =========================
   CIRCLE BUTTON
========================= */
.circle-btn {
    background-color: #e4322b;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .circle-btn:hover {
        color: #fff;
        transform: scale(1.1);
    }


/* =========================
   LOADER
========================= */
/* Fondo semi transparente centrado */
.loader-overlay {
    position: fixed;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

    /* Mostrar loader */
    .loader-overlay.show {
        display: flex;
    }

.loader-overlay .spinner-border {
    margin: 0;
}

/* Panel: el spinner sigue en el centro del viewport; el mensaje cuelga debajo */
.loader-panel {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
}

.loader-message {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    margin-top: 0.85rem;
    color: #000;
    font-size: 0.95rem;
    font-weight: 500;
    text-align: center;
    line-height: 1.35;
    /* sin esto, el absolute se encoge al ancho del spinner (~3rem) */
    width: max-content;
    max-width: min(28rem, 90vw);
    white-space: normal;
}

.loader-message img,
.loader-message svg,
.loader-message i {
    vertical-align: middle;
}

.loader-message img {
    max-height: 1.5rem;
    width: auto;
}

/* Imagen centrada y en rojo */
.loader-img {
    width: 90px;
    filter: invert(1) brightness(0) saturate(100%) sepia(100%) saturate(8000%) contrast(250%) hue-rotate(355deg);
}

/* =========================
   FONDO MODAL
========================= */
.gray-modal {
    background-color: rgb(var(--body-bg-rgb)) !important;
}

/* =========================
   TABLAS
========================= */
.Selected-Item {
    background-color: #F2F2F2 !important;
}

.scroll-base {
    max-width: 100%;
    scrollbar-width: thin;
    scrollbar-color: #c5c5c5 #f8f9fa;
}

.scroll-base::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

.scroll-base::-webkit-scrollbar-track {
    background: #f8f9fa;
}

.scroll-base::-webkit-scrollbar-thumb {
    background: #c5c5c5;
    border-radius: 4px;
}

.scroll-base::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}

.scroll-y {
    overflow-y: auto;
    overflow-x: hidden;
}

.scroll-x {
    overflow-x: auto;
    overflow-y: hidden;
}

.scroll-both {
    overflow-x: auto;
    overflow-y: hidden;
}

.dataTables_wrapper.scroll-base.scroll-both[style*="max-height"],
.dataTables_wrapper.scroll-base.scroll-y[style*="max-height"] {
    overflow-y: auto;
}

/* ResponsiveDataTable */
.dataTables_wrapper.scroll-base {
    box-sizing: border-box;
    max-width: 100%;
    container-type: inline-size;
    container-name: dt-host;
}

.dataTables_wrapper.scroll-base > .row {
    margin-left: 0;
    margin-right: 0;
    max-width: 100%;
}

.dataTables_wrapper.scroll-base table.dataTable {
    width: 100% !important;
    max-width: 100%;
    margin-bottom: 0;
}

/* ResponsiveDataTable: columna Acciones (todas las pantallas con RowActions) */
.dataTables_wrapper table.dataTable th.rdt-actions-col,
.dataTables_wrapper table.dataTable td.rdt-actions-col {
    width: auto;
    min-width: 9rem !important;
    max-width: none !important;
    white-space: nowrap !important;
    overflow: visible !important;
    text-overflow: unset !important;
    vertical-align: middle;
    text-wrap: nowrap;
}

.dataTables_wrapper table.dataTable td.rdt-actions-col .rdt-actions {
    display: inline-flex;
    flex-flow: row wrap;
    align-items: center;
    justify-content: flex-start;
    gap: 0.25rem;
    width: max-content;
    max-width: 100%;
}

.dataTables_wrapper table.dataTable td.rdt-actions-col .rdt-actions .btn {
    flex: 0 0 auto;
    line-height: 1;
    padding: 0.35rem 0.5rem;
}

.dataTables_wrapper table.dataTable td.rdt-actions-col .rdt-actions .btn i {
    line-height: 1;
    vertical-align: middle;
}

.dataTables_wrapper table.dataTable th.d-none + th,
.dataTables_wrapper table.dataTable td.d-none + td {
    border-left: 1px solid var(--bs-table-border-color, #e9ecef);
}

@container dt-host (min-width: 992px) {
    .dataTables_wrapper.scroll-base {
        overflow-x: visible;
    }

    .dataTables_wrapper.scroll-base table.dataTable {
        table-layout: fixed;
    }

    .dataTables_wrapper.scroll-base table.dataTable th,
    .dataTables_wrapper.scroll-base table.dataTable td {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dataTables_wrapper.scroll-base table.dataTable td:last-child,
    .dataTables_wrapper.scroll-base table.dataTable th:last-child {
        overflow: visible;
        text-overflow: unset;
    }

    .dataTables_wrapper.scroll-base table.dataTable th.rdt-actions-col,
    .dataTables_wrapper.scroll-base table.dataTable td.rdt-actions-col {
        min-width: 9rem !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }
}

@container dt-host (max-width: 991px) {
    .dataTables_wrapper.scroll-base {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .dataTables_wrapper.scroll-base table.dataTable {
        /*width: max-content !important;  JCSH 01/07/2026, esta linea esta ocacionando que la tabla desborde horizontalmente y exeda el tamaño de su contenedor cuando 
            tiene celdas con textos muy largos
        */
        min-width: 100%;
        table-layout: auto;
    }

    .dataTables_wrapper.scroll-base table.dataTable th,
    .dataTables_wrapper.scroll-base table.dataTable td {
        white-space: nowrap;
        overflow: visible;
        text-overflow: unset;
    }
}

@media (min-width: 992px) {
    .dataTables_wrapper.scroll-base {
        overflow-x: visible;
    }

    .dataTables_wrapper.scroll-base table.dataTable {
        table-layout: fixed;
    }

    .dataTables_wrapper.scroll-base table.dataTable th,
    .dataTables_wrapper.scroll-base table.dataTable td {
        min-width: 0;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    .dataTables_wrapper.scroll-base table.dataTable td:last-child,
    .dataTables_wrapper.scroll-base table.dataTable th:last-child {
        overflow: visible;
        text-overflow: unset;
    }

    .dataTables_wrapper.scroll-base table.dataTable th.rdt-actions-col,
    .dataTables_wrapper.scroll-base table.dataTable td.rdt-actions-col {
        min-width: 9rem !important;
        white-space: nowrap !important;
        overflow: visible !important;
    }
}

@media (max-width: 991.98px) {
    .dataTables_wrapper.scroll-base {
        overflow-x: auto;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
    }

    .dataTables_wrapper.scroll-base table.dataTable {
        width: max-content !important;
        min-width: 100%;
        table-layout: auto;
    }

    .dataTables_wrapper.scroll-base table.dataTable th,
    .dataTables_wrapper.scroll-base table.dataTable td {
        white-space: nowrap;
        overflow: visible;
        text-overflow: unset;
    }
}

@media (max-width: 767.98px) {
    .dataTables_wrapper.rdt-mobile-cards {
        overflow-x: visible;
        overflow-y: visible;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable {
        width: 100% !important;
        min-width: 0;
        border: 0;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable thead {
        display: none;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody tr {
        display: block;
        margin-bottom: 0.75rem;
        border: 1px solid var(--bs-table-border-color, #e9ecef);
        border-radius: 0.375rem;
        background: #fff;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody tr.even {
        background: #fff;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td {
        display: grid;
        grid-template-columns: minmax(6.5rem, 38%) 1fr;
        gap: 0.5rem;
        align-items: start;
        padding: 0.5rem 0.75rem;
        border: 0;
        border-bottom: 1px solid var(--bs-table-border-color, #e9ecef);
        white-space: normal;
        overflow: visible;
        text-overflow: unset;
        text-align: left;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td:last-child {
        border-bottom: 0;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td.d-none {
        display: none !important;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td::before {
        font-weight: 600;
        font-size: 0.8rem;
        color: #6c757d;
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td[data-label]::before {
        content: attr(data-label);
    }

    .dataTables_wrapper.rdt-mobile-cards table.dataTable tbody td .btn {
        margin-top: 0.15rem;
    }
}

/* =========================
   SHELL: footer siempre visible
   Sticky al viewport (sin scroll anidado: no rompe modales ni el scrollbar).
========================= */
.page {
    min-height: 100dvh;
    justify-content: flex-start !important;
}

.page > .main-content.app-content {
    /* espacio para que el sticky no tape el final del contenido */
    padding-bottom: 0.25rem;
}

.page > .footer,
.page footer.footer {
    position: sticky;
    bottom: 0;
    z-index: 1020;
    margin-top: auto;
}

/* =========================
   iFrame (legacy)
   Alto acotado al área visible: un solo scroll (dentro del iframe).
   Así SweetAlert/modales con position:fixed se centran en lo visible.
   El !important anula el auto-resize (postMessage anclo-legacy-resize).
========================= */

.iframe-wrapper {
    /* header Ynex (~3.75rem) + footer sticky (~3.25rem) + paddings/br */
    height: calc(100dvh - 8.5rem);
    max-height: calc(100dvh - 8.5rem);
    min-height: 0;
    overflow: hidden;
}

    .iframe-wrapper iframe {
        width: 100% !important;
        height: 100% !important;
        min-height: 0 !important;
        max-height: 100% !important;
        border: 0;
        display: block;
    }

/* Loader legacy (postMessage desde módulos SN* en iframe) */
.anclo-legacy-loader {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    margin: 0;
    padding: 0;
    z-index: 200000;
    background-color: rgba(0, 0, 0, 0.35);
    box-sizing: border-box;
    pointer-events: all;
}

.anclo-legacy-loader-content {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: #fff;
    border-radius: 10px;
    padding: 25px 40px;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.25);
    text-align: center;
    width: 300px;
    max-width: calc(100vw - 40px);
    box-sizing: border-box;
    margin: 0;
}

.anclo-legacy-loader-content h3 {
    margin: 0 0 10px 0;
    color: #2c3e50;
    font-size: 18px;
}

.anclo-legacy-loader-bar-track {
    width: 100%;
    background-color: #f1f1f1;
    border-radius: 25px;
    overflow: hidden;
    height: 16px;
    margin-top: 15px;
}

.anclo-legacy-loader-bar {
    display: block;
    width: 100%;
    height: 100%;
    background-color: #c62828;
    border-radius: 25px;
    transform-origin: left center;
    animation: ancloLegacyProgressSweep 2.4s ease-in-out infinite;
}

@keyframes ancloLegacyProgressSweep {
    0% {
        transform: translateX(0) scaleX(0);
        opacity: 0.4;
    }

    40% {
        transform: translateX(0) scaleX(1);
        opacity: 1;
    }

    60% {
        transform: translateX(0) scaleX(1);
        opacity: 1;
    }

    100% {
        transform: translateX(100%) scaleX(0);
        opacity: 0.4;
    }
}

/* =========================
   Editor de Menus
========================= */
.menu-edit-line {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap; /* 🔥 evita saltos */
}

/* 🔥 ID padre */
.id-input {
    width: 60px;
    min-width: 50px;
    padding: 2px;
    font-size: 11px;
    text-align: center;
}

/* 🔥 icono visual */
.icono {
    width: 20px;
    text-align: center;
}

/* 🔥 input icono */
.icon-input {
    width: 140px;
    font-size: 11px;
    padding: 2px;
}

/* 🔥 texto fijo */
.text-label {
    min-width: 180px;
    font-size: 12px;
}

/* 🔥 input texto */
.text-input {
    flex-grow: 1;
    font-size: 12px;
    padding: 2px 6px;
}

/* =========================
   Custom Cards
========================= */
.card-fullscreen-custom {
    position: fixed !important;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: 1055;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column; /* 🔥 clave */
}

    .card-fullscreen-custom .card-body {
        flex: 1; /* 🔥 ocupa el espacio restante */
        overflow: auto;
    }
    .card-fullscreen-custom .apexcharts-canvas {
        height: 100% !important;
    }

/* =========================
   Custom Choices
========================= */
.choices__inner {
    min-height: 35px !important;
    height: 35px;
    padding: 6px 12px !important;
    display: flex;
    align-items: center;
}

.choices__list--single .choices__item {
    line-height: 1.5;
}

.dataTables_wrapper table.dataTable tr:has(.costo-tooltip-container:hover) {
    position: relative;
    z-index: 9999 !important;
}

.dataTables_wrapper table.dataTable td:has(.costo-tooltip-container) {
    overflow: visible !important;
}

.costo-tooltip-container {
    position: relative;
    display: inline-flex;
    align-items: center;
}

.costo-tooltip-container:hover {
    z-index: 99999 !important;
}

.costo-tooltip-bubble {
    visibility: hidden;
    opacity: 0;
    position: absolute;
    bottom: 125%;
    right: 0;
    min-width: 240px;
    max-width: 380px;
    background: #ffffff !important;
    color: #1e293b;
    padding: 10px 14px;
    border-radius: 8px;
    font-size: 0.80rem;
    line-height: 1.45;
    box-shadow: 0 10px 25px -3px rgba(0, 0, 0, 0.18), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    border: 1px solid #e2e8f0;
    z-index: 999999 !important;
    pointer-events: none;
    white-space: normal !important;
    word-break: break-word;
    text-align: left;
    transform: translateY(4px);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.costo-tooltip-bubble::after {
    content: "";
    position: absolute;
    top: 100%;
    right: 8px;
    border-width: 6px;
    border-style: solid;
    border-color: #ffffff transparent transparent transparent;
}

.costo-tooltip-container:hover .costo-tooltip-bubble {
    visibility: visible;
    opacity: 1;
    transform: translateY(0);
}


