:root {
  --bg: #f6f7f9; --surface: #ffffff; --text: #1c2330; --muted: #5d6676; --border: #dde1e7;
  --accent: #1f5fbf; --accent-text: #ffffff; --ok: #1d7a46; --ok-bg: #e3f4ea; --err: #b42318; --err-bg: #fde8e7;
  --warn: #8a5a00; --warn-bg: #fdf3dc; --info-bg: #e8eef9; --code-bg: #0f1520; --code-text: #d6dde8;
  --radius: 8px; --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #11151c; --surface: #191f29; --text: #e4e8ee; --muted: #9aa4b2; --border: #2b3340;
    --accent: #5b9bff; --accent-text: #0b1220; --ok: #5fd08f; --ok-bg: #16301f; --err: #ff8a80; --err-bg: #3a1a19;
    --warn: #f3c25d; --warn-bg: #352a10; --info-bg: #1b2638; --code-bg: #0b0f15;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 var(--font); }
a { color: var(--accent); }
main { max-width: 1100px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 1.6rem; margin: 0 0 .5rem; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
code, .mono { font-family: var(--mono); font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.top { display: flex; align-items: center; gap: 24px; padding: 10px 16px; background: var(--surface);
  border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.brand { font-weight: 700; text-decoration: none; color: var(--text); }
.top nav { display: flex; gap: 16px; flex-wrap: wrap; flex: 1; }
.top nav a { text-decoration: none; color: var(--text); }
.top nav a:hover { color: var(--accent); }
.me { display: flex; gap: 12px; align-items: center; font-size: .9rem; }
.me form { margin: 0; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; margin: 0 0 18px; }
.narrow { max-width: 480px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 16px; margin-bottom: 24px; }
.grid .card { margin: 0; display: flex; flex-direction: column; }
.grid .card .button { margin-top: auto; align-self: flex-start; }

.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label, fieldset { display: flex; flex-direction: column; gap: 4px; font-weight: 500; }
fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
label.inline { flex-direction: row; gap: 8px; font-weight: 400; align-items: baseline; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.actions form { margin: 0; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--border);
  border-radius: 6px; padding: 7px 10px; max-width: 100%; }
textarea { width: 100%; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
button, .button { font: inherit; display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); cursor: pointer; text-decoration: none; }
button:hover, .button:hover { border-color: var(--accent); }
.primary { background: var(--accent); color: var(--accent-text); border-color: var(--accent); }
button.link { background: none; border: none; padding: 0; color: var(--accent); }
.danger { color: var(--err) !important; }

.flash { padding: 10px 12px; border-radius: 6px; background: var(--info-bg); margin: 0 0 14px; }
.flash.ok { background: var(--ok-bg); color: var(--ok); }
.flash.error { background: var(--err-bg); color: var(--err); }
.flash.warn { background: var(--warn-bg); color: var(--warn); }

.badge { display: inline-block; font-size: .78rem; font-weight: 600; padding: 2px 8px; border-radius: 99px;
  background: var(--info-bg); color: var(--text); white-space: nowrap; }
.s-success { background: var(--ok-bg); color: var(--ok); }
.s-failed { background: var(--err-bg); color: var(--err); }
.s-interrupted, .s-queued { background: var(--warn-bg); color: var(--warn); }
.s-running { background: var(--info-bg); color: var(--accent); }

.table-wrap { overflow-x: auto; margin-bottom: 12px; }
table { width: 100%; border-collapse: collapse; background: var(--surface); }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { font-size: .82rem; color: var(--muted); font-weight: 600; }
td details summary { cursor: pointer; font-size: .85rem; color: var(--accent); }

.log { background: var(--code-bg); color: var(--code-text); padding: 14px; border-radius: var(--radius);
  font: 12.5px/1.45 var(--mono); overflow: auto; max-height: 70vh; white-space: pre-wrap; word-break: break-word; }
.report table { margin: 8px 0 16px; }
.report h1 { font-size: 1.3rem; }
.toc { margin: 0 0 18px; font-size: .9rem; }
details > summary { cursor: pointer; }
@media (max-width: 640px) { .me { width: 100%; justify-content: space-between; } }
