:root {
  --bg: #090b0d;
  --panel: #111418;
  --panel-raised: #171b20;
  --line: #2a3037;
  --line-soft: #20252b;
  --text: #f2f4f5;
  --muted: #929ba4;
  --orange: #f59e0b;
  --orange-soft: rgba(245, 158, 11, 0.13);
  --green: #4ade80;
  --green-soft: rgba(74, 222, 128, 0.12);
  --blue: #60a5fa;
  --blue-soft: rgba(96, 165, 250, 0.12);
  --purple: #c084fc;
  --purple-soft: rgba(192, 132, 252, 0.12);
  --cyan: #22d3ee;
  --cyan-soft: rgba(34, 211, 238, 0.12);
  --red: #fb7185;
  --red-soft: rgba(251, 113, 133, 0.12);
  --radius: 18px;
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 84% -10%, rgba(245, 158, 11, 0.1), transparent 31rem),
    radial-gradient(circle at -10% 30%, rgba(96, 165, 250, 0.06), transparent 28rem),
    var(--bg);
}

button,
a {
  font: inherit;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 76px;
  padding: 0 clamp(20px, 4vw, 64px);
  border-bottom: 1px solid var(--line-soft);
  background: rgba(9, 11, 13, 0.84);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  color: var(--text);
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 1px solid rgba(245, 158, 11, 0.55);
  border-radius: 12px;
  color: var(--orange);
  background: var(--orange-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 800;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  font-size: 14px;
  letter-spacing: 0.02em;
}

.brand small {
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.connection {
  display: flex;
  gap: 9px;
  align-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  background: rgba(17, 20, 24, 0.8);
  font-size: 12px;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--orange);
  box-shadow: 0 0 0 4px var(--orange-soft);
}

.connection.live .connection-dot {
  background: var(--green);
  box-shadow: 0 0 0 4px var(--green-soft);
}

main {
  width: min(1500px, calc(100% - 40px));
  margin: 0 auto;
  padding: 48px 0 64px;
}

.hero {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 32px;
  margin-bottom: 32px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--orange);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(38px, 6vw, 72px);
  font-weight: 650;
  letter-spacing: -0.055em;
  line-height: 0.98;
}

h2 {
  margin-bottom: 0;
  font-size: 21px;
  letter-spacing: -0.025em;
}

.hero-copy {
  max-width: 650px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.updated {
  min-width: 210px;
  padding-bottom: 7px;
  text-align: right;
}

.updated span,
.updated strong {
  display: block;
}

.updated span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.updated strong {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  font-weight: 500;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  margin-bottom: 24px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.metric {
  min-height: 124px;
  padding: 22px 24px;
  border-right: 1px solid var(--line);
}

.metric:last-child {
  border-right: 0;
}

.metric span,
.metric small {
  display: block;
  color: var(--muted);
}

.metric span {
  font-size: 12px;
  font-weight: 600;
}

.metric strong {
  display: block;
  margin: 10px 0 2px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 32px;
}

.metric small {
  font-size: 11px;
}

.metric.attention strong {
  color: var(--orange);
}

.metric.completed strong {
  color: var(--green);
}

.metric.evidence strong {
  color: var(--blue);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(300px, 390px) 1fr;
  min-height: 630px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.attempts-panel {
  border-right: 1px solid var(--line);
  background: #0e1114;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px;
}

.count {
  display: grid;
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
}

.filters {
  display: flex;
  gap: 6px;
  padding: 0 16px 16px;
  overflow-x: auto;
}

.filter {
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
}

.filter:hover,
.filter.active {
  border-color: var(--line);
  color: var(--text);
  background: var(--panel-raised);
}

.attempt-list {
  max-height: 555px;
  padding: 0 10px 12px;
  overflow-y: auto;
}

.attempt-card {
  width: 100%;
  padding: 16px 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.attempt-card + .attempt-card {
  margin-top: 4px;
}

.attempt-card:hover,
.attempt-card.selected {
  border-color: var(--line);
  background: var(--panel-raised);
}

.attempt-card.selected {
  box-shadow: inset 3px 0 0 var(--orange);
}

.attempt-topline,
.detail-titleline,
.event-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-id,
.sequence {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  letter-spacing: 0.04em;
}

.attempt-title {
  margin: 10px 0 11px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 650;
  line-height: 1.4;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attempt-meta {
  display: flex;
  gap: 12px;
  color: var(--muted);
  font-size: 10px;
}

.status {
  display: inline-flex;
  align-items: center;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 9px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status.attention,
.status.waiting {
  color: var(--orange);
  background: var(--orange-soft);
}

.status.agent {
  color: var(--purple);
  background: var(--purple-soft);
}

.status.human {
  color: var(--cyan);
  background: var(--cyan-soft);
}

.status.failure {
  color: var(--red);
  background: var(--red-soft);
}

.status.complete {
  color: var(--green);
  background: var(--green-soft);
}

.detail-panel {
  min-width: 0;
  padding: clamp(24px, 4vw, 42px);
}

.empty-state {
  display: grid;
  min-height: 520px;
  place-content: center;
  justify-items: center;
  color: var(--muted);
  text-align: center;
}

.empty-state h2 {
  margin-bottom: 10px;
  color: var(--text);
}

.empty-state p:last-child {
  max-width: 390px;
  line-height: 1.6;
}

.empty-mark {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 22px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 18px;
  color: var(--orange);
  background: var(--orange-soft);
  font-size: 25px;
}

.detail-header {
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.detail-titleline h2 {
  max-width: 720px;
  font-size: clamp(24px, 3vw, 36px);
}

.detail-subtitle {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
}

.facts {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 22px 0 30px;
}

.fact {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(23, 27, 32, 0.55);
}

.fact span,
.fact strong {
  display: block;
}

.fact span {
  margin-bottom: 7px;
  color: var(--muted);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.fact strong,
.fact a {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 500;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.fact a {
  color: var(--blue);
}

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

.section-heading h3 {
  margin: 0;
  font-size: 14px;
}

.section-heading span {
  color: var(--muted);
  font-size: 10px;
}

.event-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin: -4px 0 20px;
}

.legend-item {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 9px;
}

.legend-item::before {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--blue);
  content: "";
}

.legend-item.waiting::before {
  background: var(--orange);
}

.legend-item.agent::before {
  background: var(--purple);
}

.legend-item.success::before {
  background: var(--green);
}

.legend-item.human::before {
  background: var(--cyan);
}

.legend-item.failure::before {
  background: var(--red);
}

.timeline {
  position: relative;
  margin-left: 7px;
  padding-left: 28px;
}

.timeline::before {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 5px;
  width: 1px;
  background: var(--line);
  content: "";
}

.event {
  position: relative;
  margin-bottom: 12px;
  padding: 14px 15px;
  border: 1px solid var(--line-soft);
  border-radius: 12px;
  background: rgba(23, 27, 32, 0.42);
}

.event::before {
  position: absolute;
  top: 19px;
  left: -27px;
  width: 9px;
  height: 9px;
  border: 2px solid var(--panel);
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.45);
  content: "";
}

.event.waiting {
  border-color: rgba(245, 158, 11, 0.24);
  background: rgba(245, 158, 11, 0.045);
}

.event.waiting::before {
  background: var(--orange);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.45);
}

.event.agent {
  border-color: rgba(192, 132, 252, 0.24);
  background: rgba(192, 132, 252, 0.045);
}

.event.agent::before {
  background: var(--purple);
  box-shadow: 0 0 0 1px rgba(192, 132, 252, 0.45);
}

.event.human {
  border-color: rgba(34, 211, 238, 0.24);
  background: rgba(34, 211, 238, 0.045);
}

.event.human::before {
  background: var(--cyan);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.45);
}

.event.failure {
  border-color: rgba(251, 113, 133, 0.24);
  background: rgba(251, 113, 133, 0.045);
}

.event.failure::before {
  background: var(--red);
  box-shadow: 0 0 0 1px rgba(251, 113, 133, 0.45);
}

.event.success {
  border-color: rgba(74, 222, 128, 0.22);
  background: rgba(74, 222, 128, 0.04);
}

.event.success::before {
  background: var(--green);
  box-shadow: 0 0 0 1px rgba(74, 222, 128, 0.45);
}

.event-title {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.event-kind {
  padding: 4px 6px;
  border-radius: 6px;
  color: var(--blue);
  background: var(--blue-soft);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  white-space: nowrap;
}

.event-kind.waiting {
  color: var(--orange);
  background: var(--orange-soft);
}

.event-kind.agent {
  color: var(--purple);
  background: var(--purple-soft);
}

.event-kind.success {
  color: var(--green);
  background: var(--green-soft);
}

.event-kind.human {
  color: var(--cyan);
  background: var(--cyan-soft);
}

.event-kind.failure {
  color: var(--red);
  background: var(--red-soft);
}

.event h4 {
  margin: 0;
  font-size: 13px;
}

.event-type {
  margin: 5px 0 8px;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
}

.event time {
  color: var(--muted);
  font-size: 10px;
  white-space: nowrap;
}

.event details {
  margin-top: 8px;
}

.event summary {
  color: var(--muted);
  cursor: pointer;
  font-size: 10px;
}

.event pre {
  max-height: 220px;
  margin: 9px 0 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  color: #c7d0d8;
  background: #0a0c0e;
  font-size: 10px;
  line-height: 1.55;
}

.artifacts {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 9px;
}

.artifact {
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: var(--blue-soft);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 9px;
  text-decoration: none;
}

.list-empty {
  padding: 36px 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.6;
  text-align: center;
}

@media (max-width: 940px) {
  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .metric:nth-child(2) {
    border-right: 0;
  }

  .metric:nth-child(-n + 2) {
    border-bottom: 1px solid var(--line);
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .attempts-panel {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .attempt-list {
    max-height: 300px;
  }
}

@media (max-width: 620px) {
  .topbar {
    height: 68px;
    padding: 0 16px;
  }

  .connection {
    padding: 8px;
  }

  #connection-label {
    display: none;
  }

  main {
    width: min(100% - 24px, 1500px);
    padding-top: 32px;
  }

  .hero {
    display: block;
  }

  .updated {
    margin-top: 22px;
    text-align: left;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    min-height: 108px;
    padding: 17px;
  }

  .metric strong {
    font-size: 27px;
  }

  .detail-panel {
    padding: 24px 18px;
  }

  .detail-titleline {
    display: block;
  }

  .detail-titleline .status {
    margin-top: 14px;
  }

  .facts {
    grid-template-columns: 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
