:root {
  color-scheme: light;
  --bg: #f7f8fa;
  --surface: #ffffff;
  --text: #16202a;
  --muted: #64717f;
  --line: #d8dee6;
  --accent: #0f766e;
  --accent-strong: #115e59;
  --blue: #2563eb;
  --red: #b91c1c;
  --amber: #b45309;
  --warn: #9a3412;
  --code-bg: #eef2f6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

a {
  color: var(--accent-strong);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 56px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.brand {
  color: var(--text);
  font-weight: 700;
}

.nav {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
}

button {
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 7px 12px;
  cursor: pointer;
}

button:hover {
  background: var(--accent-strong);
}

.page {
  width: min(1180px, calc(100vw - 32px));
  margin: 28px auto 48px;
}

.page-heading {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
}

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

h1 {
  margin-bottom: 6px;
  font-size: 28px;
  line-height: 1.15;
}

h2 {
  margin: 28px 0 10px;
  font-size: 17px;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(82px, 1fr));
  gap: 1px;
  min-width: 560px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.metrics div {
  padding: 12px;
  background: var(--surface);
}

.metrics dt {
  color: var(--muted);
  font-size: 12px;
}

.metrics dd {
  margin: 2px 0 0;
  font-size: 22px;
  font-weight: 700;
}

table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--line);
  background: var(--surface);
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

code,
pre {
  border-radius: 6px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}

code {
  padding: 2px 4px;
  overflow-wrap: anywhere;
}

pre {
  max-height: 620px;
  overflow: auto;
  padding: 16px;
  white-space: pre-wrap;
}

.empty {
  color: var(--muted);
}

.status {
  display: inline-block;
  min-width: 56px;
  border-radius: 999px;
  padding: 2px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.status-valid {
  background: var(--accent);
}

.status-invalid {
  background: var(--red);
}

.timeline-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  align-items: start;
}

.timeline-lanes {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--surface);
}

.timeline-lane {
  display: grid;
  grid-template-columns: 290px minmax(520px, 1fr);
  min-height: 72px;
  border-bottom: 1px solid var(--line);
}

.timeline-lane:last-child {
  border-bottom: 0;
}

.timeline-engine {
  display: grid;
  gap: 6px;
  align-content: center;
  padding: 12px;
  border-right: 1px solid var(--line);
  background: #fbfcfe;
}

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

.timeline-events {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 620px;
  padding: 14px;
}

.event-dot {
  position: relative;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 2px solid transparent;
  border-radius: 50%;
  padding: 0;
  color: transparent;
}

.event-dot span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}

.event-send {
  background: var(--blue);
}

.event-receive {
  border-color: var(--blue);
  background: #dbeafe;
}

.event-fork {
  background: var(--amber);
}

.event-error {
  background: var(--red);
}

.event-dot:hover,
.event-dot.is-related {
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.18);
  transform: scale(1.1);
}

.timeline-detail {
  position: sticky;
  top: 16px;
  min-height: 220px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.event-card {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
}

.event-card div {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  gap: 8px;
}

.event-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.event-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.login-panel {
  width: min(420px, 100%);
  margin: 12vh auto 0;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.login-panel label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.login-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  font: inherit;
  padding: 8px 10px;
}

@media (max-width: 760px) {
  .page-heading {
    display: block;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    min-width: 0;
    margin-top: 16px;
  }

  .timeline-shell {
    display: block;
  }

  .timeline-detail {
    position: static;
    margin-top: 12px;
  }

  table {
    display: block;
    overflow-x: auto;
  }
}
