.agent-debug-page {
  color: #172033;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  margin: 0 auto;
  max-width: 1500px;
  padding: 24px;
}

.agent-debug-hero,
.agent-debug-cycle,
.agent-debug-filter-card,
.agent-debug-runs {
  background: #ffffff;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.agent-debug-hero {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
  padding: 22px;
}

.agent-debug-back-link {
  color: #4b647d;
  font-size: 13px;
  text-decoration: none;
}

.agent-debug-back-link:hover {
  color: #0f62fe;
  text-decoration: underline;
}

.agent-debug-eyebrow {
  color: #5c708a;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.agent-debug-hero h1,
.agent-debug-cycle h2,
.agent-debug-section-heading h2 {
  letter-spacing: 0;
  margin: 0;
}

.agent-debug-hero h1 {
  font-size: 28px;
}

.agent-debug-description {
  color: #526173;
  margin: 8px 0 0;
  max-width: 780px;
}

.agent-debug-stats {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.agent-debug-stat {
  background: #ffffff;
  border: 1px solid #d8dee9;
  border-radius: 8px;
  border-top: 4px solid #6b7280;
  padding: 14px 16px;
}

.agent-debug-stat strong {
  display: block;
  font-size: 24px;
  line-height: 1;
}

.agent-debug-stat span {
  color: #5c708a;
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-top: 8px;
  text-transform: uppercase;
}

.agent-debug-stat--success { border-top-color: #16834a; }
.agent-debug-stat--info { border-top-color: #1769aa; }
.agent-debug-stat--warning { border-top-color: #b7791f; }
.agent-debug-stat--danger { border-top-color: #c2410c; }
.agent-debug-stat--total { border-top-color: #5c708a; }

.agent-debug-cycle {
  align-items: center;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 16px;
  padding: 18px;
}

.agent-debug-cycle p {
  color: #526173;
  margin: 6px 0 0;
}

.agent-debug-cycle__counts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.agent-debug-cycle__counts span,
.agent-debug-code,
.agent-debug-human {
  background: #f3f6f9;
  border: 1px solid #d8dee9;
  border-radius: 6px;
  color: #334155;
  display: inline-block;
  font-size: 12px;
  padding: 5px 8px;
}

.agent-debug-warnings {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.agent-debug-warnings p {
  background: #fefce8;
  border: 1px solid #facc15;
  border-radius: 8px;
  color: #854d0e;
  font-size: 14px;
  margin: 0;
  padding: 12px 14px;
}

.agent-debug-filter-card {
  margin-bottom: 16px;
  padding: 16px;
}

.agent-debug-filters {
  align-items: end;
  display: grid;
  gap: 12px;
  grid-template-columns: 120px repeat(6, minmax(145px, 1fr)) 130px;
}

.agent-debug-filters label {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.agent-debug-filters label span {
  color: #5c708a;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.agent-debug-filters input,
.agent-debug-filters select {
  border: 1px solid #c9d3df;
  border-radius: 6px;
  color: #172033;
  font: inherit;
  min-height: 36px;
  padding: 7px 9px;
}

.agent-debug-filter-actions {
  display: flex;
  gap: 8px;
}

.agent-debug-filter-actions button,
.agent-debug-filter-actions a {
  align-items: center;
  border-radius: 6px;
  display: inline-flex;
  font-size: 14px;
  font-weight: 700;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  text-decoration: none;
}

.agent-debug-filter-actions button {
  background: #1769aa;
  border: 1px solid #1769aa;
  color: #ffffff;
}

.agent-debug-filter-actions a {
  background: #ffffff;
  border: 1px solid #c9d3df;
  color: #334155;
}

.agent-debug-runs {
  padding: 18px;
}

.agent-debug-section-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
}

.agent-debug-section-heading span {
  color: #5c708a;
  font-size: 13px;
}

.agent-debug-table-wrap {
  overflow-x: auto;
}

.agent-debug-table {
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1180px;
  width: 100%;
}

.agent-debug-table th,
.agent-debug-table td {
  border-bottom: 1px solid #e2e8f0;
  padding: 12px;
  text-align: left;
  vertical-align: top;
}

.agent-debug-table th {
  background: #f6f8fb;
  color: #475569;
  font-size: 12px;
  text-transform: uppercase;
}

.agent-debug-table td {
  font-size: 13px;
}

.agent-debug-table p {
  color: #526173;
  margin: 6px 0 0;
}

.agent-debug-table code {
  color: #475569;
  font-size: 12px;
  word-break: break-word;
}

.agent-debug-status {
  border-radius: 6px;
  display: inline-block;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.agent-debug-status--success {
  background: #e8f7ee;
  color: #166534;
}

.agent-debug-status--info {
  background: #e8f2ff;
  color: #155e9f;
}

.agent-debug-status--warning {
  background: #fff7ed;
  color: #9a3412;
}

.agent-debug-status--danger {
  background: #feece8;
  color: #b42318;
}

.agent-debug-status--neutral {
  background: #f1f5f9;
  color: #334155;
}

.agent-debug-human {
  background: #fff1f2;
  border-color: #fecdd3;
  color: #be123c;
  margin-top: 8px;
}

.agent-debug-next-action {
  background: #f8fafc;
  border-left: 3px solid #1769aa;
  padding: 8px 10px;
}

.agent-debug-details {
  margin-top: 10px;
}

.agent-debug-details summary {
  color: #1769aa;
  cursor: pointer;
  font-weight: 700;
}

.agent-debug-timeline {
  border-left: 2px solid #d8dee9;
  list-style: none;
  margin: 12px 0 0 5px;
  padding: 0 0 0 14px;
}

.agent-debug-timeline__item {
  margin-bottom: 14px;
  position: relative;
}

.agent-debug-timeline__item::before {
  background: #6b7280;
  border: 2px solid #ffffff;
  border-radius: 999px;
  content: "";
  height: 10px;
  left: -20px;
  position: absolute;
  top: 4px;
  width: 10px;
}

.agent-debug-timeline__item--success::before { background: #16834a; }
.agent-debug-timeline__item--info::before { background: #1769aa; }
.agent-debug-timeline__item--warning::before { background: #b7791f; }
.agent-debug-timeline__item--danger::before { background: #c2410c; }

.agent-debug-timeline__item div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: space-between;
}

.agent-debug-timeline__item div span {
  color: #64748b;
}

.agent-debug-timeline__item dl {
  display: grid;
  gap: 3px 8px;
  grid-template-columns: max-content minmax(0, 1fr);
  margin: 8px 0 0;
}

.agent-debug-timeline__item dt {
  color: #64748b;
  font-weight: 700;
}

.agent-debug-timeline__item dd {
  margin: 0;
  min-width: 0;
  overflow-wrap: anywhere;
}

.agent-debug-empty {
  background: #f8fafc;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  color: #526173;
  margin: 0;
  padding: 18px;
}

@media (max-width: 980px) {
  .agent-debug-page {
    padding: 14px;
  }

  .agent-debug-cycle,
  .agent-debug-filters {
    align-items: stretch;
    grid-template-columns: 1fr;
  }

  .agent-debug-cycle {
    flex-direction: column;
  }

  .agent-debug-cycle__counts {
    justify-content: flex-start;
  }
}
