:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --panel: #ffffff;
  --ink: #1c211b;
  --muted: #667064;
  --line: #dfe5dc;
  --accent: #2b725f;
  --accent-strong: #185948;
  --accent-soft: #e5f2ed;
  --danger: #9d2d2d;
  --shadow: 0 18px 50px rgba(28, 33, 27, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.chat-shell {
  width: min(960px, calc(100vw - 32px));
  min-height: 100vh;
  margin: 0 auto;
  display: grid;
  place-items: center;
  padding: 32px 0;
}

.chat-panel {
  width: 100%;
  height: min(780px, calc(100vh - 64px));
  min-height: 560px;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px 24px 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.15;
  letter-spacing: 0;
}

.home-link,
button {
  min-height: 42px;
  border-radius: 6px;
  font: inherit;
  font-weight: 700;
}

.home-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}

.chat-status {
  min-height: 38px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 14px;
}

.chat-status.error {
  color: var(--danger);
}

.message-list {
  margin: 0;
  padding: 22px 24px;
  list-style: none;
  overflow-y: auto;
  background:
    linear-gradient(rgba(255, 255, 255, 0.92), rgba(255, 255, 255, 0.92)),
    repeating-linear-gradient(0deg, transparent 0 35px, rgba(43, 114, 95, 0.05) 35px 36px);
}

.message {
  display: flex;
  margin: 0 0 16px;
}

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

.message-bubble {
  width: fit-content;
  max-width: min(720px, 82%);
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.message.user .message-bubble {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
}

.message.bot .message-bubble {
  background: var(--accent-soft);
}

.composer {
  padding: 18px 24px 22px;
  border-top: 1px solid var(--line);
  background: #fff;
}

textarea {
  width: 100%;
  min-height: 96px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px 14px;
  color: var(--ink);
  font: inherit;
  line-height: 1.45;
}

textarea:focus {
  outline: 3px solid rgba(43, 114, 95, 0.18);
  border-color: var(--accent);
}

.composer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
}

.composer-actions span {
  color: var(--muted);
  font-size: 14px;
}

button {
  border: 0;
  padding: 0 22px;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
}

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

button:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.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: 680px) {
  .chat-shell {
    width: 100%;
    padding: 0;
  }

  .chat-panel {
    min-height: 100vh;
    height: 100vh;
    border: 0;
    border-radius: 0;
  }

  .chat-header,
  .chat-status,
  .message-list,
  .composer {
    padding-left: 16px;
    padding-right: 16px;
  }

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

  .message-bubble {
    max-width: 92%;
  }
}
