:root {
  color-scheme: dark;
  --bg: #0c111d;
  --surface: #121a2b;
  --surface-2: #18233a;
  --text: #e8eefc;
  --muted: #8fa3c8;
  --accent: #24c8a5;
  --accent-2: #2f8cff;
  --danger: #ef596f;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: radial-gradient(circle at top, #1c2844 0%, var(--bg) 50%);
  color: var(--text);
}
.app {
  max-width: 860px;
  margin: 0 auto;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  gap: 12px;
  padding: 14px;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.topbar h1 { margin: 0; font-size: 1.3rem; }
.actions { display: flex; gap: 8px; }
.chat {
  background: color-mix(in srgb, var(--surface) 86%, black);
  border: 1px solid #24314f;
  border-radius: 14px;
  padding: 12px;
  overflow: auto;
  min-height: 50dvh;
}
.msg { margin-bottom: 10px; padding: 10px 12px; border-radius: 10px; line-height: 1.45; white-space: pre-wrap; }
.msg.user { background: #23365f; margin-left: 20%; }
.msg.assistant { background: var(--surface-2); margin-right: 10%; }
.msg.system { background: #3a2230; border: 1px solid #5a2f42; }
.composer {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
}
textarea {
  width: 100%;
  resize: vertical;
  min-height: 48px;
  max-height: 180px;
  border-radius: 10px;
  border: 1px solid #2b3f69;
  background: #0e1728;
  color: var(--text);
  padding: 10px;
  font: inherit;
}
.btn {
  border: 1px solid #35507f;
  background: #182641;
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
}
.btn.primary { background: linear-gradient(120deg, var(--accent-2), var(--accent)); border: 0; color: white; font-weight: 600; }
.btn.small { padding: 6px 10px; font-size: 0.9rem; }
.btn.active { background: #2a3551; border-color: #6f88b8; }
.status { margin: 0; color: var(--muted); font-size: 0.92rem; min-height: 1.2em; }
@media (max-width: 700px) {
  .composer { grid-template-columns: 1fr; }
  .msg.user, .msg.assistant { margin: 0; }
}
