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

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  color: #fff;
  background: #10233f;
}

.brand,
.link-button {
  color: inherit;
  font: inherit;
  text-decoration: none;
}

.brand {
  font-weight: 700;
}

.link-button {
  padding: 0;
  border: 0;
  background: transparent;
  cursor: pointer;
}

.content {
  width: min(1120px, calc(100% - 2rem));
  margin: 2rem auto 4rem;
}

.panel {
  padding: clamp(1.5rem, 4vw, 3rem);
  border: 1px solid #dce3ed;
  border-radius: 1rem;
  background: #fff;
  box-shadow: 0 1rem 3rem rgb(24 42 72 / 8%);
}

.login-panel {
  max-width: 32rem;
  margin: 2rem auto 0;
}

.eyebrow {
  margin: 0 0 0.5rem;
  color: #426ba5;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2 {
  margin-top: 0;
}

label {
  display: block;
  margin-bottom: 0.35rem;
  font-weight: 600;
}

input,
textarea {
  width: 100%;
  padding: 0.7rem;
  border: 1px solid #aebbd0;
  border-radius: 0.5rem;
  background: #fff;
  color: inherit;
  font: inherit;
}

textarea {
  min-height: 7rem;
  resize: vertical;
}

button[type="submit"]:not(.link-button) {
  padding: 0.7rem 1rem;
  border: 0;
  border-radius: 0.5rem;
  color: #fff;
  background: #214f88;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

button[type="submit"]:disabled {
  cursor: progress;
  opacity: 0.65;
}

.error {
  padding: 0.75rem;
  border-radius: 0.5rem;
  color: #7b1420;
  background: #fdecef;
}

.muted,
.pending-status,
.citation-detail {
  color: #5f6f86;
}

.chat-layout {
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  gap: 1rem;
  align-items: start;
}

.conversation-panel {
  position: sticky;
  top: 1rem;
  padding: 1rem;
  border: 1px solid #dce3ed;
  border-radius: 1rem;
  background: #fff;
}

.conversation-panel__header {
  display: grid;
  gap: 0.5rem;
  margin-bottom: 1rem;
}

.new-chat-link {
  color: #214f88;
  font-weight: 700;
}

.conversation-list {
  display: grid;
  gap: 0.35rem;
}

.conversation-link {
  overflow: hidden;
  padding: 0.65rem 0.75rem;
  border-radius: 0.5rem;
  color: #243652;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.conversation-link:hover,
.conversation-link:focus-visible,
.conversation-link.is-active {
  background: #eef4fb;
}

.chat-panel {
  min-width: 0;
}

.chat-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.message-list {
  display: grid;
  gap: 1rem;
  margin: 1.5rem 0;
}

.chat-message {
  padding: 1rem;
  border: 1px solid #dce3ed;
  border-radius: 0.75rem;
}

.chat-message--user {
  margin-left: clamp(0rem, 8vw, 5rem);
  background: #f6f9fd;
}

.chat-message--assistant {
  margin-right: clamp(0rem, 4vw, 2rem);
  background: #fff;
}

.message-role {
  margin: 0 0 0.5rem;
  color: #426ba5;
  font-size: 0.82rem;
  font-weight: 700;
}

.message-body {
  line-height: 1.6;
}

.citation-block {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid #e2e8f0;
}

.citation-block h2 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.citation-block ol {
  margin: 0;
  padding-left: 1.3rem;
}

.citation-title {
  margin-bottom: 0.2rem;
}

.citation-detail {
  margin: 0.2rem 0 0.75rem;
  font-size: 0.9rem;
}

.empty-chat {
  padding: 2rem 1rem;
  border: 1px dashed #c7d2e1;
  border-radius: 0.75rem;
  text-align: center;
}

.chat-form {
  padding-top: 1rem;
  border-top: 1px solid #dce3ed;
}

.chat-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 0.75rem;
}

.pending-status {
  margin: 0;
}

@media (max-width: 760px) {
  .content {
    margin-top: 1rem;
  }

  .chat-layout {
    grid-template-columns: 1fr;
  }

  .conversation-panel {
    position: static;
  }

  .chat-message--user,
  .chat-message--assistant {
    margin-left: 0;
    margin-right: 0;
  }
}
