*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; }
body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0eefc;
}
#chat-widget {
  width: 100%;
  max-width: 420px;
  height: 90vh;
  max-height: 680px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 8px 40px rgba(83,74,183,0.13);
}
#chat-header {
  background: #534AB7;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}
#chat-header .hdr-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  color: #fff;
  font-weight: 600;
}
#chat-header .hdr-name { color: #fff; font-weight: 600; font-size: 15px; }
#chat-header .hdr-status { color: rgba(255,255,255,0.75); font-size: 12px; margin-top: 2px; }
#messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
}
.msg-bot, .msg-user {
  max-width: 78%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.55;
  animation: fadeUp .22s ease;
}
.msg-bot {
  background: #f4f3fd;
  color: #1a1a2e;
  align-self: flex-start;
  border-radius: 4px 16px 16px 16px;
}
.msg-user {
  background: #534AB7;
  color: #fff;
  align-self: flex-end;
  border-radius: 16px 4px 16px 16px;
}
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}
.typing {
  display: flex;
  gap: 5px;
  align-items: center;
  padding: 12px 16px;
  background: #f4f3fd;
  border-radius: 4px 16px 16px 16px;
  align-self: flex-start;
  animation: fadeUp .2s ease;
}
.typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #9993d6;
  animation: blink 1.2s infinite;
}
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes blink {
  0%, 80%, 100% { opacity: .3; transform: scale(1); }
  40% { opacity: 1; transform: scale(1.25); }
}
.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-self: flex-start;
  animation: fadeUp .25s ease;
}
.btn-choice {
  background: #fff;
  border: 1.5px solid #534AB7;
  color: #534AB7;
  padding: 7px 15px;
  border-radius: 20px;
  font-size: 13px;
  cursor: pointer;
  transition: background .15s, color .15s;
  font-family: inherit;
}
.btn-choice:hover { background: #534AB7; color: #fff; }
.btn-choice:active { transform: scale(.97); }
.btn-choice:disabled { opacity: .45; cursor: default; pointer-events: none; }
.email-card {
  align-self: flex-start;
  max-width: 82%;
  background: #f4f3fd;
  border-radius: 4px 16px 16px 16px;
  padding: 14px 16px;
  animation: fadeUp .25s ease;
}
.email-card p { font-size: 13px; color: #4a4a6a; margin-bottom: 10px; line-height: 1.4; }
.email-card input {
  width: 100%;
  padding: 9px 12px;
  border: 1.5px solid #ccc;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  margin-bottom: 8px;
  transition: border-color .15s;
}
.email-card input:focus { border-color: #534AB7; }
.email-card input.error { border-color: #e24b4a; }
.email-card button {
  width: 100%;
  padding: 9px;
  background: #534AB7;
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s;
}
.email-card button:hover { background: #3C3489; }
.error-msg,
.status-msg {
  display: none;
  font-size: 12px;
  line-height: 1.4;
  margin-bottom: 8px;
}
.error-msg {
  color: #c43d3c;
}
.status-msg {
  color: #3d548f;
}
.error-msg.visible,
.status-msg.visible {
  display: block;
}
.success-note {
  font-size: 13px;
  color: #0f6e56;
  background: #e1f5ee;
  padding: 10px 14px;
  border-radius: 10px;
  margin-top: 2px;
}
