.agent-trace-center {
  height: 100%;
  min-height: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 12px;
}

.trace-filters,
.trace-list,
.trace-detail {
  border: 1px solid rgba(148, 163, 184, 0.18);
}

.trace-kicker {
  color: var(--theme-primary-active);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.trace-detail-head h4 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
  line-height: 1.3;
}

.trace-detail-head p,
.trace-state p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.6;
}

.trace-mini-action {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.trace-mini-action:hover {
  border-color: rgba(var(--theme-primary-rgb), 0.28);
  color: var(--theme-primary-active);
}

.trace-filters {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) repeat(3, minmax(130px, .7fr));
  gap: 10px;
  padding: 12px;
}

.trace-field {
  display: grid;
  gap: 6px;
}

.trace-field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.trace-field input,
.trace-field select {
  width: 100%;
  height: 34px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.trace-field input {
  padding: 0 10px;
}

.trace-field select {
  padding: 0 8px;
}

.trace-layout {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(520px, .95fr) minmax(520px, 1.05fr);
  gap: 12px;
}

.trace-list,
.trace-detail {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.trace-list-head {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 14px;
  border-bottom: 1px solid var(--line);
}

.trace-list-head div {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.trace-list-head strong {
  color: var(--ink);
  font-size: 14px;
}

.trace-list-head span {
  color: var(--muted);
  font-size: 12px;
}

.trace-list-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.trace-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

.trace-table th {
  height: 36px;
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafc;
  color: #475569;
  font-weight: 800;
  text-align: left;
}

.trace-table td {
  min-height: 54px;
  padding: 10px 12px;
  border-bottom: 1px solid #edf2f7;
  color: var(--text);
  vertical-align: middle;
}

.trace-table tr {
  cursor: pointer;
}

.trace-table tr:hover td,
.trace-table tr.active td {
  background: var(--theme-primary-light-9);
}

.trace-table td strong,
.trace-table td span {
  display: block;
}

.trace-table td strong {
  max-width: 280px;
  overflow: hidden;
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-table td span {
  margin-top: 3px;
  color: var(--muted);
}

.trace-run-id {
  max-width: 160px;
  color: var(--theme-primary-active) !important;
  font-family: "SFMono-Regular", Consolas, monospace;
}

.trace-status {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.trace-status.success {
  border-color: var(--success-line);
  background: var(--success-soft);
  color: var(--success);
}

.trace-status.warning {
  border-color: var(--warning-line);
  background: var(--warning-soft);
  color: var(--warning);
}

.trace-status.danger {
  border-color: var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger);
}

.trace-status.info {
  border-color: rgba(var(--theme-primary-rgb), 0.18);
  background: var(--theme-primary-soft);
  color: var(--theme-primary-active);
}

.trace-status.mini {
  min-height: 22px;
  font-size: 11px;
}

.trace-state {
  min-height: 220px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 8px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.trace-state i {
  color: var(--theme-primary-active);
  font-size: 28px;
}

.trace-state strong {
  color: var(--ink);
  font-size: 14px;
}

.trace-state.error i,
.trace-state.error strong {
  color: var(--danger);
}

.trace-detail-head {
  min-height: 92px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.trace-detail-head > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.trace-inline-alert,
.trace-error-text {
  margin: 12px 14px 0;
  padding: 10px 12px;
  border-radius: 4px;
  font-size: 12px;
  line-height: 1.55;
}

.trace-inline-alert {
  border: 1px solid var(--warning-line);
  background: var(--warning-soft);
  color: var(--warning-active);
}

.trace-error-text {
  border: 1px solid var(--danger-line);
  background: var(--danger-soft);
  color: var(--danger-active);
}

.trace-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 12px 14px;
}

.trace-metrics div {
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #f8fafc;
}

.trace-metrics span,
.trace-metrics strong {
  display: block;
}

.trace-metrics span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}

.trace-metrics strong {
  margin-top: 4px;
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.trace-detail-grid {
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(340px, 1.2fr);
  gap: 10px;
  padding: 0 14px 14px;
  overflow: hidden;
}

.trace-event-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 8px;
  padding-right: 2px;
}

.trace-event {
  width: 100%;
  min-height: 56px;
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  text-align: left;
}

.trace-event:hover,
.trace-event.active {
  border-color: rgba(var(--theme-primary-rgb), 0.28);
  background: var(--theme-primary-light-9);
}

.event-index {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  background: var(--theme-primary-soft);
  color: var(--theme-primary-active);
  font-size: 12px;
  font-weight: 900;
}

.event-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.event-copy strong,
.event-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-copy strong {
  color: var(--ink);
  font-size: 12px;
}

.event-copy small {
  color: var(--muted);
  font-size: 11px;
}

.trace-event-payload {
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
}

.payload-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.payload-head div {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.payload-head strong {
  color: var(--ink);
  font-size: 13px;
}

.payload-head span {
  color: var(--muted);
  font-size: 12px;
}

.payload-columns {
  min-height: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  overflow: hidden;
}

.payload-columns > div {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
}

.payload-columns > div:last-child {
  border-right: 0;
}

.payload-columns h5 {
  margin: 0;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  font-size: 12px;
}

.payload-columns pre {
  min-height: 260px;
  max-height: 460px;
  margin: 0;
  padding: 12px;
  overflow: auto;
  background: #0f172a;
  color: #e2e8f0;
  font-size: 12px;
  line-height: 1.55;
}

@media (max-width: 1180px) {
  .trace-filters,
  .trace-layout,
  .trace-detail-grid,
  .payload-columns {
    grid-template-columns: 1fr;
  }
}
