.sidebar {
    width: 240px;
    border-right: 1px solid var(--border);
    background: var(--bg-secondary);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    overflow-y: auto;
}
.sidebar-header-actions {
    display: flex;
    gap: 4px;
    align-items: center;
}
.sidebar-header-actions .btn-icon--danger {
    color: var(--accent-red);
}
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-header h2 { font-size: 13px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.5px; }

.sidebar-filter {
    padding: 8px 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-filter select { width: 100%; }

.sidebar-search {
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}
.sidebar-search input {
    width: 100%;
    padding: 5px 8px;
    font-size: 12px;
    background: var(--bg-primary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
}
.sidebar-search input::placeholder { color: var(--text-secondary); }
.sidebar-search input:focus { border-color: var(--accent); outline: none; }
.sidebar-search {
    position: relative;
}
.sidebar-search-clear {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 16px;
    color: var(--text-secondary);
    cursor: pointer;
}

.category-tree { padding: 4px 0; }

/* Einzelner Baum-Eintrag */
.tree-node { -webkit-user-select: none; user-select: none; }

.tree-row {
    display: flex;
    align-items: center;
    padding: 5px 8px;
    cursor: pointer;
    color: var(--text-secondary);
    border-left: 3px solid transparent;
    transition: background 0.1s, color 0.1s;
}
.tree-row:hover { background: var(--bg-card); color: var(--text-primary); }
.tree-row.active {
    color: var(--accent);
    border-left-color: var(--accent);
    background: var(--bg-card);
}

/* Toggle-Pfeil */
.tree-toggle {
    width: 28px;
    height: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 11px;
    color: var(--text-secondary);
    transition: transform 0.15s;
    cursor: pointer;
    border-radius: var(--radius);
}
.tree-toggle:not(.empty):hover { background: rgba(255,255,255,0.08); color: var(--text-primary); }
.tree-toggle.expanded { transform: rotate(90deg); }
.tree-toggle.empty { visibility: hidden; }

/* Label */
.tree-label {
    flex: 1;
    font-size: 13px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 4px;
}

/* Count-Badge */
.tree-count {
    font-size: 10px;
    color: var(--text-secondary);
    background: rgba(255,255,255,0.06);
    padding: 1px 5px;
    border-radius: 8px;
    flex-shrink: 0;
}
.tree-row.active .tree-count {
    color: var(--accent);
    background: rgba(255,215,0,0.12);
}

.tree-row.drag-over {
    background: rgba(255,215,0,0.15);
    border-left-color: var(--accent);
}

/* Kinder-Container */
.tree-children { }
.tree-children.collapsed { display: none; }

.tree-depth-0 .tree-row { padding-left: 8px; }
.tree-depth-1 > .tree-row { padding-left: 24px; }
.tree-depth-1 > .tree-row .tree-label { font-size: 12px; }
.tree-depth-2 > .tree-row { padding-left: 40px; }
.tree-depth-2 > .tree-row .tree-label { font-size: 12px; }
.tree-depth-3 > .tree-row { padding-left: 56px; }
.tree-depth-3 > .tree-row .tree-label { font-size: 11px; }

/* "Alle" Eintrag */
.tree-row--all {
    padding: 7px 8px;
    margin-bottom: 2px;
    font-weight: 600;
}
.tree-row--all .tree-label { font-size: 13px; }
