/* Keep the compact sidebar strictly icon-only. */
[data-sidebar="icon"] .pe-app-sidebar > .px-6.pb-4.pt-2 {
    display: none;
}

[data-sidebar="icon"] .pe-app-sidebar .pe-main-menu > .pe-slide > .pe-nav-link {
    justify-content: center;
}

[data-sidebar="icon"] .pe-app-sidebar .pe-main-menu > .pe-slide > .pe-nav-link > .pe-nav-icon {
    margin-inline: auto;
}

[data-sidebar="icon"] .pe-app-sidebar .pe-main-menu > .pe-slide > .pe-nav-link > :is(.pe-nav-content, .pe-nav-arrow) {
    display: none;
}

/* Sidebar scroll fix.

   The vertical sidebar stacks three blocks: the logo (height = header
   height), the "Active System / Switch" block (custom, unmeasured), and
   the scrolling menu. The theme sizes the menu as
   `calc(100% - header-height)`, which ignores the Active System block —
   so the menu's own box hung below the viewport by exactly that block's
   height and its last items stayed unreachable even at full scroll.

   Laying the sidebar out as a flex column lets the menu claim only the
   space actually left over, whatever the blocks above it measure. The
   horizontal layout reuses `.pe-app-sidebar` as a top bar, so it opts
   out. */
.pe-app-sidebar:not(.horizontal-sidebar) {
    display: flex;
    flex-direction: column;
}

@media (max-width: 991.98px) {
    .pe-app-sidebar:not(.horizontal-sidebar) {
        display: none;
    }

    .pe-app-sidebar:not(.horizontal-sidebar).show {
        display: flex;
    }
}

.pe-app-sidebar:not(.horizontal-sidebar) > .pe-app-sidebar-logo,
.pe-app-sidebar:not(.horizontal-sidebar) > .px-6.pb-4.pt-2 {
    flex: 0 0 auto;
}

.pe-app-sidebar:not(.horizontal-sidebar) > .pe-app-sidebar-menu {
    flex: 1 1 auto;
    /* Beat the theme's `height: calc(100% - header-height)`. */
    height: auto !important;
    /* Without this a flex item refuses to shrink below its content. */
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
}
