:root {
  color-scheme: light;
  --surface: #ffffff;
  --surface-quiet: #f4f6f5;
  --text: #192421;
  --muted: #52645d;
  --line: #dce4e0;
  --accent: #165d48;
  --success: #226a41;
  --warning: #90600b;
  --running: #235f98;
  --danger: #a53137;
}

* {
  box-sizing: border-box;
}
[hidden] {
  display: none !important;
}
body {
  margin: 0;
  background: var(--surface);
  color: var(--text);
  font: 14px/1.5 system-ui, "Microsoft YaHei", sans-serif;
}
h2,
p {
  margin: 0;
}
h2 {
  font-size: 18px;
}
.topbar {
  position: sticky;
  inset-block-start: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px max(20px, calc((100% - 1240px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.topbar strong {
  font-size: 16px;
}
.top-actions,
.panel-heading,
.pager,
.dialog-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.panel-heading {
  justify-content: space-between;
  margin-bottom: 14px;
}
.shell {
  width: min(1240px, calc(100% - 40px));
  margin: 0 auto;
}
.panel {
  padding: 24px 0;
  border-bottom: 1px solid var(--line);
}
.panel:last-child {
  border: 0;
}
.muted {
  color: var(--muted);
  font-size: 12px;
}
.button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 4px 12px;
  background: var(--surface);
  color: inherit;
  font: inherit;
  white-space: nowrap;
  cursor: pointer;
}
.button:hover,
.button[aria-pressed="true"] {
  background: var(--surface-quiet);
  border-color: #a5b8af;
}
.button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--running);
  outline-offset: 2px;
}
.button:disabled {
  opacity: 0.45;
  cursor: default;
}
.button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.button.primary:hover {
  background: #104d3b;
}
.button.ghost {
  font-size: 12px;
  min-height: 30px;
}
.table-wrap {
  overflow-x: auto;
  border-block: 1px solid var(--line);
}
table {
  width: 100%;
  min-width: 800px;
  border-collapse: collapse;
}
th,
td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
th {
  background: var(--surface-quiet);
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}
tr:last-child td {
  border-bottom: 0;
}
.empty {
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.actions {
  white-space: nowrap;
}
.status-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.status-summary span {
  margin-inline-start: 4px;
  font-variant-numeric: tabular-nums;
}
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  margin-inline-end: 5px;
  background: currentColor;
}
.status {
  font-weight: 600;
}
.queued {
  color: var(--warning);
}
.running {
  color: var(--running);
}
.succeeded {
  color: var(--success);
}
.failed,
.error,
.error-text {
  color: var(--danger);
}
.prompt {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
progress {
  width: 52px;
  accent-color: var(--accent);
  vertical-align: middle;
}
.pager {
  justify-content: flex-end;
  margin-top: 12px;
  flex-wrap: wrap;
}

dialog {
  max-width: calc(100vw - 28px);
  max-height: calc(100dvh - 28px);
  border: 1px solid var(--line);
  padding: 0;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
dialog::backdrop {
  background: #101c17a0;
}
.dialog-body {
  display: grid;
  gap: 12px;
  padding: 20px;
  width: min(400px, calc(100vw - 30px));
}
.dialog-body.wide {
  width: min(640px, calc(100vw - 30px));
}
.dialog-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
label {
  display: grid;
  gap: 4px;
  font-weight: 500;
}
input {
  width: 100%;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #aebfb7;
  border-radius: 5px;
  color: var(--text);
  background: var(--surface);
  font: inherit;
}
.checkbox {
  display: flex;
  gap: 8px;
  align-items: center;
}
.checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}
.error:empty {
  display: none;
}
.secret {
  display: block;
  padding: 10px;
  background: var(--surface-quiet);
  border: 1px solid var(--line);
  font-family: ui-monospace, monospace;
  overflow-wrap: anywhere;
}
.task-prompt {
  margin-block: 8px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.events {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}
.events li {
  display: grid;
  grid-template-columns: 155px 92px 1fr;
  gap: 8px;
  padding-block: 6px;
  border-top: 1px solid var(--line);
  overflow-wrap: anywhere;
}
.events time {
  color: var(--muted);
  font-size: 12px;
}
#taskDetail code {
  overflow-wrap: anywhere;
}
#taskDetail img {
  display: block;
  max-width: 100%;
  max-height: 60vh;
  object-fit: contain;
  margin: 8px auto;
}
.toast {
  position: fixed;
  bottom: 16px;
  right: 16px;
  max-width: min(360px, calc(100% - 32px));
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  display: none;
}
.toast.show {
  display: block;
}

@media (max-width: 600px) {
  .topbar {
    padding: 10px 12px;
    flex-wrap: wrap;
  }
  .shell {
    width: calc(100% - 24px);
  }
  .panel {
    padding: 18px 0;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .events li {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
