/* BJAS internal shell sidebar final authority. Keep POS out of this system. */

body:is(
    .internal-module-shell,
    .internal-clean-page-shell,
    .wms-module-shell,
    .wms-stock-reference-shell,
    .hris-module-shell,
    .report-module-shell
):not(.pos-shell) :is(.module-sidebar, .shell-sidebar, .internal-sidebar, .app-sidebar, .clean-module-sidebar, .internal-module-nav, .information-module-nav, .info-sidebar) {
    width: var(--shell-sidebar-width, 280px) !important;
    min-width: var(--shell-sidebar-width, 280px) !important;
    max-width: var(--shell-sidebar-width, 280px) !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    background: var(--shell-surface, #ffffff) !important;
    border-right: 1px solid var(--shell-border, #dbe3ef) !important;
    z-index: var(--z-sidebar, 80) !important;
}

body:is(
    .internal-module-shell,
    .internal-clean-page-shell,
    .wms-module-shell,
    .wms-stock-reference-shell,
    .hris-module-shell,
    .report-module-shell
):not(.pos-shell) :is(.module-sidebar-nav, .shell-sidebar-nav, .sidebar-menu, .hris-module-grid) {
    display: grid !important;
    gap: 4px !important;
    padding: 12px 10px !important;
    min-width: 0 !important;
}

body:is(
    .internal-module-shell,
    .internal-clean-page-shell,
    .wms-module-shell,
    .wms-stock-reference-shell,
    .hris-module-shell,
    .report-module-shell
):not(.pos-shell) :is(.module-sidebar-link, .shell-sidebar-link, .sidebar-link, .hris-module-card) {
    min-height: 46px !important;
    padding: 9px 12px !important;
    border-radius: 12px !important;
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
    text-decoration: none !important;
    font-size: 13.5px !important;
    font-weight: 850 !important;
    color: #0f172a !important;
}

body:is(
    .internal-module-shell,
    .internal-clean-page-shell,
    .wms-module-shell,
    .wms-stock-reference-shell,
    .hris-module-shell,
    .report-module-shell
):not(.pos-shell) :is(.module-sidebar-link.is-active, .module-sidebar-link[aria-current="page"], .shell-sidebar-link.is-active, .shell-sidebar-link[aria-current="page"], .sidebar-link.is-active, .sidebar-link.active, .sidebar-link[aria-current="page"], .hris-module-card.is-active, .hris-module-card.active) {
    background: #eef4ff !important;
    color: var(--shell-primary, #0f2747) !important;
    box-shadow: inset 3px 0 0 var(--shell-primary, #0f2747) !important;
}

body:is(
    .internal-module-shell,
    .internal-clean-page-shell,
    .wms-module-shell,
    .wms-stock-reference-shell,
    .hris-module-shell,
    .report-module-shell
):not(.pos-shell) :is(.module-sidebar-link:hover, .shell-sidebar-link:hover, .sidebar-link:hover, .hris-module-card:hover) {
    background: #f8fafc !important;
    color: var(--shell-primary, #0f2747) !important;
}

body.pos-shell :is(.module-sidebar, .shell-sidebar, .internal-sidebar, .app-sidebar, .clean-module-sidebar, .internal-module-nav, .information-module-nav, .info-sidebar, .sidebar.sidebar-app-nav) {
    display: none !important;
}

@media (max-width: 768px) {
    body:is(
        .internal-module-shell,
        .internal-clean-page-shell,
        .wms-module-shell,
        .wms-stock-reference-shell,
        .hris-module-shell,
        .report-module-shell
    ):not(.pos-shell) :is(.module-sidebar, .shell-sidebar, .internal-sidebar, .app-sidebar, .clean-module-sidebar, .internal-module-nav, .information-module-nav, .info-sidebar) {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        position: static !important;
    }
}

/* WMS sidebar root authority - 2026-06-19 */
body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) {
    --shell-sidebar-width: 280px;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar {
    grid-column: 1;
    width: var(--shell-sidebar-width, 280px) !important;
    min-width: var(--shell-sidebar-width, 280px) !important;
    max-width: var(--shell-sidebar-width, 280px) !important;
    min-height: 0 !important;
    max-height: calc(100dvh - var(--shell-header-height, 76px) - 36px) !important;
    position: sticky !important;
    top: calc(var(--shell-header-height, 76px) + 18px) !important;
    align-self: start !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    background: #ffffff !important;
    border: 1px solid #dbe3ef !important;
    border-radius: 18px !important;
    box-shadow: 0 16px 42px rgba(15, 23, 42, 0.06) !important;
    z-index: var(--z-sidebar, 80) !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-head {
    display: grid !important;
    gap: 4px !important;
    padding: 14px 16px 12px !important;
    border-bottom: 1px solid #e4ebf5 !important;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%) !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-kicker {
    color: #b77916 !important;
    font-size: 11px !important;
    font-weight: 900 !important;
    letter-spacing: .16em !important;
    text-transform: uppercase !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-title {
    color: #0f172a !important;
    font-size: 18px !important;
    font-weight: 950 !important;
    line-height: 1.15 !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-nav {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 5px !important;
    padding: 10px !important;
    overflow: visible !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link {
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 8px 10px !important;
    border-radius: 12px !important;
    display: grid !important;
    grid-template-columns: 28px minmax(0, 1fr) !important;
    align-items: center !important;
    gap: 10px !important;
    color: #26364d !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    text-decoration: none !important;
    box-shadow: none !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link:is(:hover, :focus-visible) {
    background: #f8fafc !important;
    border-color: #dbe3ef !important;
    color: #0f2747 !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link:is(.is-active, [aria-current="page"]) {
    background: #eef4f8 !important;
    border-color: #d8e2ee !important;
    color: #0f2747 !important;
    box-shadow: inset 3px 0 0 #0f2747 !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-icon {
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    border-radius: 9px !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    background: #fff7e0 !important;
    border: 1px solid #f2d38a !important;
    overflow: hidden !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-icon img {
    width: 19px !important;
    height: 19px !important;
    object-fit: contain !important;
    display: block !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-copy {
    display: grid !important;
    gap: 1px !important;
    min-width: 0 !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-label {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: inherit !important;
    font-size: 13.5px !important;
    font-weight: 900 !important;
    line-height: 1.2 !important;
}

body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-note {
    display: block !important;
    min-width: 0 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    color: #64748b !important;
    font-size: 11px !important;
    font-weight: 750 !important;
    line-height: 1.15 !important;
}

body.pos-shell .module-sidebar.wms-sidebar {
    display: none !important;
}

@media (min-width: 901px) and (max-width: 1180px) {
    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) {
        --shell-sidebar-width: 236px;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link {
        min-height: 42px !important;
        padding: 8px 9px !important;
        gap: 9px !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-label {
        font-size: 13px !important;
    }
}

@media (max-width: 900px) {
    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        position: static !important;
        top: auto !important;
        max-height: none !important;
        overflow: hidden !important;
        border-radius: 16px !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-head {
        padding: 10px 12px 8px !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-title {
        font-size: 16px !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-nav {
        display: flex !important;
        gap: 8px !important;
        padding: 10px 12px 12px !important;
        overflow-x: auto !important;
        overflow-y: hidden !important;
        contain: layout paint !important;
        scroll-snap-type: x proximity !important;
        overscroll-behavior-x: contain !important;
        -webkit-overflow-scrolling: touch !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link {
        flex: 0 0 auto !important;
        width: auto !important;
        min-width: 150px !important;
        max-width: 210px !important;
        scroll-snap-align: start !important;
    }
}

@media (max-width: 640px) {
    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-head {
        display: none !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-link {
        min-width: 138px !important;
        max-width: 176px !important;
        min-height: 40px !important;
        padding: 7px 8px !important;
        grid-template-columns: 26px minmax(0, 1fr) !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-icon {
        width: 26px !important;
        height: 26px !important;
        min-width: 26px !important;
    }

    body:is(.wms-module-shell, .wms-stock-reference-shell, .internal-wms-module-shell):not(.pos-shell) .module-sidebar.wms-sidebar .module-sidebar-label {
        font-size: 12.5px !important;
    }
}