:root {
  color-scheme: light;
  --bg: #eef1f4;
  --surface: #ffffff;
  --surface-muted: #f6f7f8;
  --text: #202124;
  --muted: #676f79;
  --line: #d8dee5;
  --accent: #176b5b;
  --accent-strong: #0f4f43;
  --accent-soft: #e2f2ee;
  --warn: #8c3f2d;
  --shadow: 0 18px 45px rgba(32, 33, 36, 0.11);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, rgba(238, 241, 244, 0.84), rgba(238, 241, 244, 1)),
    url("https://images.unsplash.com/photo-1500530855697-b586d89ba3ee?auto=format&fit=crop&w=1800&q=70");
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
textarea {
  font: inherit;
}

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

.chat-panel {
  width: min(920px, 100%);
  background: rgba(255, 255, 255, 0.95);
  border: 1px solid rgba(216, 222, 229, 0.9);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 28px;
}

.app-header {
  align-items: start;
  border-bottom: 1px solid var(--line);
  display: flex;
  gap: 18px;
  justify-content: space-between;
  padding-bottom: 20px;
}

.eyebrow {
  color: var(--accent);
  font-size: 0.82rem;
  font-weight: 700;
  margin: 0 0 4px;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  font-size: clamp(2rem, 6vw, 4.2rem);
  line-height: 0.98;
  margin-bottom: 0;
}

h2 {
  font-size: 0.95rem;
  line-height: 1.2;
  margin-bottom: 10px;
}

.status-pill {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  flex: 0 0 auto;
  font-size: 0.85rem;
  padding: 7px 11px;
}

.status-pill.busy {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.status-pill.error {
  background: #f8e8e3;
  color: var(--warn);
}

.question-form {
  display: grid;
  gap: 10px;
  padding-top: 24px;
}

.question-form label,
.feedback-row > span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

textarea {
  background: var(--surface-muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  line-height: 1.45;
  min-height: 132px;
  padding: 14px 16px;
  resize: vertical;
  width: 100%;
}

textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(23, 107, 91, 0.18);
  outline: none;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
}

#ask-button {
  background: var(--accent);
  border: 0;
  border-radius: 8px;
  color: #ffffff;
  cursor: pointer;
  font-weight: 750;
  min-height: 44px;
  min-width: 112px;
  padding: 10px 18px;
}

#ask-button:hover {
  background: var(--accent-strong);
}

#ask-button:disabled {
  cursor: wait;
  opacity: 0.7;
}

.answer-section {
  display: grid;
  gap: 14px;
  padding-top: 22px;
}

.question-card,
.answer-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.question-card {
  background: var(--surface-muted);
}

#question-copy {
  color: var(--muted);
  font-style: italic;
  margin-bottom: 0;
}

.answer-copy {
  line-height: 1.62;
}

.answer-copy p:last-child {
  margin-bottom: 0;
}

.context-details {
  border-top: 1px solid var(--line);
  margin-top: 18px;
  padding-top: 14px;
}

.context-details summary {
  align-items: baseline;
  color: var(--muted);
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  list-style: none;
}

.context-details summary::-webkit-details-marker {
  display: none;
}

.context-details summary span {
  color: var(--text);
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.context-details summary small {
  font-size: 0.82rem;
}

.citations-list {
  display: grid;
  gap: 12px;
  list-style: none;
  margin: 14px 0 0;
  padding: 0;
}

.citation {
  background: var(--surface-muted);
  border-left: 3px solid var(--accent);
  border-radius: 6px;
  padding: 12px 14px;
}

.citation a {
  color: var(--accent-strong);
  font-weight: 750;
}

.citation-date {
  color: var(--muted);
  font-size: 0.88rem;
}

.citation p {
  color: #34383d;
  font-size: 0.92rem;
  line-height: 1.5;
  margin: 8px 0 0;
  white-space: pre-line;
}

.feedback-row {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.feedback-buttons {
  display: flex;
  gap: 8px;
}

.icon-button {
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  height: 44px;
  justify-content: center;
  padding: 0;
  width: 44px;
}

.icon-button:hover,
.icon-button.selected {
  background: var(--accent-soft);
  border-color: var(--accent);
}

.icon-button svg {
  fill: none;
  height: 25px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 1.8;
  width: 25px;
}

#feedback-status {
  color: var(--muted);
}

@media (max-width: 680px) {
  .shell {
    padding: 14px;
    place-items: stretch;
  }

  .chat-panel {
    padding: 18px;
  }

  .app-header {
    display: grid;
  }

  .status-pill {
    justify-self: start;
  }

  .form-actions,
  #ask-button {
    width: 100%;
  }
}
