.sidebar-toggle {
    position: absolute;
    left: 0;
    top: 0;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, .12);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    transition: all .2s ease;
}

.sidebar-header {
    position: relative;
    display: flex;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
}

.sidebar-title {
    margin-left: 58px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    margin-top: 9px;
    white-space: nowrap;
    opacity: 1;
    max-width: 160px;
    overflow: hidden;
    visibility: visible;
    transition:
        opacity .15s ease .24s,
        max-width .15s ease .24s,
        visibility 0s linear .24s;
}

.sidebar-toggle:hover {
    background: rgba(255, 255, 255, .20);
    transform: translateY(-1px);
}

.app-sidebar.collapsed .sidebar-title {
    opacity: 0;
    max-width: 0;
    visibility: hidden;
    transition-delay: 0s;
}

.app-sidebar.collapsed .sidebar-header {
    justify-content: center;
}

.app-sidebar.collapsed {
    width: 80px;
}

.app-sidebar.collapsed .sidebar-logo img {
    width: 45px;
}

.app-sidebar.collapsed .sidebar-link span {
    opacity: 0;
    max-width: 0;
    visibility: hidden;
    transition-delay: 0s;
}

.app-sidebar.collapsed~.app-main {
    margin-left: 82px;
    width: calc(100% - 82px);
}

.app-sidebar {
    transition: width 0.4s ease;
    scrollbar-width: none;
}

.app-sidebar::-webkit-scrollbar {
    display: none;
}

.app-main {
    transition: margin-left 0.4s ease, width 0.4s ease;
}

.sidebar-notification-item {
    position: relative;
}

.sidebar-notification-link {
    width: 100%;
    border: 0;
    background: transparent;
    text-align: left;
    cursor: pointer;
}

.sidebar-notification-link.has-pending>i {
    color: #fbbf24;
}

.notification-count {
    position: absolute;
    top: 3px;
    left: 25px;
    min-width: 21px;
    height: 21px;
    padding: 0 5px;
    border: 2px solid #172033;
    border-radius: 11px;
    background: #dc2626;
    color: #fff;
    font-size: .68rem;
    font-weight: 700;
    line-height: 17px;
    text-align: center;
}

.app-sidebar.collapsed .notification-count {
    top: 3px;
    left: 25px;
}

.notification-panel {
    position: fixed;
    width: min(340px, calc(100vw - 32px));
    overflow: hidden;
    border: 1px solid #dce2ea;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 42px rgba(15, 23, 42, .18);
    z-index: 1060;
}

.notification-panel-header {
    padding: 13px 16px;
    border-bottom: 1px solid #e5e7eb;
    font-weight: 700;
}

.notification-panel-body {
    padding: 16px;
}

.notification-panel-body strong,
.notification-panel-body span {
    display: block;
}

.notification-panel-body span {
    margin-top: 4px;
    color: #6b7280;
    font-size: .88rem;
}

.notification-panel-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid #e5e7eb;
    color: #166534;
    font-weight: 600;
    text-decoration: none;
}

.notification-panel-link:hover {
    background: #f0fdf4;
    color: #14532d;
}

.notification-toast {
    position: fixed;
    right: 24px;
    bottom: 24px;
    z-index: 1060;
    width: min(440px, calc(100vw - 32px));
    min-height: 72px;
    padding: 14px 46px 14px 16px;
    border-left: 4px solid #f59e0b;
    border-radius: 8px;
    background: #fff;
    box-shadow: 0 18px 48px rgba(15, 23, 42, .22);
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
}

.notification-toast>i {
    color: #d97706;
    font-size: 1.35rem;
}

.notification-toast strong,
.notification-toast span {
    display: block;
}

.notification-toast span {
    margin-top: 2px;
    color: #6b7280;
    font-size: .84rem;
}

.notification-toast>a {
    color: #166534;
    font-weight: 700;
    text-decoration: none;
}

.notification-toast>button {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    background: transparent;
    color: #6b7280;
}

.sidebar-link span {
    white-space: nowrap;
    opacity: 1;
    max-width: 190px;
    overflow: hidden;
    visibility: visible;
    transition:
        opacity .15s ease .24s,
        max-width .15s ease .24s,
        visibility 0s linear .24s;
}

.sidebar-logo img {
    transition: opacity 0.2s ease;
}

.app-layout {
    min-height: 100vh;
    background: #eef2f7;
    display: flex;
}

.app-sidebar {
    width: 260px;
    height: 100vh;
    min-height: 100vh;
    background: linear-gradient(180deg,
            #0f172a 0%,
            #1e293b 100%);
    border-right: 1px solid rgba(255, 255, 255, .08);
    padding: 24px 16px;
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1030;
}

.app-sidebar:not(.collapsed) {
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    text-align: center;
    margin-bottom: 30px;
}

.sidebar-logo img {
    width: 130px;
}

.sidebar-menu {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 25px;
}

.sidebar-link {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 12px;
    color: rgba(255, 255, 255, .75);
    text-decoration: none;
    font-weight: 500;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.sidebar-link:hover {
    background: rgba(255, 255, 255, .08);
    color: #fff;
}

.sidebar-link i {
    font-size: 1.1rem;
    flex: 0 0 auto;
}

.app-sidebar.collapsed .sidebar-link::after {
    content: attr(data-label);
    position: absolute;
    left: calc(100% + 12px);
    top: 50%;
    padding: 7px 10px;
    border-radius: 6px;
    background: #111827;
    color: #fff;
    font-size: 0.82rem;
    font-weight: 500;
    line-height: 1;
    white-space: nowrap;
    opacity: 0;
    visibility: hidden;
    transform: translate(-4px, -50%);
    pointer-events: none;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .22);
    transition: opacity .15s ease, transform .15s ease, visibility 0s linear .15s;
    z-index: 1040;
}

.app-sidebar.collapsed .sidebar-link:hover::after {
    opacity: 1;
    visibility: visible;
    transform: translate(0, -50%);
    transition-delay: .12s;
}

.sidebar-footer {
    margin-top: auto;
}

.app-main {
    margin-left: 260px;
    width: calc(100% - 260px);
    min-width: 0;
    min-height: 100vh;
    padding: 40px;
}

.sidebar-backdrop {
    display: none;
}

@media (max-width: 768px) {
    body.sidebar-mobile-open {
        overflow: hidden;
    }

    .app-layout {
        display: block;
    }

    .app-sidebar {
        position: fixed;
        right: auto;
        bottom: auto;
        width: 100%;
        height: 66px;
        min-height: 66px;
        padding: 12px 16px;
        overflow: hidden;
        box-shadow: 0 4px 18px rgba(15, 23, 42, .18);
        transition: width .25s ease, height .25s ease, box-shadow .25s ease;
    }

    .app-sidebar.collapsed {
        width: 100%;
        height: 66px;
    }

    .app-sidebar:not(.collapsed) {
        width: min(320px, calc(100vw - 40px));
        height: 100dvh;
        min-height: 100dvh;
        padding: 16px;
        overflow-x: hidden;
        overflow-y: auto;
        scrollbar-width: none;
        box-shadow: 12px 0 36px rgba(15, 23, 42, .28);
    }

    .app-sidebar:not(.collapsed)::-webkit-scrollbar {
        display: none;
    }

    .sidebar-header,
    .app-sidebar.collapsed .sidebar-header {
        justify-content: flex-start;
        min-height: 42px;
        margin: 0;
        padding: 0;
    }

    .sidebar-toggle {
        position: static;
        flex: 0 0 42px;
        border-radius: 8px;
    }

    .sidebar-title,
    .app-sidebar.collapsed .sidebar-title {
        max-width: 180px;
        margin: 0 0 0 14px;
        opacity: 1;
        visibility: visible;
        transition: none;
    }

    .app-sidebar.collapsed .sidebar-menu,
    .app-sidebar.collapsed .sidebar-footer {
        display: none;
    }

    .app-sidebar:not(.collapsed) .sidebar-menu {
        margin-top: 20px;
    }

    .app-sidebar:not(.collapsed) .sidebar-footer {
        padding-top: 20px;
    }

    .app-sidebar:not(.collapsed) .sidebar-link span {
        max-width: 190px;
        opacity: 1;
        visibility: visible;
    }

    .app-sidebar.collapsed .sidebar-link::after {
        display: none;
    }

    .app-main {
        margin-left: 0;
        width: 100%;
        padding: 88px 16px 24px;
    }

    .notification-toast {
        left: 16px;
        right: 16px;
        bottom: 16px;
        width: auto;
    }

    .app-sidebar.collapsed~.app-main {
        margin-left: 0;
        width: 100%;
    }

    .sidebar-backdrop {
        position: fixed;
        top: 0;
        right: 0;
        bottom: 0;
        left: min(320px, calc(100vw - 40px));
        z-index: 1025;
        display: block;
        border: 0;
        background: rgba(15, 23, 42, .58);
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity .2s ease, visibility 0s linear .2s;
    }

    .sidebar-backdrop.visible {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition-delay: 0s;
    }

    .notification-panel {
        max-height: calc(100dvh - 100px);
        overflow-y: auto;
    }
}

@media print {
    .sidebar-backdrop {
        display: none !important;
    }
}