:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #58635f;
  --line: #d7ded7;
  --surface: #fbfcf8;
  --panel: #ffffff;
  --accent: #2f6f5e;
  --accent-strong: #184c3f;
  --soft: #edf4ec;
  --warn: #8a4b2a;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(180deg, #f7faf4 0%, #e8f0eb 100%);
  color: var(--ink);
}

button,
textarea {
  font: inherit;
}

.shell {
  width: min(900px, calc(100% - 32px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 28px 0;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

h1 {
  margin: 0;
  font-size: clamp(2rem, 6vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.ghost,
.chips button,
.composer button {
  border: 0;
  border-radius: 8px;
  cursor: pointer;
}

.ghost {
  flex: 0 0 auto;
  padding: 10px 14px;
  background: var(--panel);
  color: var(--accent-strong);
  border: 1px solid var(--line);
  font-weight: 700;
}

.intro {
  display: grid;
  gap: 14px;
  padding: 18px 0 8px;
}

.intro p {
  max-width: 680px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.55;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chips button {
  padding: 10px 12px;
  background: var(--soft);
  color: var(--accent-strong);
  font-weight: 700;
}

.chat {
  min-height: 0;
  display: grid;
  grid-template-rows: 1fr auto;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.74);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.messages {
  min-height: 300px;
  overflow-y: auto;
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.bubble {
  width: fit-content;
  max-width: min(680px, 92%);
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
}

.bubble.assistant {
  align-self: flex-start;
  background: var(--soft);
  color: var(--ink);
}

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

.bubble.status {
  align-self: center;
  color: var(--muted);
  background: transparent;
  border: 1px dashed var(--line);
}

.bubble.error {
  align-self: flex-start;
  color: var(--warn);
  background: #fff4ed;
}

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

textarea {
  width: 100%;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  color: var(--ink);
  background: var(--surface);
  line-height: 1.4;
}

textarea:focus {
  outline: 2px solid rgba(47, 111, 94, 0.28);
  border-color: var(--accent);
}

.composer button {
  min-width: 84px;
  padding: 0 18px;
  color: white;
  background: var(--accent);
  font-weight: 800;
}

.composer button:disabled,
.ghost:disabled {
  opacity: 0.58;
  cursor: not-allowed;
}

.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;
}

@media (max-width: 640px) {
  .shell {
    width: min(100% - 20px, 900px);
    padding: 16px 0;
  }

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

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

  .composer button {
    height: 44px;
  }
}
