:root {
  --ink: #101828;
  --muted: #667085;
  --line: #eaecf0;
  --surface: #ffffff;
  --soft: #f8fafc;
  --accent: #6941c6;
  --accent-dark: #53389e;
  --success: #12b76a;
  font-family: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background:
  radial-gradient(circle at 15% 10%, rgba(105,65,198,.16), transparent 35%),
  radial-gradient(circle at 85% 80%, rgba(18,183,106,.12), transparent 30%),
  #f7f8fc; min-height: 100vh; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.demo-page { min-height: 100vh; display: grid; place-items: center; padding: 28px; }
.hero { max-width: 760px; text-align: center; }
.eyebrow { font-size: 12px; font-weight: 700; letter-spacing: .18em; color: var(--accent); }
.hero h1 { margin: 14px 0 12px; font-size: clamp(42px, 7vw, 76px); line-height: .98; letter-spacing: -.055em; }
.hero p { margin: 0 auto 26px; color: var(--muted); font-size: 18px; }

.primary-button {
  border: 0; color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-dark));
  min-height: 48px; border-radius: 14px; padding: 0 22px; font-weight: 700;
  box-shadow: 0 12px 26px rgba(105,65,198,.22); transition: .2s ease;
}
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 16px 32px rgba(105,65,198,.28); }
.primary-button.full { width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; }
.primary-button svg { width: 18px; fill: none; stroke: currentColor; stroke-width: 2; }

.chat-launcher {
  position: fixed; right: 24px; bottom: 24px; width: 62px; height: 62px; border: 0; border-radius: 22px;
  display: grid; place-items: center; color: #fff; background: linear-gradient(145deg, #7f56d9, #53389e);
  box-shadow: 0 18px 45px rgba(83,56,158,.38); z-index: 20; transition: transform .2s ease;
}
.chat-launcher:hover { transform: translateY(-3px) scale(1.02); }
.chat-launcher svg { width: 29px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.launcher-pulse { position: absolute; right: 3px; top: 3px; width: 13px; height: 13px; background: var(--success); border: 3px solid white; border-radius: 50%; }

.chat-panel {
  position: fixed; right: 24px; bottom: 98px; width: min(392px, calc(100vw - 28px)); height: min(640px, calc(100vh - 125px));
  background: var(--surface); border: 1px solid rgba(16,24,40,.08); border-radius: 26px;
  box-shadow: 0 30px 80px rgba(16,24,40,.24); overflow: hidden; z-index: 19;
  display: flex; flex-direction: column; opacity: 0; transform: translateY(18px) scale(.97);
  pointer-events: none; transition: .24s cubic-bezier(.2,.8,.2,1);
}
.chat-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.chat-header {
  min-height: 78px; padding: 15px 16px; display: flex; align-items: center; gap: 12px; color: white;
  background: linear-gradient(135deg, #101828 0%, #322659 52%, #53389e 100%);
}
.agent-avatar { width: 45px; height: 45px; border-radius: 15px; display: grid; place-items: center; position: relative; background: rgba(255,255,255,.16); border: 1px solid rgba(255,255,255,.18); font-weight: 700; }
.agent-avatar i { position: absolute; width: 12px; height: 12px; right: -2px; bottom: -2px; background: var(--success); border: 2px solid #322659; border-radius: 50%; }
.header-copy { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.header-copy strong { font-size: 15px; }
.header-copy > span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: rgba(255,255,255,.72); }
.online-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--success); }
.icon-button { width: 38px; height: 38px; border: 0; border-radius: 12px; color: white; background: rgba(255,255,255,.09); display: grid; place-items: center; }
.icon-button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 2; }

.welcome-view { flex: 1; overflow: auto; padding: 30px 24px 22px; }
.welcome-icon { width: 52px; height: 52px; display: grid; place-items: center; font-size: 27px; border-radius: 18px; background: #f4ebff; }
.welcome-view h2 { margin: 18px 0 8px; font-size: 23px; letter-spacing: -.03em; }
.welcome-view > p { color: var(--muted); line-height: 1.5; margin: 0 0 24px; font-size: 14px; }
.start-form { display: grid; gap: 15px; }
.start-form label { display: grid; gap: 7px; font-size: 13px; font-weight: 600; }
.start-form small { font-weight: 400; color: #98a2b3; }
.start-form input { width: 100%; border: 1px solid #d0d5dd; border-radius: 13px; min-height: 46px; padding: 0 13px; outline: none; color: var(--ink); background: white; }
.start-form input:focus { border-color: #9e77ed; box-shadow: 0 0 0 4px #f4ebff; }
.form-error { min-height: 18px; margin: -5px 0 0; color: #d92d20; font-size: 12px; }
.privacy-note { display: flex; align-items: center; justify-content: center; gap: 6px; color: #98a2b3; font-size: 11px; margin-top: 16px; }
.privacy-note svg { width: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.conversation-view { min-height: 0; flex: 1; display: flex; flex-direction: column; background: #f8fafc; }
.message-list { flex: 1; overflow-y: auto; padding: 22px 16px 16px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.day-label { align-self: center; font-size: 10px; color: #98a2b3; background: white; border: 1px solid var(--line); border-radius: 999px; padding: 5px 10px; }
.message { max-width: 82%; padding: 10px 13px 7px; border-radius: 17px; box-shadow: 0 3px 10px rgba(16,24,40,.06); line-height: 1.42; font-size: 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.message.agent { align-self: flex-start; background: white; border: 1px solid var(--line); border-bottom-left-radius: 5px; }
.message.customer { align-self: flex-end; color: white; background: linear-gradient(135deg, #7f56d9, #6941c6); border-bottom-right-radius: 5px; }
.message-meta { display: flex; justify-content: flex-end; gap: 5px; margin-top: 4px; font-size: 9px; opacity: .65; }

.loading-row { padding: 0 18px 8px; display: none; gap: 4px; }
.loading-row.show { display: flex; }
.loading-row span { width: 6px; height: 6px; background: #98a2b3; border-radius: 50%; animation: bounce 1s infinite alternate; }
.loading-row span:nth-child(2) { animation-delay: .15s; }
.loading-row span:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { to { transform: translateY(-4px); opacity: .45; } }

.composer { padding: 12px 12px 8px; background: white; border-top: 1px solid var(--line); display: flex; align-items: flex-end; gap: 8px; }
.composer textarea { flex: 1; max-height: 110px; resize: none; border: 0; outline: 0; border-radius: 14px; background: var(--soft); padding: 11px 12px; line-height: 1.4; }
.composer button { flex: 0 0 42px; height: 42px; border: 0; border-radius: 14px; display: grid; place-items: center; color: white; background: linear-gradient(135deg, #7f56d9, #53389e); }
.composer button:disabled { opacity: .45; cursor: default; }
.composer button svg { width: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.composer-footer { min-height: 29px; padding: 0 14px 9px; display: flex; justify-content: space-between; align-items: center; background: white; font-size: 10px; color: #98a2b3; }
.composer-footer button { border: 0; background: transparent; color: #98a2b3; font-size: 10px; }

@media (max-width: 520px) {
  .chat-panel { inset: 0; width: 100%; height: 100%; max-height: none; border-radius: 0; }
  .chat-launcher { right: 16px; bottom: 16px; }
  .chat-panel.open + .chat-launcher { display: none; }
}

.push-modal {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.push-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 40, 0.68);
  backdrop-filter: blur(7px);
}

.push-modal-card {
  position: relative;
  width: min(410px, 100%);
  padding: 34px 28px 26px;
  border-radius: 26px;
  background: white;
  box-shadow: 0 30px 90px rgba(16, 24, 40, 0.35);
  text-align: center;
  animation: pushModalIn 0.25s ease;
}

.push-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 12px;
  background: #f2f4f7;
  color: #667085;
  font-size: 22px;
}

.push-modal-icon {
  width: 66px;
  height: 66px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 22px;
  background: linear-gradient(135deg, #f4ebff, #e9d7fe);
  font-size: 31px;
}

.push-modal-tag {
  display: inline-flex;
  padding: 6px 10px;
  border-radius: 999px;
  background: #f4ebff;
  color: #6941c6;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
}

.push-modal-card h2 {
  margin: 15px 0 10px;
  font-size: 24px;
  line-height: 1.15;
  letter-spacing: -0.035em;
}

.push-modal-card p {
  margin: 0 0 22px;
  color: #667085;
  font-size: 14px;
  line-height: 1.55;
}

.push-secondary-button {
  width: 100%;
  margin-top: 9px;
  min-height: 42px;
  border: 0;
  background: transparent;
  color: #667085;
  font-weight: 600;
}

#pushMessage {
  display: block;
  min-height: 16px;
  margin-top: 8px;
  color: #667085;
}

@keyframes pushModalIn {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.97);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}