html,
body {
    width: 100vw;        
    height: 100vh;   
    margin: 0;
    padding: 0;
    overflow-x: hidden;
    overflow-y: auto;
    background-color: #000000 !important;
}

.app-screen-wrapper {
    position: relative;
    z-index: 10;
    display: flex;
    width: 100vw;
    height: 100vh;
    background-color: #000000;
    overflow: hidden;
}

.app-screen-wrapper .app-sidebar {
    width: 68px;
    height: 100vh;
    background-color: #181b23; 
    border-right: none; 
    display: flex;
    flex-direction: column;
    box-sizing: border-box;
    overflow: visible; /* Crucial for absolute profile popups */
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Expanded State Configuration */
.app-screen-wrapper .app-sidebar.sidebar-expanded {
    width: 240px;
}

/* Brand Area Setup with Top-aligned Toggle Placement */
.app-screen-wrapper .app-brand {
    padding: 15px 16px;
    display: flex;
    align-items: center;
    background-color: #181b23;
    justify-content: space-between;
    gap: 10px;
    height: 64px;
    box-sizing: border-box;
}

/* Smooth logo transition based on sidebar expanding */
.app-screen-wrapper .app-logo {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    max-width: 42px;
    max-height: 42px;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    object-position: center;
    display: none;
    border-radius: 50%;
    overflow: hidden;
    flex: 0 0 42px;
}

.app-screen-wrapper .app-sidebar.sidebar-expanded .app-logo {
    display: block;
}

.app-screen-wrapper .sidebar-menu-wrapper {
    flex: 1;
    padding: 15px 8px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    background-color: #181b23;
    overflow-y: auto; 
    overflow-x: hidden;
}

/* Sleek Webkit Scrollbars */
.app-screen-wrapper .sidebar-menu-wrapper::-webkit-scrollbar { width: 3px; }
.app-screen-wrapper .sidebar-menu-wrapper::-webkit-scrollbar-track { background: #181b23; }
.app-screen-wrapper .sidebar-menu-wrapper::-webkit-scrollbar-thumb { background: #ffb000; border-radius: 10px; }

.app-screen-wrapper .menu-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.app-screen-wrapper .group-title {
    display: none;
    font-size: 11px;
    text-transform: uppercase;
    font-weight: 700;
    color: #ffb000;
    letter-spacing: 0.8px;
    padding-left: 12px;
    margin-bottom: 4px;
    opacity: 0.6;
}

.app-screen-wrapper .app-sidebar.sidebar-expanded .group-title {
    display: block;
}

/* Nav Item Layout Blueprint */
.app-screen-wrapper .menu-item {
    display: flex;
    align-items: center;
    justify-content: center; 
    padding: 12px;
    color: #ffffff;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.2s ease-in-out;
    white-space: nowrap;
    font-size: 0; 
}

.app-screen-wrapper .app-sidebar.sidebar-expanded .menu-item {
    justify-content: flex-start;
    font-size: 14px;
    gap: 12px;
    padding: 10px 16px;
}

.app-screen-wrapper .menu-item .menu-icon {
    font-size: 18px;
    margin: 0;
    display: inline-block;
}

/* Interactive States */
.app-screen-wrapper .menu-item:hover {
    background-color: rgba(255, 176, 0, 0.15);
}

.app-screen-wrapper .menu-item:hover .menu-icon {
    color: #ffb000;
}

.app-screen-wrapper .menu-item.active {
    background-color: #ffb000; 
    color: #000000; 
}

.app-screen-wrapper .menu-item.active .menu-icon {
    color: #000000; 
}

.app-screen-wrapper .sidebar-footer {
    margin-top: auto;
    padding: 12px 8px;
    position: relative;
    background-color: #181b23;
}

.app-screen-wrapper .user-profile-badge {
    cursor: pointer;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    transition: background-color 0.2s;
    border-radius: 6px;
    padding: 8px;
    box-sizing: border-box;
}

.app-screen-wrapper .app-sidebar.sidebar-expanded .user-profile-badge {
    justify-content: flex-start;
    padding: 10px;
}

.app-screen-wrapper .user-profile-badge:hover {
    background-color: rgba(255, 255, 255, 0.1); 
}

/* Floating Dropdown Frame (ChatGPT style Alignment) */
.app-screen-wrapper .profile-dropdown-menu {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 8px;
    width: 224px; 
    background-color: #202123;
    border: 1px solid #4d4d4f;
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
    z-index: 9999; 
    display: none; 
    flex-direction: column;
}

/* Shows dropdown when class appended via JS */
.app-screen-wrapper .profile-dropdown-menu.show-dropdown {
    display: flex;
}

.app-screen-wrapper .dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    color: #ececf1;
    text-decoration: none;
    font-size: 14px;
    white-space: nowrap;
    transition: background-color 0.2s;
}

.app-screen-wrapper .dropdown-item:hover {
    background-color: #343541;
}

.app-screen-wrapper .dropdown-divider {
    border: 0;
    height: 1px;
    background-color: #4d4d4f;
    margin: 6px 0;
}

.app-screen-wrapper .user-meta {
    display: none;
    flex-direction: column;
    overflow: hidden;
}

.app-screen-wrapper .app-sidebar.sidebar-expanded .user-meta {
    display: flex;
}

.app-screen-wrapper .user-meta .name {
    font-size: 13px;
    font-weight: 600;
    color: #ffffff;
    white-space: nowrap;
    text-overflow: ellipsis;
    overflow: hidden;
}

.app-screen-wrapper .user-meta .role {
    font-size: 11px;
    color: #ffb000;
    opacity: 0.8;
}

.app-screen-wrapper .user-profile-badge .avatar {
    width: 36px;
    height: 36px;
    background-color: #ffb000; 
    color: #000000;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

/* Toggle Menu Trigger Button Top Realignment */
.app-screen-wrapper .sidebar-toggle-btn {
    background: none;
    border: none;
    padding: 6px;
    color: #a0aec0; 
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: all 0.2s ease-in-out;
}

.app-screen-wrapper .sidebar-toggle-btn:hover {
    background-color: rgba(255, 176, 0, 0.15);
    color: #ffb000; 
}

.app-screen-wrapper .app-main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
    background-color: #000000; 
    overflow: hidden;
}

.app-screen-wrapper .mobile-top-toggle {
    display: none;
    background: none;
    border: none;
    color: #ffffff;
    font-size: 22px;
    cursor: pointer;
    margin-right: 15px;
    padding: 0;
}

.app-screen-wrapper .content-top-bar {
    display: flex;
    align-items: center;
}


.app-screen-wrapper .content-top-bar {
    background: #181b23; 
    padding: 18px 30px;
    border-bottom: none; 
    flex-shrink: 0;
}

.app-screen-wrapper .content-top-bar h2 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    color: #ffffff; 
}

.app-screen-wrapper .content-body {
    flex: 1;
    padding: 30px;
    background-color: #000000;
    color: #ffffff;
    overflow-y: auto; 
    overflow-x: hidden;
}

.app-screen-wrapper .content-body::-webkit-scrollbar { width: 6px; }
.app-screen-wrapper .content-body::-webkit-scrollbar-track { background: #000000; }
.app-screen-wrapper .content-body::-webkit-scrollbar-thumb { background: #181b23; border-radius: 10px; }

/* Default sidebar SVG icon color */
.app-sidebar .menu-icon svg {
    color: #ffb000;
    stroke: currentColor;
}

.app-sidebar .logout-icon svg {
    color: #ff3b30;
    stroke: currentColor; 
}

/* Active menu item text + icon */
.app-sidebar .menu-item.active {
    background: #ffb000;
    color: #000000;
}

.app-sidebar .menu-item.active .menu-icon svg {
    color: #000000;
    stroke: currentColor;
}

/* If some SVG paths use stroke/fill directly */
.app-sidebar .menu-item.active .menu-icon svg path,
.app-sidebar .menu-item.active .menu-icon svg rect,
.app-sidebar .menu-item.active .menu-icon svg circle,
.app-sidebar .menu-item.active .menu-icon svg line,
.app-sidebar .menu-item.active .menu-icon svg polyline,
.app-sidebar .menu-item.active .menu-icon svg polygon {
    stroke: #000000;
}

/* For filled SVG icons */
.app-sidebar .menu-item.active .menu-icon svg [fill]:not([fill="none"]) {
    fill: #000000;
}

@media screen and (max-width: 768px) {
    
    /* Show the new hamburger in the top bar */
    .app-screen-wrapper .mobile-top-toggle {
        display: block;
    }

    /* Convert Sidebar into a hidden floating overlay */
    .app-screen-wrapper .app-sidebar {
        position: fixed;
        top: 0;
        left: -260px;
        width: 260px !important;
        height: 100vh;
        z-index: 99999;
        transition: left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    /* When expanded on mobile, slide it into view */
    .app-screen-wrapper .app-sidebar.sidebar-expanded {
        left: 0;
        box-shadow: 4px 0 24px rgba(0,0,0,0.8);
    }

    /* Hide the desktop toggle button inside the sidebar since we have the top one */
    .app-screen-wrapper .app-sidebar:not(.sidebar-expanded) .sidebar-toggle-btn:not(.mobile-top-toggle) {
        display: none !important;
    }

    /* Force the button to show up again when the sidebar is expanded */
    .app-screen-wrapper .app-sidebar.sidebar-expanded .sidebar-toggle-btn:not(.mobile-top-toggle) {
        display: flex !important; 
    }
}