:root {
  --bg: #0f1115;
  --panel: #181b22;
  --panel-2: #1f232c;
  --text: #e6e8ec;
  --muted: #8b94a3;
  --accent: #5b8def;
  --user: #2a3142;
  --asst: #1e2a23;
  --border: #2a2f3a;
  --err: #ff6b6b;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 -apple-system, system-ui, sans-serif; }
a { color: var(--accent); }
.muted { color: var(--muted); }
.error { color: var(--err); min-height: 1.2em; }
.btn-ghost { background: transparent; color: var(--accent); border: 1px solid var(--border); border-radius: 6px; padding: 6px 10px; cursor: pointer; text-decoration: none; display: inline-block; }
button { background: var(--accent); color: #fff; border: 0; border-radius: 6px; padding: 8px 14px; cursor: pointer; }
button:hover { filter: brightness(1.1); }

.login-page { display: grid; place-items: center; min-height: 100vh; }
.login-card { background: var(--panel); padding: 32px; border-radius: 12px; width: min(380px, 92vw); border: 1px solid var(--border); }
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card label { display: block; margin: 18px 0 8px; font-size: 13px; color: var(--muted); }
.login-card input { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); }
.login-card button { width: 100%; margin-top: 16px; }

.chat-page { height: 100vh; display: flex; flex-direction: column; }
.chat-header { display: flex; justify-content: space-between; align-items: center; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--border); }
.chat-header h1 { margin: 0; font-size: 16px; font-weight: 600; }
.header-right { display: flex; gap: 10px; align-items: center; }
.header-right label { font-size: 12px; }
.model-picker { background: var(--panel-2); color: var(--text); border: 1px solid var(--border); border-radius: 6px; padding: 6px 8px; font-size: 13px; cursor: pointer; }
.model-picker:focus { outline: 1px solid var(--accent); }
.chat-layout { flex: 1; display: grid; grid-template-columns: 280px 1fr; min-height: 0; }
.sidebar { background: var(--panel); border-right: 1px solid var(--border); padding: 16px; overflow-y: auto; }
.sidebar h2 { font-size: 13px; color: var(--muted); margin: 0 0 12px; text-transform: uppercase; letter-spacing: .04em; }
.sidebar ul { list-style: none; padding: 0; margin: 12px 0 0; }
.sidebar li a { display: block; padding: 8px; border-radius: 6px; color: var(--text); text-decoration: none; margin-bottom: 4px; }
.sidebar li a:hover { background: var(--panel-2); }
.sidebar li a strong { display: block; font-size: 11px; color: var(--muted); font-weight: 500; }
.sidebar li a span { display: block; font-size: 13px; line-height: 1.3; }

.thread-wrap { display: flex; flex-direction: column; min-height: 0; }
.thread { list-style: none; padding: 20px; margin: 0; overflow-y: auto; flex: 1; }
.msg { margin-bottom: 16px; }
.msg-user { display: flex; justify-content: flex-end; }
.msg-user .bubble { background: var(--user); max-width: 75%; padding: 12px 14px; border-radius: 10px; }
.msg-assistant .bubble { background: var(--asst); padding: 12px 14px; border-radius: 10px; max-width: 90%; }
.bubble .head { font-size: 11px; color: var(--muted); margin-bottom: 4px; text-transform: uppercase; letter-spacing: .04em; }
.bubble .body p:first-child { margin-top: 0; }
.bubble .body pre, .bubble .body code { background: #0a0c10; padding: 2px 6px; border-radius: 4px; font-size: 13px; }
.files { margin: 8px 0 0; font-size: 12px; color: var(--muted); }

.composer { border-top: 1px solid var(--border); padding: 12px 20px; background: var(--panel); }
.composer textarea { width: 100%; padding: 10px; border-radius: 6px; border: 1px solid var(--border); background: var(--panel-2); color: var(--text); resize: vertical; font-family: inherit; }
.composer-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.composer-actions span { flex: 1; }
