/* ERP sidebar "rail": icons only by default, full menu opens on click.
   Desktop only (>= 992px); phones/tablets keep AdminLTE's off-canvas menu.
   body.erp-rail       -> icon strip (56px), content starts right after it
   body.erp-rail-open  -> full 230px menu floats OVER the page (no reflow) */
@media (min-width: 992px) {
    html body.erp-rail .wrapper > .main-sidebar.app-sidebar {
        width: 56px !important;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: none;
        z-index: 1040;
        transition: width .18s ease, box-shadow .18s ease;
    }
    html body.erp-rail .wrapper > .main-sidebar.app-sidebar::-webkit-scrollbar { display: none; }
    html body.erp-rail .main-sidebar.app-sidebar::before { width: 56px !important; }

    /* content, topbar and footer start right after the strip */
    html body.erp-rail .wrapper > .content-wrapper,
    html body.erp-rail.layout-fixed .wrapper > .content-wrapper,
    html body.erp-rail.layout-navbar-fixed .wrapper > .content-wrapper,
    html body.erp-rail .wrapper > .main-header,
    html body.erp-rail.layout-fixed .wrapper > .main-header,
    html body.erp-rail.layout-navbar-fixed .wrapper > .main-header,
    html body.erp-rail .wrapper > .main-footer {
        margin-left: 72px !important;
    }

    /* ---- collapsed: hide every text part, centre the icons ---- */
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .brand-copy,
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .user-panel,
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-header,
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-link p,
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-treeview {
        display: none !important;
    }
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .brand-link {
        justify-content: center; padding-left: 0 !important; padding-right: 0 !important;
    }
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .brand-link .brand-image {
        margin: 0 !important; max-height: 28px;
    }
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .sidebar { padding-left: 4px !important; padding-right: 4px !important; overflow: visible; }
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-sidebar .nav-link {
        display: flex; justify-content: center; padding: .42rem 0 !important; width: auto !important;
        cursor: pointer;
    }
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-sidebar .nav-link .nav-icon {
        margin: 0 !important; width: auto !important; font-size: .95rem;
    }
    /* a thin divider where a section header used to be */
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-header + .nav-item {
        border-top: 1px solid rgba(255,255,255,.10); margin-top: 4px; padding-top: 4px;
    }
    html body.erp-rail:not(.erp-rail-open):not(.theme-slim) .app-sidebar .nav-header + .nav-item {
        border-top-color: rgba(0,0,0,.08);
    }

    /* ---- open: full menu over the page ---- */
    html body.erp-rail.erp-rail-open .wrapper > .main-sidebar.app-sidebar {
        width: 230px !important;
        box-shadow: 0 10px 30px rgba(15, 30, 54, .35) !important;
    }
    html body.erp-rail.erp-rail-open .main-sidebar.app-sidebar::before { width: 230px !important; }
    #erpRailShade {
        display: none; position: fixed; inset: 0; z-index: 1035;
        background: rgba(15, 30, 54, .18);
    }
    html body.erp-rail.erp-rail-open #erpRailShade { display: block; }
}

/* ---- icon contrast (all widths): every sidebar icon clearly visible ---- */
html body.theme-slim .app-sidebar .nav-sidebar .nav-link,
html body.theme-slim .app-sidebar .nav-sidebar .nav-link p { color: #e8eef6 !important; }
html body.theme-slim .app-sidebar .nav-sidebar .nav-link .nav-icon,
html body.theme-slim .app-sidebar .nav-sidebar .nav-link .right {
    color: #ffffff !important; opacity: 1 !important;
}
html body.theme-slim .app-sidebar .nav-sidebar .nav-link:hover,
html body.theme-slim .app-sidebar .nav-sidebar .nav-link.active,
html body.theme-slim .app-sidebar .nav-sidebar .menu-open > .nav-link {
    background: #2c5282 !important; color: #fff !important;
}
/* classic (light) sidebar: dark navy icons */
html body:not(.theme-slim) .app-sidebar .nav-sidebar .nav-link .nav-icon { color: #1e3a5f !important; opacity: 1 !important; }
html body:not(.theme-slim) .app-sidebar .nav-sidebar .nav-link.active .nav-icon { color: #2f6df6 !important; }
@media (min-width: 992px) {
    html body.erp-rail:not(.erp-rail-open) .app-sidebar .nav-sidebar .nav-link .nav-icon { font-size: 1.05rem !important; }
}
