.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
  transition: width 200ms ease;
}

.sidebarCollapsed {
  width: 48px;
}

/* Collapse toggle */
.collapseToggle {
  position: absolute;
  top: 8px;
  right: 4px;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--sidebar-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  z-index: 1;
  transition: color 0.12s;
}

.collapseToggle:hover {
  color: var(--sidebar-text);
}

/* Logo */
.logo {
  padding: 16px 18px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  flex-shrink: 0;
  overflow: hidden;
}

.sidebarCollapsed .logo {
  padding: 16px 0;
  justify-content: center;
}

.logoImg {
  width: 28px;
  height: 24px;
  color: var(--amber);
  filter: brightness(0) saturate(100%) invert(76%) sepia(30%) saturate(400%) hue-rotate(5deg) brightness(95%);
}

.brand {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 15px;
  color: var(--amber);
  letter-spacing: -0.3px;
}

.version {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sidebar-muted);
  margin-left: 4px;
}

/* Search */
.searchWrap {
  padding: 10px 12px;
  flex-shrink: 0;
}

.searchInner {
  position: relative;
}

.searchInput {
  width: 100%;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  padding: 6px 26px 6px 28px;
  color: var(--sidebar-text);
  font-family: var(--font-body);
  font-size: 12px;
  outline: none;
  transition: border-color 0.15s;
}

.searchInput::placeholder {
  color: var(--sidebar-muted);
}

.searchInput:focus {
  border-color: rgba(198, 130, 14, 0.4);
}

.searchIcon {
  position: absolute;
  left: 9px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--sidebar-muted);
  display: flex;
  align-items: center;
}

.searchClear {
  position: absolute;
  right: 4px;
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--sidebar-muted);
  font-size: 14px;
  cursor: pointer;
  border-radius: var(--radius-sm);
  padding: 0;
  line-height: 1;
  transition: color 0.1s, background 0.1s;
}

.searchClear:hover {
  color: var(--sidebar-text);
  background: rgba(255, 255, 255, 0.08);
}

/* Section icon (collapsed rail) */
.sectionIcon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  color: var(--sidebar-muted);
}

/* Rail item (collapsed sidebar section) */
.sectionRailItem {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px 0;
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: background 0.12s;
}

.sectionRailItem:hover {
  background: var(--sidebar-hover);
}

.sectionRailItemActive {
  border-left-color: var(--amber);
}

.sectionRailItemActive .sectionIcon {
  color: var(--amber);
}

.treeSectionActive {
  border-left-color: var(--amber);
}

/* Item sub-elements */
.itemInfo {
  flex: 1;
  min-width: 0;
}

.itemName {
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* No results */
.noResults {
  padding: 16px 18px;
  font-size: 12px;
  color: var(--sidebar-muted);
  text-align: center;
}

/* ── SidebarTree styles ──────────────────────────────────────────────────── */

.treeSection {
  padding: 0 6px 6px;
  margin-bottom: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid transparent;
}

/* Collapsible section toggle */
.treeSectionToggle {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  padding: 8px 0 4px;
  cursor: pointer;
  user-select: none;
}

.treeSectionChevronBtn {
  background: none;
  border: none;
  padding: 2px 4px;
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 9px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.12s;
}

.treeSectionChevronBtn:hover {
  color: var(--sidebar-text);
}

.treeSectionLabel {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--sidebar-muted);
  cursor: pointer;
  transition: color 0.12s;
}

.treeSectionLabel:hover {
  color: var(--amber);
}

.treeSectionLabelActive {
  color: var(--amber);
}

.tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.treeGroup {
  list-style: none;
  margin: 0;
  padding: 0;
}

.treeRow {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.12s;
  border-left: 3px solid transparent;
  margin-bottom: 1px;
  user-select: none;
  position: relative;
}

.treeRow:hover {
  background: var(--sidebar-hover);
}

.treeRowActive {
  background: var(--sidebar-active);
  color: var(--amber);
  border-left-color: var(--amber);
}

.treeRowActive .treeBadge {
  background: rgba(198, 130, 14, 0.2);
  color: var(--amber);
}

/* Chevron */
.treeChevronSlot {
  width: 14px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.treeChevron {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--sidebar-muted);
  font-size: 12px;
  cursor: pointer;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.treeChevron:hover {
  color: var(--sidebar-text);
}

/* Icon slot */
.treeIcon {
  flex-shrink: 0;
  display: flex;
  align-items: center;
}

/* Label */
.treeLabel {
  flex: 1;
  min-width: 0;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Badge */
.treeBadge {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--sidebar-muted);
  background: rgba(255, 255, 255, 0.06);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* Star button */
.treeStar {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--sidebar-muted);
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.treeStarActive {
  opacity: 1;
  color: var(--amber);
}

.treeRow:hover .treeStar {
  opacity: 1;
}

.treeStar:hover {
  color: var(--amber);
}

/* ── Bottom links ────────────────────────────────────────────────────────── */

.bottom {
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  padding: 6px;
  flex-shrink: 0;
  margin-top: auto;
}

.bottomItem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.12s;
  border-left: 3px solid transparent;
  margin-bottom: 1px;
}

.bottomItem:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text);
}

.bottomItemActive {
  background: var(--sidebar-active);
  color: var(--amber);
  border-left-color: var(--amber);
}

.bottomIcon {
  font-size: 13px;
  width: 18px;
  text-align: center;
}
