:root {
  color-scheme: dark;
  --bg: #111315;
  --panel: #181b1f;
  --panel-2: #20242a;
  --text: #eceff3;
  --muted: #9ca8b5;
  --line: #303741;
  --accent: #37b37e;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.rail {
  border-right: 1px solid var(--line);
  background: #0d0f11;
  padding: 16px;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 12px;
}

.brand {
  font-weight: 700;
  letter-spacing: 0;
}

button {
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #07120d;
  font-weight: 700;
  cursor: pointer;
}

#newChat {
  width: 38px;
  height: 38px;
  font-size: 24px;
}

.model {
  align-self: end;
  color: var(--muted);
  overflow-wrap: anywhere;
  font-size: 13px;
}

.chat {
  display: grid;
  grid-template-rows: minmax(0, 1fr) auto;
  min-height: 100vh;
}

.messages {
  overflow-y: auto;
  padding: 28px min(8vw, 96px);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.msg {
  max-width: 900px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  padding: 14px 16px;
  border-radius: 8px;
}

.user {
  align-self: flex-end;
  background: var(--panel-2);
}

.assistant {
  align-self: flex-start;
  background: var(--panel);
  border: 1px solid var(--line);
}

.composer {
  border-top: 1px solid var(--line);
  padding: 16px min(8vw, 96px);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px;
  gap: 12px;
  background: rgba(17, 19, 21, 0.96);
}

textarea {
  resize: vertical;
  min-height: 56px;
  max-height: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  padding: 12px;
  font: inherit;
}

.composer button {
  min-height: 56px;
}

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail {
    min-height: 58px;
    grid-template-columns: 1fr auto;
    grid-template-rows: auto;
    align-items: center;
  }
  .model { display: none; }
  .chat { min-height: calc(100vh - 58px); }
  .composer { grid-template-columns: 1fr; }
}
