:root {
    --sidebar-width: 276px;
    --sidebar-collapsed-width: 72px;
    --sidebar-bg: #111318;
    --sidebar-surface: #191c23;
    --sidebar-surface-hover: #222630;
    --sidebar-border: rgba(255, 255, 255, 0.08);
    --sidebar-text: #f5f7fa;
    --sidebar-muted: #949baa;
    --sidebar-accent: #ef5b8d;
    --sidebar-accent-soft: rgba(239, 91, 141, 0.13);
}

#wrapper .app-sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    align-self: flex-start;
    z-index: 1040;
    display: flex;
    flex: 0 0 var(--sidebar-width);
    width: var(--sidebar-width) !important;
    min-height: 100vh;
    max-height: 100vh;
    overflow: visible;
    background: linear-gradient(180deg, #111318 0%, #0d0f13 100%);
    color: var(--sidebar-text);
    box-shadow: 10px 0 30px rgba(15, 18, 25, 0.08);
    transition: width 180ms ease, flex-basis 180ms ease, transform 180ms ease;
}

#wrapper > #content-wrapper {
    width: calc(100% - var(--sidebar-width));
    min-width: 0;
    margin-left: var(--sidebar-width);
    transition: width 180ms ease, margin-left 180ms ease;
}

.app-sidebar *,
.app-sidebar *::before,
.app-sidebar *::after {
    box-sizing: border-box;
}

.app-sidebar__brand {
    position: relative;
    flex: 0 0 auto;
    min-height: 88px;
    padding: 16px;
    border-bottom: 1px solid var(--sidebar-border);
}

.app-sidebar__brand-link {
    display: flex;
    align-items: center;
    min-width: 0;
    color: var(--sidebar-text);
    text-decoration: none;
}

.app-sidebar__brand-link:hover {
    color: #fff;
    text-decoration: none;
}

.app-sidebar__logo-wrap {
    display: grid;
    flex: 0 0 40px;
    width: 40px;
    height: 40px;
    place-items: center;
    overflow: hidden;
    border: 1px solid rgba(239, 91, 141, 0.24);
    border-radius: 8px;
    background: #fff;
}

.app-sidebar__logo {
    display: block;
    width: 34px;
    height: 28px;
    object-fit: contain;
}

.app-sidebar__brand-copy {
    display: flex;
    min-width: 0;
    margin-left: 12px;
    flex-direction: column;
    line-height: 1.25;
    white-space: nowrap;
}

.app-sidebar__brand-copy strong {
    color: #fff;
    font-size: 15px;
    font-weight: 800;
}

.app-sidebar__brand-copy small {
    margin-top: 3px;
    color: var(--sidebar-muted);
    font-size: 11px;
    font-weight: 600;
}

.app-sidebar__environment {
    display: inline-flex;
    height: 18px;
    margin: 9px 0 0 52px;
    padding: 0 7px;
    align-items: center;
    border: 1px solid rgba(52, 211, 153, 0.22);
    border-radius: 5px;
    background: rgba(52, 211, 153, 0.08);
    color: #6ee7b7;
    font-size: 9px;
    font-weight: 800;
    letter-spacing: 0;
    line-height: 1;
    text-transform: uppercase;
    white-space: nowrap;
}

.app-sidebar__environment--dev,
.app-sidebar__environment--test {
    border-color: rgba(96, 165, 250, 0.24);
    background: rgba(96, 165, 250, 0.1);
    color: #93c5fd;
}

.app-sidebar__mobile-close {
    position: absolute;
    top: 16px;
    right: 12px;
    display: grid;
    width: 36px;
    height: 36px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 7px;
    background: transparent;
    color: var(--sidebar-muted);
}

.app-sidebar__body {
    flex: 1 1 auto;
    min-height: 0;
    padding: 16px 12px;
    overflow-x: hidden;
    overflow-y: auto;
    scrollbar-color: #333844 transparent;
    scrollbar-width: thin;
}

.app-sidebar__body::-webkit-scrollbar { width: 5px; }
.app-sidebar__body::-webkit-scrollbar-thumb { border-radius: 4px; background: #333844; }

.app-sidebar__search-wrap {
    position: relative;
    display: flex;
    height: 40px;
    margin-bottom: 16px;
    align-items: center;
}

.app-sidebar__search-wrap > .fas {
    position: absolute;
    left: 13px;
    z-index: 1;
    color: #727a89;
    font-size: 13px;
    pointer-events: none;
}

.app-sidebar__search {
    width: 100%;
    height: 40px;
    padding: 0 36px 0 36px;
    border: 1px solid var(--sidebar-border);
    border-radius: 7px;
    outline: 0;
    background: #171a20;
    color: #fff;
    font-size: 13px;
    transition: border-color 180ms ease, background-color 180ms ease, box-shadow 180ms ease;
}

.app-sidebar__search::placeholder { color: #727a89; }
.app-sidebar__search:focus {
    border-color: rgba(239, 91, 141, 0.62);
    background: #1b1e25;
    box-shadow: 0 0 0 3px rgba(239, 91, 141, 0.1);
}

.app-sidebar__search-clear {
    position: absolute;
    right: 7px;
    display: grid;
    width: 28px;
    height: 28px;
    padding: 0;
    place-items: center;
    border: 0;
    border-radius: 5px;
    background: transparent;
    color: var(--sidebar-muted);
    font-size: 11px;
}

.app-sidebar__empty {
    margin: -4px 0 16px;
    color: var(--sidebar-muted);
    font-size: 12px;
    text-align: center;
}

.app-sidebar__section-title {
    display: block;
    margin: 0 8px 8px;
    color: #6f7685;
    font-size: 10px;
    font-weight: 800;
    line-height: 16px;
    text-transform: uppercase;
}

.app-sidebar__section-title--menu {
    margin-top: 22px;
    list-style: none;
}

.app-sidebar__quick-actions {
    margin-bottom: 22px;
}

.app-sidebar__quick-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
}

.app-sidebar__quick-action {
    display: flex;
    min-width: 0;
    height: 58px;
    padding: 8px 4px;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    border: 1px solid var(--sidebar-border);
    border-radius: 7px;
    background: #171a20;
    color: #b7bdc9;
    font-size: 9px;
    font-weight: 700;
    text-align: center;
    transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.app-sidebar__quick-action i {
    margin-bottom: 6px;
    color: #ef7da4;
    font-size: 14px;
}

.app-sidebar__quick-action:hover {
    border-color: rgba(239, 91, 141, 0.32);
    background: var(--sidebar-surface-hover);
    color: #fff;
    text-decoration: none;
    transform: translateY(-1px);
}

.app-sidebar__navigation,
.app-sidebar__submenu-list {
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-sidebar__item,
.app-sidebar__group {
    position: relative;
    margin-bottom: 3px;
}

.app-sidebar__link,
.app-sidebar__group-toggle {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    height: 42px;
    padding: 0 11px;
    align-items: center;
    border: 0;
    border-radius: 7px;
    outline: 0;
    background: transparent;
    color: #aeb5c1;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    text-align: left;
    transition: background-color 180ms ease, color 180ms ease, transform 180ms ease;
}

.app-sidebar__link:hover,
.app-sidebar__group-toggle:hover {
    background: var(--sidebar-surface-hover);
    color: #fff;
    text-decoration: none;
    transform: translateX(2px);
}

.app-sidebar__link:focus-visible,
.app-sidebar__group-toggle:focus-visible,
.app-sidebar__quick-action:focus-visible,
.app-sidebar__user-button:focus-visible,
.app-sidebar__collapse:focus-visible {
    box-shadow: 0 0 0 3px rgba(239, 91, 141, 0.34);
}

.app-sidebar__icon {
    display: grid;
    flex: 0 0 22px;
    width: 22px;
    height: 22px;
    margin-right: 10px;
    place-items: center;
    color: #767e8d;
    font-size: 14px;
    transition: color 180ms ease, transform 180ms ease;
}

.app-sidebar__link:hover .app-sidebar__icon,
.app-sidebar__group-toggle:hover .app-sidebar__icon { color: #d8dce3; }

.app-sidebar__label {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__chevron {
    margin-left: auto;
    color: #626a79;
    font-size: 9px;
    transition: transform 180ms ease;
}

.app-sidebar__group-toggle[aria-expanded="true"] .app-sidebar__chevron { transform: rotate(180deg); }

.app-sidebar__item.active > .app-sidebar__link {
    background: var(--sidebar-accent-soft);
    color: #fff;
    font-weight: 800;
    box-shadow: inset 0 0 0 1px rgba(239, 91, 141, 0.08), 0 4px 14px rgba(0, 0, 0, 0.12);
}

.app-sidebar__item.active > .app-sidebar__link::before {
    position: absolute;
    top: 9px;
    bottom: 9px;
    left: -12px;
    width: 3px;
    border-radius: 0 4px 4px 0;
    background: var(--sidebar-accent);
    content: '';
}

.app-sidebar__item.active .app-sidebar__icon { color: #ff7eaa; }

.app-sidebar__group.active > .app-sidebar__group-toggle {
    color: #eef1f5;
}

.app-sidebar__submenu {
    margin: 2px 0 6px;
}

.app-sidebar__popup-title { display: none; }

.app-sidebar__submenu-list {
    position: relative;
    padding-left: 21px;
}

.app-sidebar__submenu-list::before {
    position: absolute;
    top: 4px;
    bottom: 4px;
    left: 21px;
    width: 1px;
    background: var(--sidebar-border);
    content: '';
}

.app-sidebar__submenu .app-sidebar__link {
    height: 38px;
    padding-left: 17px;
    font-size: 13px;
}

.app-sidebar__submenu .app-sidebar__icon {
    flex-basis: 18px;
    width: 18px;
    margin-right: 9px;
    font-size: 11px;
}

.app-sidebar__submenu .app-sidebar__item.active > .app-sidebar__link::before { left: -21px; }

.app-sidebar__badge {
    min-width: 20px;
    margin-left: auto;
    padding: 3px 6px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.08);
    color: #c8cdd6;
    font-size: 10px;
    text-align: center;
}

.app-sidebar__item.is-search-match > .app-sidebar__link {
    background: rgba(96, 165, 250, 0.1);
    color: #fff;
}

.app-sidebar__footer {
    flex: 0 0 auto;
    padding: 12px;
    border-top: 1px solid var(--sidebar-border);
    background: rgba(8, 10, 13, 0.48);
}

.app-sidebar__user-button {
    display: flex;
    width: 100%;
    min-width: 0;
    height: 54px;
    padding: 7px 8px;
    align-items: center;
    border: 0;
    border-radius: 7px;
    outline: 0;
    background: transparent;
    color: #fff;
    text-align: left;
    transition: background-color 180ms ease;
}

.app-sidebar__user-button::after { display: none; }
.app-sidebar__user-button:hover,
.app-sidebar__user.show .app-sidebar__user-button { background: var(--sidebar-surface-hover); }

.app-sidebar__avatar-wrap {
    position: relative;
    flex: 0 0 36px;
    width: 36px;
    height: 36px;
}

.app-sidebar__avatar {
    display: grid;
    width: 36px;
    height: 36px;
    place-items: center;
    border-radius: 7px;
    object-fit: cover;
}

.app-sidebar__avatar--initials {
    background: linear-gradient(145deg, #ee5a8d, #b93d69);
    color: #fff;
    font-size: 14px;
    font-weight: 800;
}

.app-sidebar__online {
    position: absolute;
    right: -2px;
    bottom: -2px;
    width: 10px;
    height: 10px;
    border: 2px solid #111318;
    border-radius: 50%;
    background: #34d399;
}

.app-sidebar__user-copy {
    display: flex;
    min-width: 0;
    margin-left: 10px;
    flex-direction: column;
    line-height: 1.25;
}

.app-sidebar__user-copy strong,
.app-sidebar__user-copy small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.app-sidebar__user-copy strong { max-width: 146px; font-size: 12px; font-weight: 800; }
.app-sidebar__user-copy small { max-width: 146px; margin-top: 3px; color: var(--sidebar-muted); font-size: 10px; }
.app-sidebar__user-more { margin-left: auto; color: #656d7c; font-size: 11px; }

.app-sidebar__user-menu {
    width: 228px;
    margin: 0 0 8px;
    padding: 7px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 16px 38px rgba(10, 14, 22, 0.2);
}

.app-sidebar__user-menu .dropdown-item {
    display: flex;
    height: 38px;
    padding: 0 10px;
    align-items: center;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 700;
}

.app-sidebar__user-menu .dropdown-item i { width: 22px; color: #7b8494; }
.app-sidebar__user-menu .dropdown-item.text-danger i { color: #e74a3b; }

.app-sidebar #sidebarToggle.app-sidebar__collapse {
    display: flex;
    width: 100%;
    height: 36px;
    margin-top: 7px;
    padding: 0 10px;
    align-items: center;
    border: 0;
    border-radius: 7px;
    outline: 0;
    background: transparent;
    color: #727a89;
    font-size: 11px;
    font-weight: 700;
    transition: background-color 180ms ease, color 180ms ease;
}

.app-sidebar #sidebarToggle.app-sidebar__collapse::after { display: none !important; }
.app-sidebar #sidebarToggle.app-sidebar__collapse:hover { background: var(--sidebar-surface-hover); color: #fff; }
.app-sidebar #sidebarToggle.app-sidebar__collapse i { width: 22px; margin-right: 10px; transition: transform 180ms ease; }

.app-sidebar-overlay {
    position: fixed;
    inset: 0;
    z-index: 1035;
    display: none;
    padding: 0;
    border: 0;
    background: rgba(9, 12, 18, 0.58);
    backdrop-filter: blur(2px);
}

@media (min-width: 768px) {
    #wrapper .app-sidebar.toggled {
        flex-basis: var(--sidebar-collapsed-width);
        width: var(--sidebar-collapsed-width) !important;
        overflow: visible;
    }

    #wrapper .app-sidebar.toggled ~ #content-wrapper {
        width: calc(100% - var(--sidebar-collapsed-width));
        margin-left: var(--sidebar-collapsed-width);
    }

    .app-sidebar.toggled .app-sidebar__brand { min-height: 72px; padding: 16px; }
    .app-sidebar.toggled .app-sidebar__brand-copy,
    .app-sidebar.toggled .app-sidebar__environment,
    .app-sidebar.toggled .app-sidebar__search,
    .app-sidebar.toggled .app-sidebar__search-clear,
    .app-sidebar.toggled .app-sidebar__search-wrap > .fas,
    .app-sidebar.toggled .app-sidebar__section-title,
    .app-sidebar.toggled .app-sidebar__quick-action span,
    .app-sidebar.toggled .app-sidebar__label,
    .app-sidebar.toggled .app-sidebar__badge,
    .app-sidebar.toggled .app-sidebar__chevron,
    .app-sidebar.toggled .app-sidebar__user-copy,
    .app-sidebar.toggled .app-sidebar__user-more,
    .app-sidebar.toggled .app-sidebar__collapse span { display: none !important; }

    .app-sidebar.toggled .app-sidebar__body { padding: 12px 8px; overflow: visible; }
    .app-sidebar.toggled .app-sidebar__search-wrap { display: none; }
    .app-sidebar.toggled .app-sidebar__quick-actions { margin-bottom: 12px; }
    .app-sidebar.toggled .app-sidebar__quick-grid { grid-template-columns: 1fr; gap: 4px; }
    .app-sidebar.toggled .app-sidebar__quick-action { width: 44px; height: 40px; padding: 0; }
    .app-sidebar.toggled .app-sidebar__quick-action i { margin: 0; }
    .app-sidebar.toggled .app-sidebar__link,
    .app-sidebar.toggled .app-sidebar__group-toggle { width: 44px; height: 42px; padding: 0; justify-content: center; }
    .app-sidebar.toggled .app-sidebar__icon { flex-basis: 22px; margin: 0; }

    .app-sidebar.toggled .app-sidebar__group > .app-sidebar__submenu {
        position: absolute;
        top: -8px;
        left: 52px;
        z-index: 1070;
        width: 244px;
        margin: 0;
        padding: 8px;
        border: 1px solid #303540;
        border-radius: 8px;
        background: #171a20;
        box-shadow: 0 18px 42px rgba(4, 7, 12, 0.34);
    }

    .app-sidebar.toggled .app-sidebar__popup-title {
        display: block;
        padding: 7px 9px 9px;
        color: #858d9d;
        font-size: 10px;
        font-weight: 800;
        text-transform: uppercase;
    }

    .app-sidebar.toggled .app-sidebar__submenu-list { padding: 0; }
    .app-sidebar.toggled .app-sidebar__submenu-list::before { display: none; }
    .app-sidebar.toggled .app-sidebar__submenu .app-sidebar__item { margin-bottom: 2px; }
    .app-sidebar.toggled .app-sidebar__submenu .app-sidebar__link {
        width: 100%;
        height: 38px;
        padding: 0 9px;
        justify-content: flex-start;
    }

    .app-sidebar.toggled .app-sidebar__submenu .app-sidebar__label {
        display: block !important;
        color: inherit;
    }

    .app-sidebar.toggled .app-sidebar__submenu .app-sidebar__icon {
        flex-basis: 20px;
        width: 20px;
        margin-right: 9px;
    }

    .app-sidebar.toggled .app-sidebar__submenu .app-sidebar__item.active > .app-sidebar__link::before {
        top: 8px;
        bottom: 8px;
        left: -8px;
    }

    .app-sidebar.toggled .app-sidebar__footer { padding: 8px; }
    .app-sidebar.toggled .app-sidebar__user-button { width: 44px; padding: 4px; justify-content: center; }
    .app-sidebar.toggled #sidebarToggle.app-sidebar__collapse { width: 44px; justify-content: center; }
    .app-sidebar.toggled #sidebarToggle.app-sidebar__collapse i { margin: 0; transform: rotate(180deg); }

    .app-sidebar.toggled [data-sidebar-tooltip]::after {
        position: absolute;
        top: 50%;
        left: calc(100% + 10px);
        z-index: 1060;
        padding: 7px 9px;
        border: 1px solid #303641;
        border-radius: 6px;
        background: #171a20;
        color: #fff;
        content: attr(data-sidebar-tooltip);
        font-size: 11px;
        font-weight: 700;
        line-height: 1;
        opacity: 0;
        pointer-events: none;
        transform: translate(-4px, -50%);
        transition: opacity 150ms ease, transform 150ms ease;
        white-space: nowrap;
    }

    .app-sidebar.toggled [data-sidebar-tooltip]:hover::after,
    .app-sidebar.toggled [data-sidebar-tooltip]:focus-visible::after { opacity: 1; transform: translate(0, -50%); }
    .app-sidebar.toggled .app-sidebar__group-toggle[aria-expanded="true"]::after { display: none; }
}

@media (max-width: 767.98px) {
    #wrapper > #content-wrapper {
        width: 100%;
        margin-left: 0;
    }

    #wrapper .app-sidebar {
        position: fixed;
        top: 0;
        bottom: 0;
        left: 0;
        width: min(88vw, 296px) !important;
        max-height: 100dvh;
        transform: translateX(-102%);
    }

    #wrapper .app-sidebar.toggled { width: min(88vw, 296px) !important; transform: translateX(0); }
    body.sidebar-mobile-open { overflow: hidden; }
    body.sidebar-mobile-open .app-sidebar-overlay { display: block; }
    .app-sidebar__brand { padding-right: 52px; }
    .app-sidebar__body { padding-bottom: 24px; }
}

@media (prefers-reduced-motion: reduce) {
    .app-sidebar,
    .app-sidebar *,
    .app-sidebar-overlay { scroll-behavior: auto !important; transition-duration: 0.01ms !important; }
}
