.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: linear-gradient(180deg, #ffffff 0%, #eef1ff 100%);
    border-right: 1px solid rgba(76, 110, 245, 0.1);
    padding: 1.5rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
    box-shadow: 0 10px 30px rgba(76, 110, 245, 0.08);
    transition: width 0.3s ease, transform 0.3s ease;
    z-index: 1020;
}

.sidebar-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    text-decoration: none;
    color: var(--color-text);
    font-weight: 600;
    font-size: 1rem;
}

.sidebar-logo {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background-color: var(--color-primary-soft);
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.sidebar-logo img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.sidebar-collapse {
    background: transparent;
    border: none;
    color: var(--color-primary);
    padding: 0.25rem;
    font-size: 1.2rem;
    cursor: pointer;
    border-radius: 8px;
    transition: background 0.2s ease, color 0.2s ease;
}

.sidebar-collapse:hover,
.sidebar-collapse:focus {
    background: var(--color-primary-soft);
    color: var(--color-text);
    outline: none;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
    flex-grow: 1;
    overflow-y: auto;
}

.sidebar-section {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.sidebar-section-title {
    text-transform: uppercase;
    font-size: 0.72rem;
    letter-spacing: 0.08em;
    color: var(--color-muted);
    margin: 0 0 0.35rem 0.5rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.6rem 0.9rem;
    border-radius: 12px;
    color: var(--color-text);
    text-decoration: none;
    font-size: 0.95rem;
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.sidebar-link i {
    min-width: 22px;
    text-align: center;
    font-size: 1.05rem;
    color: var(--color-primary);
}

.sidebar-link:hover {
    background: rgba(76, 110, 245, 0.12);
    transform: translateX(4px);
}

.sidebar-link.active {
    background: var(--color-primary);
    color: #fff;
    box-shadow: 0 10px 18px rgba(76, 110, 245, 0.25);
}

.sidebar-link.active i {
    color: #fff;
}

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

.sidebar-footer .sidebar-link {
    color: #e03131;
}

.sidebar-footer .sidebar-link i {
    color: #e03131;
}

.sidebar-footer .sidebar-link:hover,
.sidebar-footer .sidebar-link:focus {
    background: rgba(224, 49, 49, 0.12);
}

body.sidebar-collapsed .sidebar {
    width: var(--sidebar-collapsed-width);
    padding-inline: 1rem;
}

body.sidebar-collapsed .sidebar-brand-text,
body.sidebar-collapsed .sidebar-section-title,
body.sidebar-collapsed .sidebar-label {
    display: none;
}

body.sidebar-collapsed .sidebar-link {
    justify-content: center;
    padding-inline: 0.75rem;
}

body.sidebar-collapsed .sidebar-top {
    justify-content: center;
}

@media (max-width: 768px) {
    .sidebar-collapse {
        display: none;
    }
    
    .sidebar {
        transform: translateX(-100%);
        box-shadow: 0 18px 48px rgba(76, 110, 245, 0.2);
    }

    .sidebar.active {
        transform: translateX(0);
    }

    #toggleSidebar {
        position: fixed;
        top: 1rem;
        left: 1rem;
        z-index: 1100;
    }

    body.sidebar-open::before {
        content: '';
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.25);
        z-index: 1090;
    }
}