/* Positioning context for the absolutely-placed "Jump to current" pill,
 * and the flex column that lets `.list` own the scroll surface. */
.container {
  position: relative;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

.list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px;
  /* Belt-and-suspenders with usePreventScrollBounce (via BoundedScrollPane):
   * the CSS property handles the trackpad-flick edge case before the wheel
   * listener can intercept; the JS hook handles WKWebView's elastic gesture
   * that the CSS property doesn't reliably suppress. */
  overscroll-behavior-y: none;
}

/* "Jump to current" pill — mirrors the chat panel's scroll-to-bottom pill
 * (ScrollToBottomPill.module.css). Floats over the bottom of the list when
 * the active task has scrolled out of view and auto-follow is paused. */
.jumpToCurrent {
  position: absolute;
  left: 50%;
  bottom: 12px;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 14px;
  background: var(--chat-input-bg);
  border: 1px solid var(--divider);
  border-radius: 20px;
  color: var(--accent-primary);
  font-size: var(--caption-size);
  font-weight: 500;
  cursor: pointer;
  box-shadow: var(--shadow-md);
  transition: background var(--transition-fast),
    border-color var(--transition-fast);
}

.jumpToCurrent:hover {
  background: var(--hover-bg);
  border-color: var(--accent-primary);
}

.empty {
  padding: 16px;
  text-align: center;
  color: var(--text-dim);
  font-size: var(--body-size);
}

.section {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-bottom: 10px;
}

.sectionHeader {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 8px;
  color: var(--text-dim);
  font-size: var(--caption-size);
  font-weight: 600;
  text-transform: uppercase;
}

.sectionMeta {
  color: var(--text-dim);
  font-weight: 500;
  text-transform: none;
}

/* Subagent section headers can be much longer than "Current" / "History"
 * (e.g. "Agent A: build pagination for the sessions endpoint"), so let
 * them ellipsize cleanly inside the fixed-width sidebar header instead
 * of wrapping or pushing the count out of view. */
.subagentLabel {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 auto;
  margin-right: 6px;
  text-transform: none;
}

/* Pulsing dot next to a sibling-session header indicates the session's
 * agent is currently running — the lane is live, not archived. Uses
 * the in-progress accent so it matches the chevron/task-status palette. */
.liveDot {
  flex-shrink: 0;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent-dim);
  box-shadow: 0 0 0 2px rgba(var(--accent-primary-rgb), 0.25);
  animation: liveDotPulse 1.4s ease-in-out infinite;
}

@keyframes liveDotPulse {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

.sessionGroup {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: 4px;
}

.sessionHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  padding: 5px 8px 2px;
}

.sessionName {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text-muted);
  font-size: var(--body-size);
  font-weight: 600;
}

.archivedBadge {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: var(--caption-size);
}

.run {
  display: flex;
  flex-direction: column;
}

.runHeader {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 28px;
  padding: 5px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: var(--body-size);
  text-align: left;
  cursor: pointer;
}

.runHeader:hover {
  background: var(--hover-bg);
}

.chevron {
  flex-shrink: 0;
  color: var(--text-dim);
  transition: transform var(--transition-fast);
}

.chevronOpen {
  transform: rotate(90deg);
}

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

.runMeta {
  flex-shrink: 0;
  color: var(--text-dim);
  font-size: var(--caption-size);
}

.runTasks {
  padding-left: 18px;
}

.explanation {
  padding: 4px 8px 6px;
  color: var(--text-muted);
  font-size: var(--caption-size);
  line-height: 1.35;
}

.task {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 6px;
  font-size: var(--body-size);
  transition: background var(--transition-fast);
}

.task:hover {
  background: var(--hover-bg);
}

.statusIcon {
  flex-shrink: 0;
  width: 1.1em;
  text-align: center;
  font-size: var(--body-size);
  line-height: 18px;
}

.description {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 18px;
  color: var(--text-muted);
}

.completedDescription {
  color: var(--text-dim);
  text-decoration: line-through;
  text-decoration-color: var(--text-dim);
}

.priorityBadge {
  flex-shrink: 0;
  font-size: 10px;
  font-weight: 600;
  padding: 0 4px;
  border-radius: 3px;
  line-height: 18px;
}

.priorityHigh {
  color: var(--diff-removed-text);
}

.priorityLow {
  color: var(--text-dim);
}
