/* Worktree Manager overlay */
.overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
  z-index: 1000;
}

.panel {
  width: 900px;
  max-width: 90vw;
  max-height: 75vh;
  background: var(--bg-secondary);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-popup);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
}

.header h3 {
  margin: 0;
  font-size: var(--font-lg);
  font-weight: bold;
}

.close {
  background: none;
  border: none;
  color: var(--fg-secondary);
  font-size: var(--font-2xl);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-md);
}

.close:hover {
  background: var(--bg-highlight);
  color: var(--fg-primary);
}

.toolbar {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.toolbarTop {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pillsRow {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filterPill {
  font-size: var(--font-xs);
  font-family: var(--font-ui);
  color: var(--fg-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.1s ease, color 0.1s ease;
}

.filterPill:hover {
  background: var(--bg-highlight);
  color: var(--fg-primary);
}

.filterPillActive {
  color: var(--fg-primary);
  background: var(--bg-highlight);
  border-color: var(--accent);
}

.searchInput {
  flex: 1;
  min-width: 0;
  height: 36px;
  font-size: var(--font-sm);
  color: var(--fg-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 0 8px;
  outline: none;
}

.searchInput:focus {
  border-color: var(--accent);
}

.searchInput::placeholder {
  color: var(--fg-muted);
  opacity: 0.5;
}

.batchBar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border);
  font-size: var(--font-sm);
  color: var(--fg-muted);
}

.batchMergeBtn {
  font-size: var(--font-xs);
  color: var(--success);
  background: none;
  border: 1px solid var(--success);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-left: auto;
}

.batchMergeBtn:hover {
  background: rgba(78, 201, 176, 0.15);
}

.batchDeleteBtn {
  font-size: var(--font-xs);
  color: var(--error);
  background: none;
  border: 1px solid var(--error);
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.batchDeleteBtn:hover {
  background: rgba(244, 135, 113, 0.15);
}

.selectAll {
  flex-shrink: 0;
  cursor: pointer;
}

.rowCheckbox {
  flex-shrink: 0;
  cursor: pointer;
}

.list {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

/* Column headers */
.columnHeader {
  display: grid;
  grid-template-columns: 20px 120px 1fr auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 4px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-tertiary);
  font-size: var(--font-2xs);
  font-family: var(--font-ui);
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  position: sticky;
  top: 0;
  z-index: 1;
}

.empty {
  padding: 32px 16px;
  text-align: center;
  color: var(--fg-muted);
  font-size: var(--font-md);
}

/* Grid: [checkbox] [repo] [branch] [badges] [stats] [time] [actions] */
.row {
  display: grid;
  grid-template-columns: 20px 120px 1fr auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  cursor: default;
  border-left: 3px solid transparent;
  transition: background 0.1s ease;
}

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

.mainRow {
  opacity: 0.5;
}

/* Placeholder for checkbox column when checkbox is absent */
.checkboxPlaceholder {
  width: 20px;
}

.branchCell {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.branch {
  font-size: var(--font-md);
  font-family: var(--font-ui);
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


.worktreePath {
  font-size: var(--font-2xs);
  font-family: var(--font-ui);
  color: var(--fg-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.7;
}

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

.repo {
  font-size: var(--font-xs);
  font-family: var(--font-ui);
  color: var(--fg-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stats {
  font-size: var(--font-xs);
  font-family: var(--font-ui);
  white-space: nowrap;
  min-width: 70px;
  text-align: right;
}

.statsAdded {
  color: var(--success);
}

.statsRemoved {
  color: var(--error);
}

.statsClean {
  color: var(--fg-muted);
}

.mainBadge {
  font-size: var(--font-2xs);
  color: var(--fg-muted);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: var(--radius-md);
}

.prBadge {
  font-size: var(--font-2xs);
  font-family: var(--font-ui);
  font-weight: 600;
  padding: 1px 6px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.prOpen {
  background: rgba(78, 201, 176, 0.15);
  color: var(--success);
}

.prMerged {
  background: rgba(163, 113, 247, 0.15);
  color: var(--merged);
}

.prClosed {
  background: rgba(244, 135, 113, 0.15);
  color: var(--error);
}

.actions {
  display: flex;
  gap: 2px;
  justify-content: flex-end;
}

.actionBtn {
  font-size: var(--font-xs);
  font-family: var(--font-ui);
  color: var(--fg-muted);
  background: none;
  border: 1px solid transparent;
  padding: 2px 6px;
  border-radius: var(--radius-md);
  cursor: pointer;
  line-height: 1.2;
  transition: color 0.1s ease, background 0.1s ease;
}

.actionBtn:hover:not(:disabled) {
  background: var(--bg-highlight);
  color: var(--fg-primary);
  border-color: var(--border);
}

.actionBtn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.actionBtnDanger:hover:not(:disabled) {
  color: var(--error);
}

.orphanRow {
  opacity: 0.7;
}

.orphanBadge {
  font-size: var(--font-2xs);
  font-family: var(--font-ui);
  font-weight: 600;
  color: var(--warning);
  background: rgba(255, 200, 50, 0.15);
  padding: 1px 6px;
  border-radius: var(--radius-pill);
}

.pruneBtn {
  font-size: var(--font-xs);
  color: var(--fg-secondary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  padding: 1px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  flex-shrink: 0;
}

.pruneBtn:hover {
  background: var(--bg-highlight);
  color: var(--fg-primary);
}

.timestamp {
  font-size: var(--font-xs);
  font-family: var(--font-ui);
  color: var(--fg-muted);
  text-align: right;
  white-space: nowrap;
  min-width: 60px;
}

.footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 16px;
  border-top: 1px solid var(--border);
  font-size: var(--font-sm);
  color: var(--fg-muted);
}

.footerRight {
  margin-left: auto;
}
