:root {
  color-scheme: light;
  font-family: "Segoe UI", sans-serif;
  color: #1c2430;
  background: #f4f6f8;
}

body {
  margin: 0;
}

button, input, textarea {
  font: inherit;
}

[hidden] {
  display: none !important;
}

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
}

.login form, .chat {
  background: white;
}

.login form {
  width: min(24rem, calc(100% - 2rem));
  padding: 1.5rem;
  border: 1px solid #d5dbe3;
  border-radius: 8px;
}

label {
  display: grid;
  gap: 0.35rem;
  margin: 0.8rem 0;
}

input, textarea {
  padding: 0.55rem 0.7rem;
  border: 1px solid #c5ced8;
  border-radius: 6px;
}

button {
  padding: 0.55rem 0.8rem;
  border: 0;
  border-radius: 6px;
  background: #1f4b99;
  color: white;
  cursor: pointer;
}

button[hidden] {
  display: none;
}

.error {
  color: #8d1d1d;
}

.app {
  display: grid;
  grid-template-columns: 16rem 1fr;
  min-height: 100vh;
}

aside {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 1rem;
  background: #e7edf4;
  border-right: 1px solid #d5dbe3;
}

#conversations {
  display: grid;
  gap: 0.4rem;
  align-content: start;
  overflow: auto;
}

#conversations button, #logout {
  background: white;
  color: #1c2430;
  border: 1px solid #c5ced8;
  text-align: left;
}

.chat {
  display: grid;
  grid-template-rows: auto 1fr auto;
  min-width: 0;
}

header, #ask, #messages {
  padding: 1rem;
}

#messages {
  overflow: auto;
}

.message {
  max-width: 46rem;
  margin: 0 0 1rem;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  white-space: pre-wrap;
}

.message.user {
  margin-left: auto;
  background: #e7eefb;
}

.message.assistant, .status {
  background: white;
  border: 1px solid #d5dbe3;
}

.status {
  color: #3d4b5c;
  font-style: italic;
}

.source {
  margin-top: 0.8rem;
  padding-top: 0.6rem;
  border-top: 1px solid #e1e6ec;
  font-style: normal;
  font-size: 0.92rem;
}

.source p {
  margin: 0.2rem 0;
}

#ask {
  display: grid;
  gap: 0.6rem;
  border-top: 1px solid #d5dbe3;
}

.actions {
  display: flex;
  gap: 0.5rem;
}

#cancel {
  background: #6b7280;
}

@media (max-width: 800px) {
  .app {
    grid-template-columns: 1fr;
  }

  aside {
    max-height: 14rem;
  }
}
