:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #1d2430;
  --muted: #687386;
  --line: #d9dee7;
  --accent: #1b6f5d;
  --accent-strong: #135347;
  --warn: #9a5b00;
  --bad: #a33131;
  --good: #16724d;
}

* {
  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;
  letter-spacing: 0;
}

button,
input,
select {
  font: inherit;
}

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

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

button:disabled {
  border-color: #aab3c2;
  background: #aab3c2;
  cursor: not-allowed;
}

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

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 24px 0 40px;
}

.topbar,
.command-band,
.status-grid,
.table-wrap,
.events {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 700;
}

h2 {
  font-size: 15px;
  margin-bottom: 12px;
}

#session-line {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.auth-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.auth-actions input {
  width: min(260px, 100%);
}

.command-band {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-top: 12px;
  padding: 14px 16px;
  flex-wrap: wrap;
}

label {
  display: grid;
  gap: 4px;
  color: var(--muted);
  font-size: 12px;
}

label select {
  min-width: 180px;
  color: var(--text);
  font-size: 14px;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 12px;
  overflow: hidden;
}

.metric {
  padding: 14px 16px;
  border-right: 1px solid var(--line);
}

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

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.table-wrap {
  margin-top: 12px;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 820px;
}

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

th {
  color: var(--muted);
  font-weight: 600;
  background: #fbfcfd;
}

td.message {
  max-width: 360px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status {
  display: inline-flex;
  align-items: center;
  min-width: 76px;
  justify-content: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 12px;
  background: #edf1f5;
  color: var(--muted);
}

.status.succeeded {
  background: #e7f4ee;
  color: var(--good);
}

.status.failed {
  background: #f8e8e8;
  color: var(--bad);
}

.status.running {
  background: #e7f0f7;
  color: #265e8f;
}

.status.queued {
  background: #fff2db;
  color: var(--warn);
}

.events {
  margin-top: 12px;
  padding: 14px 16px;
}

.event-row {
  display: grid;
  grid-template-columns: 160px 110px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid var(--line);
  font-size: 13px;
}

.event-row:first-child {
  border-top: 0;
}

.event-time,
.event-kind {
  color: var(--muted);
}

@media (max-width: 720px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding-top: 10px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .auth-actions {
    justify-content: stretch;
  }

  .auth-actions input,
  .auth-actions button,
  .command-band button,
  label,
  label select {
    width: 100%;
  }

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

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

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

  .event-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
