:root {
  --bg: #0b0e14;
  --bg-panel: #141922;
  --bg-card: #1a2133;
  --border: #30363d;
  --text: #e0e0e0;
  --text-muted: #8b949e;
  --accent: #58a6ff;
  --success: #238636;
  --danger: #da3633;
  --warning: #d29922;

  /* Agent colors */
  --agent-onyx_wren: #7c3aed;
  --agent-heimdall: #0369a1;
  --agent-mimir: #0f766e;
  --agent-forseti: #b45309;
  --agent-mnemosyne: #be185d;
  --agent-brisingr: #dc2626;
}

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

html, body {
  height: 100%;
  overflow: hidden;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  display: flex;
  flex-direction: column;
}

/* ── Top Nav ── */
nav#topnav {
  display: flex;
  align-items: center;
  background: var(--bg-panel);
  border-bottom: 1px solid var(--border);
  padding: 0 16px;
  height: 48px;
  gap: 4px;
  flex-shrink: 0;
}

nav#topnav .brand {
  font-weight: 700;
  color: var(--accent);
  font-size: 15px;
  margin-right: 16px;
  white-space: nowrap;
}

.tab-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 4px 12px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  white-space: nowrap;
}
.tab-btn:hover { background: rgba(255,255,255,0.06); color: var(--text); }
.tab-btn.active { background: rgba(88,166,255,0.15); color: var(--accent); }

/* ── Layout ── */
#app {
  display: flex;
  height: calc(100vh - 48px);
  overflow: hidden;
}

#sidebar {
  width: 200px;
  min-width: 200px;
  background: var(--bg-panel);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

#main-content {
  flex: 1;
  height: 100%;
  overflow: hidden;
  position: relative;
}

.panel {
  display: none;
  width: 100%;
  height: 100%;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 20px;
}
.panel.active { display: block; }

/* ── Sidebar agent cards ── */
.agent-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s;
  border: 1px solid transparent;
}
.agent-card:hover { background: var(--bg-card); }

.agent-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.agent-info { flex: 1; min-width: 0; }
.agent-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.agent-role { font-size: 10px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.status-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-dot.online { background: #3fb950; box-shadow: 0 0 6px #3fb950; }
.status-dot.offline { background: #6e7681; }
.status-dot.checking { background: var(--warning); }

.sidebar-label {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 4px 10px;
  letter-spacing: 0.08em;
}

/* ── Common UI ── */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 16px;
}

.btn {
  background: var(--success);
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: opacity 0.15s;
}
.btn:hover { opacity: 0.85; }
.btn-secondary {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn-danger { background: var(--danger); }

h2.panel-title {
  font-size: 18px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--accent);
}

input, textarea, select {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ── Dialog ── */
dialog {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text);
  padding: 24px;
  max-width: 500px;
  width: 90vw;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
}
dialog::backdrop { background: rgba(0,0,0,0.7); }
dialog h3 { color: var(--accent); margin-bottom: 12px; }
