/* =========================================
   SIDEBAR BASE (ALWAYS DARK)
========================================== */

/* DESKTOP SIDEBAR: fixed left column */
#nav.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 260px;
    max-width: 260px;

    background: var(--background-navcolor-dark);
    border-right: 1px solid var(--dmu-topbar-border);
    color: #e5e7eb;
    z-index: 9999;

    /* animate width when collapsed/expanded */
    transition:
        width 0.25s ease,
        max-width 0.25s ease;
}

#nav .sidebar-inner {
    width: 100%;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* Middle menu area: scrollable ONLY in expanded mode */
#nav .sidebar-nav {
    padding: 1.25rem;
    overflow-y: auto;
    overflow-x: visible;
    flex: 1 1 auto;
    min-height: 0;
}

/* Scrollbar styling (WebKit) */
#nav .sidebar-nav::-webkit-scrollbar {
    width: 6px;
}

#nav .sidebar-nav::-webkit-scrollbar-track {
    background: transparent;
}

#nav .sidebar-nav::-webkit-scrollbar-thumb {
    background: rgba(148, 163, 184, 0.35);
    border-radius: 10px;
}

#nav .sidebar-nav::-webkit-scrollbar-thumb:hover {
    background: rgba(148, 163, 184, 0.55);
}

.sidebar-brand,
.sidebar-footer {
    padding: 0 1.25rem 1.25rem 1rem;
}

/* =========================================
   BRAND AREA
========================================== */

.sidebar-brand {
    padding-top: 1.25rem;
    height: 65px;
    flex-shrink: 0;
    border-bottom: 1px solid var(--dmu-sidebar-border);
}

.sidebar-logo {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-mark {
    font-size: 0.75rem;
    font-weight: 700;
    color: white;
    letter-spacing: 0.08em;
}

.sidebar-brand-text {
    line-height: 1.2;
    max-width: 200px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    transition:
        max-width 0.25s ease,
        opacity 0.12s ease 0.13s;
}

.sidebar-brand-name {
    font-size: 0.85rem;
    font-weight: 400;
    color: var(--dmu-sidebar-text);
    margin-bottom: 2px;
}

.sidebar-brand-section {
    font-size: 0.7rem;
    text-transform: uppercase;
    color: var(--dmu-sidebar-muted);
}

/* ─── Sidebar Switcher ─────────── */

.sidebar-switcher {
    min-width: 0;
    flex: 1;
}

.sidebar-switcher-toggle {
    width: calc(100% + 1.3rem);
    margin-left: -0.65rem;
    margin-right: -0.65rem;
    gap: 0;
    padding: 0.45rem 0.65rem;
    border: none;
    background: transparent;
    color: inherit;
    cursor: pointer;
    text-align: left;
    border-radius: 0.8rem;
    white-space: nowrap;
    transition: background 0.15s ease;
}

button.sidebar-switcher-toggle:hover,
button.sidebar-switcher-toggle[aria-expanded="true"] {
    background: var(--dmu-sidebar-link-hover-bg);
}

.sidebar-switcher-chevron {
    width: 14px;
    height: 14px;
    opacity: 0.5;
    flex-shrink: 0;
    transition:
        transform 0.2s ease,
        opacity 0.12s ease 0.13s,
        max-width 0.25s ease;
    max-width: 14px;
}

.sidebar-switcher-toggle[aria-expanded="true"] .sidebar-switcher-chevron {
    transform: rotate(180deg);
}

body.sidebar-collapsed .sidebar-switcher-chevron {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        opacity 0.1s ease,
        max-width 0.25s ease;
}

/* ─── Favicon overrides (edge-to-edge fill) ─── */

.sidebar-switcher .favicon-circle,
.sidebar-switcher .favicon-circle.is-loaded {
    border: 0;
    padding: 0;
    background: transparent !important;
}

.sidebar-switcher .favicon-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 999px;
}

/* ─── Force dark palette on sidebar dropdown ─── */

.sidebar-switcher .dmu-dropdown {
    --dmu-dropdown-bg: #1c1c1c;
    --dmu-dropdown-border: rgba(71, 71, 71, 0.9);
    --dmu-dropdown-text: #f0f0f0;
    --dmu-dropdown-hover-bg: rgba(151, 103, 183, 0.20);
    --dmu-dropdown-hover-text: #f0f0f0;
    --dmu-dropdown-active-text: #e9e9e9;
    --dark: #f0f0f0;
}

.sidebar-switcher .dmu-dropdown-section-header {
    color: rgba(148, 163, 184, 0.85);
}

/* =========================================
   NAV AREA / SECTION LABELS
========================================== */

.sidebar-section-label {
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    font-size: 0.7rem;
    text-transform: uppercase;
    white-space: nowrap;
}

/* =========================================
   MENU ITEMS (BASE)
========================================== */

.sidebar-item {
    margin-top: 0.25rem;
}

.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    border-radius: 0.8rem;
    padding: 0.55rem 0.65rem;
    text-decoration: none;
    color: var(--dmu-sidebar-link);
    font-size: 0.875rem;
    font-weight: 500;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.12s ease,
        box-shadow 0.15s ease,
        padding 0.25s ease;
}

.sidebar-link-inner {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    transition: gap 0.25s ease;
}

.sidebar-icon-wrapper {
    width: 28px;
    height: 28px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 28px;
    /* lock icon column width */
}

.sidebar-link .icon {
    opacity: 0.8;
}

.sidebar-link .icon > svg,
.sidebar-link .icon {
    transition: transform 0.2s ease-out;
    transform-origin: center;
    transform-box: fill-box;
    shape-rendering: geometricPrecision;
}

.sidebar-link:hover .icon > svg,
.sidebar-link:hover .icon {
    transform: scale(1.15) rotate(var(--icon-rot, -4deg));
}

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

.sidebar-link.active {
    color: #f9fafb;
    /* The active background is provided by `.sidebar-active-indicator`,
       which animates between items. */
}

/* Suppress the hover background on the active link — otherwise its
   semi-transparent rgba stacks on top of the indicator's identical
   color and the highlight visibly darkens on hover. The icon
   scale/rotate hover still runs, so feedback is preserved. */
.sidebar-link.active:hover {
    background: transparent;
}

.sidebar-link.active .icon {
    opacity: 1;
}

/* =========================================
   ACTIVE INDICATOR (animated highlight)
========================================== */

.sidebar-menu {
    position: relative;
}

.sidebar-link {
    position: relative;
    z-index: 1;
}

.sidebar-active-indicator {
    position: absolute;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 0.8rem;
    pointer-events: none;
    z-index: 0;
    opacity: 0;
    transform: translate(0, 0);
    will-change: transform, width, height;
    transition:
        transform 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        width 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        height 0.32s cubic-bezier(0.4, 0, 0.2, 1),
        opacity 0.18s ease;
}

.sidebar-active-indicator.is-visible {
    opacity: 1;
}

.sidebar-active-indicator.no-transition {
    transition: none !important;
}

@media (prefers-reduced-motion: reduce) {
    .sidebar-link .icon > svg,
    .sidebar-link .icon {
        transition: none;
    }
    .sidebar-link:hover .icon > svg,
    .sidebar-link:hover .icon {
        transform: none;
    }
}

.sidebar-link-secondary {
    padding-left: 0.35rem;
}

.sidebar-pill-initial {
    width: 26px;
    height: 26px;
    border-radius: 999px;
    background-color: var(--dmu-sidebar-pill-bg);
    border: 1px solid rgba(148, 163, 184, 0.5);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--dmu-sidebar-text);
}

/* Label */
.sidebar-label {
    display: inline-block;
    max-width: 180px;
    opacity: 1;
    transform: translateX(0);
    white-space: nowrap;
    overflow: hidden;
    transition:
        max-width 0.25s ease,
        opacity 0.12s ease 0.13s;
    /* expanding: width grows then label fades in */
}

/* Chevron for items that have a submenu */
.sidebar-group-toggle .group-chevron {
    margin-left: 0.5rem;
    opacity: 0.75;
    transition: transform 0.25s ease, opacity 0.15s ease;
}

.sidebar-group-toggle:hover .group-chevron {
    opacity: 1;
}

body.sidebar-collapsed .sidebar-group-toggle .group-chevron {
    display: none;
}

.sidebar-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.45rem;
    background: var(--primary);
    color: #e5e7eb;
    border: 1px solid var(--primary);
    transform-origin: center;
}

/* Blub animation only on collapse->expand toggle. The body class is
   added by JS for the duration of the animation so it doesn't fire on
   page load or SPA navigation. */
body.sidebar-just-expanded .sidebar-badge {
    animation: sidebar-badge-blub 0.45s cubic-bezier(0.34, 1.56, 0.64, 1) both;
}

@keyframes sidebar-badge-blub {
    0% {
        transform: scale(0);
        opacity: 0;
    }
    60% {
        transform: scale(1.15);
        opacity: 1;
    }
    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.sidebar-link.active .sidebar-badge {
    background: var(--primary);
    border-color: var(--primary);
}

/* Hide badges inside sidebar links/groups when collapsed — but not
   badges inside the switcher dropdown, which is always full-width. */
body.sidebar-collapsed .sidebar-link .sidebar-badge,
body.sidebar-expanding .sidebar-link .sidebar-badge {
    display: none;
}

/* =========================================
   FOOTER / PROFILE
========================================== */

.sidebar-footer {
    padding-top: 0.85rem;
    padding-bottom: 0.85rem;
    margin-top: auto;
    flex-shrink: 0;
    gap: 0.6rem;
    border-top: 1px solid var(--dmu-sidebar-border);
}

.sidebar-footer-toggle {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.55rem 0.65rem;
    border-radius: 0.8rem;
    background: transparent;
    border: none;
    color: var(--dmu-sidebar-link);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition:
        background 0.15s ease,
        color 0.15s ease,
        transform 0.12s ease,
        padding 0.25s ease;
}

.sidebar-footer-toggle:hover {
    background: var(--dmu-sidebar-link-hover-bg);
    color: #f9fafb;
}

.sidebar-footer-toggle .icon {
    opacity: 0.8;
    transition: opacity 0.2s ease;
}

.sidebar-footer-toggle:hover .icon {
    opacity: 1;
}

.sidebar-avatar {
    width: 32px;
    height: 32px;
    border-radius: 999px;
    background: linear-gradient(160deg, var(--gradient-1), var(--gradient-1), var(--gradient-1-lighter)) !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-avatar-initial {
    font-size: 0.9rem;
    font-weight: 500;
    color: white;
}

.sidebar-footer-text {
    line-height: 1.2;
}

.sidebar-footer-name {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--dmu-sidebar-text);
}

.sidebar-footer-role {
    font-size: 0.7rem;
    color: var(--dmu-sidebar-muted);
}

/* =========================================
   SUBMENUS
========================================== */

.sidebar-submenu {
    margin-top: 0;
    margin-left: 1.4rem;
    border-left: 1px dashed rgba(148, 163, 184, 0.3);
    padding-left: 0.6rem;
    transition:
        margin-top 0.25s ease,
        opacity 0.25s ease,
        transform 0.25s ease;
}

.sidebar-submenu.open {
    margin-top: 0.15rem;
}

.chevron-rotate {
    transition: transform 0.25s ease;
}

.chevron-rotate.active {
    transform: rotate(180deg);
}

.sidebar-menu .sidebar-divider {
    border-top: 1px solid var(--dmu-topbar-border);
    margin: 0.75rem -1.25rem;
    list-style: none;
}

.sidebar-expanded .sidebar-menu .sidebar-divider,
.sidebar-collapsed .sidebar-menu .sidebar-divider {
    margin: 0.75rem -1.25rem;
}

/* ─── Labeled section divider ─── */

.sidebar-menu .sidebar-divider-labeled {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-top: 0;
    /* Reserve the label's natural line height so the row's vertical
       footprint is identical when the label is shown vs faded out —
       prevents items below from shifting between collapsed/expanded. */
    min-height: 0.625rem;
    overflow: hidden;
    transition: gap 0.3s ease;
}

/* Labeled dividers get more breathing room. Uses a double-class selector
   on the same element (specificity 0,3,0) so it beats the (0,3,0) state
   rule above on source order, and unlike that rule it doesn't depend on
   body.sidebar-expanded — which is never set; only body.sidebar-collapsed
   exists, and the default expanded state has neither class. */
.sidebar-menu .sidebar-divider.sidebar-divider-labeled {
    margin: 1rem -1.25rem;
}

.sidebar-menu .sidebar-divider-labeled::before {
    content: "";
    /* Sidebar inner padding (1.25rem) + .sidebar-link padding (0.65rem) =
       1.9rem to the icon column; subtract the flex gap (0.5rem) so the
       label's left edge lands on the menu icons. */
    width: 1.4rem;
    border-top: 1px solid var(--dmu-topbar-border);
    transition: width 0.3s ease;
}

.sidebar-menu .sidebar-divider-labeled::after {
    content: "";
    flex: 1;
    border-top: 1px solid var(--dmu-topbar-border);
}

.sidebar-divider-label {
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--dmu-sidebar-link);
    opacity: 0.6;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    max-width: 12rem;
    transition: max-width 0.3s ease, opacity 0.3s ease;
}

/* Collapsed: smoothly fade and collapse the label, drop the flex gap,
   and shrink the lead-in line so the divider becomes a single continuous
   line. Items don't shift because the row's min-height is the same. We
   intentionally don't include body.sidebar-expanding here — that lets the
   label fade in during the expand animation rather than popping in after. */
body.sidebar-collapsed .sidebar-divider-label {
    max-width: 0;
    opacity: 0;
}

body.sidebar-collapsed .sidebar-menu .sidebar-divider-labeled {
    gap: 0;
}

body.sidebar-collapsed .sidebar-menu .sidebar-divider-labeled::before {
    width: 0;
}

/* =========================================
   SUBMENU BASE (EXPANDED SIDEBAR)
========================================== */

.custom-submenu {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transform: translateY(-4px);
    transition:
        max-height 0.25s ease,
        opacity 0.2s ease,
        transform 0.25s ease;
}

.custom-submenu.open {
    opacity: 1;
    transform: translateY(0);
    max-height: 999px;
}

/* =========================================
   COLLAPSIBLE SIDEBAR STATE (DESKTOP)
========================================== */

body.sidebar-collapsed #nav.sidebar {
    width: 72px;
    max-width: 72px;
}

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

body.sidebar-collapsed .sidebar-brand-text {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        max-width 0.25s ease,
        opacity 0.1s ease;
}

/* keep same vertical spacing as expanded, just render as a line */
body.sidebar-collapsed .sidebar-section-label {
    margin-top: 1.5rem;
    margin-bottom: 0.4rem;
    height: 1px;
    width: 40px;
    background: rgba(148, 163, 184, 0.35);
    padding: 0;
    border: 0;
    white-space: nowrap;
    overflow: hidden;
    text-indent: 200%;
    opacity: 0.4;
    margin-left: auto;
    margin-right: auto;
}

body.sidebar-collapsed .sidebar-footer-text {
    display: none;
}

body.sidebar-collapsed .sidebar-item {
    margin-top: 0.25rem;
    padding: 0;
}

body.sidebar-collapsed .sidebar-link {
    /* horizontal padding tuned so icon (28px) sits centered in
       collapsed sidebar (72px) without using justify-content: center,
       so the icon slides smoothly via padding transition */
    padding: 0.55rem 0.125rem !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
}

body.sidebar-collapsed .sidebar-link-inner {
    gap: 0;
}

body.sidebar-collapsed .sidebar-icon-wrapper {
    width: 28px !important;
    height: 28px !important;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* hard-hide labels in collapsed to avoid width games */
body.sidebar-collapsed .sidebar-label {
    max-width: 0;
    opacity: 0;
    pointer-events: none;
    transition:
        max-width 0.25s ease,
        opacity 0.1s ease;
    /* collapsing: label fades out fast, width follows */
}

body.sidebar-collapsed .sidebar-submenu {
    border-left: none;
    margin-left: 0;
    padding-left: 0;
}

body.sidebar-collapsed [data-sidebar-toggle] span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
    transition:
        max-width 0.25s ease,
        opacity 0.1s ease;
}

[data-sidebar-toggle] span {
    display: inline-block;
    max-width: 200px;
    opacity: 1;
    overflow: hidden;
    white-space: nowrap;
    transition:
        max-width 0.25s ease,
        opacity 0.12s ease 0.13s;
}

body.sidebar-collapsed [data-sidebar-toggle] [data-lucide],
body.sidebar-collapsed [data-sidebar-toggle] .icon,
body.sidebar-collapsed [data-sidebar-toggle] svg {
    width: 26px;
    height: 26px;
    transform: rotate(180deg);
}

[data-sidebar-toggle] [data-lucide],
[data-sidebar-toggle] .icon,
[data-sidebar-toggle] svg {
    transition:
        transform 0.25s ease,
        opacity 0.25s ease,
        width 0.25s ease,
        height 0.25s ease;
}

body.sidebar-collapsed .sidebar-footer-toggle {
    justify-content: center;
    gap: 0;
    /* Smaller vertical padding compensates for the larger 26px icon
       so the button's total height matches the expanded state. */
    padding: 0.4rem 0.65rem;
}

body.sidebar-collapsed #nav .sidebar-nav {
    overflow: visible;
    max-height: none;
}

body.sidebar-collapsed .custom-submenu .sidebar-link {
    height: auto !important;
    padding: 0.45rem 0.55rem !important;
    justify-content: flex-start !important;
    text-align: left;
}

/* =========================================
   FLY-OUT SUBMENUS IN COLLAPSED MODE
========================================== */

body.sidebar-collapsed .sidebar-group {
    position: relative;
}

/* =========================================
   COLLAPSED TOOLTIPS
   Hover-only tooltip on top-level items in collapsed mode.
   Styled like the flyout submenu so they share visual identity.
========================================== */

body.sidebar-collapsed .sidebar-menu > .sidebar-item {
    position: relative;
}

body.sidebar-collapsed .sidebar-menu > .sidebar-item > .sidebar-link[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    top: 50%;
    left: 65px;
    transform: translate(6px, -50%) scale(0.98);
    background: var(--dmu-sidebar-bg);
    border-radius: 0.75rem;
    padding: 0.45rem 0.75rem;
    z-index: 9999;
    max-width: 220px;
    white-space: nowrap;
    color: var(--dmu-sidebar-text);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1.2;
    pointer-events: none;
    opacity: 0;
    visibility: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.25);
    transition:
        opacity 0.18s ease,
        transform 0.18s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0s linear 0.18s;
}

body.sidebar-collapsed .sidebar-menu > .sidebar-item > .sidebar-link[data-tooltip]:hover::after,
body.sidebar-collapsed .sidebar-menu > .sidebar-item > .sidebar-link[data-tooltip]:focus-visible::after {
    opacity: 1;
    transform: translate(0, -50%) scale(1);
    visibility: visible;
    transition:
        opacity 0.18s ease,
        transform 0.18s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0s linear 0s;
}

/* Fade out the tooltip when the group's submenu is opening so the
   tooltip-to-flyout transition feels continuous (the flyout slides in
   over the same anchor). */
body.sidebar-collapsed .sidebar-menu > .sidebar-group:has(> .custom-submenu.flyout-visible) > .sidebar-link[data-tooltip]::after {
    opacity: 0;
    visibility: hidden;
    transition:
        opacity 0.18s ease,
        visibility 0s linear 0.18s;
}

body.sidebar-collapsed .custom-submenu {
    position: absolute;
    top: 0;
    left: 65px;
    min-width: 220px;
    background: var(--dmu-sidebar-bg);
    border-radius: 0.75rem;
    padding: 0.4rem 0.5rem;
    z-index: 10000;

    overflow: visible;
    max-height: none;

    opacity: 0;
    transform: translateX(6px) scale(0.98);
    pointer-events: none;
    visibility: hidden;

    transition:
        opacity 0.22s ease,
        transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0s linear 0.22s;
}

body.sidebar-collapsed .custom-submenu.flyout-visible {
    opacity: 1;
    transform: translateX(0) scale(1);
    pointer-events: auto;
    visibility: visible;
    transition:
        opacity 0.22s ease,
        transform 0.22s cubic-bezier(0.25, 0.1, 0.25, 1),
        visibility 0s;
}

body.sidebar-collapsed .custom-submenu .sidebar-link-inner {
    justify-content: flex-start;
    gap: 0.6rem;
}

body.sidebar-collapsed .custom-submenu .sidebar-icon-wrapper {
    margin: 0 0.4rem 0 0 !important;
}

body.sidebar-collapsed .custom-submenu .sidebar-label {
    max-width: 180px !important;
    opacity: 1 !important;
    transform: translateX(0) !important;
    pointer-events: auto !important;
}

body.sidebar-collapsed .custom-submenu.open .sidebar-item {
    animation: fadeSlideIn 0.18s ease forwards;
}

@keyframes fadeSlideIn {
    from {
        opacity: 0;
        transform: translateX(4px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.sidebar-close-btn {
    display: flex;
    justify-content: flex-end;
    padding: 12px;
}

.sidebar-close-btn button {
    background: transparent;
    border: none;
    padding: 6px;
    cursor: pointer;
}

.sidebar-close-btn .icon {
    opacity: 0.85;
    transition: opacity 0.15s ease;
}

.sidebar-close-btn button:hover .icon {
    opacity: 1;
}

/* =========================================
   RESPONSIVE SIDEBAR (MOBILE)
========================================== */

@media (max-width: 991.98px) {
    #nav.sidebar {
        position: fixed;
        top: 0;
        left: 0;
        height: 100vh;
        width: 290px;
        max-width: 290px;
        transform: translateX(-100%);
        transition: transform 0.25s ease;
        z-index: 1050;
    }

    body.sidebar-mobile-open #nav.sidebar {
        transform: translateX(0);
    }

    .sidebar-backdrop {
        position: fixed;
        inset: 0;
        background: rgba(17, 17, 17, 0.55);
        opacity: 0;
        pointer-events: none;
        transition: opacity 0.25s ease;
        z-index: 1040;
    }

    body.sidebar-mobile-open .sidebar-backdrop {
        opacity: 1;
        pointer-events: auto;
    }

    /* On mobile, collapsed overrides revert to expanded look */
    body.sidebar-collapsed #nav.sidebar {
        flex: 0 0 290px;
        max-width: 290px;
    }

    body.sidebar-collapsed .sidebar-brand {
        justify-content: flex-start;
    }

    body.sidebar-collapsed .sidebar-brand-text {
        max-width: 200px;
        opacity: 1;
        pointer-events: auto;
    }

    body.sidebar-collapsed .sidebar-section-label {
        display: inline-flex !important;
        width: auto !important;
        margin: 0 0 0.75rem 0 !important;
        height: auto !important;
        background: none;
    }

    body.sidebar-collapsed .sidebar-section-label span {
        display: inline;
        opacity: 0.7;
    }

    body.sidebar-collapsed .sidebar-item {
        margin-top: 2px;
        margin-bottom: 2px;
    }

    body.sidebar-collapsed .sidebar-link {
        height: 36px;
        padding: 0.3rem 0.85rem !important;
    }

    body.sidebar-collapsed .sidebar-link-inner {
        gap: 0.6rem;
    }

    body.sidebar-collapsed .sidebar-text {
        display: inline-block;
        opacity: 0.85;
    }

    body.sidebar-collapsed .sidebar-footer-text {
        display: flex;
    }

    body.sidebar-collapsed .sidebar-footer-toggle {
        width: auto;
        border: 1px solid rgba(148, 163, 184, 0.5);
        white-space: nowrap;
        overflow: visible;
        text-indent: 0;
        opacity: 0.9;
        justify-content: flex-start;
        gap: 0.55rem;
        padding: 0.55rem 0.65rem;
    }

    body.sidebar-collapsed [data-sidebar-toggle] [data-lucide],
    body.sidebar-collapsed [data-sidebar-toggle] .icon,
    body.sidebar-collapsed [data-sidebar-toggle] svg {
        width: 21px;
        height: 21px;
    }
}