/* Keep the fixed navbar out of the sidebar’s way */
.navbar.navbar-fixed {
    position: fixed;   /* keep it fixed at the top */
    top: 0;
    right: 0;          /* stretch to the right edge */
    left: 260px;       /* offset by full sidebar width */
    z-index: 1030;     /* above content but not necessarily above modals */
    width: auto;       /* will be computed from left/right */
}

/* When mini sidebar is active */
body.sidebar-mini .navbar.navbar-fixed {
    left: 80px;        /* mini width */
}

/* Make sure the main content is not hidden under the fixed navbar */
.main-panel {
    padding-top: 70px; /* adjust to your navbar height (60–80px typical) */
}

/* Let the navbar span full width sooner on compressed screens
   to prevent right-side items from overlapping into the sidebar area */
@media (max-width: 1200px) {
    .navbar.navbar-fixed { left: 0; }
}

/* On small screens, ensure any expanded navbar content overlays the page
   instead of appearing within the sidebar area */
@media (max-width: 991px) {
    .navbar.navbar-fixed { left: 0; }
    .navbar.navbar-fixed .navbar-collapse.in {
        position: fixed;
        top: 75px;           /* approx navbar height */
        left: 0;
        right: 0;
        width: auto;
        z-index: 1040;       /* above sidebar (1032) and content */
        max-height: calc(100vh - 75px);
        overflow-y: auto;
        background: rgba(255,255,255,0.98); /* subtle background */
    }
}