*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f0f2f5;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}

#login-screen {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}
#login-screen h1 { font-size: 1.5rem; color: #1e3a5f; }
#login-screen p  { color: #555; font-size: .95rem; }

#login-form { display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 320px; }
#pw-input {
  padding: 10px 14px; border: 1px solid #ccc; border-radius: 8px;
  font-size: 1rem; outline: none;
}
#pw-input:focus { border-color: #1e3a5f; }
#login-btn {
  background: #1e3a5f; color: #fff; border: none;
  padding: 12px; border-radius: 8px; font-size: 1rem; cursor: pointer;
}
#login-btn:hover { background: #2a4f80; }
#login-error { color: #c0392b; font-size: .9rem; display: none; }

#chat-screen { flex: 1; display: none; flex-direction: column; max-width: 800px; width: 100%; margin: 0 auto; }

#header {
  background: #1e3a5f; color: #fff;
  padding: 14px 20px;
  display: flex; justify-content: space-between; align-items: center;
  font-weight: 600;
}
#sign-out {
  background: none; border: 1px solid rgba(255,255,255,.5);
  color: #fff; padding: 4px 10px; border-radius: 4px;
  cursor: pointer; font-size: .85rem;
}

#messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
}

.msg { max-width: 85%; padding: 12px 16px; border-radius: 12px; line-height: 1.5; }
.msg.user { background: #1e3a5f; color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.msg.bot  { background: #fff; color: #222; align-self: flex-start; border-bottom-left-radius: 4px; box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.msg.bot .citations { margin-top: 10px; font-size: .8rem; color: #666; border-top: 1px solid #eee; padding-top: 6px; }
.msg.bot.loading { opacity: .6; font-style: italic; }

#input-row {
  display: flex; gap: 10px; padding: 16px;
  background: #fff; border-top: 1px solid #e0e0e0;
}
#question {
  flex: 1; padding: 10px 14px; border: 1px solid #ccc;
  border-radius: 8px; font-size: 1rem; outline: none;
}
#question:focus { border-color: #1e3a5f; }
#send-btn {
  background: #1e3a5f; color: #fff; border: none;
  padding: 10px 20px; border-radius: 8px; cursor: pointer; font-size: 1rem;
}
#send-btn:disabled { opacity: .5; cursor: not-allowed; }
