:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --text: #1c1f24;
  --muted: #667085;
  --border: #dde1e7;
  --accent: #2f6fdb;
  --accent-text: #ffffff;
  --danger: #c0362c;
  --warn-bg: #fff6e0;
  --warn: #b26a00;
  --ok: #1f8a4c;
  --radius: 10px;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14161a;
    --surface: #1d2026;
    --text: #e6e8eb;
    --muted: #98a1ae;
    --border: #2f343c;
    --accent: #6b9cf0;
    --accent-text: #0e1116;
    --danger: #f07167;
    --warn-bg: #3a3220;
    --warn: #f0b45a;
    --ok: #5cc98a;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
main { max-width: 860px; margin: 0 auto; padding: 16px; }
h1 { font-size: 1.5rem; margin: 8px 0 16px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
a { color: var(--accent); }

.topbar {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 10px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 700; text-decoration: none; color: var(--text); }
.topbar nav { display: flex; gap: 14px; flex: 1; }
.topbar nav a { text-decoration: none; }
.topbar .who { color: var(--muted); text-decoration: none; }

.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 16px; margin-bottom: 16px;
}
.card.narrow { max-width: 420px; margin: 40px auto; }

label { display: block; font-weight: 600; margin: 12px 0 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; margin: 8px 0; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; width: 100%;
}
input[type="checkbox"] { width: auto; }
button, .button {
  display: inline-block; font: inherit; font-weight: 600; cursor: pointer;
  background: var(--accent); color: var(--accent-text); border: 0;
  border-radius: 8px; padding: 10px 16px; margin-top: 12px; text-decoration: none;
}
button.secondary, .button.secondary { background: transparent; color: var(--accent); border: 1px solid var(--border); }
button.small { padding: 4px 10px; margin: 0; font-size: 0.85rem; }
button.link { background: none; color: var(--muted); padding: 0; margin: 0; font-weight: 400; }

form.inline { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
form.inline input, form.inline select { width: auto; flex: 1 1 140px; }
form.inline button, form.inline label.check { margin: 0; }

.list { list-style: none; margin: 0; padding: 0; }
.list li {
  display: flex; justify-content: space-between; gap: 12px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--border);
}
.list li:last-child { border-bottom: 0; }
.list.jobs li { display: block; }
.list.jobs summary { display: flex; justify-content: space-between; cursor: pointer; }
.count { color: var(--muted); white-space: nowrap; }
.lead { font-size: 1.2rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.tag {
  display: inline-block; font-size: 0.75rem; padding: 1px 6px; border-radius: 6px;
  border: 1px solid var(--border); color: var(--muted); vertical-align: middle;
}
.error { color: var(--danger); font-weight: 600; }
.warning { background: var(--warn-bg); padding: 10px 12px; border-radius: 8px; }
.status { font-size: 0.85rem; font-weight: 600; }
.status.done { color: var(--ok); }
.status.failed { color: var(--danger); }
.status.running, .status.queued { color: var(--muted); }
pre.log {
  background: var(--bg); padding: 8px; border-radius: 6px; overflow-x: auto;
  font-size: 0.8rem; white-space: pre-wrap; word-break: break-word;
}

.table-wrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 0.85rem; color: var(--muted); font-weight: 600; }
td.actions { display: flex; gap: 6px; justify-content: flex-end; }
td.actions form { margin: 0; }
tr.inactive td { opacity: 0.55; }

.copy-row { display: flex; gap: 8px; align-items: center; }
.copy-row input { flex: 1; min-width: 0; font-size: 0.85rem; }
.copy-row button { flex: none; }

.crumbs { margin: 0; color: var(--muted); font-size: 0.9rem; }
.crumbs a { text-decoration: none; }
.notice { background: var(--surface); border-left: 4px solid var(--ok); padding: 10px 12px; border-radius: 6px; }
textarea.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; line-height: 1.4; }
.nowrap { white-space: nowrap; }
.prompt-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.prompt-buttons button { margin-top: 0; }
.summary-line { margin: 16px 0 8px; }
.preview-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
.preview-actions button, .preview-actions label.check { margin: 0; }
.badge {
  display: inline-block; font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
  padding: 1px 6px; border-radius: 6px; border: 1px solid currentColor;
}
.badge.valid, .badge.active { color: var(--ok); }
.badge.flagged, .status.flagged { color: var(--warn); }
.badge.invalid { color: var(--danger); }
.badge.retired { color: var(--muted); }
tr.row-retired td { opacity: 0.55; }
table.questions td, table.preview td { vertical-align: top; }
form.tiny { display: flex; gap: 4px; margin-top: 4px; }
form.tiny input { width: 4.5em; padding: 2px 6px; }
details summary { cursor: pointer; }
