:root {
  color-scheme: light;
  --ink: #202124;
  --muted: #5f6368;
  --line: #d7dde2;
  --paper: #ffffff;
  --back: #eef3f4;
  --teal: #1f6f78;
  --red: #d1495b;
  --green: #2d7d46;
  --yellow: #b58116;
  --shadow: 0 10px 30px rgba(32, 33, 36, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--back);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--teal);
  border-radius: 6px;
  background: var(--teal);
  color: #fff;
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--teal);
}

button.danger {
  border-color: var(--red);
  background: var(--red);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

input,
select {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  min-height: 38px;
  padding: 0 10px;
}

.shell {
  width: min(1440px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr minmax(280px, 420px);
  gap: 24px;
  align-items: end;
  margin-bottom: 20px;
}

.eyebrow {
  color: var(--teal);
  font-weight: 700;
  margin: 0 0 6px;
  text-transform: uppercase;
}

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

h1 {
  font-size: 34px;
  line-height: 1.15;
  margin-bottom: 0;
}

h2 {
  font-size: 22px;
  margin-bottom: 4px;
}

h3 {
  font-size: 18px;
  margin-bottom: 10px;
}

.auth-panel label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.token-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}

.metric {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

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

.workspace {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tabs {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fafb;
}

.tab {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.tab.active {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
}

.panel {
  display: none;
  padding: 16px;
}

.panel.active {
  display: block;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
}

.panel-head p,
.empty-state p {
  color: var(--muted);
  margin-bottom: 0;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 430px) 1fr;
  gap: 16px;
  min-height: 600px;
}

.list {
  display: grid;
  align-content: start;
  gap: 10px;
  max-height: 72vh;
  overflow: auto;
}

.list.wide {
  max-height: none;
}

.run-item,
.worker-item {
  width: 100%;
  text-align: left;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.run-item.active {
  border-color: var(--teal);
  box-shadow: inset 4px 0 0 var(--teal);
}

.run-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.run-title strong {
  overflow-wrap: anywhere;
}

.meta {
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 13px;
}

.badge {
  display: inline-flex;
  border-radius: 6px;
  padding: 3px 8px;
  background: #edf2f7;
  color: var(--ink);
  font-size: 12px;
  font-weight: 700;
}

.badge.running,
.badge.queued {
  background: #e1f1f3;
  color: var(--teal);
}

.badge.completed {
  background: #e4f3e8;
  color: var(--green);
}

.badge.failed,
.badge.cancelled,
.badge.cancel_requested {
  background: #fae7ea;
  color: var(--red);
}

.badge.paused {
  background: #fff3d9;
  color: var(--yellow);
}

.detail {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 600px;
  padding: 16px;
  overflow: auto;
}

.empty-state {
  min-height: 360px;
  display: grid;
  place-items: center;
  align-content: center;
  gap: 14px;
  text-align: center;
}

.empty-state img {
  width: 140px;
  max-width: 50%;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.field {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.field span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-bottom: 4px;
}

.field strong,
.field a {
  overflow-wrap: anywhere;
}

.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 18px;
}

.controls input {
  width: 96px;
}

.subtabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.subtab {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.subtab.active {
  color: #fff;
  background: var(--teal);
  border-color: var(--teal);
}

.viewer {
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 260px;
  max-height: 520px;
  overflow: auto;
  padding: 12px;
  background: #111517;
  color: #f4f7f8;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  line-height: 1.5;
}

.timeline {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.timeline li {
  border-left: 4px solid var(--teal);
  padding: 8px 10px;
  background: #f8fafb;
  border-radius: 6px;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 13px;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--muted);
  background: #f8fafb;
}

@media (max-width: 900px) {
  .topbar,
  .split,
  .metrics-grid,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .shell {
    padding: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .list {
    max-height: none;
  }
}
