*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0d0d0d;
  --bg2: #141414;
  --bg3: #1a1a1a;
  --border: #2a2a2a;
  --text: #e0e0e0;
  --text-dim: #555;
  --text-muted: #888;
  --accent: #f5a623;
  --green: #4caf50;
  --yellow: #f5a623;
  --red: #e53935;
  --blue: #42a5f5;
  --font: "Berkeley Mono", "JetBrains Mono", "Fira Code", monospace;
}

html, body { height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 13px; }

header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.logo { font-size: 16px; font-weight: 700; color: var(--accent); letter-spacing: 2px; }
.project-name { color: var(--text-muted); font-size: 12px; }
.project-cost { color: var(--text-muted); font-size: 11px; margin-left: 8px; font-family: monospace; opacity: 0.7; }
.project-calls { color: var(--text-muted); font-size: 11px; margin-left: 8px; font-family: monospace; opacity: 0.7; }
.project-calls.warn { color: var(--yellow); opacity: 1; }
.project-calls.danger { color: var(--red); opacity: 1; }
.project-checkpoint { color: var(--text-muted); font-size: 11px; margin-left: 8px; font-family: monospace; opacity: 0.7; }
.project-checkpoint.paused { color: var(--yellow); opacity: 1; }

.room-badge {
  display: inline-block;
  margin-left: 8px;
  background: var(--accent);
  color: #000;
  border-radius: 8px;
  padding: 0 6px;
  font-size: 10px;
  line-height: 14px;
  font-weight: 700;
}

.btn-load-older {
  width: 100%;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  padding: 6px;
  cursor: pointer;
}
.btn-load-older:hover { color: var(--text); background: var(--bg2); }

main {
  --status-w: 200px;
  display: grid;
  grid-template-columns: 180px 1fr var(--status-w);
  height: calc(100vh - 45px);
}

.status-panel { position: relative; }

.resize-handle {
  position: absolute;
  top: 0;
  left: -3px;
  width: 6px;
  height: 100%;
  cursor: col-resize;
  z-index: 10;
  background: transparent;
  transition: background 0.15s;
}
.resize-handle:hover,
.resize-handle.dragging { background: var(--accent); opacity: 0.6; }

body.resizing { cursor: col-resize; user-select: none; }

/* Panels */
.rooms-panel, .feed-panel, .status-panel {
  border-right: 1px solid var(--border);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.status-panel { border-right: none; }

.panel-title {
  padding: 12px 16px 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.panel-collapsible { cursor: pointer; user-select: none; display: flex; justify-content: space-between; align-items: center; }
.panel-collapsible:hover { color: var(--text-muted); }
.panel-chevron { font-size: 10px; transition: transform 0.15s; }
.panel-collapsible.collapsed .panel-chevron { transform: rotate(-90deg); }

/* Rooms */
#rooms-list { list-style: none; padding: 8px 0; flex: 1; overflow-y: auto; }

.room {
  padding: 8px 16px;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.1s;
  font-size: 12px;
}

.room:hover { color: var(--text); background: var(--bg3); }
.room.active { color: var(--accent); }
.room.has-activity::after { content: " ●"; color: var(--green); font-size: 8px; }
.room.room-terminal { font-style: italic; }
.rooms-list--complete .room:not(.active) { opacity: 0.35; }

/* Feed */
.feed-panel { border-right: 1px solid var(--border); }

#feed {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-width: 100%;
  border-top: 1px solid var(--border);
  padding-top: 10px;
}

#feed .message:first-child {
  border-top: none;
  padding-top: 0;
}

.msg-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
  align-items: baseline;
}

.msg-time { color: var(--text-dim); font-size: 10px; }
.msg-agent { font-weight: 600; }
.msg-tag { color: var(--text-dim); font-size: 10px; font-style: italic; }

.msg-content {
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

/* Thinking indicator bubble — transient, removed when response arrives */
.thinking-indicator {
  opacity: 0.45;
}
.thinking-indicator .msg-content {
  display: flex;
  gap: 3px;
  align-items: center;
}
.thinking-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--text-dim);
  animation: thinking-bounce 1.2s ease-in-out infinite;
}
.thinking-dot:nth-child(2) { animation-delay: 0.2s; }
.thinking-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes thinking-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.3; }
  30% { transform: translateY(-4px); opacity: 1; }
}

/* Thought messages — dimmed and italic */
.message.thought .msg-content {
  color: var(--text-dim);
  font-style: italic;
}

.message.thought .msg-meta { color: #333; }

/* Escalation messages */
.message.escalation .msg-content { color: var(--yellow); }

/* Artifact messages */
.message.artifact .msg-content {
  color: var(--blue);
  font-family: monospace;
  font-size: 12px;
  background: var(--bg2);
  padding: 4px 8px;
  border-left: 2px solid var(--blue);
  border-radius: 2px;
}
.message.artifact a { color: var(--blue); text-decoration: none; }
.message.artifact a:hover { text-decoration: underline; }
.artifact-sha, .artifact-bytes {
  color: var(--text-muted);
  font-size: 10.5px;
  margin-left: 6px;
}

/* Feed actions */
.feed-actions {
  display: flex;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  background: var(--bg2);
}

.btn-primary, .btn-secondary {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 12px;
  cursor: pointer;
  transition: opacity 0.1s;
}

.btn-primary { background: var(--accent); color: #000; font-weight: 700; }
.btn-primary:disabled { opacity: 0.3; cursor: default; }
.btn-secondary { background: var(--bg3); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--text-muted); }

/* Team status */
.agent-list { list-style: none; padding: 8px 0; overflow-y: auto; }

.agent {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 16px;
  font-size: 12px;
  border-bottom: 1px solid transparent;
}
.agent:hover { background: rgba(255,255,255,0.02); }

.agent-row {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 6px;
  align-items: center;
}

.agent-divider { height: 1px; background: var(--border); margin: 6px 16px; }

.agent-status { font-size: 11px; text-align: center; }
.agent-name { color: var(--text); }
.agent-role { color: var(--text-dim); font-size: 10px; }
.agent.agent-disabled { opacity: 0.45; }

.agent-subtitle {
  color: var(--text-muted);
  font-size: 10.5px;
  padding-left: 24px;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.agent-subtitle:empty { display: none; }

.agent-counters {
  color: var(--text-dim);
  font-size: 10px;
  padding-left: 24px;
  font-family: monospace;
  letter-spacing: 0.2px;
}
.agent-counters:empty { display: none; }

/* Agent status colours */
.agent-status.thinking   { color: var(--blue); }
.agent-status.writing    { color: var(--green); }
.agent-status.reviewing  { color: var(--yellow); }
.agent-status.blocked    { color: var(--red); }
.agent-status.waiting    { color: var(--text-dim); }
.agent-status.escalating { color: var(--yellow); }

/* Human messages */
.message.message-human .msg-meta { color: var(--accent); }
.message.message-human .msg-content { color: var(--text); border-left: 2px solid var(--accent); padding-left: 8px; }

/* Jump in input */
.jump-in-input {
  flex: 1;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 10px;
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  outline: none;
}
.jump-in-input:focus { border-color: var(--accent); }

/* Console panel */
.btn-console {
  margin-left: auto;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  padding: 3px 10px;
  cursor: pointer;
}
.btn-console:hover { border-color: var(--text-muted); color: var(--text); }
.btn-console.danger { color: var(--yellow); border-color: var(--yellow); }
.btn-console.danger:hover { color: var(--red); border-color: var(--red); }

.console-badge {
  background: var(--red);
  color: #fff;
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
  margin-left: 6px;
}

.console-panel {
  background: #080808;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  font-family: var(--font);
  max-height: 160px;
  display: flex;
  flex-direction: column;
}

.console-title {
  padding: 6px 16px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#console-feed {
  overflow-y: auto;
  padding: 6px 16px;
  flex: 1;
}

.console-line {
  padding: 2px 0;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
}
.console-line.console-error { color: var(--red); }
.console-line.console-warn { color: var(--yellow); }
.console-line.console-stream { color: var(--text-dim); }
/* Inline stream log drawer in feed (mirrors Run App logs style) */
.stream-message { opacity: .85; }
.stream-log-drawer { margin-top: 4px; border: 1px solid var(--border); border-radius: 4px; overflow: hidden; }
.stream-log-pre { margin: 0; padding: 8px; font-size: 11px; line-height: 1.5; max-height: 200px; overflow-y: auto; background: var(--bg); color: var(--text-dim); white-space: pre-wrap; word-break: break-all; }
.stream-log-drawer.stream-log-done .stream-log-pre { max-height: 60px; opacity: .5; }
.stream-log-drawer.stream-log-done::after { display: block; padding: 3px 8px; font-size: 10px; color: var(--text-dim); content: "↑ done"; }
.stream-toggle { cursor: pointer; font-size: 10px; opacity: .6; user-select: none; }
.stream-toggle:hover { opacity: 1; }
.stream-pre { display: none; margin: 4px 0 2px 80px; padding: 6px 8px; background: rgba(0,0,0,.25); border-radius: 4px; font-size: 10px; white-space: pre-wrap; word-break: break-all; max-height: 300px; overflow-y: auto; color: var(--text-muted); }
.console-line.stream-open .stream-toggle { opacity: 1; }
.console-line.stream-open .stream-pre { display: block; }
.console-time { color: var(--text-dim); margin-right: 8px; }
.console-agent { color: var(--accent); margin-right: 6px; }

/* Activity panel */
.activity-panel { background: #0a0a0f; font-family: var(--font); }
.activity-toolbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 6px 14px; border-bottom: 1px solid var(--border);
  flex-shrink: 0; font-size: 10px;
}
.activity-filters { display: flex; gap: 8px; }
.act-filter-label { display: flex; align-items: center; gap: 3px; color: var(--text-dim); cursor: pointer; white-space: nowrap; }
#activity-feed {
  flex: 1; overflow-y: auto; padding: 8px 14px;
  font-size: 11px; font-family: monospace; line-height: 1.5;
}
.act-line { display: flex; gap: 0; padding: 1px 0; border-bottom: 1px solid transparent; }
.act-line:hover { background: rgba(255,255,255,0.03); }
.act-time { color: #444; min-width: 72px; flex-shrink: 0; }
.act-stage { color: #555; min-width: 80px; flex-shrink: 0; }
.act-agent { min-width: 60px; flex-shrink: 0; font-weight: 600; }
.act-type  { min-width: 56px; flex-shrink: 0; opacity: 0.6; }
.act-body  { flex: 1; word-break: break-word; white-space: pre-wrap; color: #ccc; }

/* per-type colours */
.act-line[data-type="thought"]    .act-body { color: #666; font-style: italic; }
.act-line[data-type="thought"]    .act-type { color: #555; }
.act-line[data-type="message"]    .act-body { color: #ddd; }
.act-line[data-type="message"]    .act-type { color: #7c9; }
.act-line[data-type="status"]     .act-body { color: #558; }
.act-line[data-type="status"]     .act-type { color: #446; }
.act-line[data-type="artifact"]   .act-body { color: #a8c; }
.act-line[data-type="artifact"]   .act-type { color: #86a; }
.act-line[data-type="escalation"] .act-body { color: var(--yellow); }
.act-line[data-type="escalation"] .act-type { color: var(--yellow); }
.console-repeat {
  margin-left: 6px;
  background: var(--bg3);
  color: var(--text-muted);
  border-radius: 3px;
  padding: 0 4px;
  font-size: 10px;
}
.console-filters {
  float: right;
  font-weight: 400;
  letter-spacing: 0;
  text-transform: none;
  color: var(--text-muted);
  font-size: 10px;
}
.console-filters label { margin-left: 8px; cursor: pointer; }
.console-filters input { vertical-align: middle; margin-right: 3px; }
.btn-console-clear {
  margin-left: 10px;
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 10px;
  padding: 1px 6px;
  cursor: pointer;
}
.btn-console-clear:hover { border-color: var(--text-muted); color: var(--text); }

/* Dev URL banner */
.dev-url-banner {
  margin-left: auto;
  font-size: 11px;
  color: var(--green);
  border: 1px solid var(--green);
  border-radius: 4px;
  padding: 3px 10px;
}
.dev-url-banner a { color: var(--green); text-decoration: none; }
.dev-url-banner a:hover { text-decoration: underline; }

/* Landing */
.landing {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 60px 20px;
  min-height: calc(100vh - 50px);
}
.landing-card {
  width: 100%;
  max-width: 560px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 32px;
}
.landing-card h1 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
}
.landing-sub {
  color: var(--text-muted);
  margin-bottom: 24px;
  font-size: 13px;
}
#local-login-form label,
#settings-form label,
#new-project-form label {
  display: block;
  margin: 14px 0 6px;
  color: var(--text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
#local-login-form input,
#settings-form input,
#settings-form select,
#new-project-form input,
#new-project-form textarea {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  padding: 10px 12px;
  resize: vertical;
}
#local-login-form input:focus,
#settings-form input:focus,
#settings-form select:focus,
#new-project-form input:focus,
#new-project-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}
#local-login-form button,
#settings-form button,
#new-project-form button {
  margin-top: 20px;
  width: 100%;
  padding: 10px;
  font-size: 13px;
}
.landing-error {
  margin-top: 14px;
  padding: 10px 12px;
  background: rgba(229, 57, 53, 0.1);
  border: 1px solid var(--red);
  border-radius: 4px;
  color: var(--red);
  font-size: 12px;
}
.recent-projects { list-style: none; margin-top: 24px; padding: 0; }
.recent-projects li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  margin-bottom: 6px;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-decoration: none;
  color: var(--text);
  font-size: 13px;
  transition: border-color 0.15s;
}
.recent-projects li a:hover { border-color: var(--accent); }
.recent-projects .rp-name { font-weight: 600; }
.recent-projects .rp-meta { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.recent-projects .rp-phase {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent);
  background: rgba(255,180,0,0.08);
  border: 1px solid rgba(255,180,0,0.2);
  border-radius: 3px;
  padding: 2px 6px;
}
.recent-projects-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin: 24px 0 10px;
  border-top: 1px solid var(--border);
  padding-top: 20px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ==================== Monitor page ==================== */

.monitor-body { overflow: hidden; }

.header-tabs { margin-left: auto; display: flex; gap: 12px; font-size: 11px; }
.header-tabs a { color: var(--text-muted); text-decoration: none; padding: 3px 10px; border: 1px solid var(--border); border-radius: 3px; }
.header-tabs a:hover { color: var(--text); border-color: var(--text-muted); }
.header-tabs .tab-active { color: var(--accent); padding: 3px 10px; border: 1px solid var(--accent); border-radius: 3px; }

/* ── Project toolbar ── */
.project-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}
.project-toolbar-tabs { display: flex; align-items: center; gap: 0; }
.project-toolbar-actions { display: flex; align-items: center; gap: 8px; }
.ptab {
  font-size: 12px;
  color: var(--text-muted);
  padding: 10px 14px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  text-decoration: none;
  transition: color 0.1s, border-color 0.1s;
  user-select: none;
}
.ptab:hover { color: var(--text); }
.ptab-active { color: var(--text); border-bottom-color: var(--accent); }
.ptab-action {
  font-size: 11px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  cursor: pointer;
  font-family: var(--font);
  transition: color 0.1s, border-color 0.1s;
}
.ptab-action:hover { color: var(--text); border-color: var(--text-muted); }
.ptab-action.danger { color: var(--accent); border-color: rgba(245,166,35,0.4); }

/* ==================== Hamburger / header-right ==================== */
.header-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 11px;
}
/* When header-tabs is nested inside header-right, cancel its own auto margin */
.header-right .header-tabs { margin-left: 0; }

.hamburger-btn {
  display: none;
  background: none;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 16px;
  line-height: 1;
  padding: 4px 9px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: auto;
}
.hamburger-btn:hover { color: var(--text); border-color: var(--text-muted); }

/* Mobile panel tabs (project view) */
.mobile-panel-tabs {
  display: none;
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: var(--bg2);
  border-top: 1px solid var(--border);
  z-index: 100;
}
.mobile-panel-tabs button {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-muted);
  font-family: var(--font);
  font-size: 11px;
  padding: 10px 0;
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.mobile-panel-tabs button.active { color: var(--accent); border-top: 2px solid var(--accent); }

/* ==================== Responsive ==================== */

@media (max-width: 640px) {
  /* Header */
  header { padding: 10px 14px; gap: 8px; position: relative; flex-wrap: wrap; }
  .project-cost, .project-checkpoint { display: none; }

  .hamburger-btn { display: block; }

  .header-right {
    display: none;
    margin-left: 0;        /* cancel desktop auto-margin */
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    padding: 10px 0 6px;
    border-top: 1px solid var(--border);
    order: 10;
  }
  header.menu-open .header-right { display: flex; }

  /* All direct children of header-right go left-aligned on mobile */
  header.menu-open .header-right > * { margin-left: 0 !important; align-self: flex-start; }

  /* header-tabs nested inside header-right becomes a column */
  header.menu-open .header-right .header-tabs {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-left: 0;
  }

  /* Standalone header-tabs (dashboard/admin) — same collapse behaviour */
  header > .header-tabs {
    display: none;
    margin-left: 0;
    width: 100%;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    padding: 10px 0 6px;
    border-top: 1px solid var(--border);
    order: 10;
  }
  header.menu-open > .header-tabs { display: flex; }

  /* Project view — single column, feed visible by default */
  body:not(.monitor-body) main:not(.landing) {
    grid-template-columns: 1fr;
    height: calc(100vh - 45px - 44px); /* leave room for bottom tabs */
  }
  body:not(.monitor-body) main:not(.landing) .rooms-panel,
  body:not(.monitor-body) main:not(.landing) .status-panel { display: none; }

  body:not(.monitor-body) main.show-rooms .rooms-panel { display: flex; }
  body:not(.monitor-body) main.show-rooms .feed-panel  { display: none; }
  body:not(.monitor-body) main.show-team  .status-panel { display: flex; }
  body:not(.monitor-body) main.show-team  .feed-panel  { display: none; }

  .mobile-panel-tabs { display: flex; }
  .resize-handle { display: none; }

  /* Landing / dashboard */
  .landing { padding: 16px 12px; }
  .landing-card { padding: 20px 16px; }

  /* Action buttons */
  .action-bar { flex-wrap: wrap; }
  .action-bar button { flex: 1; min-width: 80px; }
}

@media (max-width: 900px) and (min-width: 641px) {
  /* Tablet: hide rooms sidebar, keep feed + team */
  body:not(.monitor-body) main:not(.landing) {
    grid-template-columns: 1fr var(--status-w);
  }
  body:not(.monitor-body) main:not(.landing) .rooms-panel { display: none; }
}

.stuck-banner {
  background: #3a1818; color: #ffb4b4; padding: 8px 16px;
  border-bottom: 1px solid var(--red); font-size: 12px;
  display: flex; align-items: center; gap: 12px;
}
.monitor-main {
  display: grid;
  grid-template-rows: auto 1fr 200px;
  height: calc(100vh - 45px);
}

.monitor-agents { border-bottom: 1px solid var(--border); padding: 10px 16px; background: var(--bg2); }
.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; margin-top: 8px; }

.agent-card {
  background: var(--bg3); border: 1px solid var(--border); border-radius: 4px;
  padding: 8px 10px; font-size: 11px; display: flex; flex-direction: column; gap: 4px;
}
.agent-card-head { display: flex; align-items: center; gap: 8px; }
.agent-card-name { font-weight: 700; color: var(--accent); }
.agent-card-role { color: var(--text-muted); font-size: 10px; }
.agent-card-status { margin-left: auto; font-size: 10px; padding: 1px 6px; border-radius: 3px; background: var(--bg); color: var(--text-muted); }
.agent-card-status.s-thinking { background: var(--blue); color: #fff; }
.agent-card-status.s-writing { background: var(--green); color: #fff; }
.agent-card-status.s-blocked { background: var(--red); color: #fff; }
.agent-card-status.s-waiting { background: var(--bg); color: var(--text-muted); }
.agent-card-body { color: var(--text); min-height: 32px; line-height: 1.4; overflow: hidden; text-overflow: ellipsis; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.agent-card-foot { display: flex; gap: 10px; color: var(--text-dim); font-size: 10px; flex-wrap: wrap; }

.monitor-rooms { border-bottom: 1px solid var(--border); overflow: hidden; display: flex; flex-direction: column; }
.room-columns { display: grid; grid-template-columns: repeat(5, 1fr); flex: 1; overflow: hidden; gap: 1px; background: var(--border); }
.room-column { background: var(--bg); display: flex; flex-direction: column; overflow: hidden; }
.room-col-title { padding: 4px 10px; font-size: 10px; color: var(--text-muted); letter-spacing: 1.5px; background: var(--bg2); border-bottom: 1px solid var(--border); flex-shrink: 0; text-transform: uppercase; }
.room-col-feed { flex: 1; overflow-y: auto; padding: 6px 10px; font-size: 11px; }

.mon-msg { padding: 3px 0; border-bottom: 1px solid var(--bg3); }
.mon-msg-meta { display: block; font-size: 10px; color: var(--text-dim); margin-bottom: 2px; }
.mon-msg.mon-human .mon-msg-meta { color: var(--accent); font-weight: 700; }
.mon-msg.mon-escalation { color: var(--yellow); }
.mon-thought { opacity: 0.5; font-style: italic; }

.monitor-console { background: #080808; padding: 0; display: flex; flex-direction: column; overflow: hidden; }
.mon-console-feed { flex: 1; overflow-y: auto; padding: 4px 16px; font-size: 11px; }
.mon-console-line { padding: 1px 0; color: var(--text-muted); }
.mon-console-line.mon-c-error { color: var(--red); }
.mon-console-line.mon-c-warn { color: var(--yellow); }
.mon-console-line.mon-c-heartbeat { opacity: 0.4; }
.mon-c-time { color: var(--text-dim); margin-right: 8px; }
.mon-c-agent { color: var(--accent); margin-right: 6px; }

/* Dashboard project cards */
.project-card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 14px 16px;
  margin-bottom: 10px;
  transition: border-color 0.15s;
}
.project-card:hover { border-color: var(--text-muted); }
.project-card-complete { opacity: 0.6; }
.project-card-complete:hover { opacity: 0.8; border-color: var(--border); }
.project-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.project-card-name { color: var(--text); font-weight: 600; text-decoration: none; font-size: 14px; }
.project-card-name:hover { color: var(--accent); }
.project-card-phase {
  color: var(--text-muted); font-size: 10px; font-family: monospace;
  text-transform: uppercase; letter-spacing: 0.5px;
}
.project-card-brief { color: var(--text-muted); font-size: 12px; line-height: 1.4; margin-bottom: 8px; }
.project-card-meta {
  color: var(--text-dim); font-size: 10.5px; font-family: monospace;
  display: flex; justify-content: space-between; align-items: center;
}
.project-card-meta a { color: var(--blue); text-decoration: none; }
.project-card-meta a:hover { text-decoration: underline; }

/* ==================== Themes ==================== */

/* Feed content stays monospace regardless of theme */
.msg-content { font-family: "Berkeley Mono", "JetBrains Mono", "Fira Code", monospace !important; }

/* ---- Material Dark (MD3) ---- */
[data-theme="material"] {
  --bg: #1c1b1f;
  --bg2: #2b2930;
  --bg3: #322f37;
  --border: #49454f;
  --text: #e6e1e5;
  --text-muted: #cac4d0;
  --text-dim: #938f99;
  --accent: #d0bcff;
  --green: #6dc849;
  --yellow: #f5c518;
  --red: #cf6679;
  --blue: #82b4ff;
  --font: 'Google Sans', 'Roboto', ui-sans-serif, system-ui, sans-serif;
}
[data-theme="material"] header { border-bottom: none; box-shadow: 0 1px 4px rgba(0,0,0,0.5); }
[data-theme="material"] .landing-card { border-radius: 16px; border: none; box-shadow: 0 2px 12px rgba(0,0,0,0.4); }
[data-theme="material"] .landing-card h1 { font-weight: 400; }
[data-theme="material"] .btn-primary,
[data-theme="material"] .btn-secondary { border-radius: 20px; }
[data-theme="material"] .btn-console { border-radius: 8px; }
[data-theme="material"] #local-login-form input,
[data-theme="material"] #new-project-form input,
[data-theme="material"] #new-project-form textarea { border-radius: 8px; }
[data-theme="material"] .agent-list li { border-radius: 8px; }
[data-theme="material"] .recent-projects li a { border-radius: 10px; border: none; background: var(--bg3); }
[data-theme="material"] .recent-projects li a:hover { background: var(--border); }

/* ---- Light ---- */
[data-theme="light"] {
  --bg: #fafafa;
  --bg2: #ffffff;
  --bg3: #f0eff4;
  --border: #e0dde6;
  --text: #1c1b1f;
  --text-muted: #49454f;
  --text-dim: #938f99;
  --accent: #6750a4;
  --green: #386a20;
  --yellow: #7d5700;
  --red: #ba1a1a;
  --blue: #0061a4;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
}
[data-theme="light"] .console-panel { background: #f0eff4; }
[data-theme="light"] .activity-panel { background: #f5f5fa; }
[data-theme="light"] #activity-feed { color: #333; }
[data-theme="light"] .act-time  { color: #aaa; }
[data-theme="light"] .act-stage  { color: #999; }
[data-theme="light"] .act-body  { color: #333; }

/* ---- Nord ---- */
[data-theme="nord"] {
  --bg: #2e3440;
  --bg2: #3b4252;
  --bg3: #434c5e;
  --border: #4c566a;
  --text: #eceff4;
  --text-muted: #d8dee9;
  --text-dim: #6c7a96;
  --accent: #88c0d0;
  --green: #a3be8c;
  --yellow: #ebcb8b;
  --red: #bf616a;
  --blue: #81a1c1;
}

/* ---- Dracula ---- */
[data-theme="dracula"] {
  --bg: #282a36;
  --bg2: #1e1f29;
  --bg3: #343746;
  --border: #44475a;
  --text: #f8f8f2;
  --text-muted: #ccc;
  --text-dim: #6272a4;
  --accent: #bd93f9;
  --green: #50fa7b;
  --yellow: #f1fa8c;
  --red: #ff5555;
  --blue: #8be9fd;
}

/* ---- Solarized ---- */
[data-theme="solarized"] {
  --bg: #002b36;
  --bg2: #073642;
  --bg3: #0d4555;
  --border: #2d5566;
  --text: #93a1a1;
  --text-muted: #839496;
  --text-dim: #586e75;
  --accent: #b58900;
  --green: #859900;
  --yellow: #b58900;
  --red: #dc322f;
  --blue: #268bd2;
}

/* ---- Monokai ---- */
[data-theme="monokai"] {
  --bg: #272822;
  --bg2: #1e1f1c;
  --bg3: #3e3d32;
  --border: #49483e;
  --text: #f8f8f2;
  --text-muted: #ccc;
  --text-dim: #75715e;
  --accent: #fd971f;
  --green: #a6e22e;
  --yellow: #e6db74;
  --red: #f92672;
  --blue: #66d9e8;
}
[data-theme="light"] .act-line[data-type="thought"] .act-body { color: #aaa; }
[data-theme="light"] .act-line[data-type="status"]  .act-body { color: #bbb; }
[data-theme="light"] .message.thought .msg-content { color: #666; }
[data-theme="light"] .room-badge { color: #fff; }
