:root {
  --bg: #0b0f14;
  --card: #111826;
  --muted: #9aa4b2;
  --text: #e7eef8;
  --border: #1e2a3a;
  --accent: #4f8cff;
  --danger: #ff5c7a;
}
* { box-sizing: border-box; }
body.page {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial;
  background: var(--bg);
  color: var(--text);
}
.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  background: rgba(11,15,20,0.9);
  backdrop-filter: blur(6px);
}
.brand { font-weight: 700; }
.grow { flex: 1; }

.layout {
  display: grid;
  grid-template-columns: 280px 320px 1fr;
  gap: 12px;
  padding: 12px;
}
.pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  min-height: calc(100vh - 70px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.pane-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px;
  border-bottom: 1px solid var(--border);
}
.pane-head h2 { margin: 0; font-size: 16px; }
.pane-subhead {
  border-top: 1px solid var(--border);
  padding: 12px;
}
.pane-subhead h3 { margin: 0 0 8px 0; font-size: 14px; }

.list {
  padding: 8px;
  overflow: auto;
  flex: 1;
}
.list.small { max-height: 200px; flex: 0 0 auto; }

.item {
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  margin-bottom: 8px;
  cursor: pointer;
}
.item:hover { border-color: #2a3a52; }
.item.active { border-color: var(--accent); }
.item .title { font-weight: 650; }
.item .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.muted { color: var(--muted); font-size: 12px; }
.err { color: var(--danger); margin-top: 10px; }

.card {
  max-width: 420px;
  margin: 10vh auto;
  padding: 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--card);
}
h1 { margin: 0 0 8px 0; font-size: 20px; }
label { display:block; margin: 12px 0 6px; color: var(--muted); font-size: 12px; }
input[type="password"], input[type="text"], textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #0c1320;
  color: var(--text);
}
textarea { resize: vertical; }
button {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--accent);
  color: white;
  cursor: pointer;
  font-weight: 650;
}
button:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-secondary {
  background: transparent;
  border-color: #2a3a52;
}
.chat { padding: 12px; display:flex; flex-direction: column; height: 100%; }
.chat-controls { margin-bottom: 10px; }
.messages {
  flex: 1;
  overflow: auto;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: #0a111d;
}
.msg {
  padding: 10px 12px;
  border-radius: 14px;
  margin-bottom: 10px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
}
.msg.user { background: rgba(79,140,255,0.07); }
.msg.assistant { background: rgba(255,255,255,0.03); }
.msg .role { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.msgForm { display:flex; gap: 10px; align-items: flex-end; margin-top: 10px; }
.msgForm textarea { flex: 1; }
