:root {
    --citius-yellow: #f0dc00;
    --citius-yellow-dark: #c9b900;
    --citius-black: #111111;
    --citius-sidebar-width: 19rem;
    --citius-chrome-height: 7.5rem;
    --citius-font-scale: 1;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    overflow-x: hidden;
    background: #eef1f4;
    color: #25282c;
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: calc(1rem * var(--citius-font-scale));
}

button,
input,
select,
textarea {
    font-size: inherit;
}

#contenedor.app-shell {
    width: 100% !important;
    min-height: 100vh !important;
    height: auto !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
    background: #eef1f4;
    border: 0;
}

#titulos.app-header {
    height: auto;
    min-height: 5rem;
    padding: .55rem 0;
    background: var(--citius-black);
    border-bottom: 3px solid var(--citius-yellow);
    box-shadow: 0 .25rem 1rem rgba(0, 0, 0, .18);
    z-index: 1040;
}

.app-brand {
    min-width: 0;
    color: #fff;
    text-decoration: none;
}

.app-logo {
    display: block;
    width: auto;
    height: 2.75rem;
    max-width: 10rem;
    object-fit: contain;
    object-position: left center;
}

.app-module-title {
    padding-left: 1rem;
    border-left: 1px solid rgba(255, 255, 255, .25);
    font-size: 1rem;
    font-weight: 500;
    letter-spacing: .02em;
    white-space: nowrap;
}

.app-session-text {
    max-width: 28rem;
    overflow: hidden;
    color: rgba(255, 255, 255, .78);
    font-size: .875rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

#breadcrumb.app-toolbar {
    float: none;
    clear: none;
    height: auto;
    margin: 0;
    padding: 0;
    color: #212529;
    background: #fff;
    border-top: 0;
    border-bottom: 1px solid #dee2e6;
    font-size: inherit;
    box-shadow: 0 .125rem .35rem rgba(22, 27, 34, .05);
    z-index: 1020;
}

#contenidos.app-main {
    float: none;
    clear: none;
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
}

.app-layout {
    display: flex;
    width: 100%;
    min-height: calc(100vh - var(--citius-chrome-height));
}

.app-sidebar {
    --bs-offcanvas-width: var(--citius-sidebar-width);
    width: var(--citius-sidebar-width);
    color: #fff;
    background: #171717;
    border-right: 1px solid #343434;
}

.app-sidebar .offcanvas-body {
    min-height: 0;
}

.sidebar-heading {
    min-height: 3.25rem;
    padding: .75rem 1rem;
    color: rgba(255, 255, 255, .72);
    border-bottom: 1px solid #343434;
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
}

.sidebar-scroll {
    min-height: 0;
    overflow-y: auto;
    scrollbar-color: #4c4c4c #171717;
}

.app-sidebar .accordion,
.app-sidebar .accordion-item,
.app-sidebar .accordion-button,
.app-sidebar .accordion-body {
    color: inherit;
    background: transparent;
}

.app-sidebar .accordion-item {
    border: 0;
    border-bottom: 1px solid #303030;
}

.app-sidebar .accordion-button {
    min-height: 3.25rem;
    padding: .85rem 1rem;
    color: #f5f5f5;
    font-size: .925rem;
    font-weight: 600;
    box-shadow: none;
}

.app-sidebar .accordion-button:not(.collapsed) {
    color: #111;
    background: var(--citius-yellow);
}

.app-sidebar .accordion-button::after {
    filter: invert(1) grayscale(1) brightness(2);
}

.app-sidebar .accordion-button:not(.collapsed)::after {
    filter: none;
}

.app-sidebar .accordion-body {
    padding: .35rem 0 .6rem;
    background: #202020;
}

.sidebar-link {
    display: block;
    width: 100%;
    padding: .62rem 1rem .62rem 1.35rem;
    color: rgba(255, 255, 255, .8);
    background: transparent;
    border: 0;
    border-left: .22rem solid transparent;
    text-align: left;
    line-height: 1.3;
    transition: color .15s ease, background-color .15s ease, border-color .15s ease;
}

.sidebar-link:hover,
.sidebar-link:focus-visible,
.sidebar-link.is-active {
    color: #fff;
    background: rgba(255, 255, 255, .08);
    border-left-color: var(--citius-yellow);
    outline: 0;
}

.sidebar-select-wrap {
    padding: .25rem 1rem .75rem 1.35rem;
}

.sidebar-footer {
    padding: 1rem;
    border-top: 1px solid #343434;
    background: #141414;
}

.sidebar-restore {
    display: none;
}

#marco.app-content {
    float: none;
    flex: 1 1 auto;
    width: auto;
    min-width: 0;
    height: auto;
    min-height: calc(100vh - var(--citius-chrome-height));
    padding: 1rem;
    overflow: auto;
    background: #f6f7f9;
}

#marco.app-content > :first-child {
    margin-top: 0;
}

.app-content table {
    max-width: 100%;
}

.welcome-panel {
    display: grid;
    min-height: min(34rem, calc(100vh - 11rem));
    place-items: center;
    padding: 2rem;
    text-align: center;
    background: #fff;
    border: 1px solid #e2e5e9;
    border-radius: 1rem;
    box-shadow: 0 .5rem 1.5rem rgba(21, 26, 33, .06);
}

.welcome-eyebrow {
    margin-bottom: .5rem;
    color: #887f00;
    font-size: .8rem;
    font-weight: 800;
    letter-spacing: .15em;
    text-transform: uppercase;
}

.app-footer {
    display: none;
}

.app-loading {
    display: flex;
    min-height: 16rem;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    color: #5e6570;
}

.app-loading .spinner-border {
    width: 1.5rem;
    height: 1.5rem;
    color: #a49700;
}

.login-page {
    display: grid;
    min-height: calc(100vh - var(--citius-chrome-height));
    place-items: center;
}

.login-card {
    width: min(100%, 30rem);
    overflow: hidden;
}

.login-card .form-control {
    width: 100%;
    padding: .625rem .75rem;
    color: #212529;
    background-color: #fff;
    font-size: 1rem;
}

.app-sidebar .form-select {
    width: 100%;
    color: #212529;
    background-color: #fff;
    font-size: .875rem;
}

.login-card::before {
    display: block;
    height: .4rem;
    background: var(--citius-yellow);
    content: '';
}

.login-logo {
    width: auto;
    max-width: 13.75rem;
    max-height: 4.5rem;
    object-fit: contain;
}

#marco .table-responsive,
#marco .legacy-table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

#marco img,
#contenido_dialogo img,
#contenido_dialogo_lista img {
    max-width: 100%;
    height: auto;
}

.ui-dialog {
    max-width: calc(100vw - 2rem) !important;
}

.ui-dialog .ui-dialog-content {
    max-height: calc(100vh - 10rem) !important;
    overflow: auto;
}

@media (min-width: 992px) {
    .app-sidebar {
        position: sticky;
        top: 0;
        flex: 0 0 var(--citius-sidebar-width);
        height: calc(100vh - var(--citius-chrome-height));
        visibility: visible !important;
        transform: none !important;
        transition: flex-basis .2s ease, width .2s ease, opacity .15s ease;
    }

    .app-layout.sidebar-collapsed .app-sidebar {
        width: 0;
        flex-basis: 0;
        overflow: hidden;
        opacity: 0;
        border-right: 0;
    }

    .app-layout.sidebar-collapsed .sidebar-restore {
        position: fixed;
        left: .5rem;
        bottom: 1rem;
        z-index: 1030;
        display: grid;
        width: 2.5rem;
        height: 2.5rem;
        place-items: center;
        padding: 0;
        color: #111;
        background: var(--citius-yellow);
        border: 0;
        border-radius: 50%;
        box-shadow: 0 .25rem .8rem rgba(0, 0, 0, .22);
        cursor: pointer;
        font-size: 1.75rem;
        line-height: 1;
    }
}

@media (max-width: 991.98px) {
    :root {
        --citius-chrome-height: 7rem;
    }

    #titulos.app-header {
        min-height: 4.25rem;
    }

    .app-logo {
        height: 2.5rem;
        max-width: 9rem;
    }

    .app-sidebar {
        height: 100vh;
    }

    #marco.app-content {
        width: 100%;
        min-height: calc(100vh - var(--citius-chrome-height));
        padding: .75rem;
    }

    .welcome-panel {
        min-height: calc(100vh - 9rem);
        padding: 1.25rem;
    }
}

@media (max-width: 575.98px) {
    .app-header .container-fluid {
        padding-right: .65rem;
        padding-left: .65rem;
    }

    .app-logo {
        height: 2.25rem;
        max-width: 8rem;
    }

    #textos_comandos .btn {
        padding: .25rem .4rem;
    }
}


/*
 * Compatibilidad con css/estilos.css heredado.
 * La hoja antigua usa selectores globales y varios ID del marco original.
 * Estas reglas aíslan la nueva carcasa Bootstrap sin alterar los módulos AJAX.
 */
#citiusMenu.sidebar-scroll {
    float: none;
    width: auto;
    height: auto;
    min-height: 0;
    padding: 0;
    margin: 0;
    background: transparent;
}

#citiusMenuAccordion.accordion {
    padding: 0;
    margin: 0;
    list-style: none;
}

#marco .nhead,
#marco .vhead {
    box-sizing: border-box;
    max-width: 100%;
}

#marco table.tablesorter {
    margin-right: 0;
    margin-left: 0;
}

@media (max-width: 767.98px) {
    #marco .cabecera {
        display: block;
    }

    #marco .nhead,
    #marco .vhead {
        float: none;
        display: block;
        width: 100%;
        margin-left: 0;
    }

    #marco #cont_filtros2 > div {
        float: none;
        width: 100%;
        height: auto;
        margin-right: 0;
        margin-bottom: .5rem;
    }
}

/*
 * Ajuste de ocupacion completa del viewport.
 * Bootstrap aplica reglas con !important a .offcanvas-lg en escritorio;
 * por eso el lateral quedaba transparente y tomaba solo la altura del contenido.
 */
html,
body {
    height: 100%;
}

body {
    overflow: hidden;
}

#contenedor.app-shell {
    height: 100vh !important;
    height: 100dvh !important;
    min-height: 0 !important;
    overflow: hidden;
}

#contenidos.app-main {
    display: flex;
    flex: 1 1 0;
    width: 100%;
    min-width: 0;
    min-height: 0;
    overflow: hidden;
}

.app-layout {
    display: flex;
    flex: 1 1 auto;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden;
}

.app-sidebar {
    color: #fff !important;
    background-color: #171717 !important;
    border-right: 1px solid #343434 !important;
}

.app-sidebar .offcanvas-body {
    display: flex !important;
    flex: 1 1 auto !important;
    flex-direction: column;
    width: 100%;
    min-width: 0;
    min-height: 0;
    height: 100%;
    overflow: hidden !important;
    background-color: #171717 !important;
}

#citiusMenu.sidebar-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: #171717;
}

.sidebar-footer {
    flex: 0 0 auto;
}

#marco.app-content {
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none;
    overflow: auto;
}

.welcome-panel {
    width: 100%;
    min-height: 100%;
    height: 100%;
    box-sizing: border-box;
}

.login-page {
    width: 100%;
    min-height: 100%;
}

@media (min-width: 992px) {
    .app-sidebar.offcanvas-lg {
        position: relative;
        top: auto;
        display: flex !important;
        flex: 0 0 var(--citius-sidebar-width) !important;
        width: var(--citius-sidebar-width) !important;
        min-width: var(--citius-sidebar-width);
        max-width: var(--citius-sidebar-width);
        height: 100% !important;
        min-height: 0;
        visibility: visible !important;
        overflow: hidden;
        background-color: #171717 !important;
        border-right: 1px solid #343434 !important;
        transform: none !important;
    }

    .app-layout.sidebar-collapsed .app-sidebar.offcanvas-lg {
        flex-basis: 0 !important;
        width: 0 !important;
        min-width: 0;
        max-width: 0;
        border-right: 0 !important;
    }
}

@media (max-width: 991.98px) {
    #marco.app-content {
        width: 100%;
        height: 100% !important;
    }

    .app-sidebar {
        height: 100vh !important;
        height: 100dvh !important;
    }
}

/*
 * Contraste definitivo del menu lateral.
 * Se fuerza sobre Bootstrap y sobre la hoja heredada para evitar que el
 * accordion quede con fondo gris claro y texto blanco.
 */
#sidebar.app-sidebar,
#sidebar.app-sidebar .offcanvas-header,
#sidebar.app-sidebar .offcanvas-body,
#sidebar.app-sidebar #citiusMenu,
#sidebar.app-sidebar #citiusMenuAccordion {
    color: #ffffff !important;
    background-color: #20242a !important;
}

#sidebar.app-sidebar .sidebar-heading {
    color: #f4f5f6 !important;
    background-color: #181b1f !important;
    border-bottom-color: #40464f !important;
}

#sidebar.app-sidebar .accordion-item {
    color: #ffffff !important;
    background-color: #20242a !important;
    border-bottom: 1px solid #3a4048 !important;
}

#sidebar.app-sidebar .accordion-header {
    margin: 0;
    background-color: #20242a !important;
}

#sidebar.app-sidebar .accordion-button,
#sidebar.app-sidebar .accordion-button.collapsed {
    color: #ffffff !important;
    background-color: #272c33 !important;
    border: 0 !important;
    box-shadow: none !important;
}

#sidebar.app-sidebar .accordion-button:hover,
#sidebar.app-sidebar .accordion-button:focus-visible {
    color: #ffffff !important;
    background-color: #343b44 !important;
}

#sidebar.app-sidebar .accordion-button:not(.collapsed) {
    color: #161616 !important;
    background-color: var(--citius-yellow) !important;
}

#sidebar.app-sidebar .accordion-button::after {
    opacity: 1;
    filter: brightness(0) invert(1) !important;
}

#sidebar.app-sidebar .accordion-button:not(.collapsed)::after {
    filter: brightness(0) !important;
}

#sidebar.app-sidebar .accordion-collapse,
#sidebar.app-sidebar .accordion-body {
    color: #ffffff !important;
    background-color: #161a1e !important;
}

#sidebar.app-sidebar .sidebar-link {
    color: #f1f3f5 !important;
    background-color: #161a1e !important;
    border-bottom: 1px solid rgba(255, 255, 255, .055);
}

#sidebar.app-sidebar .sidebar-link:hover,
#sidebar.app-sidebar .sidebar-link:focus-visible {
    color: #ffffff !important;
    background-color: #303741 !important;
    border-left-color: var(--citius-yellow) !important;
}

#sidebar.app-sidebar .sidebar-link.is-active {
    color: #111111 !important;
    background-color: var(--citius-yellow) !important;
    border-left-color: #ffffff !important;
    font-weight: 700;
}

#sidebar.app-sidebar .sidebar-footer {
    color: #ffffff !important;
    background-color: #111315 !important;
    border-top-color: #40464f !important;
}

/*
 * Capa final de la carcasa. Se mantiene al final y usa los ID reales para
 * impedir que Bootstrap o cualquier CSS heredado cambien el contraste.
 */
#breadcrumb.app-toolbar {
    height: auto !important;
    margin: 0 !important;
    padding: 0 !important;
    color: #212529 !important;
    background: #ffffff !important;
    border: 0 !important;
    border-bottom: 1px solid #dfe3e8 !important;
}

#sidebar.app-sidebar,
#sidebar.app-sidebar.offcanvas-lg,
#sidebar.app-sidebar .offcanvas-body,
#sidebar.app-sidebar #citiusMenu,
#sidebar.app-sidebar #citiusMenuAccordion {
    color: #ffffff !important;
    background: #17191d !important;
}

#sidebar.app-sidebar .accordion {
    --bs-accordion-color: #ffffff;
    --bs-accordion-bg: #17191d;
    --bs-accordion-border-color: #3a3f47;
    --bs-accordion-btn-color: #ffffff;
    --bs-accordion-btn-bg: #24282e;
    --bs-accordion-active-color: #111111;
    --bs-accordion-active-bg: var(--citius-yellow);
}

#sidebar.app-sidebar .sidebar-heading {
    color: #d9dde2 !important;
    background: #111316 !important;
}

#sidebar.app-sidebar .accordion-item,
#sidebar.app-sidebar .accordion-header {
    color: #ffffff !important;
    background: #17191d !important;
    border-color: #3a3f47 !important;
}

#sidebar.app-sidebar .accordion-button,
#sidebar.app-sidebar .accordion-button.collapsed {
    color: #ffffff !important;
    background: #24282e !important;
    border-bottom: 1px solid #3a3f47 !important;
    opacity: 1 !important;
}

#sidebar.app-sidebar .accordion-button:hover,
#sidebar.app-sidebar .accordion-button:focus-visible {
    color: #ffffff !important;
    background: #343a43 !important;
}

#sidebar.app-sidebar .accordion-button:not(.collapsed) {
    color: #111111 !important;
    background: var(--citius-yellow) !important;
}

#sidebar.app-sidebar .accordion-collapse,
#sidebar.app-sidebar .accordion-body {
    color: #ffffff !important;
    background: #0f1114 !important;
}

#sidebar.app-sidebar .sidebar-link {
    color: #f4f6f8 !important;
    background: #0f1114 !important;
}

#sidebar.app-sidebar .sidebar-link:hover,
#sidebar.app-sidebar .sidebar-link:focus-visible {
    color: #ffffff !important;
    background: #303640 !important;
}

#sidebar.app-sidebar .sidebar-footer {
    color: #ffffff !important;
    background: #0b0c0e !important;
}

#marco.app-content {
    align-self: stretch;
    flex: 1 1 0;
    width: 0;
    min-width: 0;
    height: auto !important;
    min-height: 0 !important;
    margin: 1rem !important;
    padding: 1rem !important;
    overflow: auto;
    background: #ffffff !important;
    border: 1px solid #dce1e6;
    border-radius: .9rem;
    box-shadow: 0 .35rem 1rem rgba(20, 28, 38, .05);
}

#marco.app-content .welcome-panel {
    width: 100%;
    min-height: 100%;
    height: auto;
    padding: 1rem;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
}

@media (max-width: 991.98px) {
    #marco.app-content {
        width: auto;
        margin: .75rem !important;
        padding: .75rem !important;
    }
}

