:root {
  --bg: #fff7fb;
  --surface: #ffffff;
  --pink: #e83f8f;
  --pink-strong: #c91f72;
  --pink-soft: #ffe0ee;
  --text: #2d2630;
  --muted: #7a6873;
  --line: #f4bfd7;
  --shadow: 0 22px 70px rgba(201, 31, 114, 0.16);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(232, 63, 143, 0.16), transparent 32rem),
    linear-gradient(135deg, #fff 0%, var(--bg) 54%, #fff 100%);
}

.site-page {
  overflow: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: #fff;
  background: var(--pink);
  cursor: pointer;
  transition: transform 0.16s ease, background 0.16s ease;
}

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

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: wait;
  opacity: 0.62;
}

.site-backdrop {
  min-height: 100vh;
  padding: 22px;
  background:
    linear-gradient(rgba(255, 255, 255, 0.74), rgba(255, 246, 250, 0.84)),
    url("https://images.unsplash.com/photo-1507525428034-b723cf961d3e?auto=format&fit=crop&w=1800&q=78") center/cover;
}

.site-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: min(1120px, calc(100vw - 44px));
  margin: 0 auto;
  padding: 18px 0;
}

.site-topbar strong {
  color: var(--pink-strong);
  font-size: 24px;
}

.site-topbar nav {
  display: flex;
  gap: 22px;
  color: #6c5663;
  font-weight: 700;
}

.site-hero {
  display: grid;
  width: min(1120px, calc(100vw - 44px));
  min-height: calc(100vh - 88px);
  margin: 0 auto;
  align-items: center;
}

.site-hero div {
  max-width: 620px;
}

.site-kicker {
  color: var(--pink-strong);
  font-weight: 800;
}

.site-hero h1 {
  margin: 12px 0;
  font-size: clamp(42px, 7vw, 84px);
  line-height: 0.96;
}

.site-hero p:not(.site-kicker) {
  max-width: 540px;
  color: #5b4854;
  font-size: 20px;
  line-height: 1.5;
}

.site-hero button,
.chat-launcher {
  min-height: 52px;
  margin-top: 24px;
  padding: 0 24px;
  border-radius: 999px;
  box-shadow: 0 14px 34px rgba(201, 31, 114, 0.26);
  font-weight: 800;
}

.chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 5;
}

.chat-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(32, 19, 29, 0.42);
  opacity: 0;
  pointer-events: none;
  backdrop-filter: blur(7px);
  transition: opacity 0.22s ease;
}

.chat-overlay.is-open {
  opacity: 1;
  pointer-events: auto;
}

.chat-shell {
  display: grid;
  grid-template-rows: auto 1fr auto;
  width: min(430px, calc(100vw - 28px));
  aspect-ratio: 9 / 16;
  max-height: calc(100vh - 36px);
  min-height: min(720px, calc(100vh - 36px));
  margin: 0 auto;
  overflow: hidden;
  border: 10px solid #20131d;
  border-radius: 38px;
  background: #fff;
  box-shadow: 0 30px 90px rgba(32, 19, 29, 0.36);
  backdrop-filter: blur(16px);
  transform: translateY(18px) scale(0.96);
  transition: transform 0.22s ease;
}

.chat-overlay.is-open .chat-shell {
  transform: translateY(0) scale(1);
}

.chat-header,
.admin-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 12px;
  border-bottom: 1px solid var(--line);
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.96), rgba(255, 224, 238, 0.98));
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-weight: 900;
  font-size: 23px;
  background: linear-gradient(135deg, var(--pink), #ff8fbd);
}

h1,
h2,
p {
  margin: 0;
}

.chat-header h1,
.admin-header h1 {
  font-size: 20px;
  letter-spacing: 0;
  line-height: 1;
}

.chat-header p,
.admin-header p,
.muted {
  color: var(--muted);
}

.chat-title {
  min-width: 0;
  flex: 1;
}

.chat-title p {
  min-height: 18px;
  font-size: 13px;
}

.typing-status {
  color: var(--pink-strong);
  animation: blinkStatus 1s ease-in-out infinite;
}

.icon-button {
  display: grid;
  width: 36px;
  height: 36px;
  min-height: 36px;
  place-items: center;
  border-radius: 50%;
  color: var(--pink-strong);
  background: rgba(255, 255, 255, 0.72);
  font-size: 26px;
  line-height: 1;
}

.icon-button:hover {
  color: #fff;
}

.messages {
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 18px 12px;
  background:
    radial-gradient(circle at 10% 0%, rgba(255, 199, 223, 0.5), transparent 16rem),
    linear-gradient(180deg, #fff8fb, #fff1f7 48%, #ffffff);
}

.message {
  width: fit-content;
  max-width: 84%;
  padding: 11px 13px;
  border-radius: 20px;
  white-space: pre-wrap;
  font-size: 14px;
  line-height: 1.42;
  box-shadow: 0 8px 22px rgba(45, 38, 48, 0.08);
}

.message.assistant {
  align-self: flex-start;
  border-bottom-left-radius: 6px;
  background: var(--surface);
}

.message.user {
  align-self: flex-end;
  border-bottom-right-radius: 6px;
  color: #fff;
  background: linear-gradient(135deg, var(--pink), #f66fa8);
}

.typing-bubble {
  display: flex;
  align-items: center;
  gap: 5px;
  min-width: 56px;
}

.typing-bubble span {
  display: block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #c9789d;
  animation: typingDot 1.1s ease-in-out infinite;
}

.typing-bubble span:nth-child(2) {
  animation-delay: 0.16s;
}

.typing-bubble span:nth-child(3) {
  animation-delay: 0.32s;
}

.composer {
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 9px;
  padding: 11px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.98);
}

.composer textarea,
.admin-panel input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 14px;
  outline: 0;
  color: var(--text);
  background: #fff;
}

.composer textarea {
  min-height: 44px;
  max-height: 116px;
  resize: none;
  padding: 12px 14px;
  border-radius: 22px;
}

.composer textarea:focus,
.admin-panel input:focus {
  border-color: var(--pink);
  box-shadow: 0 0 0 4px rgba(232, 63, 143, 0.12);
}

.composer button,
.admin-panel button,
.admin-header a {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 16px;
  font-weight: 700;
}

.composer button {
  display: grid;
  width: 46px;
  padding: 0;
  place-items: center;
  border-radius: 50%;
  font-size: 24px;
}

.admin-status {
  margin: 18px 0;
}

.leads-list {
  display: grid;
  gap: 14px;
}

.lead-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffafd;
}

.lead-card-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.lead-card-heading span {
  font-size: 13px;
  font-weight: 700;
}

.delivery-ok {
  color: #18794e;
}

.delivery-error {
  color: #b42318;
}

.lead-card dl {
  display: grid;
  grid-template-columns: minmax(120px, 0.7fr) minmax(0, 1.3fr);
  gap: 7px 14px;
  margin: 0;
}

.lead-card dt {
  color: var(--muted);
}

.lead-card dd {
  min-width: 0;
  margin: 0;
  overflow-wrap: anywhere;
}

.lead-summary {
  margin: 14px 0 8px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  white-space: pre-wrap;
}

.admin-header a {
  display: inline-grid;
  margin-left: auto;
  place-items: center;
  color: #fff;
  text-decoration: none;
  background: var(--pink);
}

.admin-shell {
  width: min(1120px, calc(100vw - 28px));
  margin: 14px auto 40px;
}

.admin-panel,
.stats-grid article,
.recent-list article {
  border: 1px solid rgba(232, 63, 143, 0.16);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 12px 36px rgba(201, 31, 114, 0.1);
}

.admin-panel {
  display: grid;
  gap: 14px;
  margin-top: 16px;
  padding: 18px;
}

.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.admin-panel input {
  min-height: 48px;
  padding: 0 14px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.stats-grid article {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.stats-grid span {
  color: var(--muted);
}

.stats-grid strong {
  font-size: 32px;
}

.chat-ids {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.chat-id-button {
  min-height: 40px;
  color: var(--pink-strong);
  border: 1px solid var(--line);
  background: var(--pink-soft);
}

.recent-list {
  display: grid;
  gap: 10px;
}

.recent-list article {
  display: grid;
  gap: 6px;
  padding: 14px;
}

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

@keyframes typingDot {
  0%,
  70%,
  100% {
    transform: translateY(0);
    opacity: 0.38;
  }

  35% {
    transform: translateY(-4px);
    opacity: 1;
  }
}

@keyframes blinkStatus {
  0%,
  100% {
    opacity: 0.45;
  }

  50% {
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .site-topbar nav {
    display: none;
  }

  .site-hero h1 {
    font-size: 44px;
  }

  .chat-shell {
    width: min(430px, calc(100vw - 16px));
    min-height: auto;
    height: min(calc((100vw - 16px) * 16 / 9), calc(100vh - 16px));
    margin: 0;
    border-width: 7px;
    border-radius: 30px;
  }

  .chat-header,
  .admin-header {
    padding: 12px;
  }

  .messages {
    padding: 14px 10px;
  }

  .message {
    max-width: 92%;
  }

  .composer,
  .admin-row,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .composer button {
    min-height: 44px;
  }
}
