.workflows-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.workflows-toolbar-search {
  position: relative;
  min-width: 0;
}

.workflows-toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.workflow-action-button {
  min-width: 0;
  flex: 1 1 132px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.workflow-icon-button {
  flex: 0 0 40px;
  width: 40px;
}

.workflows-summary-row {
  margin-top: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.workflow-checkbox {
  width: 16px;
  height: 16px;
  border-radius: 4px;
  border: var(--ac-border-width, 1px) solid var(--ac-border, #e7e5e4);
  appearance: none;
  cursor: pointer;
  transition: all var(--ac-motion-fast, 120ms) ease;
}

.workflow-record-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.92);
}

.workflow-recording-active {
  box-shadow: 0 0 0 1px rgba(220, 38, 38, 0.35);
}

.workflow-record-stop:disabled {
  opacity: 0.55;
  cursor: default;
}

.workflow-error-banner {
  margin-top: 10px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  border: var(--ac-border-width, 1px) solid rgba(220, 38, 38, 0.35);
  border-radius: var(--ac-radius-button, 8px);
  background: rgba(239, 68, 68, 0.08);
  color: var(--ac-danger, #b91c1c);
  padding: 9px 10px;
  font-size: 12px;
  line-height: 1.4;
}

.workflow-error-banner span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.workflow-error-banner button {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  padding: 0;
}

.recording-panel {
  margin-top: 10px;
  border: var(--ac-border-width, 1px) solid var(--ac-border, #e7e5e4);
  border-radius: var(--ac-radius-button, 8px);
  background: var(--ac-surface-muted, #f2f0eb);
  padding: 10px;
}

.recording-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
}

.recording-status-chip {
  font-size: 11px;
  font-weight: 600;
  color: #b91c1c;
  background: rgba(239, 68, 68, 0.12);
  border-radius: 9999px;
  padding: 2px 8px;
}

.recording-meta {
  font-size: 11px;
  color: var(--ac-text-muted, #6e6e6e);
}

.recording-timeline-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
}

.recording-timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 6px;
}

.recording-timeline-index {
  width: 20px;
  text-align: right;
  font-size: 11px;
  color: var(--ac-text-subtle, #a8a29e);
}

.recording-timeline-text {
  font-size: 12px;
  color: var(--ac-text, #1a1a1a);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recording-timeline-empty {
  font-size: 12px;
  color: var(--ac-text-muted, #6e6e6e);
}

.workflow-checkbox:checked {
  background-color: var(--ac-accent, #d97757);
  border-color: var(--ac-accent, #d97757);
  background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
}

.advanced-divider {
  display: flex;
  align-items: center;
  text-align: center;
  margin: 20px 0 16px;
  font-size: 12px;
  font-weight: 500;
}

.advanced-divider::before,
.advanced-divider::after {
  content: "";
  flex: 1;
  border-bottom: var(--ac-border-width, 1px) solid var(--ac-border, #e7e5e4);
}

.advanced-section {
  margin-bottom: 8px;
  overflow: hidden;
}

.advanced-section-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  font-size: 13px;
  font-weight: 500;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color var(--ac-motion-fast, 120ms) ease;
}

.advanced-section-header:hover {
  background-color: var(--ac-hover-bg, #f5f5f4);
}

.advanced-section-content {
  padding: 0 12px 12px;
}

.run-item {
  padding: 10px 12px;
  cursor: pointer;
  transition: background-color var(--ac-motion-fast, 120ms) ease;
}

.run-item:hover {
  background-color: var(--ac-hover-bg, #f5f5f4) !important;
}

.trigger-manager {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding-top: 2px;
}

.trigger-form-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 8px;
}

.trigger-field,
.trigger-toggle {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  font-size: 11px;
  font-weight: 600;
  color: var(--ac-text-muted, #6e6e6e);
}

.trigger-field-wide {
  grid-column: 1 / -1;
}

.trigger-field input,
.trigger-field select,
.trigger-field textarea {
  width: 100%;
  min-width: 0;
  border: var(--ac-border-width, 1px) solid var(--ac-border, #e7e5e4);
  border-radius: var(--ac-radius-button, 8px);
  background: var(--ac-surface, #ffffff);
  color: var(--ac-text, #1a1a1a);
  font-size: 12px;
  font-weight: 400;
  padding: 7px 8px;
  outline: none;
}

.trigger-field textarea {
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.trigger-toggle {
  flex-direction: row;
  align-items: center;
  grid-column: 1 / -1;
}

.trigger-toggle input {
  width: 16px;
  height: 16px;
}

.trigger-form-error {
  color: var(--ac-danger, #ef4444);
  font-size: 12px;
}

.trigger-actions-row,
.trigger-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.trigger-actions-row button,
.trigger-item-actions button {
  border: none;
  border-radius: var(--ac-radius-button, 8px);
  background: var(--ac-surface-muted, #f2f0eb);
  color: var(--ac-text, #1a1a1a);
  font-size: 12px;
  font-weight: 600;
  padding: 7px 9px;
}

.trigger-actions-row button:first-child {
  background: var(--ac-accent, #d97757);
  color: var(--ac-accent-contrast, #ffffff);
}

.trigger-item-actions button:disabled {
  opacity: 0.5;
  cursor: default;
}

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

.trigger-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 10px;
  border-radius: var(--ac-radius-button, 8px);
  background: var(--ac-surface-muted, #f2f0eb);
}

.trigger-item-main {
  min-width: 0;
}

.trigger-item-title {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--ac-text, #1a1a1a);
  font-size: 13px;
  font-weight: 600;
}

.trigger-kind {
  border-radius: 999px;
  background: var(--ac-accent-subtle, rgba(217, 119, 87, 0.12));
  color: var(--ac-accent, #d97757);
  font-size: 10px;
  font-weight: 700;
  padding: 2px 6px;
  text-transform: uppercase;
}

.trigger-item-detail {
  margin-top: 4px;
  color: var(--ac-text-muted, #6e6e6e);
  font-size: 12px;
  overflow-wrap: anywhere;
}

.trigger-danger {
  color: var(--ac-danger, #ef4444) !important;
}

@media (max-width: 360px) {
  .workflow-action-button {
    flex-basis: 100%;
  }

  .workflow-icon-button {
    flex-basis: 40px;
  }

  .trigger-form-grid {
    grid-template-columns: 1fr;
  }

  .trigger-item {
    flex-direction: column;
  }
}

/* Section expand transition */
.section-expand-enter-active,
.section-expand-leave-active {
  transition: all var(--ac-motion-normal, 180ms) ease;
  overflow: hidden;
}

.section-expand-enter-from,
.section-expand-leave-to {
  opacity: 0;
  max-height: 0;
}

.section-expand-enter-to,
.section-expand-leave-from {
  opacity: 1;
  max-height: 500px;
}
