:root {
  color-scheme: light;
  --blue: #0050a4;
  --black: #151515;
  --white: #ffffff;
  --border: #d8dde6;
  --muted: #5d6675;
  --surface: #f4f7fb;
  --accent: #d71920;
  --send-blue: #69c7ff;
  --send-blue-dark: #0b72b7;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #edf4fb 48%, #f7f7f7 100%);
  color: var(--black);
}

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

.chat-panel {
  width: min(980px, 100%);
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
  max-height: 980px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 24px 80px rgba(15, 23, 42, 0.12);
  overflow: hidden;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 24px;
  border-bottom: 4px solid var(--blue);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(1.3rem, 2.4vw, 2rem);
  line-height: 1.1;
}

.status {
  min-width: 158px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.86rem;
  text-align: center;
  background: var(--surface);
}

.messages {
  min-height: 0;
  overflow-y: auto;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background:
    linear-gradient(rgba(255,255,255,0.94), rgba(255,255,255,0.94)),
    repeating-linear-gradient(90deg, var(--blue) 0 10px, var(--black) 10px 20px, var(--white) 20px 30px);
}

.message {
  width: fit-content;
  max-width: min(720px, 100%);
  border-radius: 8px;
  padding: 12px 14px;
  line-height: 1.5;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  text-indent: 0;
}

.message.user {
  align-self: flex-end;
  background: var(--blue);
  color: var(--white);
}

.message.bot {
  align-self: flex-start;
  border: 1px solid var(--border);
  background: var(--white);
}

.intro-message {
  width: min(720px, 100%);
  max-width: min(720px, 100%);
  text-align: left;
  margin-left: 0;
  text-indent: 0;
  white-space: normal;
}

.loading-message {
  color: var(--muted);
}

.sources {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.source-item {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
}

.source-item a {
  color: var(--blue);
  font-weight: 700;
  text-decoration: none;
}

.source-item a:hover {
  text-decoration: underline;
}

.source-date {
  color: var(--muted);
  font-size: 0.82rem;
}

.quick-questions-panel {
  border-top: 1px solid var(--border);
  background: #fbfcfe;
}

.quick-questions-toggle {
  width: 100%;
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border: 0;
  border-radius: 0;
  padding: 10px 16px;
  background: #fbfcfe;
  color: var(--black);
  font-size: 0.9rem;
  font-weight: 800;
  text-align: left;
}

.quick-questions-toggle:hover {
  background: #eef6fd;
  color: var(--black);
}

.quick-questions-icon {
  color: var(--blue);
  font-size: 1.1rem;
  line-height: 1;
}

.quick-questions {
  min-height: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 16px 10px;
}

.quick-questions-panel.collapsed .quick-questions {
  display: none;
}

.quick-questions-panel.collapsed .quick-questions-icon {
  transform: rotate(-90deg);
}

.quick-question {
  width: auto;
  min-width: 0;
  max-width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 11px;
  background: var(--white);
  color: var(--blue);
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  white-space: normal;
}

.composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

textarea {
  width: 100%;
  min-height: 52px;
  max-height: 160px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px;
  font: inherit;
}

button {
  min-width: 112px;
  border: 0;
  border-radius: 6px;
  padding: 0 18px;
  background: var(--send-blue);
  color: var(--black);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--send-blue-dark);
  color: var(--white);
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

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

  .chat-panel {
    height: 100vh;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .status {
    width: 100%;
    text-align: left;
  }

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

  button {
    min-height: 46px;
  }

  .quick-questions {
    padding-inline: 12px;
  }

  .quick-questions-toggle {
    padding-inline: 12px;
  }
}
