:root {
  color-scheme: light;
  --bg: #f4f3ef;
  --surface: #fcfcfb;
  --border: #dddcd5;
  --text: #0b0b0b;
  --text-2: #52514e;
  --accent: #2a78d6;
  --accent-ink: #ffffff;
  --ok: #1d7a3a;
  --warn: #9a6200;
  --bad: #b3261e;
  --chip: #ecebe6;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #121211; --surface: #1a1a19; --border: #33332f; --text: #f0efec; --text-2: #c3c2b7;
    --accent: #3987e5; --ok: #5cc27a; --warn: #e0a640; --bad: #f2827a; --chip: #262624;
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #121211; --surface: #1a1a19; --border: #33332f; --text: #f0efec; --text-2: #c3c2b7;
  --accent: #3987e5; --ok: #5cc27a; --warn: #e0a640; --bad: #f2827a; --chip: #262624;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", sans-serif; }
a { color: var(--accent); }
header.top { display: flex; align-items: center; gap: 16px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--border); }
header.top .brand { font-weight: 650; text-decoration: none; color: var(--text); }
header.top nav { margin-left: auto; display: flex; gap: 14px; align-items: center; color: var(--text-2); }
main { max-width: 1200px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.5rem; margin: 0 0 16px; }
h2 { font-size: 1.15rem; margin: 28px 0 10px; }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; margin-bottom: 16px; }
.muted { color: var(--text-2); }
.btn { display: inline-block; border: 1px solid var(--border); background: var(--surface); color: var(--text); border-radius: 8px; padding: 7px 14px; font: inherit; cursor: pointer; text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.danger { color: var(--bad); }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 7px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--text-2); font-weight: 600; font-size: .9rem; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }
.status { display: inline-block; padding: 1px 9px; border-radius: 99px; background: var(--chip); font-size: .85rem; white-space: nowrap; }
.status::before { content: "● "; }
.status.done::before { color: var(--ok); }
.status.partial::before, .status.queued::before, .status.submitting::before { color: var(--warn); }
.status.running::before { color: var(--accent); }
.status.failed::before, .status.cancelled::before { color: var(--bad); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px 24px; }
.field label { display: block; font-weight: 600; margin-bottom: 4px; }
.field .help { color: var(--text-2); font-size: .85rem; }
.field select, .field input[type=text], .field input[type=password], .field input[type=number] { width: 100%; padding: 7px 9px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); font: inherit; }
.choices { display: flex; gap: 14px; flex-wrap: wrap; }
.choices label { font-weight: 400; display: inline-flex; gap: 6px; align-items: center; }
.errorlist { color: var(--bad); margin: 4px 0; padding-left: 18px; }
.messages { list-style: none; padding: 0; }
.messages li { background: var(--surface); border-left: 4px solid var(--accent); padding: 8px 12px; margin-bottom: 8px; }
details summary { cursor: pointer; font-weight: 600; }
pre.log { background: var(--chip); padding: 12px; border-radius: 8px; overflow-x: auto; font-size: .82rem; max-height: 420px; }
.plot-controls { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.plot-controls .field { min-width: 150px; }
.notice { border-left: 4px solid var(--warn); padding: 8px 12px; background: var(--surface); }
dl.params { display: grid; grid-template-columns: max-content 1fr; gap: 4px 16px; margin: 0; }
dl.params dt { color: var(--text-2); }
dl.params dd { margin: 0; }
@media (max-width: 640px) { header.top { padding: 10px 16px; flex-wrap: wrap; } main { padding: 16px; } }
