:root {
  --bg: #f6f5f2; --panel: #ffffff; --ink: #1d1f24; --quiet: #6a6e78; --line: #e2e0da;
  --accent: #2f5bd3; --ok: #1f8a4c; --warn: #b7791f; --bad: #c0392b;
  --log-bg: #15171c; --log-ink: #d7dae0;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #16181d; --panel: #1e2128; --ink: #e8e9ec; --quiet: #9aa0ab; --line: #2d313a; --accent: #7aa2ff; }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; line-height: 1.5; }
a { color: var(--accent); }

.top { position: sticky; top: 0; z-index: 5; display: flex; gap: 24px; align-items: center;
  padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.brand { font-weight: 650; color: var(--ink); text-decoration: none; letter-spacing: -0.01em; }
.top nav { display: flex; gap: 4px; }
.top nav a { padding: 6px 10px; border-radius: 6px; color: var(--quiet); text-decoration: none; }
.top nav a.active { color: var(--ink); background: var(--bg); }

main { max-width: 980px; margin: 0 auto; padding: 24px 16px 64px; }
h1 { font-size: 22px; margin: 0 0 16px; letter-spacing: -0.01em; }
h2 { font-size: 16px; margin: 28px 0 10px; }
.row { display: flex; gap: 12px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.muted { color: var(--quiet); }
.small { font-size: 13px; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.stack > * + * { margin-top: 12px; }

label { display: block; font-size: 13px; color: var(--quiet); margin-bottom: 4px; }
input, select, textarea { width: 100%; font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; }
textarea { min-height: 120px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

button { font: inherit; border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  border-radius: 8px; padding: 8px 14px; cursor: pointer; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.danger { color: var(--bad); }
button:disabled { opacity: .5; cursor: default; }

.list { list-style: none; margin: 0; padding: 0; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.list li + li { border-top: 1px solid var(--line); }
.list a.item, .list div.item { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 16px; color: inherit; text-decoration: none; }
.list a.item:hover { background: var(--bg); }
.item .title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.empty { padding: 28px 16px; text-align: center; color: var(--quiet); }

.badge { display: inline-block; font-size: 12px; padding: 2px 8px; border-radius: 99px; border: 1px solid currentColor; white-space: nowrap; }
.s-queued { color: var(--quiet); } .s-running { color: var(--accent); } .s-succeeded { color: var(--ok); }
.s-failed { color: var(--bad); } .s-cancelled { color: var(--warn); }

.facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 14px; margin: 0; }
.facts dt { color: var(--quiet); }
.facts dd { margin: 0; overflow-wrap: anywhere; }

.log { background: var(--log-bg); color: var(--log-ink); border-radius: var(--radius); padding: 12px 14px;
  font: 12.5px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; max-height: 70vh; overflow: auto;
  white-space: pre-wrap; overflow-wrap: anywhere; }
.log .phase { color: #8fb3ff; font-weight: 600; margin-top: 6px; }
.log .err { color: #f0a49a; }
.log .agent { color: #c9e7c4; }
.log .tool { color: #e9cf8f; }
.log .meta { color: #8a909b; }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--bg);
  padding: 10px 16px; border-radius: 8px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: 90vw; }
#toast.show { opacity: 1; }

.auth { max-width: 380px; margin: 10vh auto 0; }
.tabs { display: flex; gap: 4px; margin-bottom: 16px; }
.tabs button.on { background: var(--bg); border-color: var(--ink); }
