.library-header {
    position: sticky;
    top: 0;
    z-index: var(--z-header);
    background: var(--bg-primary);
    border-bottom: 1px solid var(--border-color);
}

.library-header-inner {
    max-width: 1060px;
    margin: 0 auto;
    padding: 0 2rem;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 2rem;
}

.library-header a {
    text-decoration: none;
    color: inherit;
}

/* ── BRAND ── */

.library-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
}

.library-brand i {
    font-size: 1.2rem;
    color: var(--accent-color);
}

/* ── NAV ── */

.library-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    min-width: 0;
    flex: 1 1 auto;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

.library-nav::-webkit-scrollbar {
    display: none;
}

.library-nav-link {
    padding: 0.4rem 0.85rem;
    border-radius: 8px;
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--text-secondary);
    text-decoration: none;
    white-space: nowrap;
    flex-shrink: 0;
    transition:
        background 0.12s,
        color 0.12s;
}

.library-nav-link:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.library-nav-link--active {
    color: var(--text-primary);
    background: var(--surface-hover);
}

/* ── ACTIONS ── */

.library-actions {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-shrink: 0;
}

.icon-button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 38px;
    height: 38px;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font-size: 1rem;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.12s;
}

.icon-button:hover {
    background: var(--surface-hover);
}

/* ── USER BUTTON ── */

.library-user-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.6rem 0.3rem 0.75rem;
    border: none;
    border-radius: 10px;
    background: transparent;
    color: var(--text-primary);
    font: inherit;
    cursor: pointer;
    transition: background 0.12s;
}

.library-user-btn:hover {
    background: var(--surface-hover);
}

.library-username {
    font-size: 0.88rem;
    font-weight: 600;
}

/* ── SYNC STATUS DOT ── */

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--text-secondary);
    flex-shrink: 0;
}

/* ── RESPONSIVE ── */

@media (max-width: 600px) {
    .library-header-inner {
        padding: 0 1rem;
        gap: 1rem;
    }

    .library-username {
        display: none;
    }

    .library-nav-link {
        padding: 0.4rem 0.6rem;
        font-size: 0.85rem;
    }
}

@media (max-width: 420px) {
    .library-brand span {
        display: none;
    }

    .library-nav {
        justify-content: flex-start;
    }

    .library-nav-link {
        padding: 0.35rem 0.5rem;
        font-size: 0.8rem;
    }
}

/* ── USER MENU SLIDE-OUT PANEL ── */

.user-menu-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: var(--overlay-color);
    z-index: var(--z-backdrop);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.user-menu-overlay.open {
    display: block;
    opacity: 1;
}

.user-menu-panel {
    position: fixed;
    top: 0;
    right: 0;
    height: 100%;
    width: 280px;
    max-width: 85vw;
    background: var(--surface-raised);
    border-left: 1px solid var(--border-color);
    box-shadow: var(--shadow-lg);
    z-index: var(--z-modal);
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.25s ease;
}

.user-menu-panel.open {
    transform: translateX(0);
}

.user-menu-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.user-menu-panel-title {
    font-size: var(--font-size-base);
    font-weight: 600;
    color: var(--text-primary);
}

.user-menu-panel-body {
    display: flex;
    flex-direction: column;
    padding: 0.5rem;
    gap: 0.25rem;
}

.user-menu-item {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    width: 100%;
    padding: 0.75rem 0.85rem;
    border: none;
    border-radius: var(--radius);
    background: transparent;
    font: inherit;
    font-size: var(--font-size-sm);
    color: var(--text-primary);
    text-align: left;
    cursor: pointer;
    transition: background 0.12s;
}

.user-menu-item:hover:not(:disabled) {
    background: var(--surface-hover);
}

.user-menu-item:disabled {
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

.user-menu-item--danger:hover {
    background: var(--danger-subtle);
    color: var(--danger-color);
}
