:root {
  --bg: #f6f7f9;
  --panel: #fff;
  --ink: #14181f;
  --muted: #6b7480;
  --line: #e3e6ea;
  --accent: #2563eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --radius: 10px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font: 15px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header.top {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 28px;
  height: 58px;
  position: sticky;
  top: 0;
  z-index: 20;
}
header.top .brand { font-weight: 700; font-size: 17px; letter-spacing: -0.02em; }
header.top nav { display: flex; gap: 20px; margin-left: 8px; }
header.top nav a { color: var(--muted); font-weight: 500; }
header.top nav a.on { color: var(--ink); }
header.top nav a .pill {
  background: var(--red); color: #fff; border-radius: 20px;
  padding: 1px 7px; font-size: 12px; margin-left: 5px; font-weight: 600;
}
header.top .spacer { flex: 1; }

main { max-width: 1080px; margin: 0 auto; padding: 28px 24px 80px; }

h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 12px; }
.sub { color: var(--muted); margin: 0 0 24px; }

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

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }

.agent-card { display: block; color: inherit; }
.agent-card:hover { text-decoration: none; border-color: #c9cfd6; }
.agent-card .name { font-weight: 650; font-size: 16px; }
.agent-card .role { color: var(--muted); font-size: 13px; }
.agent-card ul { margin: 12px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: #e8edf6; color: var(--accent);
  display: grid; place-items: center; font-weight: 700; flex: none;
}

.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }
.dot.running, .dot.idle { background: var(--green); }
.dot.working { background: var(--accent); }
.dot.stopped { background: #b3bac2; }
.dot.error { background: var(--red); }

.tag {
  font-size: 12px; padding: 2px 9px; border-radius: 20px;
  background: #eef1f5; color: var(--muted); font-weight: 500;
}
.tag.l0 { background: #fdecec; color: var(--red); }
.tag.l1 { background: #fdf3e2; color: var(--amber); }
.tag.l2 { background: #e7f7ec; color: var(--green); }

button, .btn {
  font: inherit; font-weight: 550;
  background: var(--accent); color: #fff;
  border: 0; border-radius: 8px; padding: 9px 15px; cursor: pointer;
}
button:hover { filter: brightness(1.07); }
button.ghost { background: #eef1f5; color: var(--ink); }
button.danger { background: var(--red); }
button.ok { background: var(--green); }
button.sm { padding: 5px 11px; font-size: 13px; }
button:disabled { opacity: .5; cursor: default; }

input, textarea, select {
  font: inherit; width: 100%;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 11px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 2px solid #cddcfb; border-color: var(--accent); }
label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 5px; }
label .hint { font-weight: 400; color: var(--muted); }
textarea { min-height: 84px; resize: vertical; }

dialog {
  border: 0; border-radius: 14px; padding: 0;
  width: min(540px, 92vw); box-shadow: 0 24px 60px rgba(0,0,0,.22);
}
dialog::backdrop { background: rgba(15,20,30,.45); }
dialog .body { padding: 22px 24px; }
dialog .foot {
  padding: 14px 24px; border-top: 1px solid var(--line);
  display: flex; justify-content: flex-end; gap: 8px; background: #fbfcfd;
  border-radius: 0 0 14px 14px;
}

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }

.log { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.log .line { padding: 5px 0; border-bottom: 1px solid #f0f2f4; display: flex; gap: 10px; }
.log .line:last-child { border: 0; }
.log .when { color: #9aa2ab; flex: none; }
.log .who { color: var(--accent); flex: none; }
.log .line.error .what { color: var(--red); }
.log .line.approval .what { color: var(--amber); }
.log .line.report .what { color: var(--green); }

pre.detail {
  background: #f7f8fa; border: 1px solid var(--line); border-radius: 8px;
  padding: 10px; font-size: 12px; overflow: auto; max-height: 260px; white-space: pre-wrap;
}

.notice {
  background: #fff8e6; border: 1px solid #f2dfae; color: #7a5a12;
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 16px; font-size: 14px;
}
.notice code { background: #f6ecd2; padding: 1px 5px; border-radius: 4px; }

.task { border-bottom: 1px solid var(--line); padding: 11px 0; }
.task:last-child { border: 0; }
.task .title { font-weight: 550; }
.task .meta { color: var(--muted); font-size: 12.5px; }
.status { font-size: 12px; font-weight: 600; }
.status.done { color: var(--green); }
.status.failed { color: var(--red); }
.status.running { color: var(--accent); }
.status.queued { color: var(--muted); }
