/* ── Pipelines: Multi-Stage CLI Orchestration ── */

/* ── Animations ── */
@keyframes pipe-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ── Container ── */
.pipe-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
}

/* ── Header ── */
.pipe-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border, #30363d);
  flex-shrink: 0;
}

.pipe-header-title {
  flex: 1;
  font-size: 16px;
  font-weight: 600;
  color: var(--text, #e6edf3);
}

.pipe-back-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-dim, #8b949e);
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
}

.pipe-back-btn:active {
  background: rgba(255, 255, 255, 0.08);
}

.pipe-btn-add {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 0 14px;
  border-radius: 8px;
  border: 1px solid var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.1);
  color: var(--accent, #58a6ff);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
}

.pipe-btn-add:active {
  background: rgba(88, 166, 255, 0.2);
}

.pipe-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── Project Picker ── */
.pipe-project-picker-wrap {
  padding: 8px 16px;
  border-bottom: 1px solid var(--border, #30363d);
  flex-shrink: 0;
}

.pipe-project-picker {
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  font-size: 13px;
  appearance: auto;
}

.pipe-project-picker:focus {
  outline: none;
  border-color: var(--accent, #58a6ff);
}

/* ── List View ── */
.pipe-list {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 8px;
}

/* ── Empty State ── */
.pipe-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 16px;
  color: var(--text-dim, #8b949e);
  text-align: center;
  gap: 8px;
}

.pipe-empty-icon {
  font-size: 32px;
  opacity: 0.5;
}

.pipe-empty-text {
  font-size: 14px;
}

.pipe-empty-hint {
  font-size: 12px;
  color: var(--text-dim, #8b949e);
  opacity: 0.7;
  max-width: 260px;
  line-height: 1.5;
  margin-top: 4px;
}

/* ── Card ── */
.pipe-card {
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 10px;
  padding: 12px;
  margin-bottom: 8px;
}

.pipe-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pipe-card-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipe-card-desc {
  font-size: 12px;
  color: var(--text-dim, #8b949e);
  margin-bottom: 8px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pipe-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.pipe-card-actions {
  display: flex;
  gap: 4px;
}

.pipe-card-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: var(--text-dim, #8b949e);
  cursor: pointer;
  padding: 0;
}

.pipe-card-action:active {
  background: rgba(255, 255, 255, 0.08);
}

.pipe-card-action.delete:active {
  color: #f85149;
}

/* ── CLI Badges ── */
.pipe-badges {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.pipe-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 20px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  color: #fff;
}

.pipe-badge-c { background: #58a6ff; }
.pipe-badge-g { background: #238636; }
.pipe-badge-x { background: #d29922; }
.pipe-badge-s { background: #8b949e; }
.pipe-badge-cycle { background: #a371f7; font-style: italic; }

/* ── Stage Flow (horizontal CLI badge row with arrows) ── */
.pipe-flow {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.pipe-flow-arrow {
  color: var(--text-dim, #8b949e);
  font-size: 12px;
  opacity: 0.5;
  flex-shrink: 0;
}

/* ── Trigger Badge ── */
.pipe-trigger-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim, #8b949e);
}

.pipe-trigger-badge-cron { color: #58a6ff; background: rgba(88, 166, 255, 0.1); }
.pipe-trigger-badge-webhook { color: #d29922; background: rgba(210, 153, 34, 0.1); }
.pipe-trigger-badge-hook { color: #a855f7; background: rgba(168, 85, 247, 0.1); }
.pipe-trigger-badge-manual { color: #8b949e; background: rgba(139, 148, 158, 0.08); }

/* ── Run Status (inline dot + text) ── */
.pipe-run-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
}

.pipe-run-status::before {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.pipe-run-status-completed { color: #238636; }
.pipe-run-status-completed::before { background: #238636; }

.pipe-run-status-failed { color: #f85149; }
.pipe-run-status-failed::before { background: #f85149; }

.pipe-run-status-running { color: #58a6ff; }
.pipe-run-status-running::before {
  background: #58a6ff;
  animation: pipe-pulse 1.5s ease-in-out infinite;
}

/* ── Builder View ── */
.pipe-builder {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.pipe-stage-card {
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 10px;
  margin-bottom: 10px;
  overflow: hidden;
}

.pipe-stage-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  cursor: pointer;
  user-select: none;
  min-height: 48px;
}

.pipe-stage-header:active {
  background: rgba(255, 255, 255, 0.03);
}

.pipe-stage-chevron {
  color: var(--text-dim, #8b949e);
  transition: transform 0.15s;
  flex-shrink: 0;
}

.pipe-stage-card.expanded .pipe-stage-chevron {
  transform: rotate(90deg);
}

.pipe-stage-name {
  flex: 1;
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipe-stage-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.pipe-stage-body {
  display: none;
  padding: 0 12px 12px;
}

.pipe-stage-card.expanded .pipe-stage-body {
  display: block;
}

/* ── Variable Editor (table) ── */
.pipe-var-editor {
  width: 100%;
  border-collapse: collapse;
  margin-top: 8px;
}

.pipe-var-editor th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim, #8b949e);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border, #30363d);
}

.pipe-var-editor td {
  padding: 6px 8px;
  border-bottom: 1px solid rgba(48, 54, 61, 0.4);
}

.pipe-var-editor input {
  width: 100%;
  padding: 6px 8px;
  border-radius: 6px;
  border: 1px solid var(--border, #30363d);
  background: var(--bg, #0d1117);
  color: var(--text, #e6edf3);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  box-sizing: border-box;
}

.pipe-var-editor input:focus {
  outline: none;
  border-color: var(--accent, #58a6ff);
}

.pipe-var-remove {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #f85149;
  cursor: pointer;
  font-size: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

/* ── Add Stage Button ── */
.pipe-add-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 2px dashed var(--border, #30363d);
  background: transparent;
  color: var(--text-dim, #8b949e);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
}

.pipe-add-stage:active {
  border-color: var(--accent, #58a6ff);
  color: var(--accent, #58a6ff);
}

/* ── Monitor View ── */
.pipe-monitor {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

/* ── Timeline ── */
.pipe-timeline {
  position: relative;
  padding-left: 24px;
}

.pipe-timeline::before {
  content: '';
  position: absolute;
  left: 9px;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--border, #30363d);
}

.pipe-timeline-stage {
  position: relative;
  margin-bottom: 16px;
}

.pipe-timeline-stage::before {
  content: '';
  position: absolute;
  left: -19px;
  top: 6px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--border, #30363d);
  background: var(--bg, #0d1117);
  z-index: 1;
}

.pipe-timeline-stage-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
  min-height: 28px;
}

.pipe-timeline-stage-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
}

.pipe-timeline-stage-meta {
  font-size: 11px;
  color: var(--text-dim, #8b949e);
  margin-left: auto;
}

/* ── Stage Status Icons (timeline dots) ── */
.pipe-status-pending::before { border-color: #8b949e; background: var(--bg, #0d1117); }
.pipe-status-running::before {
  border-color: #58a6ff;
  background: #58a6ff;
  animation: pipe-pulse 1.5s ease-in-out infinite;
}
.pipe-status-completed::before { border-color: #238636; background: #238636; }
.pipe-status-failed::before { border-color: #f85149; background: #f85149; }
.pipe-status-skipped::before { border-color: #484f58; background: #484f58; }
.pipe-status-cancelled::before { border-color: #484f58; background: #484f58; }

/* ── Expandable Output ── */
.pipe-stage-expand {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 36px;
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text-dim, #8b949e);
  font-size: 12px;
  cursor: pointer;
  text-align: left;
}

.pipe-stage-expand:active {
  background: rgba(255, 255, 255, 0.03);
}

.pipe-stage-expand-chevron {
  transition: transform 0.15s;
  flex-shrink: 0;
}

.pipe-stage-expand.expanded .pipe-stage-expand-chevron {
  transform: rotate(90deg);
}

.pipe-output {
  max-height: 300px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 10px 12px;
  margin-top: 6px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: rgba(0, 0, 0, 0.3);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 12px;
  color: var(--text, #e6edf3);
  white-space: pre-wrap;
  word-break: break-all;
  line-height: 1.5;
}

/* ── Form Elements ── */
.pipe-form {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px;
}

.pipe-field {
  margin-bottom: 14px;
}

.pipe-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-dim, #8b949e);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}

.pipe-input {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  font-size: 14px;
  font-family: inherit;
  box-sizing: border-box;
}

.pipe-input:focus {
  outline: none;
  border-color: var(--accent, #58a6ff);
}

.pipe-select {
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  font-size: 14px;
  appearance: auto;
}

.pipe-select:focus {
  outline: none;
  border-color: var(--accent, #58a6ff);
}

.pipe-textarea {
  width: 100%;
  min-height: 80px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  color: var(--text, #e6edf3);
  font-size: 13px;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  resize: vertical;
  box-sizing: border-box;
}

.pipe-textarea:focus {
  outline: none;
  border-color: var(--accent, #58a6ff);
}

.pipe-hint {
  font-size: 11px;
  color: var(--text-dim, #8b949e);
  margin-top: 4px;
}

/* ── Dependency Checkboxes ── */
.pipe-dep-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.pipe-dep-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: var(--surface, #161b22);
  cursor: pointer;
  min-height: 48px;
}

.pipe-dep-checkbox.checked {
  border-color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.08);
}

.pipe-dep-checkbox input[type="checkbox"] {
  accent-color: var(--accent, #58a6ff);
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.pipe-dep-checkbox-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text, #e6edf3);
}

/* ── Buttons ── */
.pipe-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 48px;
  padding: 0 20px;
  border-radius: 10px;
  border: none;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pipe-btn:active {
  opacity: 0.85;
}

.pipe-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.pipe-btn-primary {
  background: #238636;
  color: #fff;
}

.pipe-btn-danger {
  background: #f85149;
  color: #fff;
}

.pipe-btn-sm {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 6px;
  font-size: 12px;
}

.pipe-cancel-btn {
  width: 100%;
  min-height: 48px;
  border-radius: 10px;
  border: 1px solid #f85149;
  background: rgba(248, 81, 73, 0.1);
  color: #f85149;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}

.pipe-cancel-btn:active {
  background: rgba(248, 81, 73, 0.2);
}

/* ── Form Footer ── */
.pipe-form-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border, #30363d);
  flex-shrink: 0;
}

.pipe-form-footer .pipe-btn {
  width: 100%;
}

/* ── Modal Overlay ── */
.pipe-modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.pipe-modal {
  background: var(--surface, #161b22);
  border: 1px solid var(--border, #30363d);
  border-radius: 12px;
  padding: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.pipe-modal-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text, #e6edf3);
  margin-bottom: 12px;
}

.pipe-modal-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.pipe-modal-actions .pipe-btn {
  flex: 1;
}

/* ── Template Items ── */
.pipe-template-item {
  padding: 12px;
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  margin-bottom: 8px;
  transition: border-color 0.15s;
}

.pipe-template-item:active {
  border-color: var(--accent, #58a6ff);
  background: rgba(88, 166, 255, 0.05);
}

.pipe-template-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
}

.pipe-template-desc {
  font-size: 12px;
  color: var(--text-dim, #8b949e);
  margin-top: 4px;
  line-height: 1.4;
}

/* ── Variable Row ── */
.pipe-var-row {
  display: flex;
  gap: 6px;
  margin-bottom: 6px;
  align-items: center;
}

.pipe-var-row .pipe-var-name {
  flex: 1;
}

.pipe-var-row .pipe-var-default {
  flex: 1.5;
}

/* ── Collapsible Section (Advanced, Variables) ── */
.pipe-collapsible {
  margin-top: 8px;
  border: 1px solid var(--border, #30363d);
  border-radius: 8px;
  overflow: hidden;
}

.pipe-collapsible-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  min-height: 40px;
  padding: 8px 12px;
  border: none;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim, #8b949e);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  text-align: left;
}

.pipe-collapsible-toggle:active {
  background: rgba(255, 255, 255, 0.05);
}

.pipe-collapsible-chevron {
  transition: transform 0.15s;
  flex-shrink: 0;
}

.pipe-collapsible.expanded .pipe-collapsible-chevron {
  transform: rotate(90deg);
}

.pipe-collapsible-body {
  display: none;
  padding: 4px 12px 12px;
}

.pipe-collapsible.expanded .pipe-collapsible-body {
  display: block;
}

/* ── Dynamic Add Button ── */
.pipe-dyn-add {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: var(--accent, #58a6ff);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  margin-top: 4px;
}

.pipe-dyn-add:active {
  background: rgba(88, 166, 255, 0.1);
}

/* ── Error Banner ── */
.pipe-error {
  margin: 8px 16px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(248, 81, 73, 0.1);
  border: 1px solid rgba(248, 81, 73, 0.3);
  color: #f85149;
  font-size: 13px;
}

/* ── History Section (in card) ── */
.pipe-history-section {
  margin-top: 8px;
  border-top: 1px solid rgba(48, 54, 61, 0.5);
  padding-top: 6px;
}

.pipe-history-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  border: none;
  background: transparent;
  color: var(--text-dim, #8b949e);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  padding: 4px 0;
  text-align: left;
}

.pipe-history-toggle svg {
  transition: transform 0.15s;
  flex-shrink: 0;
}

.pipe-history-toggle-open svg {
  transform: rotate(90deg);
}

.pipe-history-toggle:active {
  color: var(--text, #e6edf3);
}

.pipe-history-list {
  padding-top: 6px;
}

.pipe-history-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 0;
  border-bottom: 1px solid rgba(48, 54, 61, 0.3);
}

.pipe-history-row:last-child {
  border-bottom: none;
}

.pipe-history-dot {
  font-size: 8px;
  flex-shrink: 0;
}

.pipe-history-dot-completed { color: #238636; }
.pipe-history-dot-failed { color: #f85149; }
.pipe-history-dot-cancelled { color: #484f58; }
.pipe-history-dot-running { color: #58a6ff; }
.pipe-history-dot-max_iterations { color: #d29922; }

.pipe-history-info {
  font-size: 11px;
  color: var(--text-dim, #8b949e);
  flex: 1;
  min-width: 0;
}

.pipe-history-pills {
  display: flex;
  gap: 3px;
  flex-wrap: wrap;
  width: 100%;
  padding-left: 14px;
}

.pipe-history-pill {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  padding: 1px 5px;
  border-radius: 3px;
  max-width: 100px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipe-history-pill-completed { background: rgba(35, 134, 54, 0.2); color: #238636; }
.pipe-history-pill-failed { background: rgba(248, 81, 73, 0.2); color: #f85149; }
.pipe-history-pill-skipped { background: rgba(72, 79, 88, 0.2); color: #484f58; }
.pipe-history-pill-cancelled { background: rgba(72, 79, 88, 0.2); color: #484f58; }
.pipe-history-pill-running { background: rgba(88, 166, 255, 0.2); color: #58a6ff; }

/* ── Active Runs Section ── */
.pipe-active-runs {
  margin-bottom: 12px;
}

.pipe-active-runs-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #58a6ff;
  padding: 0 4px 8px;
}

.pipe-active-run {
  background: var(--surface, #161b22);
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-left: 3px solid #58a6ff;
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 8px;
  animation: pipe-active-glow 2s ease-in-out infinite;
}

@keyframes pipe-active-glow {
  0%, 100% { border-left-color: #58a6ff; }
  50% { border-left-color: rgba(88, 166, 255, 0.4); }
}

.pipe-active-run-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

.pipe-active-run-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text, #e6edf3);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipe-active-run-elapsed {
  font-size: 12px;
  font-weight: 500;
  color: #58a6ff;
  flex-shrink: 0;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
}

.pipe-active-run-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.pipe-active-run-stage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--text, #e6edf3);
}

.pipe-active-run-counter {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim, #8b949e);
  flex-shrink: 0;
}

.pipe-active-run-actions {
  display: flex;
  gap: 6px;
}

.pipe-active-run-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid var(--border, #30363d);
  background: transparent;
  color: var(--text-dim, #8b949e);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  flex: 1;
}

.pipe-active-run-btn:active {
  background: rgba(255, 255, 255, 0.06);
}

.pipe-active-run-btn-monitor {
  color: #58a6ff;
  border-color: rgba(88, 166, 255, 0.3);
}

.pipe-active-run-btn-session {
  color: #a371f7;
  border-color: rgba(163, 113, 247, 0.3);
}

.pipe-active-run-btn-cancel {
  color: #f85149;
  border-color: rgba(248, 81, 73, 0.3);
}

.pipe-active-run-btn-monitor:active { background: rgba(88, 166, 255, 0.1); }
.pipe-active-run-btn-session:active { background: rgba(163, 113, 247, 0.1); }
.pipe-active-run-btn-cancel:active { background: rgba(248, 81, 73, 0.1); }

/* ── Pulsing badge ── */
.pipe-badge-pulse {
  animation: pipe-pulse 1.5s ease-in-out infinite;
}

/* ── Running Card Indicator ── */
.pipe-card-running {
  border-left: 3px solid #58a6ff;
  animation: pipe-active-glow 2s ease-in-out infinite;
}

.pipe-card-running-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0 6px;
}

.pipe-card-running-text {
  font-size: 12px;
  font-weight: 500;
  color: #58a6ff;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  animation: pipe-pulse 1.5s ease-in-out infinite;
}

.pipe-card-running-link {
  font-size: 11px;
  font-weight: 600;
  color: #58a6ff;
  background: transparent;
  border: 1px solid rgba(88, 166, 255, 0.3);
  border-radius: 6px;
  padding: 2px 8px;
  cursor: pointer;
  flex-shrink: 0;
  min-height: 28px;
  display: inline-flex;
  align-items: center;
}

.pipe-card-running-link:active {
  background: rgba(88, 166, 255, 0.15);
}

/* ── Status Row (replaces pipe-card-bottom) ── */
.pipe-card-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
}

/* ── Clear History Button ── */
.pipe-card-clear-history {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-dim, #8b949e);
  cursor: pointer;
  padding: 0;
  opacity: 0.5;
  margin-left: auto;
  flex-shrink: 0;
}

.pipe-card-clear-history:hover,
.pipe-card-clear-history:active {
  opacity: 1;
  color: #f85149;
  background: rgba(248, 81, 73, 0.1);
}

/* ── History Header ── */
.pipe-history-header {
  display: flex;
  align-items: center;
  gap: 6px;
}

.pipe-history-header .pipe-history-toggle {
  flex: 1;
}

/* ── Clickable History Row ── */
.pipe-history-row-clickable {
  cursor: pointer;
  border-radius: 6px;
  padding: 5px 4px;
  margin: 0 -4px;
}

.pipe-history-row-clickable:active {
  background: rgba(255, 255, 255, 0.04);
}

.pipe-history-row-expanded {
  background: rgba(255, 255, 255, 0.02);
}

/* ── History Detail (expanded) ── */
.pipe-history-detail {
  padding: 4px 0 8px 18px;
}

.pipe-history-detail-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
  font-size: 11px;
}

.pipe-history-detail-name {
  color: var(--text, #e6edf3);
  font-weight: 500;
  min-width: 60px;
}

.pipe-history-detail-dur {
  color: var(--text-dim, #8b949e);
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', monospace;
  font-size: 10px;
}

/* ── Flow row spacing in card ── */
.pipe-card > .pipe-flow {
  margin: 4px 0 2px;
}
