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

:root {
  --bg: #1a1b26;
  --bg-alt: #24283b;
  --bg-highlight: #2f3549;
  --fg: #c0caf5;
  --fg-dim: #565f89;
  --fg-bright: #e0e6ff;
  --accent: #7aa2f7;
  --accent-hover: #89b4fa;
  --green: #9ece6a;
  --red: #f7768e;
  --orange: #e0af68;
  --border: #3b4261;
  --radius: 6px;
  --font: 'JetBrains Mono', 'Fira Code', 'Cascadia Code', monospace;
}

body {
  font-family: var(--font);
  font-size: 14px;
  background: var(--bg);
  color: var(--fg);
  line-height: 1.6;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: 220px;
  background: var(--bg-alt);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
  display: flex;
  flex-direction: column;
}

.sidebar-header {
  padding: 0 1rem 1rem;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0.5rem;
}

.sidebar-header h1 {
  font-size: 1.2rem;
  color: var(--accent);
  font-weight: 600;
}

.sidebar-header small {
  color: var(--fg-dim);
  font-size: 0.75rem;
}

.nav-link {
  display: block;
  padding: 0.5rem 1rem;
  color: var(--fg-dim);
  text-decoration: none;
  transition: all 0.15s;
}

.nav-link:hover {
  background: var(--bg-highlight);
  color: var(--fg);
}

.nav-link.active {
  background: var(--bg-highlight);
  color: var(--accent);
  border-left: 3px solid var(--accent);
}

.nav-spacer { flex: 1; }

/* Main content */
.content {
  flex: 1;
  padding: 1.5rem 2rem;
  overflow-y: auto;
}

.content h2 {
  color: var(--fg-bright);
  margin-bottom: 1rem;
  font-size: 1.3rem;
}

.content h3 {
  color: var(--fg);
  margin: 1rem 0 0.5rem;
  font-size: 1rem;
}

/* Cards */
.card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
}

.card-title {
  font-weight: 600;
  color: var(--fg-bright);
}

/* Grid */
.grid { display: grid; gap: 1rem; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }

/* Tables */
table { width: 100%; border-collapse: collapse; }
th, td { padding: 0.5rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { color: var(--fg-dim); font-weight: 500; font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.05em; }
td { color: var(--fg); }
tr:hover td { background: var(--bg-highlight); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.4rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-highlight);
  color: var(--fg);
  cursor: pointer;
  font-family: var(--font);
  font-size: 0.85rem;
  transition: all 0.15s;
}

.btn:hover { border-color: var(--accent); color: var(--accent); }
.btn-primary { background: var(--accent); color: var(--bg); border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-danger { border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red); color: var(--bg); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.8rem; }

/* Forms */
input, textarea, select {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.5rem 0.75rem;
  color: var(--fg);
  font-family: var(--font);
  font-size: 0.9rem;
  width: 100%;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
}

textarea { min-height: 100px; resize: vertical; }
label { display: block; color: var(--fg-dim); margin-bottom: 0.25rem; font-size: 0.85rem; }
.form-group { margin-bottom: 0.75rem; }

/* Badges */
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
}

.badge-green { background: rgba(158,206,106,0.15); color: var(--green); }
.badge-red { background: rgba(247,118,142,0.15); color: var(--red); }
.badge-orange { background: rgba(224,175,104,0.15); color: var(--orange); }
.badge-blue { background: rgba(122,162,247,0.15); color: var(--accent); }

/* Status dot */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
}

.status-online { background: var(--green); }
.status-offline { background: var(--fg-dim); }

/* Loading */
.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  color: var(--fg-dim);
}

/* Login page */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg);
}

.login-card {
  background: var(--bg-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: 100%;
  max-width: 400px;
}

.login-card h1 {
  color: var(--accent);
  margin-bottom: 1.5rem;
  text-align: center;
}

/* Messages */
.message {
  padding: 0.5rem 0.75rem;
  border-left: 3px solid var(--border);
  margin-bottom: 0.5rem;
  background: var(--bg);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.message-human { border-left-color: var(--accent); }
.message-info { border-left-color: var(--green); }
.message-question { border-left-color: var(--orange); }
.message-decision { border-left-color: var(--red); }

.message-meta {
  font-size: 0.75rem;
  color: var(--fg-dim);
  margin-bottom: 0.25rem;
}

/* Memory editor */
.editor {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.75rem;
  font-family: var(--font);
  font-size: 0.9rem;
  color: var(--fg);
  min-height: 200px;
  width: 100%;
  resize: vertical;
}

/* Tabs */
.tabs {
  display: flex;
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
}

.tab {
  padding: 0.5rem 1rem;
  cursor: pointer;
  color: var(--fg-dim);
  border-bottom: 2px solid transparent;
  transition: all 0.15s;
}

.tab:hover { color: var(--fg); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* Empty state */
.empty {
  text-align: center;
  padding: 2rem;
  color: var(--fg-dim);
}

/* Alerts */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 0.75rem;
  border-left: 3px solid;
}

.alert-info { background: rgba(122,162,247,0.1); border-left-color: var(--accent); }
.alert-warning { background: rgba(224,175,104,0.1); border-left-color: var(--orange); }
.alert-error { background: rgba(247,118,142,0.1); border-left-color: var(--red); }

/* Flex utilities */
.flex { display: flex; }
.flex-between { justify-content: space-between; }
.flex-center { align-items: center; }
.gap-1 { gap: 0.5rem; }
.gap-2 { gap: 1rem; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mr-1 { margin-right: 0.5rem; }

@media (max-width: 768px) {
  .layout { flex-direction: column; }
  .sidebar { width: 100%; flex-direction: row; overflow-x: auto; }
  .grid-2, .grid-3 { grid-template-columns: 1fr; }
}
