/* ============================================================
   LAYOUT OVERRIDE — Sidebar + Main Gap + Scroll Fix
   Loaded LAST → !important overrides everything
   ============================================================ */

/* ── SIDEBAR: compact, scrollable ── */
.sidebar {
    width: 220px !important;
    height: 100vh !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    z-index: 200 !important;
    background: #030305 !important;
}
[data-theme="light"] .sidebar {
    background: #f8f9fb !important;
}

/* ── SIDEBAR SCROLL WRAPPER: must shrink ── */
.sidebar-scroll-wrapper {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow: hidden !important;
    display: flex !important;
    flex-direction: column !important;
}

/* ── SIDEBAR SCROLL: the actual scrollable area ── */
.sidebar-scroll {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
}

/* Webkit scrollbar — hidden */
.sidebar-scroll::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
}

/* Kill any other sidebar scrollbar overrides */
.sidebar::-webkit-scrollbar {
    width: 0 !important;
    display: none !important;
}

/* ── MAIN CONTENT: tight against sidebar ── */
.main {
    margin-left: 220px !important;
    width: calc(100% - 220px) !important;
    padding: 0.5rem 1rem !important;
    height: 100vh !important;
    overflow-y: auto !important;
}
.main.full-width {
    margin-left: 0 !important;
    width: 100% !important;
}

/* ── HEADER: less vertical waste ── */
.header {
    margin-bottom: 0.75rem !important;
}

/* ── BODY: no overflow, flex layout ── */
body {
    height: 100vh !important;
    overflow: hidden !important;
    display: flex !important;
}

/* ── MOBILE (<768px): sidebar off-screen, main full ── */
@media (max-width: 767px) {
    .sidebar {
        width: 260px !important;
        transform: translateX(-100%) !important;
    }
    .sidebar.active {
        transform: translateX(0) !important;
        background: #030305 !important;
        z-index: 200 !important;
        box-shadow: 4px 0 30px rgba(0,0,0,0.7) !important;
    }
    .main {
        margin-left: 0 !important;
        width: 100% !important;
        padding: 0.5rem !important;
        padding-bottom: 75px !important;
    }
}

/* ── TABLET (768-1023px) ── */
@media (min-width: 768px) and (max-width: 1023px) {
    .sidebar {
        width: 220px !important;
    }
    .main {
        margin-left: 220px !important;
        width: calc(100% - 220px) !important;
        padding: 0.5rem 1rem !important;
    }
}
