:root {
  color-scheme: light;
  --red: #df1232;
  --ink: #1e2026;
  --muted: #69707d;
  --line: #dfe3ea;
  --bg: #f4f5f7;
  --panel: #ffffff;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  color: var(--ink);
  background: var(--bg);
}

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

.chat-shell {
  width: min(760px, 100%);
  height: min(760px, calc(100vh - 48px));
  min-height: 560px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  grid-template-rows: auto 1fr auto auto;
  box-shadow: 0 18px 60px rgba(22, 28, 45, 0.12);
  overflow: hidden;
}

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

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

h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.15;
}

.status {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 12px;
}

.messages {
  padding: 20px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.msg {
  max-width: 82%;
  padding: 12px 14px;
  border-radius: 8px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.msg.bot {
  align-self: flex-start;
  background: #f1f3f6;
}

.msg.user {
  align-self: flex-end;
  background: var(--red);
  color: #fff;
}

.chat-form, .lead-form {
  border-top: 1px solid var(--line);
  padding: 14px;
  display: grid;
  gap: 10px;
  background: #fff;
}

.chat-form {
  grid-template-columns: 44px 1fr auto;
}

.lead-form {
  grid-template-columns: 1fr 1fr auto;
}

input {
  min-width: 0;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0 12px;
  font: inherit;
}

button {
  height: 44px;
  border: 0;
  border-radius: 6px;
  padding: 0 16px;
  background: var(--red);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.icon-button {
  padding: 0;
  background: #eef1f5;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled {
  opacity: 0.6;
  cursor: default;
}

@media (max-width: 640px) {
  .page { padding: 0; }
  .chat-shell {
    height: 100vh;
    min-height: 100vh;
    border: 0;
    border-radius: 0;
  }
  .msg { max-width: 92%; }
  .lead-form { grid-template-columns: 1fr; }
  .chat-form { grid-template-columns: 40px 1fr; }
  .chat-form button[type="submit"] { grid-column: 1 / -1; }
}
