:root {
  color-scheme: dark;
  --bg: #101214;
  --card: #1a1d21;
  --line: #2a2f36;
  --text: #f3f4f6;
  --muted: #9aa3af;
  --accent: #3b82f6;
  --danger: #f87171;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.app { min-height: 100%; display: flex; flex-direction: column; }
header {
  position: sticky; top: 0;
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: #0c0e10;
  border-bottom: 1px solid var(--line);
}
header h1, header h2 { font-size: 16px; margin: 0; flex: 1; }
button, input, textarea, select {
  font: inherit;
  color: inherit;
}
button {
  background: var(--accent);
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  min-height: 44px;
}
button.ghost { background: transparent; color: var(--muted); }
button:disabled { opacity: .5; }

main { flex: 1; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
}
.list { display: flex; flex-direction: column; gap: 8px; }
.item {
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
}
.muted { color: var(--muted); font-size: 13px; }
input, textarea, select {
  width: 100%;
  background: #0c0e10;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px;
}
textarea { min-height: 88px; resize: vertical; }
.row { display: flex; gap: 8px; }
.messages { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; }
.msg { padding: 10px 12px; border-radius: 12px; white-space: pre-wrap; word-break: break-word; }
.msg.user { background: #1e3a5f; align-self: flex-end; max-width: 92%; }
.msg.assistant { background: var(--card); border: 1px solid var(--line); }
.composer { position: sticky; bottom: 0; background: var(--bg); padding-top: 8px; }
.error { color: var(--danger); }
.hidden { display: none; }
