@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=Manrope:wght@600;700&display=swap");

:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #66736b;
  --line: #dce3de;
  --paper: #ffffff;
  --canvas: #f3f6f3;
  --green: #186b4b;
  --green-dark: #10523a;
  --mint: #e4f2e9;
  --error: #9f3028;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  color: var(--ink);
  background:
    linear-gradient(rgba(30, 78, 57, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(30, 78, 57, 0.035) 1px, transparent 1px),
    var(--canvas);
  background-size: 24px 24px;
  font-family: "DM Sans", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

.shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(960px, 100%);
  min-height: 100%;
  margin: 0 auto;
  background: var(--paper);
  border-inline: 1px solid var(--line);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--line);
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  color: white;
  background: var(--green);
  border-radius: 7px;
  font-family: "Manrope", sans-serif;
  font-size: 21px;
  font-weight: 700;
}

h1,
h2,
p {
  margin: 0;
}

h1,
h2 {
  font-family: "Manrope", sans-serif;
  letter-spacing: 0;
}

h1 {
  font-size: 17px;
}

.topbar p {
  margin-top: 2px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-left: auto;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.status span {
  width: 8px;
  height: 8px;
  background: #2e9f69;
  border-radius: 50%;
}

.conversation {
  min-height: 0;
  padding: 48px clamp(20px, 6vw, 72px);
  overflow-y: auto;
}

.access-panel {
  display: grid;
  place-items: center;
  padding: 32px 20px;
}

.access-panel > div {
  width: min(460px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.access-panel h2 {
  margin-bottom: 22px;
  font-size: 22px;
}

.access-form label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.access-form > div {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
}

.access-form input {
  min-width: 0;
  padding: 11px 12px;
  border: 1px solid #bdc9c1;
  border-radius: 6px;
  outline: 0;
}

.access-form input:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 107, 75, 0.1);
}

.access-form button {
  padding: 10px 14px;
  color: white;
  background: var(--green);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.access-form button:hover { background: var(--green-dark); }

.access-error {
  min-height: 20px;
  margin-top: 10px;
  color: var(--error);
  font-size: 13px;
}

.welcome {
  width: min(580px, 100%);
  margin: clamp(28px, 10vh, 96px) auto 0;
}

.eyebrow {
  margin-bottom: 10px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h2 {
  margin-bottom: 28px;
  font-size: clamp(25px, 4vw, 34px);
  line-height: 1.2;
}

.suggestions {
  display: grid;
  gap: 9px;
}

.suggestions button {
  width: 100%;
  padding: 13px 15px;
  color: var(--ink);
  text-align: left;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 150ms, background 150ms;
}

.suggestions button:hover {
  background: var(--mint);
  border-color: #a9c7b6;
}

.message {
  display: flex;
  margin-bottom: 24px;
  animation: reveal 240ms ease-out both;
}

.message.user {
  justify-content: flex-end;
}

.bubble {
  max-width: min(680px, 88%);
  line-height: 1.55;
  white-space: pre-wrap;
}

.user .bubble {
  padding: 12px 16px;
  background: var(--green);
  color: white;
  border-radius: 8px 8px 2px 8px;
}

.assistant .bubble {
  width: 100%;
}

.assistant-label {
  display: block;
  margin-bottom: 8px;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.sources {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}

.source {
  display: block;
  padding: 11px 13px;
  color: var(--green-dark);
  text-decoration: none;
  background: var(--mint);
  border-left: 3px solid var(--green);
  border-radius: 0 5px 5px 0;
}

.source strong,
.source small {
  display: block;
}

.source small {
  margin-top: 3px;
  color: var(--muted);
}

.loading {
  display: flex;
  gap: 5px;
  padding-top: 8px;
}

.loading span {
  width: 7px;
  height: 7px;
  background: var(--green);
  border-radius: 50%;
  animation: pulse 1s infinite alternate;
}

.loading span:nth-child(2) { animation-delay: 180ms; }
.loading span:nth-child(3) { animation-delay: 360ms; }
.error .bubble { color: var(--error); }

.composer {
  display: grid;
  grid-template-columns: 1fr 44px;
  align-items: end;
  gap: 10px;
  margin: 0 clamp(16px, 5vw, 64px) 24px;
  padding: 9px 9px 9px 16px;
  background: var(--paper);
  border: 1px solid #bdc9c1;
  border-radius: 8px;
  box-shadow: 0 10px 30px rgba(23, 33, 27, 0.08);
}

.composer:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(24, 107, 75, 0.1);
}

textarea {
  width: 100%;
  max-height: 140px;
  padding: 10px 0;
  color: var(--ink);
  resize: none;
  border: 0;
  outline: 0;
}

textarea::placeholder {
  color: #89938d;
}

.send {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  color: white;
  background: var(--green);
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.send:hover { background: var(--green-dark); }
.send:disabled { cursor: wait; opacity: 0.55; }
.send svg { width: 19px; fill: none; stroke: currentColor; stroke-width: 2; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@keyframes reveal {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes pulse {
  from { opacity: 0.3; transform: translateY(0); }
  to { opacity: 1; transform: translateY(-3px); }
}

@media (max-width: 640px) {
  .shell { border: 0; }
  .topbar { min-height: 66px; padding: 12px 16px; }
  .brand-mark { width: 38px; height: 38px; flex-basis: 38px; }
  .conversation { padding: 24px 16px; }
  .welcome { margin-top: 28px; }
  .access-form > div { grid-template-columns: 1fr; }
  .composer { margin: 0 12px 12px; }
  .status { font-size: 0; }
}
