:root {
  color-scheme: light;
  --bg: #f6f7f9;
  --panel: #ffffff;
  --text: #20242b;
  --muted: #667085;
  --border: #d8dee8;
  --accent: #166c5a;
  --accent-strong: #0d5a49;
  --danger: #b42318;
  --warning: #9a5b00;
  --queued: #375dfb;
  --running: #0d7490;
  --success: #167647;
  --shadow: 0 14px 34px rgba(30, 41, 59, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

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

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

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

label {
  display: block;
  margin-bottom: 6px;
  color: #344054;
  font-size: 13px;
  font-weight: 600;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 11px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 190px;
  resize: vertical;
}

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

.login-panel {
  width: min(420px, 100%);
  margin: 14vh auto 0;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.login-panel h1,
.topbar h1,
.panel-head h2 {
  margin: 0;
}

.login-panel h1 {
  font-size: 24px;
  line-height: 1.2;
}

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.error-text {
  min-height: 20px;
  color: var(--danger);
}

.app-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(420px, 1.35fr);
  gap: 16px;
}

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar h1 {
  font-size: 24px;
  line-height: 1.2;
}

.runner-state {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.composer-panel,
.tasks-panel,
.detail-panel {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.composer-panel,
.tasks-panel {
  padding: 18px;
}

.detail-panel {
  grid-row: span 2;
  min-height: 620px;
  overflow: hidden;
}

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

.panel-head h2 {
  font-size: 18px;
}

.task-form {
  display: grid;
  grid-template-columns: 1fr 140px 34px;
  gap: 14px;
}

.form-row.full,
.form-actions {
  grid-column: 1 / -1;
}

.timeout-row {
  display: grid;
  grid-template-columns: 1fr;
}

.timeout-row .muted {
  align-self: end;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

.secondary-button {
  color: #263241;
  background: #eef2f6;
}

.secondary-button:hover {
  background: #dde5ee;
}

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

.danger-button:hover {
  background: #912018;
}

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

.tasks-list {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
}

.task-item {
  width: 100%;
  min-height: 64px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px;
  background: #fff;
  color: var(--text);
  text-align: left;
}

.task-item:hover,
.task-item.active {
  border-color: var(--accent);
  background: #f2fbf8;
}

.task-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 650;
}

.task-subtitle {
  margin-top: 6px;
  overflow: hidden;
  color: var(--muted);
  font-size: 13px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.badge {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 4px 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
}

.status-queued {
  background: var(--queued);
}

.status-running {
  background: var(--running);
}

.status-success {
  background: var(--success);
}

.status-error,
.status-cancelled {
  background: var(--danger);
}

.status-waiting_approval {
  background: var(--warning);
}

.task-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 0 18px 12px;
  color: var(--muted);
  font-size: 13px;
}

.log-output {
  min-height: 540px;
  max-height: 70vh;
  margin: 0;
  padding: 18px;
  overflow: auto;
  border-top: 1px solid var(--border);
  background: #111827;
  color: #e5e7eb;
  font-family: Consolas, "Cascadia Mono", ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
}

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

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

  .detail-panel {
    grid-row: auto;
    min-height: 420px;
  }

  .task-form,
  .task-meta {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
  }
}
