:root {
  --bg: #f6efe6;
  --panel: #fffaf4;
  --ink: #2f231d;
  --muted: #7a675b;
  --accent: #b6462f;
  --accent-dark: #8f2f20;
  --border: #e3d3c1;
  --bubble-user: #2f231d;
  --bubble-bot: #efe4d6;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, #f2d6c2 0, transparent 30%),
    radial-gradient(circle at bottom right, #e7c97f 0, transparent 22%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.chat-shell {
  width: min(920px, 100%);
  height: min(780px, 90vh);
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: rgba(255, 250, 244, 0.94);
  border: 1px solid var(--border);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(64, 34, 20, 0.18);
}

.chat-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(182,70,47,0.08), rgba(217,164,65,0.08));
}

.avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex-shrink: 0;
}

.avatar-art {
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 22px;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #d67c44);
}

.header-copy h1 {
  margin: 0;
  font-size: 20px;
}

.header-copy p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.chat-body {
  padding: 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.message {
  display: flex;
  gap: 12px;
  align-items: flex-start;
}

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

.message.user .avatar {
  display: none;
}

.bubble {
  max-width: min(72ch, 80%);
  padding: 14px 16px;
  border-radius: 18px;
  line-height: 1.45;
  font-size: 15px;
  white-space: pre-wrap;
}

.message.bot .bubble {
  background: var(--bubble-bot);
  border-top-left-radius: 6px;
}

.message.user .bubble {
  background: var(--bubble-user);
  color: #fff;
  border-top-right-radius: 6px;
}

.meta {
  margin-top: 6px;
  font-size: 12px;
  color: var(--muted);
}

.lead-card {
  margin-top: 8px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 14px;
  font-size: 12px;
  overflow: auto;
}

.typing-dots {
  display: inline-flex;
  gap: 4px;
  margin-left: 6px;
  vertical-align: middle;
}

.typing-dots span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  opacity: 0.35;
  animation: blink 1.2s infinite ease-in-out;
}

.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }

@keyframes blink {
  0%, 80%, 100% { transform: scale(0.9); opacity: 0.35; }
  40% { transform: scale(1.15); opacity: 1; }
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--border);
  background: rgba(255,255,255,0.6);
}

.chat-input {
  width: 100%;
  min-height: 56px;
  max-height: 180px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px 16px;
  font: inherit;
  color: var(--ink);
  background: #fff;
  outline: none;
}

.send-btn {
  align-self: end;
  height: 56px;
  padding: 0 20px;
  border: 0;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  color: #fff;
  font-weight: 600;
  cursor: pointer;
}

@media (max-width: 720px) {
  body { padding: 0; }
  .chat-shell {
    width: 100%;
    height: 100vh;
    border-radius: 0;
  }
  .bubble { max-width: 88%; }
}
