* { box-sizing: border-box; margin: 0; }
:root {
  --bg: #14161a; --bg2: #1b1e24; --bg3: #23272f;
  --fg: #d7dae0; --muted: #8a919e; --accent: #7aa2f7;
  --green: #9ece6a; --red: #f7768e; --yellow: #e0af68; --gray: #565f89;
}
body { display: flex; height: 100vh; background: var(--bg); color: var(--fg);
  font: 14px/1.45 ui-monospace, "SF Mono", Menlo, Consolas, monospace; }
button { background: var(--bg3); color: var(--fg); border: 1px solid #333a45; border-radius: 6px;
  padding: 4px 10px; cursor: pointer; font: inherit; }
button:hover { border-color: var(--accent); }
button.danger:hover { border-color: var(--red); color: var(--red); }
input, textarea, select { background: var(--bg2); color: var(--fg); border: 1px solid #333a45;
  border-radius: 6px; padding: 6px 8px; font: inherit; }
.muted { color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; background: var(--gray); }
.dot.idle { background: var(--gray); } .dot.queued { background: var(--yellow); }
.dot.running { background: var(--green); box-shadow: 0 0 6px var(--green); }
.dot.failed { background: var(--red); } .dot.terminated { background: #3a3f4b; }

#sidebar { width: 290px; min-width: 290px; background: var(--bg2); border-right: 1px solid #2a2f38;
  display: flex; flex-direction: column; }
#side-head { display: flex; justify-content: space-between; align-items: center; padding: 12px; }
#side-head h1 { font-size: 16px; color: var(--accent); }
#agent-list { overflow-y: auto; flex: 1; }
.agent-row { padding: 7px 12px; cursor: pointer; display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.agent-row:hover { background: var(--bg3); }
.agent-row.selected { background: var(--bg3); border-left: 2px solid var(--accent); }
.agent-row .name { overflow: hidden; text-overflow: ellipsis; }
.agent-row .cost { margin-left: auto; font-size: 11px; color: var(--muted); }
.badge { background: var(--yellow); color: #14161a; border-radius: 8px; font-size: 10px;
  padding: 0 5px; font-weight: bold; }

#main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
#empty-state { margin: auto; color: var(--muted); }
#agent-view { display: flex; flex-direction: column; height: 100%; }
#agent-head { padding: 10px 16px; border-bottom: 1px solid #2a2f38; display: flex;
  align-items: center; gap: 16px; flex-wrap: wrap; }
#ah-name { font-weight: bold; font-size: 15px; }
#ah-actions { margin-left: auto; display: flex; gap: 8px; }

#watcher-panel { padding: 10px 16px; border-bottom: 1px solid #2a2f38; background: var(--bg2); }
.watcher-row { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.watcher-row .wr-err { color: var(--red); font-size: 12px; }
#watcher-form { display: flex; gap: 8px; margin-top: 8px; }
#wf-config { flex: 1; }

#transcript { flex: 1; overflow-y: auto; padding: 14px 16px; display: flex; flex-direction: column; gap: 8px; }
.ev { max-width: 100%; }
.ev-inbox { background: var(--bg3); border-left: 3px solid var(--accent); border-radius: 6px; padding: 8px 10px; }
.ev-inbox .from { color: var(--accent); font-size: 12px; margin-bottom: 3px; }
.ev-text { white-space: pre-wrap; word-break: break-word; }
.ev-tool { color: var(--muted); font-size: 12px; cursor: pointer; }
.ev-tool .body { display: none; white-space: pre-wrap; word-break: break-word; background: var(--bg2);
  padding: 6px 8px; border-radius: 6px; margin-top: 4px; max-height: 240px; overflow-y: auto; }
.ev-tool.open .body { display: block; }
.ev-sep { text-align: center; color: var(--muted); font-size: 11px; border-bottom: 1px dashed #2a2f38;
  line-height: 0.1; margin: 10px 0; }
.ev-sep span { background: var(--bg); padding: 0 10px; }
.ev-sys { color: var(--yellow); font-size: 12px; }
.ev-err { color: var(--red); font-size: 12px; white-space: pre-wrap; }

#composer { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid #2a2f38; }
#msg-input { flex: 1; resize: vertical; }

dialog { background: var(--bg2); color: var(--fg); border: 1px solid #333a45; border-radius: 10px;
  padding: 20px; width: 480px; }
dialog::backdrop { background: rgba(0,0,0,.55); }
#spawn-form { display: flex; flex-direction: column; gap: 10px; }
#spawn-form .row { display: flex; justify-content: flex-end; gap: 8px; }
