/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  transition: width 0.22s cubic-bezier(0.4,0,0.2,1);
  position: relative; z-index: 60;
}

#sidebar.collapsed { width: 0; border-right-color: transparent; }

#sidebar-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#sidebar-logo {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-mono); font-size: 13px; font-weight: 500;
  color: var(--text); white-space: nowrap;
}

.sidebar-logo-mark {
  width: 24px; height: 24px; border-radius: 6px;
  background: var(--accent); flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
}
.sidebar-logo-mark svg { width: 13px; height: 13px; }

#sidebar-collapse-btn {
  width: 26px; height: 26px; border-radius: var(--radius-xs);
  background: none; border: none; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition); flex-shrink: 0;
}
#sidebar-collapse-btn:hover { background: var(--surface3); color: var(--text-muted); }

/* User area */
#user-area {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#user-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent-soft); border: 1px solid var(--accent-border);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 500; color: var(--accent);
  flex-shrink: 0; overflow: hidden;
}
#user-avatar img { width: 100%; height: 100%; object-fit: cover; }

#user-info { flex: 1; min-width: 0; }
#user-name {
  font-size: 12px; font-weight: 500; color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
#user-email {
  font-size: 10px; color: var(--text-dim);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

#signout-btn {
  width: 26px; height: 26px; border-radius: var(--radius-xs);
  background: none; border: none; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all var(--transition);
}
#signout-btn:hover { background: var(--red-soft); color: var(--red); }

/* Trees list */
#trees-section { flex: 1; display: flex; flex-direction: column; overflow: hidden; }

#trees-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 6px;
  font-size: 10px; font-weight: 500; color: var(--text-dim);
  letter-spacing: 0.08em; text-transform: uppercase; flex-shrink: 0;
}

#new-tree-btn {
  width: 20px; height: 20px; border-radius: 4px;
  background: none; border: none; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  transition: all var(--transition);
}
#new-tree-btn:hover { background: var(--surface3); color: var(--accent); }

#trees-list {
  flex: 1; overflow-y: auto; padding: 4px 8px 12px;
}

.tree-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: var(--radius-sm);
  cursor: pointer; transition: all var(--transition);
  group: true; position: relative;
  border: 1px solid transparent;
}
.tree-item:hover { background: var(--surface2); }
.tree-item.active {
  background: var(--accent-soft);
  border-color: var(--accent-border);
}

.tree-item-icon {
  width: 8px; height: 8px; border-radius: 50%;
  flex-shrink: 0; background: var(--text-dim);
  transition: background var(--transition);
}
.tree-item.active .tree-item-icon { background: var(--accent); }

.tree-item-name {
  flex: 1; font-size: 13px; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--transition);
}
.tree-item.active .tree-item-name { color: var(--text); }

.tree-item-actions {
  display: none; gap: 2px; flex-shrink: 0;
}
.tree-item:hover .tree-item-actions { display: flex; }

.tree-action-btn {
  width: 22px; height: 22px; border-radius: 4px;
  background: none; border: none; color: var(--text-dim);
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; transition: all var(--transition);
}
.tree-action-btn:hover { background: var(--surface4); color: var(--text); }
.tree-action-btn.delete:hover { background: var(--red-soft); color: var(--red); }

/* Sidebar expand button (when collapsed) */
#sidebar-expand-btn {
  position: fixed; top: 50%; left: 0; transform: translateY(-50%);
  width: 20px; height: 48px;
  background: var(--surface2); border: 1px solid var(--border-md);
  border-left: none; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted); cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 61; transition: all var(--transition);
}
#sidebar-expand-btn:hover { background: var(--surface3); color: var(--text); }
