/* Overlay de carga: no bloquear clics cuando está oculto */
#portal-loading-overlay:not(.is-visible) {
    pointer-events: none !important;
    visibility: hidden;
}

#portal-loading-overlay.is-visible {
    pointer-events: auto;
}

body.modal-open #portal-loading-overlay,
body.modal-open #portal-loading-overlay.is-visible,
body.gface-dialog-open #portal-loading-overlay,
body.gface-dialog-open #portal-loading-overlay.is-visible {
    display: none !important;
    pointer-events: none !important;
    visibility: hidden !important;
}

/* Topbar encima del overlay de carga (2500) en pantalla normal */
#page-topbar {
    z-index: 2600 !important;
    pointer-events: auto !important;
}

/* --- Portal de modales GFACE (sin backdrop Bootstrap) --- */
#gface-modal-scrim {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 10050;
    background: rgba(15, 23, 42, 0.45);
    pointer-events: auto;
}

body.gface-dialog-open #gface-modal-scrim {
    display: block;
}

body.gface-dialog-open #page-topbar {
    z-index: 1000 !important;
}

#gface-modal-portal {
    position: fixed;
    inset: 0;
    z-index: 10060;
    pointer-events: none;
    overflow-x: hidden;
    overflow-y: auto;
}

#gface-modal-portal .modal {
    z-index: 10060 !important;
    pointer-events: auto !important;
}

#gface-modal-portal .modal.show .modal-dialog,
#gface-modal-portal .modal.show .modal-content,
#gface-modal-portal .modal.show .modal-header,
#gface-modal-portal .modal.show .modal-body,
#gface-modal-portal .modal.show .modal-footer,
#gface-modal-portal .modal.show input,
#gface-modal-portal .modal.show select,
#gface-modal-portal .modal.show textarea,
#gface-modal-portal .modal.show button,
#gface-modal-portal .modal.show label,
#gface-modal-portal .modal.show a {
    pointer-events: auto !important;
}

html[data-theme="alegra"] #gface-modal-portal .modal.show .modal-dialog {
    animation: none !important;
    transform: none !important;
}

/* Modales legacy (resto del portal) con backdrop Bootstrap */
.modal-backdrop {
    z-index: 2690 !important;
}

.modal {
    z-index: 2700 !important;
}

.modal.show {
    pointer-events: auto !important;
}

.modal.show .modal-dialog,
.modal.show .modal-content {
    pointer-events: auto !important;
}

html[data-theme="alegra"] .modal.show .modal-dialog {
    animation: none !important;
    transform: none !important;
}

/* SweetAlert2 por encima de modales GFACE (#gface-modal-portal ≈ 10060, .modal ≈ 2700) */
.swal2-container {
    z-index: 10170 !important;
}

/* Combobox NIT-first (lista anclada a body, encima de topbar/sidebar) */
#nitFirstCard {
    position: relative;
    z-index: 5;
    overflow: visible;
}
.nit-combobox {
    position: relative;
}
.nit-combobox-list {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
    overflow-y: auto;
    padding: 0.25rem;
}
.nit-combobox-item {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-radius: 0.35rem;
    cursor: pointer;
}
.nit-combobox-item:hover,
.nit-combobox-item.is-active {
    background: #ecfdf5;
}
.nit-combobox-nit {
    font-weight: 600;
    font-size: 0.875rem;
    color: #0f172a;
}
.nit-combobox-nombre {
    font-size: 0.8rem;
    color: #64748b;
}
.nit-combobox-empty {
    padding: 0.75rem;
    font-size: 0.875rem;
}

/* Choices en filtros de consultas: por encima del menú */
.choices__list--dropdown,
.choices__list[aria-expanded] {
    z-index: 6000 !important;
}
