@import url('https://fonts.googleapis.com/css2?family=Inter:opsz,wght@14..32,100..900&display=swap');.sidebar-navigation {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 200;
  width: var(--sidebar-width);
  min-width: var(--sidebar-width);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  padding: var(--spacing-lg) 0;
  height: 100vh;
  height: 100dvh;
  overflow-x: hidden;
  overflow-y: auto;
  /* Soft elevation along the right edge (Replay-style rail) */
  box-shadow:
    1px 0 0 rgba(10, 10, 10, 0.04),
    6px 0 20px -4px rgba(10, 10, 10, 0.08),
    12px 0 40px -12px rgba(10, 10, 10, 0.06);
  box-sizing: border-box;
}

.sidebar-navigation.collapsed {
  width: var(--sidebar-width-collapsed);
  min-width: var(--sidebar-width-collapsed);
  max-width: var(--sidebar-width-collapsed);
  cursor: pointer;
  /* Let flyout labels render to the right; overflow hidden would clip them */
  overflow: visible;
}

.sidebar-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0 var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  min-height: 32px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
  gap: 10px;
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.sidebar-logo-icon {
  display: block;
  height: 28px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  flex-shrink: 0;
}

/* Collapsed: logo swaps to panel-left on hover */
.sidebar-logo-expand-hit {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  padding: var(--spacing-sm) 0;
  margin-bottom: var(--spacing-lg);
  border: none;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.sidebar-logo-expand-hit:hover {
  background: var(--color-bg-hover);
}

.sidebar-logo-expand-hit .sidebar-logo-icon {
  transition: opacity 0.15s ease;
}

.sidebar-logo-hover-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.15s ease;
  pointer-events: none;
}

.sidebar-navigation.collapsed .sidebar-logo-expand-hit:hover .sidebar-logo-icon {
  opacity: 0;
}

.sidebar-navigation.collapsed .sidebar-logo-expand-hit:hover .sidebar-logo-hover-panel {
  opacity: 1;
}

.sidebar-panel-toggle {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  padding: 0;
  border: none;
  background: transparent;
  border-radius: var(--radius-sm);
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: background-color 0.1s ease, color 0.15s ease;
}

.sidebar-panel-toggle:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
}

.sidebar-nav-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 0 var(--spacing-sm);
}

.sidebar-nav-link {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 0px 8px;
  border-radius: var(--radius-sm);
  height: 28px;
  font-size: 13px;
  font-weight: 450;
  color: var(--color-text-secondary);
  background: transparent;
  text-decoration: none;
  transition: background-color 0.1s ease, color 0.15s ease;
}

.sidebar-nav-link:hover {
  background: var(--color-bg-hover);
  color: var(--color-text-primary);
  text-decoration: none;
}

.sidebar-nav-link:active {
  background: var(--color-border-light);
}

.sidebar-nav-link.active {
  background: var(--color-border-light);
  color: var(--color-text-primary);
  font-weight: 500;
}

.sidebar-nav-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-navigation.collapsed .sidebar-nav-list {
  padding: 0 4px;
}

.sidebar-navigation.collapsed .sidebar-nav-link {
  position: relative;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.sidebar-nav-tooltip {
  position: absolute;
  left: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 13px;
  font-weight: 500;
  line-height: 1.25;
  white-space: nowrap;
  border: 1px solid rgba(255, 255, 255, 0.14);
  box-shadow: var(--shadow-md);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.12s ease, visibility 0.12s ease;
  z-index: 260;
}

.sidebar-navigation.collapsed .sidebar-nav-link:hover .sidebar-nav-tooltip,
.sidebar-navigation.collapsed .sidebar-nav-link:focus-visible .sidebar-nav-tooltip {
  opacity: 1;
  visibility: visible;
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.filter-bar-dropdown {
  position: relative;
}

.filter-bar-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 38px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background-color 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.filter-bar-dropdown-trigger:hover {
  border-color: var(--color-border-hover);
  background: var(--color-bg-hover);
}

.filter-bar-dropdown-trigger:focus-visible {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.filter-bar-dropdown-trigger.open {
  border-color: var(--color-text-primary);
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.filter-bar-dropdown-chevron {
  width: 14px;
  height: 14px;
  color: var(--color-text-secondary);
  transition: transform 0.15s;
}

.filter-bar-dropdown-trigger.open .filter-bar-dropdown-chevron {
  transform: rotate(180deg);
}

.filter-bar-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 220px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  z-index: 60;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
}

.filter-bar-dropdown-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 8px 12px;
  font-size: 13px;
  color: var(--color-text-primary);
  background: none;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color 0.1s ease;
}

.filter-bar-dropdown-option:hover {
  background: var(--color-bg-hover);
}

.filter-bar-dropdown-option.selected {
  background: var(--color-border-light);
  color: var(--color-text-primary);
  font-weight: 600;
}

.filter-bar-button {
  margin-left: auto;
  min-height: 38px;
  padding: 8px 16px;
  background: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-on-primary);
  cursor: pointer;
  transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.1s ease;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
}

.filter-bar-button:hover {
  background: var(--color-primary-hover);
  border-color: var(--color-primary-hover);
}

.filter-bar-button:active {
  transform: scale(0.98);
}

.filter-bar-button:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--color-bg), 0 0 0 4px var(--color-primary);
}

@media (max-width: 640px) {
  .filter-bar {
    gap: var(--spacing-sm);
  }

  .filter-bar-dropdown-trigger {
    font-size: 13px;
    padding: var(--spacing-xs) var(--spacing-sm);
  }

  .filter-bar-button {
    font-size: 13px;
    padding: var(--spacing-xs) var(--spacing-sm);
  }
}
.failure-tag-stats-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.failure-tag-stats-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-hover);
}

.failure-tag-stats-card-title {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  padding: var(--spacing-md) var(--spacing-lg);
  border-bottom: 1px solid var(--color-border-light);
  background: linear-gradient(to bottom, var(--color-surface), var(--color-bg-secondary));
}

.failure-tag-stats-table {
  width: 100%;
  border-collapse: collapse;
}

.failure-tag-stats-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 10px var(--spacing-lg);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  text-align: left;
}

.failure-tag-stats-table td {
  font-size: 13px;
  color: var(--color-text-primary);
  padding: 10px var(--spacing-lg);
  border-bottom: 1px solid var(--color-border-light);
}

.failure-tag-stats-table tr:last-child td {
  border-bottom: none;
}

.stats-success-rate-cell {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.stats-success-rate-value {
  font-weight: 500;
  min-width: 36px;
}

.stats-success-rate-bar {
  display: flex;
  gap: 2px;
  align-items: center;
}

.stats-success-rate-segment {
  width: 7px;
  height: 14px;
  border-radius: 3px;
}

.stats-success-rate-segment.high {
  background: var(--color-bar-high);
}

.stats-success-rate-segment.medium {
  background: var(--color-bar-medium);
}

.stats-success-rate-segment.low {
  background: var(--color-bar-low);
}

.stats-success-rate-segment.empty {
  background: var(--color-border-light);
}

.stats-cost-value {
  font-weight: 500;
  color: var(--color-text-primary);
}

@media (max-width: 480px) {
  .failure-tag-stats-card-title {
    font-size: 16px;
    padding: var(--spacing-md) var(--spacing-md) var(--spacing-sm);
  }

  .failure-tag-stats-table th,
  .failure-tag-stats-table td {
    padding: var(--spacing-xs) var(--spacing-md);
  }

  .failure-tag-stats-table th:nth-child(3),
  .failure-tag-stats-table td:nth-child(3) {
    display: none;
  }
}
.failure-tag-stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md) var(--spacing-lg);
  flex: 1;
}

@media (max-width: 1100px) {
  .failure-tag-stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 700px) {
  .failure-tag-stats-grid {
    grid-template-columns: 1fr;
  }
}

.failure-tag-stats-grid-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: var(--spacing-xl) var(--spacing-lg);
  color: var(--color-text-muted);
  font-size: 14px;
  line-height: 1.5;
  background: var(--color-surface);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
}
.footer-link {
  text-align: center;
  font-size: 13px;
  color: var(--color-text-muted);
  padding-top: var(--spacing-md);
}

.footer-link a {
  font-weight: 500;
  color: var(--color-text-link);
}
.main-page {
  display: flex;
  min-height: 100vh;
}
.failure-cards-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.failure-count {
  color: var(--color-text-secondary);
  font-weight: 400;
}

.failure-cards-header-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.add-failure-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 8px 16px;
  background: var(--color-primary);
  color: var(--color-on-primary);
  border: none;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease;
}

.add-failure-btn:hover {
  background: var(--color-primary-hover);
}

.clean-failures-btn {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}

.clean-failures-btn:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.clean-failures-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auto-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease;
}

.auto-toggle:has(.auto-toggle-input:checked) {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.auto-toggle-input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.auto-toggle-label {
  user-select: none;
}

/* No overflow here — same as RunsTable. Any overflow on this box makes `th { position: sticky }` use that
 * scrollport instead of the viewport, so the header scrolls away with the rows. Wide grids scroll with the page. */
.failures-grid-wrapper {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
}

.failures-grid {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.failures-grid-th {
  position: sticky;
  top: var(--failures-grid-sticky-top, 200px);
  z-index: 35;
  background: var(--color-surface);
  padding: 8px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--color-text-secondary);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}

.failures-grid-th:first-child {
  border-top-left-radius: var(--radius-lg);
}

.failures-grid-th:last-child {
  border-top-right-radius: var(--radius-lg);
}

.failures-grid-agent-col {
  text-align: center;
  min-width: 100px;
}

.failures-grid-id-col {
  width: 70px;
  white-space: nowrap;
}

.failures-grid-title-col {
  min-width: 200px;
  max-width: 400px;
}

.failures-grid-row {
  transition: background 0.1s ease;
}

.failures-grid-row:hover {
  background: rgba(50, 45, 35, 0.04);
}

.failures-grid-td {
  padding: 6px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.failures-grid-link {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: 500;
}

.failures-grid-link:hover {
  text-decoration: underline;
}

.failures-grid-title-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 400px;
}

.failures-grid-no-data {
  color: var(--color-text-muted);
}

.failures-grid-winner {
  background: rgba(22, 163, 74, 0.08);
}

.failures-grid-score {
  display: block;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  line-height: 1.3;
}

.failures-grid-score.positive {
  color: #16a34a;
}

.failures-grid-score.negative {
  color: #dc2626;
}

.failures-grid-time {
  display: block;
  font-size: 11px;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
}

.failures-grid-empty {
  text-align: center;
  padding: 32px;
  color: var(--color-text-muted);
}
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.dialog-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.dialog-field-row {
  display: flex;
  gap: var(--spacing-md);
}

.dialog-field-row .dialog-field {
  flex: 1;
}

.dialog-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.dialog-input {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color 0.15s ease;
}

.dialog-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.dialog-textarea {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.dialog-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.dialog-input::placeholder,
.dialog-textarea::placeholder {
  color: var(--color-text-muted);
}

.custom-select-wrapper {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.custom-select-trigger:hover {
  border-color: var(--color-primary);
}

.custom-select-trigger-overlay {
  position: absolute;
  inset: 0;
  cursor: pointer;
  z-index: 1;
}

.custom-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  margin-top: 2px;
}

.custom-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--color-text-primary);
  cursor: pointer;
}

.custom-dropdown-item:hover {
  background: var(--color-primary-light);
}

.custom-dropdown-item.selected {
  color: var(--color-primary);
  font-weight: 500;
}

.immutability-notice {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-sm);
}

.dialog-btn-cancel {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.dialog-btn-cancel:hover {
  background: var(--color-bg);
}

.dialog-btn-submit {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.dialog-btn-submit:hover {
  background: var(--color-primary-hover);
}

.dialog-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
.tag-filter-bar {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
  margin-bottom: var(--spacing-lg);
  max-width: 100%;
}

.tag-filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.tag-filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-filter-chip:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.tag-filter-chip.active {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.tag-filter-count {
  font-size: 11px;
  opacity: 0.7;
}

.tag-filter-dismiss {
  font-size: 14px;
  margin-left: 2px;
  line-height: 1;
}

.tag-filter-toggle {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--radius-full, 9999px);
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.tag-filter-toggle:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
  background: rgba(50, 45, 35, 0.03);
}

.tag-filter-actions {
  margin-left: auto;
}

.create-tag-btn {
  padding: 4px 12px;
  border-radius: var(--radius-md);
  border: 1px dashed var(--color-border);
  background: transparent;
  color: var(--color-text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.create-tag-btn:hover {
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.create-tag-form {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.create-tag-input {
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 140px;
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.create-tag-input:focus {
  outline: none;
  border-color: var(--color-primary);
}

.create-tag-submit {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.create-tag-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.create-tag-cancel {
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 12px;
  cursor: pointer;
}
.failures-page {
  display: flex;
  min-height: 100vh;
}

.failure-cards-grid {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
  max-width: 800px;
}

.failures-search-bar {
  position: relative;
  max-width: 800px;
  margin-bottom: var(--spacing-md);
}

.failures-search-input {
  width: 100%;
  padding: 10px 36px 10px 14px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  font-size: 14px;
  background: var(--color-surface);
  color: var(--color-text);
  box-sizing: border-box;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.failures-search-input:focus {
  outline: none;
  border-color: var(--color-text-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.failures-search-input::placeholder {
  color: var(--color-text-muted);
}

.failures-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}

.failures-search-clear:hover {
  color: var(--color-text);
}

.failures-loading {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.failures-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.failures-empty {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-muted);
  font-size: 14px;
}
.delete-agent-wrapper {
  position: relative;
  display: inline-flex;
}

.delete-agent-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.delete-agent-btn:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.delete-agent-popover {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-sm) var(--spacing-md);
  white-space: nowrap;
  z-index: 20;
}

.delete-agent-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.delete-agent-popover-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.delete-agent-confirm-yes,
.delete-agent-confirm-no {
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  cursor: pointer;
}

.delete-agent-confirm-yes {
  background: var(--color-danger);
  color: var(--color-on-primary);
  border-color: var(--color-danger);
}

.delete-agent-confirm-yes:hover {
  background: var(--color-danger-hover);
}

.delete-agent-confirm-no {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.delete-agent-confirm-no:hover {
  background: var(--color-bg);
}
.agents-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow-x: auto;
}

.agents-table {
  display: grid;
  grid-template-columns: 1fr;
  grid-template-rows: auto repeat(auto-fill, 44px);
}

.agents-table-header {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 72px;
  column-gap: var(--spacing-lg);
  align-items: center;
  min-width: 0;
  min-height: 36px;
  padding: var(--spacing-sm) var(--spacing-md);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.agents-table-header > span {
  min-width: 0;
}

.agents-table-header > span:last-child {
  min-width: 72px;
  text-align: center;
  white-space: nowrap;
}

.agents-table-header .agents-col-score,
.agents-table-header .agents-col-count {
  text-align: right;
  white-space: nowrap;
}

.agents-table-row {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr) 72px;
  column-gap: var(--spacing-lg);
  grid-column: 1 / -1;
  align-items: center;
  min-width: 0;
  height: 44px;
  padding: 0 var(--spacing-md);
  background: transparent;
  color: var(--color-text-primary);
  border: none;
  cursor: pointer;
  text-decoration: none;
  outline: none;
  transition: background 0.1s ease;
}

.agents-table-row:hover {
  background: rgba(50, 45, 35, 0.05);
}

.agent-name-cell {
  min-width: 0;
  font-weight: 600;
  font-size: 13px;
}

.agent-name-cell .agent-name-link {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.agent-name-link {
  color: var(--color-primary);
  text-decoration: none;
}

.agent-name-link:hover {
  text-decoration: underline;
}

.agent-score-cell {
  min-width: 0;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.score-value.positive {
  color: var(--color-pass);
}

.score-value.negative {
  color: var(--color-fail);
}

.agent-count-cell {
  min-width: 0;
  font-size: 13px;
  color: var(--color-text-secondary);
  font-variant-numeric: tabular-nums;
  text-align: right;
  white-space: nowrap;
}

.agent-actions-cell {
  position: relative;
  z-index: 1;
  text-align: center;
  padding-left: var(--spacing-xs);
}

@media (max-width: 768px) {
  .agents-table-header,
  .agents-table-row {
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) 72px;
    column-gap: var(--spacing-lg);
  }

  .agents-col-count {
    display: none;
  }
}
.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.dialog {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: var(--spacing-lg);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.dialog-header .dialog-title {
  margin-bottom: 0;
}

.dialog-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: var(--spacing-xs);
  line-height: 1;
  border-radius: var(--radius-sm);
}

.dialog-close-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg);
}

.dialog-title {
  font-size: 20px;
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-lg);
}

.dialog-subtitle {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: -12px;
  margin-bottom: var(--spacing-md);
}

.dialog-form {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.dialog-field {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.dialog-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.dialog-input {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  transition: border-color 0.15s ease;
}

.dialog-input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.dialog-textarea {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  resize: vertical;
  transition: border-color 0.15s ease;
}

.dialog-textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px var(--color-primary-light);
}

.dialog-input::placeholder,
.dialog-textarea::placeholder {
  color: var(--color-text-muted);
}

.dialog-textarea-mono {
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  line-height: 1.6;
}

.custom-select-wrapper {
  position: relative;
}

.custom-select-trigger {
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  background: var(--color-surface);
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s ease;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.custom-select-trigger:hover {
  border-color: var(--color-primary);
}

.select-chevron {
  font-size: 10px;
  color: var(--color-text-muted);
  margin-left: auto;
}

.custom-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  margin-top: 2px;
}

.custom-dropdown-item {
  display: block;
  width: 100%;
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  background: none;
  text-align: left;
  font-size: 14px;
  color: var(--color-text-primary);
  cursor: pointer;
}

.custom-dropdown-item:hover {
  background: var(--color-primary-light);
}

.custom-dropdown-item.selected {
  color: var(--color-primary);
  font-weight: 500;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: var(--spacing-sm);
  padding-top: var(--spacing-sm);
}

.dialog-btn-cancel {
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.dialog-btn-cancel:hover {
  background: var(--color-bg);
}

.dialog-btn-submit {
  padding: var(--spacing-sm) var(--spacing-md);
  border: none;
  border-radius: var(--radius-md);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
}

.dialog-btn-submit:hover {
  background: var(--color-primary-hover);
}

.dialog-btn-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.immutability-notice {
  font-size: 12px;
  color: var(--color-text-muted);
  font-style: italic;
}

.dialog-textarea-error {
  border-color: var(--color-error);
}

.dialog-field-error {
  font-size: 12px;
  color: var(--color-error);
  margin: 0;
}
.agents-page {
  display: flex;
  min-height: 100vh;
}

.new-agent-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}

.new-agent-btn:hover {
  background: var(--color-primary-hover);
}

.agents-loading {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.agents-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.agents-empty {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-muted);
  font-size: 14px;
}
.delete-run-wrapper {
  position: relative;
  display: inline-flex;
  z-index: 1;
}

.delete-run-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-xs);
  border-radius: var(--radius-sm);
  transition: background 0.15s ease, color 0.15s ease;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
}

.delete-run-btn:hover {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.delete-run-popover {
  position: absolute;
  right: 0;
  top: 100%;
  margin-top: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  padding: var(--spacing-sm) var(--spacing-md);
  white-space: nowrap;
  z-index: 20;
}

.delete-run-popover-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.delete-run-popover-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.delete-run-confirm-yes,
.delete-run-confirm-no {
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid;
  cursor: pointer;
}

.delete-run-confirm-yes {
  background: var(--color-danger);
  color: var(--color-on-primary);
  border-color: var(--color-danger);
}

.delete-run-confirm-yes:hover {
  background: var(--color-danger-hover);
}

.delete-run-confirm-no {
  background: var(--color-surface);
  color: var(--color-text-secondary);
  border-color: var(--color-border);
}

.delete-run-confirm-no:hover {
  background: var(--color-bg);
}
.runs-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
}

.runs-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

.runs-col-name { width: 22%; }
.runs-col-created { width: 14%; }
.runs-col-agent { width: 16%; }
.runs-col-selections { width: 26%; }
.runs-col-stats { width: 16%; }
.runs-col-actions { width: 6%; }

.runs-table thead th {
  position: sticky;
  top: var(--runs-table-sticky-top, 72px);
  z-index: 35;
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  white-space: nowrap;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runs-table thead th:first-child {
  border-top-left-radius: var(--radius-lg);
}

.runs-table thead th:last-child {
  border-top-right-radius: var(--radius-lg);
}

.runs-table-sortable {
  cursor: pointer;
  user-select: none;
}

.runs-table-sortable:hover {
  color: var(--color-primary);
}

.runs-table-sort-icon {
  margin-left: var(--spacing-xs);
  font-size: 12px;
}

.runs-table tbody tr {
  transition: background 0.15s ease;
}

.runs-table-clickable-row {
  cursor: pointer;
}

.runs-table tbody tr:hover {
  background: var(--color-bg);
}

.runs-table tbody td {
  padding: var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
  color: var(--color-text-primary);
  vertical-align: middle;
  overflow: hidden;
  text-overflow: ellipsis;
}

.runs-table tbody tr:last-child td {
  border-bottom: none;
}

.run-name-cell {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-refined-badge {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 5px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  vertical-align: middle;
  line-height: 1.2;
}

.run-created-cell {
  color: var(--color-text-secondary);
  white-space: nowrap;
}

.run-agent-cell {
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-selections-cell {
  color: var(--color-text-secondary);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.run-stats-cell {
  white-space: nowrap;
  font-weight: 500;
}

.run-actions-cell {
  white-space: nowrap;
  text-align: center;
  position: relative;
  z-index: 1;
}

.runs-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-muted);
  font-size: 14px;
}

/* Hide Selected Tags/Failures column at 1024px */
@media (max-width: 1024px) {
  .runs-table thead th:nth-child(4),
  .runs-table tbody td:nth-child(4) {
    display: none;
  }
}

/* Hide Summary Stats column at 768px */
@media (max-width: 768px) {
  .runs-table thead th:nth-child(5),
  .runs-table tbody td:nth-child(5) {
    display: none;
  }
}
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--spacing-lg);
}

.dialog-header .dialog-title {
  margin-bottom: 0;
}

.dialog-close-btn {
  background: none;
  border: none;
  font-size: 18px;
  color: var(--color-text-muted);
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
  border-radius: var(--radius-sm);
}

.dialog-close-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg);
}

.dialog-field-error {
  font-size: 12px;
  color: var(--color-danger);
  margin-top: 2px;
}

.new-run-agent-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.new-run-agent-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.new-run-agent-label .required {
  color: var(--color-danger);
  font-weight: 600;
}

.new-run-selections-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.new-run-selections-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.new-run-tag-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.new-run-tag-item {
  border-radius: var(--radius-sm);
}

.new-run-tag-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 4px 0;
}

.new-run-expand-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: var(--color-text-muted);
  padding: 0 4px;
  line-height: 1;
  flex-shrink: 0;
}

.new-run-expand-btn:hover {
  color: var(--color-text-primary);
}

.new-run-tag-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
}

.new-run-tag-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.new-run-tag-name {
  font-weight: 500;
}

.new-run-tag-count {
  font-weight: 400;
  font-size: 12px;
  color: var(--color-text-muted);
}

.new-run-failure-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-left: 36px;
  padding-bottom: 4px;
}

.new-run-failure-label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 2px 0;
}

.new-run-failure-label input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--color-primary);
  cursor: pointer;
}

.new-run-failure-slug {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-bg);
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.new-run-container-count-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.new-run-container-count-description {
  font-size: 12px;
  color: var(--color-text-muted);
  margin: 0;
}

.new-run-container-count-input {
  width: 80px;
  padding: 6px 8px;
  font-size: 14px;
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-primary);
  -moz-appearance: textfield;
  appearance: textfield;
}

.new-run-container-count-input::-webkit-outer-spin-button,
.new-run-container-count-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.new-run-selected-agents {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.new-run-agent-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-primary-light, rgba(45, 106, 79, 0.1));
  color: var(--color-primary);
  border-radius: var(--radius-sm);
}

.new-run-agent-badge-remove {
  background: none;
  border: none;
  font-size: 10px;
  cursor: pointer;
  color: var(--color-text-muted);
  padding: 0 2px;
  line-height: 1;
}

.new-run-agent-badge-remove:hover {
  color: var(--color-danger);
}
.runs-page {
  display: flex;
  min-height: 100vh;
}

.new-run-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: 8px 16px;
  border: none;
  border-radius: var(--radius-lg);
  background: var(--color-primary);
  color: var(--color-on-primary);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background 0.15s ease;
}

.new-run-btn:hover {
  background: var(--color-primary-hover);
}

.runs-loading {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.runs-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}
.run-header {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.run-header-back {
  font-size: 13px;
  color: var(--color-text-muted);
  text-decoration: none;
  align-self: flex-start;
}

.run-header-back:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.run-header-top-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  flex-wrap: wrap;
}

.run-header-error-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-md);
  background: var(--color-danger-light);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  color: var(--color-danger);
  font-size: 14px;
  line-height: 1.5;
}

.run-header-error-banner svg {
  flex-shrink: 0;
  margin-top: 2px;
}

.run-header-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.run-header-status-badge {
  display: inline-flex;
  align-items: center;
  padding: var(--spacing-xs) var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.run-header-status-badge.completed {
  background: var(--color-badge-completed);
  color: var(--color-badge-completed-text);
}

.run-header-status-badge.running {
  background: var(--color-badge-running);
  color: var(--color-badge-running-text);
}

.run-header-status-badge.failed {
  background: var(--color-badge-failed);
  color: var(--color-badge-failed-text);
}

.run-header-status-badge.pending {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.run-header-spacer {
  flex: 1;
}

.run-header-delete-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--spacing-xs);
  padding: var(--spacing-sm) var(--spacing-md);
  border: 1px solid var(--color-danger);
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--color-danger);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
}

.run-header-delete-btn:hover {
  background: var(--color-danger-light);
}

.run-header-delete-btn-danger {
  background: var(--color-danger);
  color: var(--color-on-primary);
}

.run-header-delete-btn-danger:hover {
  background: var(--color-danger-hover);
}

.run-header-delete-confirm {
  display: flex;
  gap: 8px;
  align-items: center;
}

.run-header-delete-confirm-text {
  font-size: 14px;
  color: var(--color-danger);
}

@media (max-width: 640px) {
  .run-header-title {
    font-size: 20px;
  }
}
.run-metadata {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-lg);
}

.run-metadata-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.run-metadata-section {
  flex: 1;
  min-width: 200px;
}

.run-metadata-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.run-metadata-value {
  font-size: 14px;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.run-metadata-agent-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xs);
}

.run-metadata-agent-icon {
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
}

.run-metadata-muted-text {
  color: var(--color-text-muted);
}

.run-metadata-label-spaced {
  margin-top: var(--spacing-sm);
}

.run-metadata-tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--spacing-xs);
}

.run-metadata-tag-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
}

.run-metadata-tag-badge.security {
  background: var(--color-badge-security);
  color: var(--color-badge-security-text);
}

.run-metadata-tag-badge.performance {
  background: var(--color-badge-performance);
  color: var(--color-badge-performance-text);
}

.run-metadata-tag-badge.default {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.run-metadata-branch-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 14px;
  color: var(--color-text-primary);
}

.run-metadata-branch-icon {
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
}

.run-metadata-commit {
  color: var(--color-primary);
  font-family: monospace;
  font-size: 13px;
}

.run-metadata-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12px;
  color: var(--color-text-muted);
  padding: 2px;
}

.run-metadata-copy-btn:hover {
  color: var(--color-primary);
}

.run-metadata-timestamp-row {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 14px;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-xs);
}

.run-metadata-timestamp-icon {
  display: flex;
  align-items: center;
  color: var(--color-text-secondary);
}

.run-metadata-details-link {
  color: var(--color-primary);
  font-size: 13px;
  cursor: pointer;
  text-decoration: none;
}

.run-metadata-details-link:hover {
  text-decoration: underline;
}

.run-metadata-popover {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  margin-top: var(--spacing-xs);
  font-size: 13px;
  color: var(--color-text-primary);
  max-height: 200px;
  overflow-y: auto;
}

.run-metadata-popover-content {
  white-space: pre-wrap;
  word-break: break-word;
}

.run-metadata-failure-list {
  margin: 0;
  padding-left: var(--spacing-md);
  list-style: disc;
}

.run-metadata-failure-list li {
  margin-bottom: 2px;
}

.run-metadata-agent-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: var(--spacing-sm);
}

.run-metadata-agent-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-primary-light, rgba(45, 106, 79, 0.1));
  color: var(--color-primary);
  border-radius: var(--radius-sm);
}

@media (max-width: 640px) {
  .run-metadata {
    padding: var(--spacing-md);
  }

  .run-metadata-agent-row {
    flex-wrap: wrap;
  }
}
.run-summary-statistics {
  margin-bottom: var(--spacing-md);
}

.run-summary-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-md);
}

.run-summary-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--spacing-md);
}

@media (max-width: 768px) {
  .run-summary-cards {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 640px) {
  .run-summary-title {
    font-size: 16px;
  }

  .run-summary-cards {
    grid-template-columns: 1fr;
  }

  .run-summary-card {
    padding: var(--spacing-md);
  }

  .run-summary-card-value {
    font-size: 20px;
  }
}

.run-summary-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-lg);
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.run-summary-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.run-summary-card-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-secondary);
}

.run-summary-card-icon {
  display: flex;
  align-items: center;
}

.run-summary-card-value {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
}

.run-summary-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.run-summary-progress-fill {
  height: 100%;
  border-radius: var(--radius-sm);
  transition: width 0.3s ease;
}

.run-summary-progress-fill.high {
  background: var(--color-bar-high);
}

.run-summary-progress-fill.medium {
  background: var(--color-bar-medium);
}

.run-summary-progress-fill.low {
  background: var(--color-bar-low);
}

.run-summary-agent-breakdown {
  margin-top: var(--spacing-md);
}

.run-summary-subtitle {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--spacing-sm);
}

.run-summary-agent-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.run-summary-agent-table th {
  text-align: left;
  padding: 6px 12px;
  font-weight: 500;
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-border);
}

.run-summary-agent-table td {
  padding: 6px 12px;
  color: var(--color-text-primary);
  border-bottom: 1px solid var(--color-border-light);
}

.run-summary-agent-name {
  font-weight: 500;
}

.run-summary-rate.high {
  color: var(--color-pass);
  font-weight: 600;
}

.run-summary-rate.medium {
  color: var(--color-partial);
  font-weight: 600;
}

.run-summary-rate.low {
  color: var(--color-fail);
  font-weight: 600;
}
.detailed-results {
  flex: 1;
  min-width: 0;
}

.detailed-results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-md);
  border-bottom: 2px solid var(--color-border);
  padding-bottom: var(--spacing-sm);
}

.detailed-results-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.detailed-results-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.detailed-results-filter {
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  width: 180px;
  background: var(--color-surface);
  color: var(--color-text-primary);
}

.detailed-results-filter::placeholder {
  color: var(--color-text-muted);
}

.detailed-results-filter-icon {
  color: var(--color-text-muted);
  display: flex;
  align-items: center;
}

.detailed-results-table-wrapper {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
}

.detailed-results-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.detailed-results-table thead th {
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  padding: var(--spacing-sm) var(--spacing-md);
  white-space: nowrap;
}

/* Column widths are auto since column count varies with agent/attempt */

.detailed-results-table tbody td {
  padding: var(--spacing-sm) var(--spacing-md);
  border-bottom: 1px solid var(--color-border-light);
  font-size: 14px;
  color: var(--color-text-primary);
  word-wrap: break-word;
  overflow-wrap: break-word;
}

.detailed-results-table tbody td:nth-child(1) {
  word-break: break-all;
}

.detailed-results-table tbody tr:hover {
  background: var(--color-bg);
}

.detailed-results-table tbody tr:last-child td {
  border-bottom: none;
}

.result-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px var(--spacing-sm);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.result-status-badge.pass {
  background: var(--color-pass-bg);
  color: var(--color-pass);
}

.result-status-badge.fail {
  background: var(--color-fail-bg);
  color: var(--color-fail);
}

.result-status-badge.dsq {
  background: var(--color-badge-queued);
  color: var(--color-badge-queued-text);
}

.result-status-badge.disagree {
  background: var(--color-violet-light);
  color: var(--color-violet);
}

.result-assessment-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
  font-weight: 500;
}

.result-assessment-badge.correct {
  color: var(--color-pass);
}

.result-assessment-badge.incorrect {
  color: var(--color-fail);
}

.result-assessment-badge.partial {
  color: var(--color-partial);
}

.result-assessment-badge.freetext {
  color: var(--color-text-secondary);
  font-weight: 400;
  white-space: pre-wrap;
  word-break: break-word;
  display: block;
  line-height: 1.5;
  font-size: 12px;
  max-width: 100%;
  background: var(--color-bg);
  padding: var(--spacing-sm) var(--spacing-md);
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border-light);
}

.detailed-results-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-secondary);
  font-size: 14px;
}

.result-metrics {
  font-size: 13px;
  color: var(--color-text-secondary);
}

/* In-progress statuses */
.result-status-badge.not_started {
  background: var(--color-bg);
  color: var(--color-text-muted);
  opacity: 0.6;
}

.result-status-badge.pending,
.result-status-badge.fixing {
  background: var(--color-bg);
  color: var(--color-text-muted);
}

.result-status-badge.fix_completed {
  background: var(--color-pass-bg);
  color: var(--color-pass);
}

.result-status-badge.validating {
  background: var(--color-info-light);
  color: var(--color-info);
}

.result-row-pending {
  opacity: 0.75;
}

.result-status-time {
  font-size: 11px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.result-spinner {
  animation: spin 1s linear infinite;
}

/* Log toggle and expandable logs */
.result-test-cell {
  display: flex;
  align-items: center;
  gap: 6px;
}

.result-test-link {
  color: var(--color-primary);
  text-decoration: none;
}

.result-test-link:hover {
  text-decoration: underline;
}

.result-logs-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border: none;
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 0;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}

.result-logs-toggle:hover {
  background: var(--color-bg);
  color: var(--color-text-primary);
}

.result-logs-row td {
  padding: 0 !important;
  border-bottom: 1px solid var(--color-border-light) !important;
}

.result-logs-row:hover {
  background: none !important;
}

.result-logs-content {
  background: var(--color-bg);
  border-top: 1px solid var(--color-border-light);
  padding: var(--spacing-sm) var(--spacing-md);
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
  font-size: 12px;
  line-height: 1.5;
}

.result-log-entry {
  display: flex;
  gap: var(--spacing-sm);
  padding: 1px 0;
}

.result-log-timestamp {
  color: var(--color-text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.result-log-line {
  color: var(--color-text-primary);
  word-break: break-all;
  white-space: pre-wrap;
}

/* Phase sections in expanded logs */
.result-phase-section {
  margin-bottom: var(--spacing-md);
}

.result-phase-section:last-child {
  margin-bottom: 0;
}

.result-phase-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--color-text-secondary);
  padding: var(--spacing-xs) 0;
  margin-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-border-light);
}

.result-event-entry {
  display: flex;
  gap: var(--spacing-sm);
  padding: 2px 0;
  font-size: 12px;
}

.result-event-label {
  font-weight: 600;
  color: var(--color-primary);
}

.result-event-task-started .result-event-label {
  color: var(--color-text-secondary);
}

.result-event-task-done .result-event-label {
  color: var(--color-primary);
}

/* Assessment shown in expanded row */
.result-expanded-assessment {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  margin-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border-light);
  font-family: inherit;
}

.result-assessment-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.result-expanded-assessment-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
}

.result-confidence-rating {
  font-size: 13px;
  color: var(--color-partial);
  margin-left: 8px;
  letter-spacing: 1px;
}

.result-assessed-at {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: auto;
}

.result-rerun-assessment-btn {
  font-size: 12px;
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-left: 8px;
}

.result-rerun-assessment-btn:hover:not(:disabled) {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.result-rerun-assessment-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.result-retrigger-btn {
  font-size: 12px;
  padding: 2px 10px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-left: 8px;
}

.result-retrigger-btn:hover:not(:disabled) {
  background: var(--color-bg-tertiary);
  color: var(--color-text-primary);
}

.result-retrigger-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Container shown in expanded row */
.result-expanded-container {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-xs) 0;
  margin-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border-light);
  font-family: inherit;
}

.result-expanded-container-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
}

.result-logs-loading {
  padding: var(--spacing-sm);
  color: var(--color-text-muted);
  font-size: 13px;
}

/* Agent badge in results table */
.result-agent-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-primary-light, rgba(45, 106, 79, 0.1));
  color: var(--color-primary);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Container name in results table */
.result-container-name {
  font-size: 12px;
  color: var(--color-text-secondary);
  font-family: 'SF Mono', 'Fira Code', 'Fira Mono', Menlo, monospace;
  white-space: nowrap;
}

/* Agent filter dropdown */
.detailed-results-agent-filter {
  position: relative;
}

.detailed-results-agent-filter-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: var(--spacing-xs) var(--spacing-sm);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-surface);
  color: var(--color-text-primary);
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
}

.detailed-results-agent-filter-btn:hover {
  border-color: var(--color-primary);
}

.detailed-results-agent-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-md);
  z-index: 10;
  min-width: 180px;
  max-height: 300px;
  overflow-y: auto;
}

/* Judge assessment dropdowns */

.judge-assessment {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.judge-section {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.judge-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  color: var(--color-text-secondary);
  margin-bottom: 2px;
}

.judge-dropdown {
  display: flex;
  flex-direction: column;
}

.judge-dropdown-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: none;
  padding: 3px 4px;
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-primary);
  border-radius: var(--radius-sm);
  text-align: left;
}

.judge-dropdown-toggle:hover {
  background: var(--color-bg-hover);
}

.judge-verdict-badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 1px 6px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.judge-verdict-badge.judge-pass {
  color: var(--color-pass);
  background: rgba(34, 197, 94, 0.1);
}

.judge-verdict-badge.judge-fail {
  color: var(--color-fail);
  background: rgba(239, 68, 68, 0.1);
}

.judge-verdict-badge.judge-unknown {
  color: var(--color-text-muted);
  background: var(--color-bg-secondary);
}

.judge-label {
  color: var(--color-text-secondary);
  font-size: 12px;
}

.judge-reasoning {
  margin: 4px 0 8px 20px;
  padding: var(--spacing-sm);
  background: var(--color-bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-secondary);
  max-height: 300px;
  overflow-y: auto;
}

@media (max-width: 768px) {
  .detailed-results-filter {
    width: 120px;
  }
}
.run-details-page {
  display: flex;
  min-height: 100vh;
}

.run-details-loading {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.run-details-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.run-details-not-found {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.run-actions {
  display: flex;
  gap: var(--spacing-sm);
}

.run-action-btn {
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  color: var(--color-text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.run-action-btn:hover:not(:disabled) {
  background: var(--color-bg);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

.run-action-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}
/* Shared by WebhookInstructions + McpInstructions — API / MCP docs on Settings */

.webhook-instructions {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xl);
  max-width: 52rem;
}

.webhook-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.webhook-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 var(--spacing-xs);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.webhook-section-title::before {
  content: '';
  width: 3px;
  height: 1.15em;
  border-radius: 2px;
  background: var(--color-primary);
  flex-shrink: 0;
}

.webhook-endpoint,
.mcp-tool {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: var(--spacing-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.webhook-endpoint:hover,
.mcp-tool:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}

.webhook-endpoint-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 var(--spacing-md);
  line-height: 1.3;
}

.webhook-method-url {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
}

.webhook-method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 52px;
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.webhook-method.post {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: 1px solid var(--color-border);
}

.webhook-method.get {
  background: var(--color-info-light);
  color: var(--color-info);
  border: 1px solid rgba(13, 148, 136, 0.2);
}

.webhook-method.delete {
  background: var(--color-danger-light);
  color: var(--color-danger);
  border: 1px solid rgba(201, 53, 69, 0.2);
}

.webhook-method.patch {
  background: var(--color-warning-light);
  color: var(--color-warning);
  border: 1px solid rgba(217, 119, 6, 0.2);
}

.webhook-url {
  font-size: 13px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--color-text-primary);
  word-break: break-all;
  line-height: 1.45;
}

.webhook-description {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-md);
  line-height: 1.55;
}

.webhook-description:last-child {
  margin-bottom: 0;
}

.webhook-description code {
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  background: var(--color-primary-light);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border-light);
}

.webhook-body-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-muted);
  margin: 0 0 var(--spacing-sm);
}

.webhook-body-label-spaced {
  margin-top: var(--spacing-md);
}

.webhook-code {
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: var(--color-text-primary);
  overflow-x: auto;
  line-height: 1.6;
  white-space: pre;
  margin: 0 0 var(--spacing-md);
}

.webhook-endpoint .webhook-code:last-child,
.mcp-tool .webhook-code:last-child {
  margin-bottom: 0;
}
.webhook-events-feed {
  margin-top: var(--spacing-sm);
  max-width: 56rem;
}

.webhook-events-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  width: 100%;
  text-align: left;
  padding: var(--spacing-md) var(--spacing-lg);
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  cursor: pointer;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.webhook-events-toggle:hover {
  background: var(--color-bg-secondary);
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}

.webhook-events-toggle-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-tertiary);
  font-size: 10px;
  color: var(--color-text-secondary);
  flex-shrink: 0;
}

.webhook-events-list {
  margin-top: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  max-height: 480px;
  overflow-y: auto;
  background: var(--color-surface);
  box-shadow: var(--shadow-sm);
}

.webhook-events-loading,
.webhook-events-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-muted);
  font-size: 14px;
}

.webhook-events-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  font-size: 14px;
  font-weight: 500;
}

.webhook-events-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

.webhook-events-table th {
  font-size: 10px;
  font-weight: 700;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-secondary);
  padding: 10px 12px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 2;
}

.webhook-events-table th:not(:last-child),
.webhook-events-table td:not(:last-child) {
  border-right: 1px solid var(--color-border-light);
}

.webhook-events-table td {
  border-bottom: 1px solid var(--color-border-light);
  padding: 10px 12px;
  vertical-align: top;
}

.webhook-events-table tbody tr:hover td {
  background: var(--color-bg-hover);
}

.webhook-events-table tbody tr:last-child td {
  border-bottom: none;
}

.event-time {
  white-space: nowrap;
  color: var(--color-text-muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.event-type-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-sm);
  background: var(--color-sidebar-bg);
  color: var(--color-text-secondary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.event-type-container {
  background: var(--color-info-light);
  color: var(--color-info);
}

.event-type-message {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.event-type-task {
  background: var(--color-partial-bg);
  color: var(--color-partial);
}

.event-type-log {
  background: var(--color-bg-tertiary);
  color: var(--color-text-muted);
}

.event-type-error {
  background: var(--color-fail-bg);
  color: var(--color-fail);
}

.event-container {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--color-text-secondary);
  word-break: break-all;
}

.event-run-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--color-primary);
  text-decoration: none;
}

.event-run-link:hover {
  text-decoration: underline;
}

.event-no-run {
  color: var(--color-text-disabled);
  font-size: 12px;
}

.event-data-text {
  font-size: 12px;
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.event-data-log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 11px;
  color: var(--color-text-muted);
  word-break: break-word;
}
.settings-page {
  display: flex;
  min-height: 100vh;
}

.settings-main {
  max-width: 56rem;
}

.settings-section {
  margin-bottom: var(--spacing-xl);
}

.settings-section:last-of-type {
  margin-bottom: 0;
}

.settings-section-title {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.03em;
  line-height: 1.25;
  margin: 0 0 var(--spacing-sm);
}

.settings-section-description {
  font-size: 14px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-lg);
  line-height: 1.55;
  max-width: 48rem;
}
.failure-detail-page {
  display: flex;
  min-height: 100vh;
}

.failure-detail-main {
  max-width: 56rem;
}

[data-testid="failure-detail-sections"] {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.failure-detail-loading,
.failure-detail-not-found {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.failure-detail-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.failure-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.failure-detail-header-actions {
  flex-shrink: 0;
}

.failure-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
  min-width: 0;
}

.failure-detail-back {
  font-size: 13px;
  color: var(--color-text-muted);
}

.failure-detail-back:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.failure-detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
}

@media (max-width: 640px) {
  .failure-detail-title {
    font-size: 20px;
  }
}

.failure-detail-ids {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  flex-wrap: wrap;
}

.failure-detail-short-id {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-primary);
  background: var(--color-primary-light, rgba(34, 84, 61, 0.08));
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  cursor: pointer;
  border: none;
}

.failure-detail-short-id:hover {
  background: var(--color-primary-light, rgba(34, 84, 61, 0.15));
}

.short-id-edit {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
}

.short-id-input {
  font-size: 14px;
  font-family: monospace;
  font-weight: 600;
  padding: 2px 8px;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-sm);
  width: 80px;
  color: var(--color-primary);
  background: var(--color-surface);
}

.short-id-save-btn,
.short-id-cancel-btn {
  font-size: 12px;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  border: 1px solid var(--color-border);
}

.short-id-save-btn {
  background: var(--color-primary);
  color: var(--color-on-primary);
  border-color: var(--color-primary);
}

.short-id-cancel-btn {
  background: var(--color-surface);
  color: var(--color-text-secondary);
}

.failure-detail-id {
  font-size: 12px;
  color: var(--color-text-muted);
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
}

.failure-detail-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

.failure-detail-tag {
  display: inline-block;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-badge-completed-text);
  background: var(--color-badge-completed);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.failure-detail-tag.editable {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.failure-detail-tag-remove {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 11px;
  color: inherit;
  opacity: 0.6;
  padding: 0 2px;
  line-height: 1;
}

.failure-detail-tag-remove:hover {
  opacity: 1;
}

.failure-detail-tag-input {
  font-size: 12px;
  padding: 2px 6px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  width: 120px;
}

.failure-detail-no-tags {
  font-size: 12px;
  color: var(--color-text-muted);
}

.failure-detail-edit-tags-btn {
  font-size: 11px;
  padding: 2px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: none;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.failure-detail-edit-tags-btn:hover {
  background: var(--color-bg-secondary);
}

.failure-detail-delete-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-danger);
  background: var(--color-surface);
  color: var(--color-danger);
  cursor: pointer;
}

.failure-detail-delete-btn:hover {
  background: var(--color-danger-light);
}

.failure-detail-meta {
  display: flex;
  gap: var(--spacing-xl);
  flex-wrap: wrap;
  padding: var(--spacing-md) var(--spacing-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.failure-detail-meta-row {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
  min-width: 8rem;
}

.meta-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.meta-value {
  font-size: 14px;
  color: var(--color-text-primary);
}

.failure-detail-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.failure-detail-section:not(.failure-detail-stage) {
  padding: var(--spacing-lg);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.failure-detail-section:not(.failure-detail-stage):hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}

.failure-detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.failure-detail-section:not(.failure-detail-stage) > .failure-detail-section-title {
  font-size: 1.125rem;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.02em;
  margin: 0 0 var(--spacing-md);
  padding-bottom: var(--spacing-sm);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.failure-detail-section:not(.failure-detail-stage) > .failure-detail-section-title::before {
  content: '';
  width: 3px;
  height: 1.15em;
  border-radius: 2px;
  background: var(--color-primary);
  flex-shrink: 0;
}

.failure-detail-repo a {
  font-size: 14px;
  word-break: break-all;
  color: var(--color-text-link);
  text-decoration: none;
  font-weight: 500;
}

.failure-detail-repo a:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

.failure-detail-test-file-row {
  margin-top: var(--spacing-sm);
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--spacing-sm);
}

.meta-link,
.resource-link {
  color: var(--color-text-link);
  font-weight: 500;
  text-decoration: none;
}

.meta-link:hover,
.resource-link:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

.failure-detail-changesets {
  display: flex;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.changeset-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.changeset-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.changeset-value {
  font-size: 13px;
  color: var(--color-text-primary);
  background: var(--color-bg-tertiary);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border-light);
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  word-break: break-all;
}

.failure-detail-pre {
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  color: var(--color-text-primary);
}

.refined-steps-list {
  list-style: none;
  counter-reset: step;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.refined-steps-item {
  counter-increment: step;
  display: flex;
  align-items: flex-start;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) var(--spacing-md);
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  font-size: 13px;
  line-height: 1.5;
  color: var(--color-text-primary);
}

.refined-steps-item::before {
  content: counter(step);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-on-primary);
  font-size: 12px;
  font-weight: 600;
  flex-shrink: 0;
  margin-top: 1px;
}

.refined-steps-description {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.refined-steps-link {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--color-accent);
  text-decoration: none;
  white-space: nowrap;
  margin-left: var(--spacing-sm);
}

.refined-steps-link:hover {
  text-decoration: underline;
}

.refined-steps-empty {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
  padding: var(--spacing-sm) 0;
}

.rca-step-content {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rca-evidence-row {
  margin-top: 4px;
  margin-left: 8px;
}

.rca-evidence-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 12px;
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  text-align: left;
  width: 100%;
}

.rca-evidence-toggle:hover {
  color: var(--color-text-primary);
}

.rca-evidence-label {
  font-family: var(--font-mono);
  word-break: break-all;
}

.rca-evidence-detail {
  margin: 4px 0 4px 20px;
  padding: 8px;
  background: var(--color-bg-secondary, #1a1a2e);
  border-radius: 4px;
  font-size: 12px;
  font-family: var(--font-mono);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 400px;
  overflow: auto;
}

.rca-evidence-empty {
  font-style: italic;
  color: var(--color-text-secondary);
}

.rca-judges {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rca-judge-item {
  display: flex;
  flex-direction: column;
}

.rca-judge-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--color-text-primary);
}

.rca-judge-toggle:hover {
  opacity: 0.8;
}

.rca-judge-verdict {
  font-weight: 600;
  font-size: 12px;
  padding: 1px 6px;
  border-radius: 3px;
}

.rca-judge-accept {
  background: var(--color-success-bg, #1a3a1a);
  color: var(--color-success, #4ade80);
}

.rca-judge-reject {
  background: var(--color-error-bg, #3a1a1a);
  color: var(--color-error, #f87171);
}

.rca-judge-name {
  color: var(--color-text-secondary);
}

.failure-detail-hint {
  font-size: 12px;
  color: var(--color-text-secondary);
  margin: 0 0 var(--spacing-sm) 0;
}

.failure-detail-results-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.failure-detail-section:not(.failure-detail-stage) .failure-detail-results-table {
  box-shadow: none;
}

.failure-detail-results-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  padding: 10px 12px;
  text-align: left;
}

.failure-detail-results-table td {
  font-size: 13px;
  border-bottom: 1px solid var(--color-border-light);
  padding: 10px 12px;
  vertical-align: middle;
}

.failure-detail-results-table tbody tr:last-child td {
  border-bottom: none;
}

.failure-detail-results-table tbody tr:hover td {
  background: var(--color-surface);
}

.result-agent-cell {
  font-weight: 600;
  color: var(--color-text-primary);
}

.result-run-cell {
  max-width: 12rem;
  min-width: 0;
}

.result-run-link {
  display: block;
  max-width: 100%;
  font-size: 13px;
  color: var(--color-text-link);
  font-weight: 500;
  text-decoration: none;
}

.result-run-link:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

.result-run-link-text {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.result-status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
}

.result-status-badge.pass {
  background: var(--color-pass-bg);
  color: var(--color-pass);
}

.result-status-badge.fail {
  background: var(--color-fail-bg);
  color: var(--color-fail);
}

.result-status-badge.dsq {
  background: var(--color-badge-queued);
  color: var(--color-badge-queued-text);
}

.result-status-badge.disagree {
  background: var(--color-violet-light);
  color: var(--color-violet);
}

/* Assessment Editing */
.assessment-display {
  position: relative;
}

.assessment-edit-btn {
  margin-top: var(--spacing-sm);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.assessment-edit-btn:hover {
  background: var(--color-sidebar-bg);
  color: var(--color-text-primary);
}

.assessment-edit-textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--spacing-md);
  font-size: 13px;
  font-family: monospace;
  line-height: 1.6;
  border: 1px solid var(--color-primary);
  border-radius: var(--radius-md);
  background: var(--color-surface);
  color: var(--color-text-primary);
  resize: vertical;
}

.assessment-edit-actions {
  display: flex;
  gap: var(--spacing-sm);
  margin-top: var(--spacing-sm);
}

.assessment-edit-save {
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
}

.assessment-edit-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.assessment-edit-cancel {
  padding: 4px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
}

/* Clean Branch Section */
.clean-branch-content {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.clean-branch-info {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.clean-branch-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.clean-branch-row--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: var(--spacing-xs);
}

.clean-branch-row--stack > dd {
  width: 100%;
  margin: 0;
}

.clean-branch-description {
  font-size: 13px;
  color: var(--color-text-secondary);
  margin: 0;
}

.clean-branch-empty {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.clean-branch-button {
  align-self: flex-start;
  padding: 6px 14px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-primary);
  background: var(--color-primary);
  color: var(--color-on-primary);
  cursor: pointer;
}

.clean-branch-button:hover {
  opacity: 0.9;
}

.clean-branch-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.clean-error-text {
  color: var(--color-danger, #dc3545);
  font-size: 13px;
  word-break: break-word;
}

.model-output-text {
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-light);
  padding: var(--spacing-md);
  border-radius: var(--radius-md);
  margin: 0;
  max-height: 400px;
  overflow-y: auto;
  color: var(--color-text-primary);
}

.failure-detail-code {
  font-size: 13px;
  font-family: "SF Mono", "Fira Code", "Fira Mono", Menlo, Consolas, monospace;
  padding: 4px 10px;
  background: var(--color-bg-tertiary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-sm);
  color: var(--color-text-primary);
}

.clean-status-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 10px;
  text-transform: capitalize;
}

.clean-status--running {
  background: var(--color-badge-running, #e8f0fe);
  color: var(--color-badge-running-text, #1967d2);
}

.clean-status--completed {
  background: var(--color-pass-bg);
  color: var(--color-pass);
}

.clean-status--failed {
  background: var(--color-fail-bg);
  color: var(--color-fail);
}

/* Clean Events */
.clean-events-section {
  margin-top: var(--spacing-sm);
}

.clean-events-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: none;
  border: none;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 0;
}

.clean-events-toggle:hover {
  color: var(--color-primary);
}

.clean-events-toggle-icon {
  font-size: 10px;
}

.clean-events-list {
  margin-top: var(--spacing-sm);
}

.clean-events-loading,
.clean-events-empty {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: var(--spacing-sm) 0;
}

.clean-events-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  overflow: hidden;
  font-size: 12px;
}

.clean-events-table th {
  font-size: 11px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg-tertiary);
  padding: 8px 12px;
  text-align: left;
  position: sticky;
  top: 0;
  z-index: 1;
}

.clean-events-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border-light);
  vertical-align: top;
}

.clean-events-table tbody tr:hover td {
  background: var(--color-surface);
}

.clean-events-table tbody tr:last-child td {
  border-bottom: none;
}

.clean-attempt-section {
  margin-bottom: 16px;
}

.clean-attempt-section:last-child {
  margin-bottom: 0;
}

.clean-attempt-heading {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  gap: 8px;
}

.clean-attempt-container {
  font-size: 11px;
  font-weight: 400;
  color: var(--color-text-muted);
}


.clean-attempts-list {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.clean-attempt-item {
  display: flex;
  flex-direction: column;
}

.clean-attempt-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  background: none;
  border: none;
  font-size: 13px;
  color: var(--color-text-secondary);
  cursor: pointer;
  padding: 4px 0;
}

.clean-attempt-toggle:hover {
  color: var(--color-primary);
}

.clean-attempt-events {
  margin-top: var(--spacing-sm);
  padding-left: var(--spacing-md);
  border-left: 2px solid var(--color-border);
}

/* Stage Section Collapsible Toggle */
.failure-detail-stage {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--color-surface);
  padding: 0;
  gap: 0;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.failure-detail-stage:hover {
  border-color: var(--color-border-hover);
  box-shadow: var(--shadow-md);
}

.stage-section-header {
  display: flex;
  align-items: center;
  border-bottom: 1px solid var(--color-border-light);
}

.stage-section-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  background: none;
  border: none;
  cursor: pointer;
  padding: var(--spacing-md) var(--spacing-lg);
  flex: 1;
  text-align: left;
  border-radius: var(--radius-lg);
  transition: background-color 0.1s ease;
}

.stage-refresh-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-right: var(--spacing-md);
  flex-shrink: 0;
  transition: background-color 0.15s ease, color 0.15s ease;
}

.stage-refresh-btn:hover {
  background: var(--color-sidebar-bg);
  color: var(--color-text-primary);
}

.stage-refresh-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.stage-refresh-icon {
  font-size: 18px;
  line-height: 1;
}

.stage-refresh-icon.spinning {
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.stage-section-toggle:hover {
  background: rgba(50, 45, 35, 0.03);
}

.stage-section-toggle:hover .failure-detail-section-title {
  color: var(--color-primary);
}

.stage-section-toggle .failure-detail-section-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  transition: color 0.15s ease;
  flex: 1;
}

.stage-section-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--radius-sm);
  font-size: 10px;
  line-height: 1;
  color: var(--color-text-secondary);
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border-light);
  flex-shrink: 0;
  transition: transform 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.failure-detail-stage .failure-detail-hint {
  margin: 0;
  padding: var(--spacing-sm) var(--spacing-lg) var(--spacing-md);
  line-height: 1.5;
  border-bottom: 1px solid var(--color-border-light);
  background: var(--color-bg-secondary);
}

.failure-detail-stage .clean-branch-content {
  padding: var(--spacing-md) var(--spacing-lg) var(--spacing-lg);
}

/* Pipeline status */
.failure-detail-pipeline-status {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.failure-detail-pipeline-items {
  display: flex;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.failure-detail-pipeline-item {
  display: flex;
  align-items: center;
  gap: var(--spacing-xs);
  font-size: 14px;
}

.failure-detail-pipeline-label {
  font-weight: 600;
  color: var(--color-text-secondary);
}

.failure-detail-pipeline-value {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.failure-detail-pipeline-value.running {
  background: var(--color-warning-light, #fef3c7);
  color: var(--color-warning, #d97706);
}

.failure-detail-pipeline-value.completed {
  background: var(--color-pass-light, #d1fae5);
  color: var(--color-pass, #059669);
}

.failure-detail-pipeline-value.failed {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.failure-detail-pipeline-error {
  font-size: 12px;
  color: var(--color-danger);
}

/* Failure Run Results Table */
.failure-detail-run-results-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.failure-detail-run-results-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-sidebar-bg);
  padding: 8px 12px;
  text-align: left;
}

.failure-detail-run-results-table td {
  font-size: 13px;
  border-bottom: 1px solid var(--color-border-light);
  padding: 8px 12px;
}

.failure-detail-run-results-table tbody tr:last-child td {
  border-bottom: none;
}

.failure-run-status {
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
}

.failure-run-status.pass {
  background: var(--color-pass-light, #d1fae5);
  color: var(--color-pass, #059669);
}

.failure-run-status.fail {
  background: var(--color-danger-light);
  color: var(--color-danger);
}

.failure-run-status.dsq {
  background: var(--color-warning-light, #fef3c7);
  color: var(--color-warning, #d97706);
}

.failure-run-status.disagree {
  background: var(--color-violet-light);
  color: var(--color-violet);
}

.additional-root-causes-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.additional-root-cause-item .failure-detail-pre {
  margin: 0;
}
.agent-detail-page {
  display: flex;
  min-height: 100vh;
}

.agent-detail-loading,
.agent-detail-not-found {
  text-align: center;
  padding: var(--spacing-xl) 0;
  color: var(--color-text-secondary);
  font-size: 14px;
}

.agent-detail-error {
  text-align: center;
  padding: var(--spacing-lg);
  color: var(--color-danger);
  background: var(--color-danger-light);
  border-radius: var(--radius-md);
  font-size: 14px;
}

.agent-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--spacing-md);
}

.agent-detail-header-left {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-xs);
}

.agent-detail-back {
  font-size: 13px;
  color: var(--color-text-muted);
}

.agent-detail-back:hover {
  color: var(--color-primary);
  text-decoration: none;
}

.agent-detail-title {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
}

@media (max-width: 640px) {
  .agent-detail-title {
    font-size: 20px;
  }
}

.agent-detail-name-input {
  font-size: 24px;
  font-weight: 700;
  color: var(--color-text-primary);
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}

.agent-detail-header-actions {
  display: flex;
  gap: var(--spacing-sm);
  align-items: center;
}

.agent-detail-edit-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-primary);
  background: var(--color-surface);
  color: var(--color-primary);
  cursor: pointer;
}

.agent-detail-edit-btn:hover {
  background: var(--color-primary);
  color: var(--color-on-primary);
}

.agent-detail-save-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-pass);
  background: var(--color-pass);
  color: var(--color-on-primary);
  cursor: pointer;
}

.agent-detail-save-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.agent-detail-cancel-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text-secondary);
  cursor: pointer;
}

.agent-detail-delete-btn {
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 500;
  border: 1px solid var(--color-danger);
  background: var(--color-surface);
  color: var(--color-danger);
  cursor: pointer;
}

.agent-detail-delete-btn:hover {
  background: var(--color-danger-light);
}

.agent-detail-meta {
  display: flex;
  gap: var(--spacing-lg);
  flex-wrap: wrap;
}

.agent-detail-meta-row {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.agent-detail-section {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-sm);
}

.agent-detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
}

.agent-detail-code {
  font-size: 13px;
  color: var(--color-text-primary);
  background: var(--color-sidebar-bg);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  font-family: monospace;
  display: inline-block;
}

.agent-detail-field-input {
  font-size: 13px;
  color: var(--color-text-primary);
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  font-family: monospace;
}

.agent-detail-textarea {
  font-size: 13px;
  color: var(--color-text-primary);
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  font-family: monospace;
  line-height: 1.6;
  resize: vertical;
}

.agent-detail-pre {
  background: var(--color-sidebar-bg);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: var(--spacing-md);
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  color: var(--color-text-primary);
}

.agent-detail-results-table {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.agent-detail-results-table th {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-sidebar-bg);
}

.agent-detail-results-table td {
  font-size: 13px;
  border-bottom: 1px solid var(--color-border-light);
}

.agent-detail-results-table tbody tr:last-child td {
  border-bottom: none;
}

.agent-detail-enabled-toggle {
  display: flex;
  align-items: center;
}

.agent-detail-enabled-toggle label {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  font-size: 14px;
  color: var(--color-text-secondary);
  cursor: pointer;
}

.agent-detail-enabled-toggle input[type="checkbox"] {
  cursor: pointer;
}
.processing-page {
  display: flex;
  min-height: 100vh;
}

.processing-header {
  margin-bottom: 0;
}

.processing-toggles {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: 0;
  flex-wrap: wrap;
}


.processing-toggle {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  cursor: pointer;
  font-size: 13px;
  color: var(--color-text-secondary);
  user-select: none;
}

.processing-toggle-input {
  accent-color: var(--color-primary);
}

.processing-toggle-label {
  font-weight: 500;
}

.processing-section {
  margin-bottom: var(--spacing-lg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  background: var(--color-surface);
}

.processing-section-header {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: 10px var(--spacing-md);
  cursor: pointer;
  user-select: none;
  border-radius: var(--radius-md);
  margin-bottom: var(--spacing-sm);
}

.processing-section-header:hover {
  background: rgba(50, 45, 35, 0.03);
}

.processing-section-header.processing-section-header--sticky {
  position: sticky;
  top: var(--processing-section-sticky-top, 180px);
  z-index: 35;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border-light);
  box-shadow: 0 6px 12px -8px rgba(10, 10, 10, 0.08);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
}

.processing-section-header.processing-section-header--sticky:hover {
  background: var(--color-surface);
}

.processing-section-chevron {
  display: flex;
  align-items: center;
  color: var(--color-text-muted);
  transition: transform 0.15s ease;
}

.processing-section-chevron.expanded {
  transform: rotate(90deg);
}

.processing-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  flex: 1;
}

.processing-section-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  background: var(--color-border-light);
  color: var(--color-text-muted);
}

.processing-section-badge.has-items {
  background: var(--color-primary-light);
  color: var(--color-primary);
}

.processing-section-badge.running {
  background: var(--color-badge-running);
  color: var(--color-badge-running-text);
}

.processing-section-info {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-left: auto;
  padding-right: var(--spacing-sm);
}

.processing-section-content {
  padding: 0 var(--spacing-md) var(--spacing-md);
}

.processing-subsection-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin: var(--spacing-sm) 0 var(--spacing-xs);
  padding-bottom: var(--spacing-xs);
  border-bottom: 1px solid var(--color-border-light);
}

.processing-subsection-title:first-child {
  margin-top: 0;
}

.processing-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

/*
 * Each <li> is its own grid. If the last column used max-content, its width would differ
 * per row and the 1fr title column would absorb the difference — shifting the status column.
 * Fixed-width time column keeps ID | title | status | time aligned across all rows.
 */
.processing-list-item {
  display: grid;
  grid-template-columns: 6.5rem minmax(0, 1fr) 7.5rem 17rem;
  align-items: center;
  column-gap: var(--spacing-md);
  row-gap: var(--spacing-xs);
  padding: 8px 0;
  border-bottom: 1px solid var(--color-border-light);
  font-size: 13px;
  color: var(--color-text-secondary);
}

.processing-list-item--run-row {
  grid-template-columns: minmax(5rem, 10rem) minmax(0, 1fr) minmax(4rem, 8rem) 7.5rem 17rem;
}

.processing-list-item:last-child {
  border-bottom: none;
}

.processing-list-short-id {
  font-weight: 600;
  color: var(--color-text-primary);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.processing-list-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.processing-list-status {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  justify-self: start;
  max-width: 100%;
  text-align: center;
  white-space: nowrap;
}

.processing-list-status.running {
  background: var(--color-badge-running);
  color: var(--color-badge-running-text);
}

.processing-list-status.completed {
  background: var(--color-badge-completed);
  color: var(--color-badge-completed-text);
}

.processing-list-status.failed {
  background: var(--color-badge-failed);
  color: var(--color-badge-failed-text);
}

.processing-list-time {
  font-size: 12px;
  color: var(--color-text-muted);
  white-space: nowrap;
  justify-self: stretch;
  text-align: right;
  font-variant-numeric: tabular-nums;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}

.processing-list-error {
  grid-column: 1 / -1;
  font-size: 12px;
  color: var(--color-danger);
  line-height: 1.4;
  word-break: break-word;
}

.processing-empty {
  font-size: 13px;
  color: var(--color-text-muted);
  padding: var(--spacing-sm) 0;
}

.processing-list-link {
  text-decoration: none;
  color: inherit;
}

.processing-list-link:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.processing-list-row-link {
  display: contents;
  text-decoration: none;
  color: inherit;
}

.processing-list-row-link:hover .processing-list-short-id,
.processing-list-row-link:hover .processing-list-title {
  color: var(--color-primary);
}

.processing-list-item:has(.processing-list-row-link:focus-visible) {
  outline: 2px solid var(--color-primary);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

.processing-section-badge.failed {
  background: var(--color-badge-failed);
  color: var(--color-badge-failed-text);
}

.processing-actions {
  margin-bottom: 12px;
}

.processing-section-reset-btn {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 10px;
  border-radius: 10px;
  border: 1px solid var(--color-badge-failed);
  background: transparent;
  color: var(--color-badge-failed-text);
  cursor: pointer;
  white-space: nowrap;
}

.processing-section-reset-btn:hover {
  background: var(--color-badge-failed);
}

.processing-log-summary {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-bottom: var(--spacing-sm);
}

.processing-list-status.pass {
  background: var(--color-badge-completed);
  color: var(--color-badge-completed-text);
}

.processing-list-status.fail {
  background: var(--color-badge-failed);
  color: var(--color-badge-failed-text);
}

.processing-list-status.dsq {
  background: var(--color-border-light);
  color: var(--color-text-muted);
}

.processing-list-status.disagree {
  background: var(--color-violet-light);
  color: var(--color-violet);
}

.processing-list-status.validating {
  background: var(--color-badge-running);
  color: var(--color-badge-running-text);
}
.resources-page {
  display: flex;
  min-height: 100vh;
}

.resources-status-cards {
  display: flex;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.resources-card {
  flex: 1;
  min-width: 200px;
  padding: var(--spacing-md);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-secondary);
}

.resources-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--spacing-sm);
}

.resources-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin: 0;
}

.resources-card-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--color-bg-primary);
  color: var(--color-text-secondary);
}

.resources-card-badge.active {
  background: var(--color-bg-info);
  color: var(--color-text-primary);
}

.resources-card-controls {
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
}

.resources-limit-label {
  font-size: 13px;
  color: var(--color-text-secondary);
}

.resources-limit-input {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-size: 14px;
  text-align: center;
}

.resources-limit-btn {
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-secondary);
  color: var(--color-text-primary);
  font-size: 13px;
  cursor: pointer;
}

.resources-limit-btn:hover:not(:disabled) {
  background: var(--color-bg-hover);
}

.resources-limit-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.resources-section {
  margin-bottom: var(--spacing-xl);
}

.resources-section-header {
  position: sticky;
  top: var(--resources-section-sticky-top, 200px);
  z-index: 35;
  display: flex;
  align-items: center;
  gap: var(--spacing-sm);
  padding: var(--spacing-sm) 0;
  margin-bottom: var(--spacing-md);
  border-bottom: 1px solid var(--color-border);
  background: var(--color-bg);
  box-shadow: 0 6px 12px -8px rgba(10, 10, 10, 0.08);
  cursor: pointer;
  user-select: none;
}

.resources-section-title {
  font-size: 16px;
  font-weight: 600;
  margin: 0;
}

.resources-actions {
  display: flex;
  align-items: center;
  gap: var(--spacing-md);
  margin-bottom: var(--spacing-lg);
  flex-wrap: wrap;
}

.resources-filters {
  display: flex;
  gap: var(--spacing-sm);
  margin-bottom: var(--spacing-md);
  flex-wrap: wrap;
}

.resources-filter-select {
  padding: 6px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-primary);
  color: var(--color-text-primary);
  font-size: 13px;
}

.resources-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: fixed;
}

.resources-table th {
  text-align: left;
  padding: 8px 12px;
  border-bottom: 2px solid var(--color-border);
  color: var(--color-text-secondary);
  font-weight: 600;
  white-space: nowrap;
}

.resources-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.resources-table tr:hover {
  background: var(--color-bg-hover);
}

.resource-status-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}

.resource-status-badge.pending {
  background: var(--color-bg-warning);
  color: var(--color-text-warning);
}

.resource-status-badge.running {
  background: var(--color-bg-info);
  color: var(--color-text-info);
}

.resource-status-badge.stopped {
  background: var(--color-bg-success);
  color: var(--color-text-success);
}

.resource-status-badge.failed {
  background: var(--color-bg-error);
  color: var(--color-text-error);
}

.resource-status-badge.pass {
  background: var(--color-bg-success);
  color: var(--color-text-success);
}

.resource-status-badge.fail {
  background: var(--color-bg-error);
  color: var(--color-text-error);
}

.resource-status-badge.dsq {
  background: var(--color-bg-warning);
  color: var(--color-text-warning);
}

.resource-status-badge.disagree {
  background: var(--color-bg-tertiary);
  color: var(--color-text-secondary);
}

.resource-purpose-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
}

.resource-name-cell {
  font-family: monospace;
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-task-cell {
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-error-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--color-text-error);
  font-size: 12px;
}

.resource-link {
  color: var(--color-text-link);
  text-decoration: none;
}

.resource-link:hover {
  text-decoration: underline;
}

.resources-reap-button {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
  cursor: pointer;
  margin-left: auto;
}

.resources-reap-button:hover:not(:disabled) {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.resources-reap-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.resources-reap-result {
  font-size: 12px;
  color: var(--color-text-muted);
}

.resources-empty {
  text-align: center;
  padding: var(--spacing-xl);
  color: var(--color-text-secondary);
}

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

.resource-row.expanded {
  background: var(--color-bg-secondary);
}

.resource-toggle-cell {
  width: 28px;
  text-align: center;
  color: var(--color-text-secondary);
}

.resource-toggle-icon {
  display: inline-block;
  transition: transform 0.15s ease;
}

.resource-toggle-icon.open {
  transform: rotate(90deg);
}

/* Events panel */
.resource-events-row td {
  padding: 0 !important;
  border-bottom: 2px solid var(--color-border);
}

.resource-events-panel {
  padding: 12px 16px 12px 40px;
  background: var(--color-bg-primary);
  border-top: 1px solid var(--color-border);
}

.resource-events-header {
  font-size: 12px;
  font-weight: 600;
  color: var(--color-text-secondary);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.resource-events-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.resource-events-table th {
  text-align: left;
  padding: 4px 8px;
  color: var(--color-text-secondary);
  font-weight: 600;
  font-size: 11px;
  border-bottom: 1px solid var(--color-border);
}

.resource-events-table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.resource-event-time {
  white-space: nowrap;
  color: var(--color-text-secondary);
  font-family: monospace;
  font-size: 11px;
}

.resource-event-type-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 500;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
}

.resource-event-type-error {
  background: var(--color-bg-error);
  color: var(--color-text-error);
}

.resource-event-type-container {
  background: var(--color-bg-info);
  color: var(--color-text-info);
}

.resource-event-type-task {
  background: var(--color-bg-warning);
  color: var(--color-text-warning);
}

.resource-event-data {
  color: var(--color-text-primary);
  max-width: 400px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.resource-events-empty {
  font-size: 12px;
  color: var(--color-text-secondary);
  padding: 8px 0;
}

/* Unified timeline */
.resource-timeline {
  max-height: 500px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
  font-size: 12px;
}

.timeline-entry {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 3px 4px;
  border-radius: 3px;
}

.timeline-entry:hover {
  background: var(--color-bg-hover);
}

.timeline-time {
  flex-shrink: 0;
  min-width: 130px;
  font-family: monospace;
  font-size: 11px;
  color: var(--color-text-secondary);
}

.timeline-type-badge {
  flex-shrink: 0;
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 500;
  min-width: 70px;
  text-align: center;
  background: var(--color-bg-secondary);
  color: var(--color-text-secondary);
}

.timeline-type-log {
  background: transparent;
  color: var(--color-text-secondary);
  font-weight: 400;
}

.timeline-type-task-started {
  background: var(--color-bg-warning);
  color: var(--color-text-warning);
}

.timeline-type-task-done {
  background: var(--color-bg-success);
  color: var(--color-text-success);
}

.timeline-type-task-failed {
  background: var(--color-bg-error);
  color: var(--color-text-error);
}

/* Log entries */
.timeline-log {
  font-family: monospace;
  font-size: 11px;
}

.timeline-log-text {
  color: var(--color-text-primary);
  white-space: pre-wrap;
  word-break: break-all;
}

/* Task entries */
.timeline-task {
  flex-direction: column;
  gap: 4px;
  padding: 8px;
  background: var(--color-bg-secondary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  margin: 4px 0;
}

.timeline-task-header {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}


.timeline-task-json {
  margin: 4px 0 0 0;
  padding: 8px;
  background: var(--color-bg-primary);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius);
  font-family: monospace;
  font-size: 11px;
  line-height: 1.4;
  color: var(--color-text-primary);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
}

/* Other event entries */
.timeline-event-data {
  color: var(--color-text-primary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-content-footer {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-current-width);
  right: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  align-items: center;
  box-sizing: border-box;
  min-height: var(--app-footer-height);
  padding-bottom: env(safe-area-inset-bottom, 0px);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
}

.app-content-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: var(--spacing-sm) var(--spacing-md);
  min-height: var(--app-footer-height);
  box-sizing: border-box;
}

.app-content-footer-logo {
  display: block;
  flex-shrink: 0;
}

.app-content-footer-brand {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: -0.02em;
}

.app-content-footer-dot {
  font-size: 13px;
  color: var(--color-text-muted);
  line-height: 1;
  user-select: none;
}

.app-content-footer-copy {
  font-size: 13px;
  color: var(--color-text-muted);
}


/* Design tokens aligned with nut.new / Replay UI (neutral surfaces, rose brand, dark primary actions) */

:root {
  /* Surfaces */
  --color-bg: #f9fafb;
  --color-surface: #ffffff;
  --color-sidebar-bg: #fafafa;
  --color-border: #e5e5e5;
  --color-border-light: #f5f5f5;
  --color-border-hover: #d4d4d4;

  /* Typography */
  --color-text: #0a0a0a;
  --color-text-primary: #0a0a0a;
  --color-text-secondary: #404040;
  --color-text-muted: #737373;
  --color-text-disabled: #a3a3a3;
  --color-text-link: #e11d48;
  --color-text-info: #0f766e;
  --color-text-success: #047857;
  --color-text-warning: #b45309;
  --color-text-error: #a92739;

  /* Brand accent (logo, links, highlights) — rose-600 */
  --color-brand: #e11d48;
  --color-brand-hover: #be123c;
  --color-brand-light: #fff1f2;

  /* Primary actions — neutral-900 (dark button) */
  --color-primary: #171717;
  --color-primary-hover: #262626;
  --color-primary-light: rgba(23, 23, 23, 0.08);
  --color-primary-subtle: rgba(23, 23, 23, 0.1);
  --color-on-primary: #fafafa;

  /* Semantic accent (e.g. tabs, secondary CTAs) */
  --color-accent: #e11d48;

  /* Danger / destructive — red-600 */
  --color-danger: #c93545;
  --color-danger-hover: #a92739;
  --color-danger-light: #fdf4f3;
  --color-error: #c93545;

  /* Status */
  --color-pass: #059669;
  --color-pass-bg: #ecfdf5;
  --color-pass-light: #d1fae5;
  --color-fail: #c93545;
  --color-fail-bg: #fdf4f3;
  --color-partial: #d97706;
  --color-partial-bg: #fffbeb;

  --color-bar-high: #059669;
  --color-bar-medium: #d97706;
  --color-bar-low: #c93545;

  /* Info — teal */
  --color-info: #0d9488;
  --color-info-light: #f0fdfa;

  --color-warning: #d97706;
  --color-warning-light: #fef3c7;

  /* Layered backgrounds (tables, panels) */
  --color-bg-primary: #ffffff;
  --color-bg-secondary: #f9fafb;
  --color-bg-tertiary: #f3f4f6;
  --color-bg-hover: #f5f5f5;
  --color-bg-info: #ecfeff;
  --color-bg-warning: #fffbeb;
  --color-bg-success: #ecfdf5;
  --color-bg-error: #fdf4f3;

  /* Badges */
  --color-badge-security: #f0fdfa;
  --color-badge-security-text: #0f766e;
  --color-badge-performance: #fdf4f3;
  --color-badge-performance-text: #a92739;
  --color-badge-completed: #ecfdf5;
  --color-badge-completed-text: #047857;
  /* Amber/warning — clearly distinct from green “completed” (teal read too similar) */
  --color-badge-running: var(--color-warning-light);
  --color-badge-running-text: var(--color-text-warning);
  --color-badge-failed: #fdf4f3;
  --color-badge-failed-text: #a92739;
  --color-badge-queued: #fffbeb;
  --color-badge-queued-text: #b45309;

  /* Neutral / disagree / violet chips */
  --color-violet-light: #f5f3ff;
  --color-violet: #6d28d9;

  /* Spacing */
  --spacing-xs: 4px;
  --spacing-sm: 8px;
  --spacing-md: 16px;
  --spacing-lg: 24px;
  --spacing-xl: 32px;

  /* Border radius — nut scale */
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(10, 10, 10, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(10, 10, 10, 0.08), 0 2px 4px -2px rgba(10, 10, 10, 0.05);
  --shadow-lg: 0 10px 15px -3px rgba(10, 10, 10, 0.08), 0 4px 6px -4px rgba(10, 10, 10, 0.05);

  /* Layout — fixed sidebar rail; --sidebar-current-width updated in SidebarNavigation */
  --sidebar-width: 250px;
  --sidebar-width-collapsed: 48px;
  --sidebar-current-width: var(--sidebar-width);
  --border-radius: var(--radius-md);

  /* Fixed footer in main content column (see AppContentFooter) */
  --app-footer-height: 36px;

  font-family: "Inter", "Inter Variable", -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  font-weight: 400;
  color: var(--color-text-primary);
  background-color: var(--color-bg);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* Reserve horizontal space for fixed sidebar (see SidebarNavigation.css) */

.main-page,
.agents-page,
.failures-page,
.runs-page,
.settings-page,
.run-details-page,
.resources-page,
.processing-page,
.failure-detail-page,
.agent-detail-page {
  padding-left: var(--sidebar-current-width);
  padding-bottom: calc(var(--app-footer-height) + env(safe-area-inset-bottom, 0px));
}

/* Shared main column: padding, sticky page header (title + toolbars) */

.app-page-main {
  --page-pad-x: var(--spacing-lg);
  --page-pad-y: var(--spacing-lg);
  flex: 1;
  padding: var(--page-pad-y) var(--page-pad-x);
  max-width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: var(--spacing-lg);
}

.app-page-sticky-header {
  position: sticky;
  top: 0;
  z-index: 40;
  margin: calc(-1 * var(--page-pad-y)) calc(-1 * var(--page-pad-x)) var(--spacing-md);
  padding: var(--page-pad-y) var(--page-pad-x) var(--spacing-md);
  background: var(--color-bg);
  border-bottom: 1px solid var(--color-border);
  box-shadow: 0 4px 20px -10px rgba(10, 10, 10, 0.12);
}

.app-page-sticky-header-inner {
  display: flex;
  flex-direction: column;
  gap: var(--spacing-md);
}

.app-page-sticky-header-inner--row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--spacing-md);
}

.app-page-title {
  margin: 0;
  font-size: clamp(1.375rem, 1.2rem + 0.5vw, 1.625rem);
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.app-page-sticky-header .failure-cards-header,
.app-page-sticky-header .tag-filter-bar,
.app-page-sticky-header .failures-search-bar {
  margin-bottom: 0;
}

.app-page-sticky-header .processing-header,
.app-page-sticky-header .processing-toggles {
  margin-bottom: 0;
}

.app-page-sticky-header .settings-header,
.app-page-sticky-header .resources-header {
  margin-bottom: 0;
}

.app-page-sticky-header .resources-status-cards {
  margin-bottom: 0;
}

.app-load-more-wrap {
  text-align: center;
  padding: var(--spacing-md) 0;
}

.app-load-more-btn {
  padding: 8px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.app-load-more-btn:hover:not(:disabled) {
  border-color: var(--color-border-hover);
  background: var(--color-bg-hover);
}

.app-load-more-btn:disabled {
  cursor: not-allowed;
  opacity: 0.65;
}

@media (max-width: 640px) {
  .app-page-main {
    --page-pad-x: var(--spacing-md);
    --page-pad-y: var(--spacing-md);
  }

  .app-page-sticky-header-inner:not(.app-page-sticky-header-inner--row) {
    gap: var(--spacing-sm);
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
}

a {
  color: var(--color-text-link);
  text-decoration: none;
}

a:hover {
  color: var(--color-brand-hover);
  text-decoration: underline;
}

button {
  font-family: inherit;
  cursor: pointer;
}

input, textarea, select {
  font-family: inherit;
}

table {
  border-collapse: collapse;
  width: 100%;
}

th, td {
  text-align: left;
  padding: var(--spacing-sm) var(--spacing-md);
}

/* Responsive dialog */

@media (max-width: 640px) {
  .dialog {
    max-width: calc(100% - 24px);
    padding: var(--spacing-md);
  }

  .dialog-field-row {
    flex-direction: column;
    gap: var(--spacing-md);
  }
}

/* Responsive tables — card mode at narrowest viewport */

@media (max-width: 480px) {
  .agents-table thead,
  .runs-table thead {
    display: none;
  }

  .agents-table tbody tr,
  .runs-table tbody tr {
    display: flex;
    flex-wrap: wrap;
    padding: var(--spacing-md);
    gap: var(--spacing-xs) var(--spacing-md);
    border-bottom: 1px solid var(--color-border-light);
  }

  .agents-table tbody td,
  .runs-table tbody td {
    border-bottom: none;
    padding: 0;
    font-size: 13px;
  }

  .agents-table .agent-name-cell,
  .runs-table .run-name-cell {
    width: 100%;
    font-size: 14px;
  }

  .agents-table .agent-prompt-cell {
    display: none;
  }

  .runs-table .run-selections-cell {
    display: none;
  }
}

/* Screen reader only utility */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}
