:root {
  --bg: #1e1f22;
  --panel: #2a2b2f;
  --text: #e6e6e6;
  --accent: #d97757;
  --muted: #8a8d93;
  --border: #3a3b3f;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}
.screen { height: 100%; display: flex; flex-direction: column; }
.hidden { display: none !important; }

#login-screen { align-items: center; justify-content: center; }
#login-form {
  display: flex; flex-direction: column; gap: 12px;
  width: min(320px, 90vw);
}
#login-form h1 { text-align: center; margin: 0 0 12px; color: var(--accent); }
#login-form input, #login-form button { padding: 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 16px; }
#login-form input { background: var(--panel); color: var(--text); }
#login-form button { background: var(--accent); color: #1e1f22; font-weight: 600; border: none; cursor: pointer; }
.error { color: #e57373; min-height: 1.2em; text-align: center; margin: 0; }
.link-btn { background: none; border: none; color: var(--muted); text-decoration: underline; cursor: pointer; font-size: 13px; padding: 4px; }
.link-btn:hover { color: var(--accent); }

header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: var(--panel); border-bottom: 1px solid var(--border);
  font-weight: 600;
}
#logout-btn { background: none; border: 1px solid var(--border); color: var(--muted); border-radius: 6px; padding: 6px 12px; cursor: pointer; }

#messages { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 80%; padding: 10px 14px; border-radius: 12px; line-height: 1.4; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: var(--accent); color: #1e1f22; }
.msg.assistant { align-self: flex-start; background: var(--panel); border: 1px solid var(--border); }
.msg.system { align-self: center; color: var(--muted); font-size: 0.85em; }

#chat-form {
  display: flex; align-items: center; gap: 8px;
  padding: 12px; background: var(--panel); border-top: 1px solid var(--border);
}
#message-input {
  flex: 1; padding: 12px; border-radius: 20px; border: 1px solid var(--border);
  background: var(--bg); color: var(--text); font-size: 15px;
}
#attach-btn, #chat-form button[type="submit"] {
  background: none; border: none; color: var(--accent); font-size: 20px; cursor: pointer; padding: 8px;
}
#chat-form button[type="submit"] { font-size: 15px; font-weight: 600; }
#attached-name { font-size: 12px; color: var(--muted); max-width: 100px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
