/* brain-office UI — pixel art aesthetic, dark theme */
:root {
  --bg: #0e1116;
  --bg2: #161a22;
  --bg3: #1f2530;
  --fg: #e6e8ef;
  --fg2: #9aa3b2;
  --acc: #6cf;
  --acc2: #f8c46a;
  --warn: #ff7b72;
  --ok: #79e07c;
  --line: #2a313e;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0; height: 100%;
  background: var(--bg); color: var(--fg);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 13px;
}
.topbar {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 12px; background: var(--bg2);
  border-bottom: 1px solid var(--line);
}
.topbar .brand { font-size: 15px; }
.topbar .logo { color: var(--acc); margin-right: 4px; }
.topbar label { color: var(--fg2); font-size: 12px; }
.topbar select, .topbar input {
  background: var(--bg3); color: var(--fg);
  border: 1px solid var(--line); border-radius: 4px;
  padding: 3px 6px; font-family: inherit;
}
.topbar .grow { flex: 1; }
.btn {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  padding: 5px 10px; border-radius: 4px; text-decoration: none; font-family: inherit;
  cursor: pointer;
}
.btn:hover { background: #2a313e; }
.btn.ghost { background: transparent; }
.btn.primary { background: var(--acc); color: #042; border-color: var(--acc); }
.btn.danger { background: var(--warn); color: #210; border-color: var(--warn); }
.dim { color: var(--fg2); font-size: 11px; }

.badge {
  display: inline-block; padding: 2px 6px; border-radius: 3px; font-size: 11px;
  background: var(--bg3); border: 1px solid var(--line);
}
.badge.ok { background: rgba(121,224,124,.15); border-color: var(--ok); color: var(--ok); }
.badge.bad { background: rgba(255,123,114,.15); border-color: var(--warn); color: var(--warn); }

.grid {
  display: grid; grid-template-columns: 1fr 320px; gap: 10px;
  padding: 10px; height: calc(100vh - 49px);
}
.canvas-wrap {
  position: relative;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
  overflow: hidden; display: flex; align-items: center; justify-content: center;
}
canvas {
  image-rendering: pixelated; image-rendering: crisp-edges;
  background: #2a1d12;
  width: 100%; height: 100%;
  max-width: 100%; max-height: 100%;
}
#agent-overlay { pointer-events: none; }

.side {
  display: flex; flex-direction: column; gap: 10px;
  min-height: 0; height: 100%;
}
.card {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 6px;
  padding: 8px 12px;
  display: flex; flex-direction: column;
  flex: 1 1 0;          /* split available height between Agents and Activity */
  min-height: 140px;    /* never collapse below this */
  min-width: 0;
}
.card h3 {
  margin: 0 0 6px 0; font-size: 12px; color: var(--fg2);
  text-transform: uppercase; letter-spacing: 1px;
  flex: 0 0 auto;
}
.card ul {
  list-style: none; margin: 0; padding: 0;
  overflow-y: auto; overflow-x: hidden;
  flex: 1 1 0; min-height: 0;
}
.card li {
  padding: 5px 0; border-bottom: 1px solid var(--line);
  font-size: 12px; line-height: 1.45;
  word-break: break-word;     /* long file paths / URLs wrap instead of overflow */
}
.card li:last-child { border-bottom: 0; }

.agent-pill {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
  margin-right: 6px; vertical-align: middle;
}
.agent-status { color: var(--fg2); font-size: 11px; margin-left: 4px; }
.agent-tool   { color: var(--acc2); font-size: 11px; margin-left: 4px;
                white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
                display: inline-block; max-width: 60%; vertical-align: middle; }

.ev { display: flex; gap: 6px; }
.ev .t { color: var(--fg2); font-size: 10px; min-width: 50px; }
.ev.tool_start .k { color: var(--acc); }
.ev.tool_end .k { color: var(--ok); }
.ev.tool_denied .k, .ev.waiting .k { color: var(--warn); }
.ev.subagent_spawn .k, .ev.subagent_done .k { color: var(--acc2); }

/* Editor */
.editor-grid {
  display: grid; grid-template-columns: 220px 1fr 220px; gap: 10px;
  padding: 10px; height: calc(100vh - 49px);
}
.palette button {
  display: block; width: 100%; text-align: left;
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  padding: 5px 8px; margin-bottom: 4px; border-radius: 4px; cursor: pointer;
  font-family: inherit;
}
.palette button.sel { border-color: var(--acc); background: rgba(102,204,255,.1); }
.tool-row { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }
.tool-row button { flex: 1; padding: 4px 6px; }

input[type="color"] { width: 36px; height: 24px; vertical-align: middle; padding: 0; border: none; background: transparent; }
input[type="text"], input[type="number"] {
  background: var(--bg3); color: var(--fg); border: 1px solid var(--line);
  padding: 4px 6px; border-radius: 4px; font-family: inherit;
}
.row { display: flex; gap: 6px; align-items: center; margin: 4px 0; flex-wrap: wrap; }
.row label { color: var(--fg2); font-size: 11px; }

/* speech bubble overlay (drawn on canvas — no DOM, kept for future) */
