/* ------------------------------------------------------------------
   PERFEX-ERP · custom.css
   Created 2026-08-07 · CR-001 · sidebar scroll fix
   Core auto-loads this file. Safe to delete to revert everything.
   ------------------------------------------------------------------ */

/* Sidebar holds 128 menu items (~1307px) in a 522px viewport, and core
   sets overflow: visible, so items below the fold cannot be reached.
   Pin it to the window and give it its own scrollbar. */
#menu.sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    height: 100vh;
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
}

/* Same treatment for the setup (gear) menu */
#setup-menu.sidebar,
.setup-menu-container .sidebar {
    max-height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
}

/* Slim, unobtrusive scrollbar */
#menu.sidebar::-webkit-scrollbar,
#setup-menu.sidebar::-webkit-scrollbar {
    width: 6px;
}
#menu.sidebar::-webkit-scrollbar-track,
#setup-menu.sidebar::-webkit-scrollbar-track {
    background: transparent;
}
#menu.sidebar::-webkit-scrollbar-thumb,
#setup-menu.sidebar::-webkit-scrollbar-thumb {
    background: rgba(0, 0, 0, 0.25);
    border-radius: 3px;
}
#menu.sidebar::-webkit-scrollbar-thumb:hover,
#setup-menu.sidebar::-webkit-scrollbar-thumb:hover {
    background: rgba(0, 0, 0, 0.4);
}

/* Firefox */
#menu.sidebar,
#setup-menu.sidebar {
    scrollbar-width: thin;
    scrollbar-color: rgba(0, 0, 0, 0.25) transparent;
}

/* CR-003: core's mainWrapperHeightFix() writes an inline min-height equal to
   the document height onto #menu on every load and resize. min-height beats
   max-height, so it cancels the scroll cap above. Override it. */
#menu.sidebar {
    min-height: 0 !important;
    height: 100vh !important;
    max-height: 100vh !important;
}
