:root {
  --bg: #0f1115;
  --panel: #171a21;
  --panel-2: #1f242e;
  --text: #e6e9ef;
  --muted: #9aa3b2;
  --accent: #6ea8fe;
  --user: #2b3a55;
  --bot: #1f242e;
  --border: #2a2f3a;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
header h1 { margin: 0; font-size: 22px; letter-spacing: 0.5px; }
.tag { margin: 4px 0 0; color: var(--muted); font-size: 13px; }

main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 880px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
  gap: 12px;
}

select, button, textarea {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}
select { min-width: 220px; }
button { cursor: pointer; color: #0f1115; background: var(--accent); border: none; font-weight: 600; }
button:hover { filter: brightness(1.08); }
button:disabled { opacity: 0.5; cursor: default; }
.status { font-size: 12px; color: var(--muted); }

.messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px;
  min-height: 200px;
}
.msg {
  max-width: 85%;
  padding: 10px 14px;
  border-radius: 12px;
  white-space: pre-wrap;
  line-height: 1.45;
  border: 1px solid var(--border);
}
.msg.user { align-self: flex-end; background: var(--user); }
.msg.bot { align-self: flex-start; background: var(--bot); }
.msg .role { font-size: 11px; color: var(--muted); display: block; margin-bottom: 4px; }
.msg.error { align-self: stretch; background: #3a1d1d; border-color: #5a2a2a; }

.composer { display: flex; gap: 10px; align-items: end; }
#input { flex: 1; resize: vertical; }
