:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --border: #2a2f3a;
  --text: #e6e8ee;
  --muted: #8a93a6;
  --accent: #4f8cff;
  --accent-dim: #2a4a8a;
  --warn: #e0a04a;
  --ok: #5cc685;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}
header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}
header h1 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}
header .subtitle {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}
main {
  flex: 1;
  display: flex;
  flex-direction: column;
  max-width: 920px;
  width: 100%;
  margin: 0 auto;
  padding: 16px;
}
#chat {
  flex: 1;
  overflow-y: auto;
  padding: 12px 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.msg { padding: 14px 16px; border-radius: 10px; border: 1px solid var(--border); }
.msg.user { background: var(--accent-dim); border-color: var(--accent); align-self: flex-end; max-width: 80%; }
.msg.bot { background: var(--panel); align-self: flex-start; max-width: 95%; }
.msg .meta { font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.msg .body { white-space: pre-wrap; line-height: 1.55; font-size: 14px; }
.msg .citations {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px dashed var(--border);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cite {
  background: var(--panel-2);
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}
.cite .ref { color: var(--accent); font-weight: 600; font-size: 11px; margin-bottom: 4px; }
.cite .snippet { color: var(--text); line-height: 1.5; }
#ask-form {
  display: flex;
  gap: 8px;
  padding: 12px 0;
  border-top: 1px solid var(--border);
}
#query {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 12px 14px;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
}
#query:focus { border-color: var(--accent); }
button {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: #6ba1ff; }
button:disabled { background: var(--accent-dim); cursor: not-allowed; }
footer { padding: 8px 0; font-size: 11px; color: var(--muted); }
.status-ok { color: var(--ok); }
.status-bad { color: var(--warn); }
