.dashboard-layout,
.app-shell {
    width: min(1380px, calc(100% - 36px));
    margin: 24px auto 30px;
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    gap: 26px;
    align-items: start;
}

.page-content {
    min-width: 0;
}

.service-shell {
    width: min(1500px, calc(100% - 28px));
    align-items: start;
}

.mobile-sidebar-toggle {
    display: none;
}

.dashboard-sidebar {
    position: sticky;
    top: 92px;
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.sidebar-panel {
    background: rgba(255, 255, 255, 0.86);
    border: 1px solid rgba(148, 163, 184, 0.35);
    border-radius: 24px;
    box-shadow: 0 12px 24px rgba(15, 23, 42, 0.06);
    padding: 20px 16px;
}

.sidebar-label {
    margin: 0 0 14px;
    color: #475569;
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    font-weight: 800;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.side-btn {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 14px 14px;
    border-radius: 14px;
    border: none;
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    color: #ffffff;
    text-decoration: none;
    font-size: 15px;
    font-weight: 700;
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.2);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.side-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 45%, #84cc16 100%);
    box-shadow: 0 10px 18px rgba(34, 197, 94, 0.2);
}

.side-btn.active {
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.side-btn.contact-btn,
.side-btn.logout-btn {
    background: linear-gradient(135deg, #0ea5e9 0%, #2563eb 100%);
    box-shadow: 0 10px 18px rgba(37, 99, 235, 0.2);
}

.side-btn.contact-btn:hover,
.side-btn.logout-btn:hover {
    background: linear-gradient(135deg, #16a34a 0%, #22c55e 45%, #84cc16 100%);
    box-shadow: 0 10px 18px rgba(34, 197, 94, 0.2);
}

.sidebar-logout {
    margin-top: auto;
    width: 100%;
}

.side-icn {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.18);
    font-size: 16px;
}

.help-panel {
    padding-top: 16px;
}

@media (max-width: 980px) {
    .mobile-sidebar-toggle {
        position: fixed;   /* fallback until sidebar_dock.js moves it into the header */
        bottom: 18px;
        left: 14px;
        z-index: 130;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 12px;
        background: linear-gradient(135deg, #2563eb 0%, #0ea5e9 100%);
        color: #fff;
        font-size: 24px;
        line-height: 1;
        padding: 0;
        box-shadow: 0 8px 18px rgba(37, 99, 235, 0.25);
        cursor: pointer;
    }

    /* Docked inside the header (right edge), so it never overlaps content */
    .mobile-sidebar-toggle.docked {
        position: absolute;
        top: 50%;
        right: 12px;
        bottom: auto;
        left: auto;
        transform: translateY(-50%);
        width: 42px;
        height: 42px;
        z-index: 140;
    }
    header.has-dock { padding-right: 64px !important; }
    header.has-dock-top .mobile-sidebar-toggle.docked { top: 16px; transform: none; right: 14px; }

    .dashboard-layout,
    .app-shell {
        width: min(100% - 18px, 100%);
        grid-template-columns: 1fr;
    }

    .dashboard-sidebar {
        position: fixed;
        top: 88px;
        left: 16px;
        width: min(300px, calc(100% - 32px));
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        transform: translateX(-120%);
        transition: transform 0.25s ease;
        z-index: 120;
        opacity: 0;
        pointer-events: none;
    }

    .dashboard-sidebar.open {
        transform: translateX(0);
        opacity: 1;
        pointer-events: auto;
    }

    .sidebar-nav {
        display: grid;
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    .dashboard-layout,
    .app-shell {
        width: min(100% - 18px, 100%);
        gap: 18px;
    }

    .sidebar-panel {
        padding: 16px 12px;
    }

    .side-btn {
        font-size: 14px;
        padding: 12px 12px;
    }
}

@media (max-width: 980px) {
    .dashboard-layout, .app-shell { padding-bottom: 76px; }
}

/* ---------------------------------------------------------------
   Ek hi sidebar (includes/sidebar.php) — compact aur hamesha
   screen me fit: lamba ho to sidebar khud scroll hota hai.
---------------------------------------------------------------- */
.dashboard-sidebar { gap: 14px; }
.dashboard-sidebar .sidebar-panel { padding: 16px 14px; border-radius: 20px; }
.dashboard-sidebar .sidebar-label { margin-bottom: 10px; }
.dashboard-sidebar .sidebar-nav { gap: 8px; }
.dashboard-sidebar .side-btn { padding: 11px 12px; }
.dashboard-sidebar .customer-id-box strong { overflow-wrap: anywhere; }

@media (min-width: 981px) {
    .dashboard-sidebar {
        max-height: calc(100vh - 110px);
        overflow-y: auto;
        overscroll-behavior: contain;
        scrollbar-width: thin;
        scrollbar-color: rgba(100, 116, 139, .35) transparent;
        padding-right: 2px;
    }
    .dashboard-sidebar::-webkit-scrollbar { width: 6px; }
    .dashboard-sidebar::-webkit-scrollbar-thumb { background: rgba(100, 116, 139, .35); border-radius: 6px; }
}

/* Mobile: poori unchai wala drawer, solid background, peeche halka parda */
@media (max-width: 980px) {
    .dashboard-sidebar {
        top: 0;
        left: 0;
        bottom: 0;
        width: min(300px, 86vw);
        max-height: none;
        height: 100%;
        padding: 18px 12px calc(18px + env(safe-area-inset-bottom));
        gap: 12px;
        background: #eef3fb;
        border-radius: 0 22px 22px 0;
        z-index: 1000;
        transform: translateX(-105%);
    }
    .dashboard-sidebar.open {
        box-shadow: 0 0 0 100vmax rgba(15, 23, 42, .45), 12px 0 32px rgba(15, 23, 42, .25);
    }
    .dashboard-sidebar .sidebar-panel {
        background: #fff;
        box-shadow: none;
    }
    body:has(.dashboard-sidebar.open) { overflow: hidden; }
}
