/* Чат на лендинге: панель в палитре сайта, без сторонних библиотек. */
.chat-launcher {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 40;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 52px;
  padding: 0 18px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  background: var(--pink);
  border: 0;
  border-radius: 999px;
  box-shadow: 0 12px 28px rgba(8, 12, 20, .35);
  cursor: pointer;
}
.chat-launcher:hover { background: #ff579b; }
.chat-launcher:focus-visible { outline: 2px solid var(--white); outline-offset: 2px; }
.chat-launcher svg { width: 22px; height: 22px; }

.chat-panel {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(16px + 64px + env(safe-area-inset-bottom));
  z-index: 41;
  display: flex;
  flex-direction: column;
  width: min(400px, calc(100vw - 32px));
  max-height: min(70vh, 620px);
  background: var(--paper, #0f1620);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 60px rgba(8, 12, 20, .5);
  overflow: hidden;
}
.chat-panel[hidden] { display: none; }
.chat-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .03);
}
.chat-head h2 { margin: 0; font-size: 16px; font-weight: 700; color: var(--white); }
.chat-head p { margin: 2px 0 0; font-size: 12px; color: var(--muted); }
.chat-close {
  margin-left: auto;
  width: 36px;
  height: 36px;
  font-size: 20px;
  line-height: 1;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  cursor: pointer;
}
.chat-log {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chat-message {
  max-width: 88%;
  padding: 10px 14px;
  font-size: 14px;
  line-height: 1.45;
  color: var(--white);
  background: rgba(255, 255, 255, .06);
  border-radius: 14px 14px 14px 4px;
  white-space: pre-line;
}
.chat-message.is-user {
  align-self: flex-end;
  color: var(--navy);
  background: var(--pink);
  border-radius: 14px 14px 4px 14px;
}
.chat-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 0 16px 12px; }
.chat-chip {
  padding: 8px 12px;
  font: inherit;
  font-size: 13px;
  color: var(--white);
  background: none;
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.chat-chip:hover, .chat-chip:focus-visible { border-color: var(--pink); }

.chat-form {
  display: grid;
  gap: 10px;
  padding: 0 16px 14px;
  max-height: 54vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.chat-form[hidden] { display: none; }
.chat-form label { display: grid; gap: 6px; font-size: 12px; color: var(--muted); }
.chat-form input, .chat-form textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--white);
  background: var(--surface, #1e293b);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.chat-form textarea { min-height: 52px; resize: vertical; }
.chat-form .chat-consent {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  cursor: pointer;
}
.chat-form .chat-consent span { display: block; }
.chat-consent input {
  flex: none;
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  accent-color: var(--pink);
}
.chat-consent a { color: var(--white); text-decoration: underline; text-underline-offset: .2em; }
.chat-submit {
  min-height: 46px;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--navy);
  background: var(--pink);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.chat-submit[disabled] { opacity: .6; cursor: default; }
.chat-status { margin: 0; padding: 0 16px 14px; font-size: 13px; color: var(--muted); }
.chat-status.is-error { color: #ff8fa8; }

.chat-compose { display: flex; gap: 8px; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
.chat-compose textarea {
  flex: 1;
  min-height: 44px;
  max-height: 120px;
  padding: 11px 12px;
  font: inherit;
  font-size: 14px;
  color: var(--white);
  background: var(--surface, #1e293b);
  border: 1px solid var(--line);
  border-radius: 12px;
  resize: none;
}
.chat-send {
  flex: none;
  width: 44px;
  height: 44px;
  font-size: 18px;
  color: var(--navy);
  background: var(--pink);
  border: 0;
  border-radius: 12px;
  cursor: pointer;
}
.chat-send[disabled] { opacity: .55; cursor: default; }

@media (max-width: 600px) {
  .chat-launcher span { display: none; }
  .chat-launcher { width: 56px; height: 56px; padding: 0; justify-content: center; }
  .chat-panel {
    left: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-height: 88vh;
    border-radius: 18px 18px 0 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .chat-panel, .chat-message { transition: none; }
}
