:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --accent: #60a5fa;
  --accent-2: #3b82f6;
  --border: #334155;
  --user-bg: #1e3a5f;
  --assistant-bg: #1e293b;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

header {
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: baseline;
  gap: 1rem;
}

header h1 { margin: 0; font-size: 1.1rem; font-weight: 600; }

main#messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
  max-width: 860px;
  width: 100%;
  margin: 0 auto;
}

.msg {
  margin-bottom: 1rem;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.msg.user { background: var(--user-bg); }
.msg.assistant { background: var(--assistant-bg); }
.msg .role {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.citations {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px dashed var(--border);
  font-size: 0.85rem;
  color: var(--muted);
}
.citations summary { cursor: pointer; }
.citations ol { margin: 0.5rem 0 0; padding-left: 1.25rem; }
.citations li { margin-bottom: 0.5rem; }
.citations code {
  background: var(--surface-2);
  padding: 1px 4px;
  border-radius: 3px;
  font-size: 0.8rem;
}

footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.5rem;
  background: var(--surface);
}

#composer {
  max-width: 860px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

#prompt {
  width: 100%;
  resize: vertical;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.6rem 0.8rem;
  font: inherit;
  font-size: 0.95rem;
}

#prompt:focus { outline: none; border-color: var(--accent); }

.row { display: flex; align-items: center; gap: 0.75rem; }

button {
  background: var(--accent-2);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 0.5rem 1rem;
  font: inherit;
  font-weight: 500;
  cursor: pointer;
}
button:hover:not(:disabled) { background: var(--accent); }
button:disabled { opacity: 0.5; cursor: not-allowed; }
button.secondary {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.muted { color: var(--muted); font-size: 0.85rem; }
.cursor { display: inline-block; animation: blink 1s steps(1) infinite; }
@keyframes blink { 50% { opacity: 0; } }
