:root {
    --bps-sidebar-width: 296px;
    --bps-sidebar-rail-width: 76px;
    --bps-sidebar-top: 64px;
    --bps-sidebar-surface: #ffffff;
    --bps-sidebar-subtle: #f8fafc;
    --bps-sidebar-border: #e5e9ef;
    --bps-sidebar-text: #41546a;
    --bps-sidebar-muted: #91a0b5;
    --bps-sidebar-strong: #1f2d3d;
    --bps-sidebar-primary: var(--bps-primary, #2563eb);
    --bps-sidebar-primary-soft: #eaf2ff;
    --bps-sidebar-shadow: 8px 0 28px rgba(30, 41, 59, 0.09);
    --bps-sidebar-tms: #0284c7;
    --bps-sidebar-tms-soft: #e0f2fe;
    --bps-sidebar-fleet: #0f766e;
    --bps-sidebar-fleet-soft: #e6fffb;
    --bps-sidebar-wms: #d97706;
    --bps-sidebar-wms-soft: #fff7ed;
    --bps-sidebar-erp: #16a34a;
    --bps-sidebar-erp-soft: #ecfdf3;
    --bps-sidebar-config: #7c3aed;
    --bps-sidebar-config-soft: #f5f3ff;
    --bps-sidebar-tasks: #be123c;
    --bps-sidebar-tasks-soft: #fff1f2;
}

/* Densidad de escritorio equivalente al zoom 90% de Chrome. */
@media screen and (min-width: 992px) {
    body.bps-app-density-90 {
        --bps-app-viewport-height: 111.111111vh;
        zoom: 0.9;
        min-height: var(--bps-app-viewport-height);
    }

    body.bps-app-density-90 .layout-wrapper,
    body.bps-app-density-90 .layout-container,
    body.bps-app-density-90 .layout-page {
        min-height: var(--bps-app-viewport-height);
    }

    body.bps-app-density-90 #layout-menu.bps-sidebar-shell,
    body.bps-app-density-90 #miMenuDesplegable.bps-sidebar {
        height: calc(var(--bps-app-viewport-height) - var(--bps-sidebar-top)) !important;
    }
}

.layout-page {
    padding-left: 0 !important;
}

.layout-page > .content-wrapper {
    transition: margin-left 180ms ease, width 180ms ease;
}

#layout-menu.bps-sidebar-shell {
    position: fixed !important;
    top: var(--bps-sidebar-top) !important;
    right: auto !important;
    bottom: auto !important;
    left: 0 !important;
    z-index: 1050;
    width: var(--bps-sidebar-rail-width) !important;
    height: calc(100vh - var(--bps-sidebar-top)) !important;
    min-height: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
    transform: none !important;
}

#miMenuDesplegable.bps-sidebar {
    position: absolute;
    inset: 0 auto auto 0;
    display: flex;
    width: var(--bps-sidebar-rail-width);
    height: calc(100vh - var(--bps-sidebar-top));
    flex-direction: column;
    overflow: visible;
    border-right: 1px solid var(--bps-sidebar-border);
    background: var(--bps-sidebar-surface);
    box-shadow: 3px 0 12px rgba(30, 41, 59, 0.05);
    transition: width 180ms ease, box-shadow 180ms ease, transform 180ms ease, opacity 180ms ease;
}

#miMenuDesplegable.bps-sidebar.mostrar {
    width: var(--bps-sidebar-width);
    box-shadow: var(--bps-sidebar-shadow);
}

.bps-sidebar-header {
    display: flex;
    min-height: 64px;
    flex: 0 0 64px;
    align-items: center;
    gap: 10px;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid var(--bps-sidebar-border);
}

.bps-sidebar-brand-mark {
    display: inline-flex;
    width: 38px;
    height: 38px;
    flex: 0 0 38px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid #d9e7ff;
    border-radius: 9px;
    background: var(--bps-sidebar-primary-soft);
    color: var(--bps-sidebar-primary);
    font-size: 1.16rem;
    cursor: pointer;
}

.bps-sidebar-brand-mark:hover {
    border-color: #bdd3ff;
    background: #deebff;
    color: var(--bps-sidebar-primary);
}

.bps-sidebar-brand-mark:focus-visible {
    outline: 2px solid var(--bps-sidebar-primary);
    outline-offset: 2px;
}

.bps-sidebar-brand-copy {
    display: flex;
    min-width: 0;
    flex: 1 1 auto;
    flex-direction: column;
    line-height: 1.15;
}

.bps-sidebar-brand-copy small {
    margin-bottom: 3px;
    color: var(--bps-sidebar-muted);
    font-size: 0.62rem;
    font-weight: 750;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.bps-sidebar-brand-copy strong {
    overflow: hidden;
    color: var(--bps-sidebar-strong);
    font-size: 0.88rem;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bps-sidebar-collapse {
    display: inline-flex;
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 1px solid transparent;
    border-radius: 8px;
    background: transparent;
    color: #718096;
    font-size: 1.2rem;
}

.bps-sidebar-collapse:hover {
    border-color: var(--bps-sidebar-border);
    background: var(--bps-sidebar-subtle);
    color: var(--bps-sidebar-strong);
}

.bps-sidebar-collapse:focus-visible,
#miMenuDesplegable .menu-link:focus-visible,
.bps-sidebar-search input:focus-visible,
.bps-sidebar-logout:focus-visible {
    outline: 2px solid var(--bps-sidebar-primary);
    outline-offset: 2px;
}

.bps-sidebar-search {
    position: relative;
    display: flex;
    height: 42px;
    flex: 0 0 42px;
    align-items: center;
    margin: 10px 12px 4px;
    color: #7c8ba1;
}

.bps-sidebar-search > .bx {
    position: absolute;
    left: 11px;
    z-index: 1;
    font-size: 1rem;
    pointer-events: none;
}

.bps-sidebar-search input {
    width: 100%;
    height: 38px;
    padding: 0 42px 0 34px;
    border: 1px solid var(--bps-sidebar-border);
    border-radius: 8px;
    background: var(--bps-sidebar-subtle);
    color: var(--bps-sidebar-strong);
    font: inherit;
    font-size: 0.78rem;
}

.bps-sidebar-search input::placeholder {
    color: #9aa7b8;
}

.bps-sidebar-search kbd {
    position: absolute;
    right: 8px;
    padding: 2px 5px;
    border: 1px solid #dfe4ea;
    border-radius: 5px;
    background: #fff;
    color: #8290a3;
    box-shadow: none;
    font-family: inherit;
    font-size: 0.62rem;
    font-weight: 650;
}

.bps-sidebar-scroll {
    position: relative;
    min-height: 0;
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-color: #cbd4df transparent;
    scrollbar-width: thin;
}

.bps-sidebar-scroll::-webkit-scrollbar {
    width: 5px;
}

.bps-sidebar-scroll::-webkit-scrollbar-thumb {
    border-radius: 999px;
    background: #cbd4df;
}

#miMenuDesplegable .menu-inner {
    display: block !important;
    width: 100%;
    margin: 0 !important;
    padding: 4px 12px 18px !important;
    list-style: none;
}

#miMenuDesplegable .menu-header {
    display: flex !important;
    width: auto !important;
    min-height: auto !important;
    align-items: flex-start;
    justify-content: flex-start !important;
    gap: 8px;
    margin: 19px 10px 7px !important;
    padding: 0 !important;
    color: var(--bps-sidebar-muted) !important;
    font-size: 0.64rem !important;
    font-weight: 750 !important;
    letter-spacing: 0.075em !important;
    line-height: 1.2 !important;
    text-align: left !important;
    text-transform: uppercase;
}

#miMenuDesplegable .menu-header:first-child {
    margin-top: 8px !important;
}

#miMenuDesplegable .menu-header::after {
    display: none;
}

#miMenuDesplegable .menu-header-system {
    margin-top: 24px !important;
    padding-top: 18px !important;
    border-top: 1px solid var(--bps-sidebar-border);
}

#miMenuDesplegable .menu-item {
    position: relative;
    width: 100%;
    margin: 0 0 3px !important;
    padding: 0 !important;
    border-radius: 8px;
    list-style: none;
}

#miMenuDesplegable .menu-link {
    position: relative;
    display: flex !important;
    width: 100% !important;
    min-height: 40px;
    align-items: center;
    gap: 10px;
    padding: 6px 10px !important;
    margin: 0 !important;
    border: 1px solid transparent;
    border-radius: 8px !important;
    background: transparent !important;
    color: var(--bps-sidebar-text) !important;
    box-shadow: none !important;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
    text-decoration: none !important;
    transform: none !important;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

#miMenuDesplegable .menu-link:hover {
    border-color: #e8ecf1;
    background: #f7f9fb !important;
    color: var(--bps-sidebar-strong) !important;
}

#miMenuDesplegable .menu-link > div {
    min-width: 0;
    padding: 0 22px 0 0 !important;
    overflow: visible !important;
    color: inherit;
    line-height: 1.25 !important;
    text-overflow: clip !important;
    white-space: normal !important;
}

#miMenuDesplegable .menu-icon {
    display: inline-flex !important;
    width: 24px;
    height: 24px;
    min-width: 24px;
    align-items: center;
    justify-content: center;
    margin: 0 !important;
    color: #7f8da1;
    font-size: 1.08rem !important;
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link {
    min-height: 42px;
    font-size: 0.82rem !important;
    font-weight: 600 !important;
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .menu-icon {
    width: 26px;
    height: 26px;
    min-width: 26px;
    border-radius: 0;
    background: transparent;
    color: #75869b;
    font-size: 1.08rem !important;
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-dashboard,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-tms,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-fleet,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-wms,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-erp,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-tasks,
#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-maestro {
    border-radius: 7px;
}

#miMenuDesplegable .menu-icon.icon-dashboard {
    color: var(--bps-sidebar-primary) !important;
}

#miMenuDesplegable .menu-icon.icon-tms {
    color: var(--bps-sidebar-tms) !important;
}

#miMenuDesplegable .menu-icon.icon-wms {
    color: var(--bps-sidebar-wms) !important;
}

#miMenuDesplegable .menu-icon.icon-erp {
    color: var(--bps-sidebar-erp) !important;
}

#miMenuDesplegable .menu-icon.icon-fleet {
    color: var(--bps-sidebar-fleet) !important;
}

#miMenuDesplegable .menu-icon.icon-tasks {
    color: var(--bps-sidebar-tasks) !important;
}

#miMenuDesplegable .menu-icon.icon-maestro {
    color: var(--bps-sidebar-config) !important;
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-dashboard {
    background: var(--bps-sidebar-primary-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-tms {
    background: var(--bps-sidebar-tms-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-wms {
    background: var(--bps-sidebar-wms-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-erp {
    background: var(--bps-sidebar-erp-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-fleet {
    background: var(--bps-sidebar-fleet-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-tasks {
    background: var(--bps-sidebar-tasks-soft);
}

#miMenuDesplegable .menu-inner > .menu-item > .menu-link > .icon-maestro {
    background: var(--bps-sidebar-config-soft);
}

#miMenuDesplegable .menu-toggle::after {
    content: "" !important;
    position: absolute !important;
    top: 50% !important;
    right: 14px !important;
    width: 7px !important;
    height: 7px !important;
    margin: -4px 0 0 !important;
    border: solid #94a3b8 !important;
    border-width: 0 1.5px 1.5px 0 !important;
    border-radius: 0 !important;
    background: none !important;
    transform: rotate(-45deg) !important;
    transform-origin: center !important;
    transition: transform 120ms ease !important;
}

#miMenuDesplegable .menu-item.open > .menu-toggle::after {
    margin-top: -5px !important;
    transform: rotate(45deg) !important;
}

#miMenuDesplegable .menu-sub {
    display: none;
    margin: 3px 0 8px 25px !important;
    padding: 3px 0 3px 11px !important;
    border-left: 1px solid var(--bps-sidebar-border) !important;
    background: transparent !important;
    list-style: none;
}

#miMenuDesplegable .menu-item.open > .menu-sub {
    display: block !important;
}

#miMenuDesplegable .menu-sub .menu-link {
    min-height: 34px;
    padding: 6px 8px !important;
    border: 0;
    font-size: 0.78rem !important;
    font-weight: 550 !important;
    color: #607289 !important;
}

#miMenuDesplegable .menu-item.active > .menu-link,
#miMenuDesplegable .menu-item.active-path > .menu-link {
    border-color: #e2e8f0;
    background: #f1f5f9 !important;
    color: var(--bps-sidebar-primary) !important;
}

#miMenuDesplegable .menu-inner > .menu-item.active-path > .menu-link > .menu-icon {
    background: transparent;
    color: var(--bps-sidebar-primary) !important;
}

#miMenuDesplegable .menu-item-blocked {
    opacity: 1 !important;
    filter: none !important;
    pointer-events: none;
}

#miMenuDesplegable .menu-item-blocked > .menu-link {
    color: #9aa8ba !important;
}

#miMenuDesplegable .menu-item-blocked > .menu-link > .menu-icon {
    background: transparent;
    color: #a7b2c0 !important;
}

#miMenuDesplegable .bps-search-hidden,
#miMenuDesplegable .menu-header.bps-search-hidden {
    display: none !important;
}

.bps-sidebar-search-empty {
    padding: 30px 16px;
    color: #8b99ac;
    text-align: center;
    font-size: 0.78rem;
}

.bps-sidebar-search-empty .bx {
    display: block;
    margin-bottom: 8px;
    font-size: 1.35rem;
}

.bps-sidebar-footer {
    flex: 0 0 auto;
    padding: 10px 12px 12px;
    border-top: 1px solid var(--bps-sidebar-border);
    background: var(--bps-sidebar-surface);
}

.bps-sidebar-logout {
    display: flex;
    width: 100%;
    min-height: 42px;
    align-items: center;
    gap: 9px;
    padding: 6px 10px;
    border: 1px solid transparent;
    border-radius: 8px;
    color: #b42318;
    font-size: 0.82rem;
    font-weight: 650;
    text-decoration: none;
}

.bps-sidebar-logout:hover {
    border-color: #f1c7c3;
    background: #fff4f2;
    color: #912018;
}

.bps-sidebar-logout .bx {
    display: inline-flex;
    width: 30px;
    height: 30px;
    flex: 0 0 30px;
    align-items: center;
    justify-content: center;
    border-radius: 7px;
    background: #fff0ee;
    font-size: 1.05rem;
}

.bps-sidebar-backdrop {
    position: fixed;
    inset: var(--bps-sidebar-top) 0 0;
    z-index: -1;
    visibility: hidden;
    margin: 0;
    padding: 0;
    border: 0;
    background: rgba(15, 23, 42, 0.32);
    opacity: 0;
    pointer-events: none;
    transition: opacity 180ms ease, visibility 180ms ease;
}

@media (min-width: 992px) {
    .layout-page > .content-wrapper {
        width: calc(100% - var(--bps-sidebar-rail-width));
        margin-left: var(--bps-sidebar-rail-width);
    }

    html.bps-sidebar-open .layout-page > .content-wrapper {
        width: calc(100% - var(--bps-sidebar-width));
        margin-left: var(--bps-sidebar-width);
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-header {
        justify-content: center;
        padding: 10px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-brand-mark {
        width: 42px;
        height: 42px;
        flex-basis: 42px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-brand-copy,
    #miMenuDesplegable:not(.mostrar) .bps-sidebar-collapse,
    #miMenuDesplegable:not(.mostrar) .bps-sidebar-search {
        display: none;
    }

    #miMenuDesplegable:not(.mostrar) .menu-inner {
        padding: 8px 9px 14px !important;
    }

    #miMenuDesplegable:not(.mostrar) .menu-header {
        display: block !important;
        width: 24px;
        height: 1px;
        min-height: 1px !important;
        margin: 10px auto 8px !important;
        overflow: hidden;
        background: var(--bps-sidebar-border);
        color: transparent !important;
        font-size: 0 !important;
    }

    #miMenuDesplegable:not(.mostrar) .menu-header-system {
        padding-top: 0 !important;
        border-top: 0;
    }

    #miMenuDesplegable:not(.mostrar) .menu-header::after {
        display: none;
    }

    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item {
        display: block;
        width: 100%;
        margin-bottom: 5px !important;
    }

    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item > .menu-link {
        width: 48px !important;
        min-height: 48px;
        justify-content: center;
        gap: 0;
        margin: 0 auto !important;
        padding: 6px !important;
    }

    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item > .menu-link > div,
    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item > .menu-link::after,
    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item > .menu-sub {
        display: none !important;
    }

    #miMenuDesplegable:not(.mostrar) .menu-inner > .menu-item > .menu-link > .menu-icon {
        width: 30px;
        height: 30px;
        min-width: 30px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-footer {
        padding: 10px 9px 12px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-logout {
        width: 48px;
        min-height: 46px;
        justify-content: center;
        margin: 0 auto;
        padding: 5px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-logout .bx {
        width: 34px;
        height: 34px;
        flex-basis: 34px;
    }

    #miMenuDesplegable:not(.mostrar) .bps-sidebar-logout span {
        display: none;
    }
}

@media (max-width: 991.98px) {
    html.bps-sidebar-open body {
        overflow: hidden;
    }

    #layout-menu.bps-sidebar-shell {
        width: 0 !important;
        height: 0 !important;
    }

    #miMenuDesplegable.bps-sidebar {
        width: min(var(--bps-sidebar-width), 90vw);
        visibility: hidden;
        border-radius: 0 10px 10px 0;
        opacity: 0;
        transform: translateX(-100%);
        pointer-events: none;
    }

    #miMenuDesplegable.bps-sidebar.mostrar {
        visibility: visible;
        opacity: 1;
        transform: translateX(0);
        pointer-events: auto;
    }

    html.bps-sidebar-open .bps-sidebar-backdrop {
        z-index: 1040;
        visibility: visible;
        opacity: 1;
        pointer-events: auto;
    }
}

@media (prefers-reduced-motion: reduce) {
    .layout-page > .content-wrapper,
    #miMenuDesplegable.bps-sidebar,
    #miMenuDesplegable .menu-link,
    #miMenuDesplegable .menu-toggle::after,
    .bps-sidebar-backdrop {
        transition: none !important;
    }
}
