html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
}

/* --- Layout Structure --- */
.page {
    display: flex;
    flex-direction: column;
}

main {
    flex: 1;
}

.sidebar {
    background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
}

    /* 1. Sidebar Top Row (Keep this Dark) */
    .sidebar .top-row {
        height: 3.5rem;
        background-color: rgba(0,0,0,0.4) !important;
        display: flex;
        align-items: center;
    }

/* 2. Main Content Top Bar (Restore Light Gray) */
main .top-row {
    height: 3.5rem;
    background-color: #f7f7f7 !important; /* Your original light gray */
    border-bottom: 1px solid #d6d5d5;
    display: flex;
    align-items: center;
    padding-left: 1.5rem !important;
    padding-right: 1.5rem !important;
}

    /* Fix link colors in the Light Gray top bar so they aren't white */
    main .top-row a,
    main .top-row .btn-link {
        color: #006bb7 !important; /* Original blue link color */
        text-decoration: none;
    }

/* --- Menu Item Styling (White Text & Icons) --- */
.nav-item .nav-link,
.nav-item button.nav-link {
    display: flex !important;
    align-items: center;
    width: 100%;
    padding: 0.6rem 1rem;
    color: rgba(255, 255, 255, 0.9) !important;
    background: transparent !important;
    border: none;
    text-decoration: none;
    cursor: pointer;
    text-align: left;
}

    .nav-item .nav-link:hover,
    .nav-item .nav-link.active {
        background-color: rgba(255, 255, 255, 0.15) !important;
        color: #ffffff !important;
    }

.nav-item i, .nav-item .bi {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 1.5rem;
    height: 1.5rem;
    font-size: 1.15rem;
    margin-right: 0.8rem;
    color: inherit !important;
    background-image: none !important;
}

.nav-item .ms-auto {
    margin-left: auto !important;
    font-size: 0.8rem;
    opacity: 0.7;
}

/* --- Custom Scrollbar --- */
.nav-scrollable::-webkit-scrollbar {
    width: 6px;
}

.nav-scrollable::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
}

.nav-scrollable::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 10px;
}

    .nav-scrollable::-webkit-scrollbar-thumb:hover {
        background: rgba(255, 255, 255, 0.4);
    }

/* --- MOBILE LOGIC (Portrait) --- */
@media (max-width: 640.98px) {
    .navbar-toggler {
        display: block !important;
        opacity: 1 !important;
        background-color: rgba(255, 255, 255, 0.1);
        border: 1px solid rgba(255, 255, 255, 0.2);
        border-radius: .6rem;
        padding: .3rem .55rem;
        line-height: 1;
    }

    .navbar-toggler i {
        display: block;
        font-size: 1.35rem;
        color: #fff;
    }

    .nav-scrollable {
        display: none; /* Hide by default on mobile */
    }

    /* THE OVERLAY: Logic for floating menu (offset by the status-bar inset) */
    .sidebar:has(.navbar-checkbox:checked) .nav-scrollable {
        display: block !important;
        position: fixed;
        top: calc(3.5rem + env(safe-area-inset-top, 0px));
        left: 0;
        width: 100vw;
        height: calc(100vh - 3.5rem - env(safe-area-inset-top, 0px));
        background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
        z-index: 1000;
        overflow-y: overlay;
    }
}

/* --- DESKTOP LOGIC (Landscape) — see the breakpoint block at the end of this file --- */

/* ═══════════════════════════════════════════════════════════
   WITLINE WEB ADMIN — Admin Shell Styles
   ═══════════════════════════════════════════════════════════ */

.admin-shell { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }
.admin-topbar { display: flex; justify-content: space-between; align-items: center; padding: 0 1rem; height: 3.5rem; background: #1a1a2e; color: #fff; flex-shrink: 0; }
.admin-topbar-left { display: flex; align-items: center; gap: 0.75rem; }
.admin-menu-btn { background: none; border: none; color: #fff; font-size: 1.25rem; cursor: pointer; padding: 0.25rem 0.5rem; }
.admin-brand { font-weight: 700; font-size: 1.1rem; letter-spacing: 0.05em; }
.admin-topbar-right { display: flex; align-items: center; gap: 1rem; }
.admin-tenant { font-size: 0.85rem; opacity: 0.85; }

.admin-body { display: flex; flex: 1; overflow: hidden; }
.admin-sidebar { width: 260px; background: #16213e; color: #c8d6e5; overflow-y: auto; flex-shrink: 0; transition: margin-left 0.25s; }
.admin-sidebar:not(.open) { margin-left: -260px; }

.admin-nav { list-style: none; padding: 0.5rem 0; margin: 0; }
.admin-nav-item { padding: 0; }
.admin-nav-link { display: flex; align-items: center; padding: 0.6rem 1.25rem; color: #c8d6e5; text-decoration: none; font-size: 0.9rem; transition: background 0.15s, color 0.15s; }
.admin-nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.admin-nav-link.active { background: rgba(74,144,226,0.2); color: #4a90e2; font-weight: 600; border-right: 3px solid #4a90e2; }

.admin-nav-divider { height: 1px; background: rgba(255,255,255,0.1); margin: 0.5rem 1rem; }
.admin-nav-header { padding: 0.5rem 1.25rem 0.25rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: rgba(255,255,255,0.4); font-weight: 600; }

.admin-main { flex: 1; overflow-y: auto; background: #f5f6fa; }

/* Responsive: collapse sidebar on small screens */
@media (max-width: 768px) {
    .admin-sidebar { position: fixed; top: 3.5rem; left: 0; bottom: 0; z-index: 100; }
    .admin-sidebar:not(.open) { margin-left: -260px; }
}

/* --- DESKTOP LOGIC (Landscape) ---
   These rules previously sat OUTSIDE any media query (broken brace): the drawer
   was force-shown and the hamburger hidden on phones. Restored under 641px. */
@media (min-width: 641px) {
    .page {
        flex-direction: row; /* Side-by-side */
    }

    .sidebar {
        width: 250px;
        height: calc(100vh - env(safe-area-inset-top, 0px));
        position: sticky;
        top: 0;
    }

    .nav-scrollable {
        display: block !important; /* Always show on desktop */
        height: calc(100vh - 3.5rem - env(safe-area-inset-top, 0px));
        overflow-y: auto;
    }

    .navbar-toggler {
        display: none !important; /* Hide hamburger on desktop */
    }
}

/* ── Mobile shell polish (2026-09-13): pill nav items, active accent, mobile paddings.
   Scoped to the sidebar so they cannot leak into the web app's .nav-item tab strips. ── */
.sidebar .nav-item {
    margin: 2px 0;
}

.sidebar .nav-item .nav-link {
    border-radius: .6rem;
    position: relative;
    transition: background-color .15s, color .15s;
}

.sidebar .nav-item .nav-link.active {
    background-color: rgba(255, 255, 255, 0.18) !important;
    font-weight: 600;
}

.sidebar .nav-item .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 20%;
    bottom: 20%;
    width: 3px;
    border-radius: 999px;
    background: #7cc4ff;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar .nav-item .nav-link {
        transition: none;
    }
}

@media (max-width: 640.98px) {
    main .top-row {
        height: 3rem;
        padding-left: .75rem !important;
        padding-right: .75rem !important;
    }

    article.content {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }
}
