:root {
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f6f7f4;
  color: #1f2933;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

.shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px;
}

.chat {
  width: min(920px, 100%);
  min-height: min(760px, calc(100vh - 64px));
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  background: #ffffff;
  border: 1px solid #d7ddd2;
  box-shadow: 0 18px 60px rgba(31, 41, 51, 0.12);
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #e3e7df;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 20px;
  line-height: 1.2;
}

h2 {
  font-size: 13px;
  color: #52606d;
}

#status {
  margin-top: 4px;
  font-size: 13px;
  color: #64748b;
}

.mode {
  padding: 6px 8px;
  border: 1px solid #c7d2c0;
  color: #48633f;
  font-size: 12px;
  white-space: nowrap;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px;
  overflow-y: auto;
}

.message {
  max-width: 74%;
  padding: 11px 13px;
  border: 1px solid #dbe2d6;
  line-height: 1.45;
  white-space: pre-wrap;
}

.message.user {
  align-self: flex-end;
  background: #e9f3e4;
}

.message.assistant {
  align-self: flex-start;
  background: #f8faf7;
}

.sources {
  border-top: 1px solid #e3e7df;
  padding: 12px 20px;
  background: #fbfcfa;
}

.sources ul {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.sources a,
.sources span {
  display: inline-flex;
  max-width: 260px;
  padding: 6px 8px;
  border: 1px solid #d7ddd2;
  color: #1f2933;
  font-size: 12px;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 16px 20px 20px;
  border-top: 1px solid #e3e7df;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 48px;
  max-height: 140px;
  border: 1px solid #cfd8c9;
  padding: 10px 11px;
  font: inherit;
}

textarea:focus {
  outline: 2px solid #9ac087;
  outline-offset: 1px;
}

button {
  min-width: 104px;
  border: 1px solid #395b31;
  background: #395b31;
  color: #ffffff;
  font: inherit;
  font-weight: 650;
  cursor: pointer;
}

button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

@media (max-width: 640px) {
  .shell {
    padding: 0;
  }

  .chat {
    min-height: 100vh;
    border: 0;
  }

  .message {
    max-width: 90%;
  }

  .composer {
    grid-template-columns: 1fr;
  }

  button {
    min-height: 44px;
  }
}
