.chatsTab {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toolbar {
  display: flex;
  gap: 6px;
  align-items: center;
}

.search {
  flex: 1;
  padding: 6px 10px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  font-size: 0.85rem;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #111);
}

.createBtn {
  padding: 6px 10px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  background: var(--accent, #4f46e5);
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1;
  transition: background 0.15s;
}

.createBtn:hover {
  background: var(--accent-hover, #4338ca);
}

.modeToggle {
  padding: 6px 8px;
  border: 1px solid var(--border-color, #d1d5db);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
  font-size: 0.85rem;
}

.modeActive {
  background: var(--bg-active, #eef2ff);
}

/* ── Aktiv / Archiv filter tabs ── */

.filterTabs {
  display: flex;
  gap: 0;
  border-bottom: 2px solid var(--border-color, #e5e7eb);
}

.filterTab {
  flex: 1;
  padding: 6px 0;
  font-size: 0.8rem;
  font-weight: 600;
  text-align: center;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-secondary, #6b7280);
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color 0.15s, border-color 0.15s;
}

.filterTab:hover {
  color: var(--text-primary, #111);
}

.filterTabActive {
  color: var(--accent, #4f46e5);
  border-bottom-color: var(--accent, #4f46e5);
}

/* ── Loading / Empty ── */

.loading,
.emptyState {
  padding: 16px;
  text-align: center;
  color: var(--text-secondary, #6b7280);
  font-size: 0.85rem;
}

/* ── Chat list ── */

.flatList,
.tree {
  display: flex;
  flex-direction: column;
}

.chatItem {
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  display: flex;
  align-items: center;
  font-size: 0.85rem;
  position: relative;
  gap: 6px;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s;
}

.chatItem:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.chatItemActive {
  background: var(--primary-light, #eef2ff);
  border-color: var(--accent, #4f46e5);
  font-weight: 500;
}

.chatItemActive:hover {
  background: var(--primary-light, #eef2ff);
}

.chatItemArchived {
  opacity: 0.65;
}

.chatDate {
  font-size: 0.7rem;
  color: var(--text-secondary, #9ca3af);
  flex-shrink: 0;
  min-width: 36px;
}

.chatLabel {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

/* ── Inline action icons (show on hover) ── */

.chatActions {
  display: none;
  gap: 2px;
  flex-shrink: 0;
  margin-left: auto;
  align-items: center;
}

.chatItem:hover .chatActions {
  display: flex;
}

.actionBtn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 3px;
  border-radius: 4px;
  font-size: 0.75rem;
  line-height: 1;
  transition: background 0.15s;
  opacity: 0.7;
}

.actionBtn:hover {
  background: rgba(0, 0, 0, 0.06);
  opacity: 1;
}

.actionBtnDanger:hover {
  background: rgba(220, 38, 38, 0.1);
}

.renameInput {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--accent, #4f46e5);
  outline: none;
  background: var(--bg-input, #fff);
  color: var(--text-primary, #111);
}

/* ── Tree sections (feature code level) ── */

.treeSection {
  margin-bottom: 4px;
}

.treeSectionHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-secondary, #6b7280);
}

.treeSectionHeader:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
  color: var(--text-primary, #111);
}

.treeSectionLabel {
  flex: 1;
}

/* ── Tree groups (feature instance level) ── */

.treeGroup {
  margin-bottom: 2px;
}

.treeGroupHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.85rem;
}

.treeGroupHeader:hover {
  background: var(--bg-hover, rgba(0, 0, 0, 0.04));
}

.treeGroupCurrent {
  color: var(--accent, #4f46e5);
}

.treeArrow {
  font-size: 0.7rem;
  width: 12px;
}

.treeGroupLabel {
  flex: 1;
}

.treeGroupCount {
  font-size: 0.75rem;
  color: var(--text-secondary, #9ca3af);
  background: var(--bg-badge, #f3f4f6);
  padding: 1px 6px;
  border-radius: 10px;
}

.treeChildren {
  padding-left: 20px;
}

@media (prefers-color-scheme: dark) {
  .search,
  .renameInput {
    background: var(--bg-input-dark, #1f2937);
    border-color: var(--border-dark, #374151);
    color: #f3f4f6;
  }
  .chatItem:hover,
  .treeGroupHeader:hover,
  .treeSectionHeader:hover {
    background: rgba(255, 255, 255, 0.05);
  }
  .treeSectionHeader {
    color: #9ca3af;
  }
  .treeSectionHeader:hover {
    color: #f3f4f6;
  }
  .chatItemActive,
  .chatItemActive:hover {
    background: rgba(79, 70, 229, 0.15);
    border-color: var(--accent, #4f46e5);
  }
  .treeGroupCount {
    background: #374151;
    color: #9ca3af;
  }
  .actionBtn:hover {
    background: rgba(255, 255, 255, 0.08);
  }
  .actionBtnDanger:hover {
    background: rgba(220, 38, 38, 0.15);
  }
  .createBtn {
    border-color: var(--border-dark, #374151);
  }
  .filterTabs {
    border-bottom-color: var(--border-dark, #374151);
  }
  .filterTab:hover {
    color: #f3f4f6;
  }
}
