.site-chat-trigger {
  position: fixed;
  z-index: 10;
  right: max(16px, env(safe-area-inset-right));
  bottom: calc(max(16px, env(safe-area-inset-bottom)) + var(--site-chat-footer-offset, 0px));
  display: inline-flex;
  align-items: center;
  gap: 9px;
  min-height: 48px;
  padding: 9px 17px;
  border: 1px solid #3027dc;
  border-radius: 999px;
  background: #3027dc;
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 5px 18px #10234933;
}

.site-chat-trigger:hover { background: #261dbf; }
.site-chat-trigger:focus-visible { outline: 2px solid #3027dc; outline-offset: 3px; }

.site-chat {
  position: fixed;
  inset: auto 16px 16px auto;
  margin: 0;
  width: min(390px, calc(100% - 32px));
  max-height: min(620px, calc(100dvh - 32px));
  padding: 0;
  border: 1px solid #bcccee;
  border-radius: 18px;
  background: white;
  color: #162541;
  box-shadow: 0 12px 42px #1023493d;
}

.site-chat::backdrop { background: #10234933; }
.site-chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: #edf3ff; }
.site-chat-header h2 { margin: 0; font-size: 1.12rem; flex: 1; }
.site-chat-close { min-width: 44px; min-height: 44px; border: 0; background: transparent; color: inherit; font-size: 1.75rem; cursor: pointer; }
.site-chat-body { padding: 16px; }
 .site-chat-form { margin: 12px 0 0; background: transparent; border: 0; padding: 0; }
.site-chat-label { color: #34466a; margin-bottom: 6px; }
.site-chat-composer { display: flex; align-items: center; gap: 8px; }
.site-chat-composer textarea { flex: 1; min-width: 0; min-height: 46px; max-height: 120px; resize: vertical; padding: 12px 14px; border: 1px solid #8493b4; border-radius: 20px; font: inherit; }
.site-chat-send { display: grid; place-items: center; width: 46px; height: 46px; flex: 0 0 46px; border: 0; border-radius: 50%; color: #fff; background: #3027dc; cursor: pointer; }
.site-chat-send:disabled { opacity: .55; cursor: wait; }
.site-chat-skip-phone { margin-top: 8px; padding: 8px 0; min-height: 40px; border: 0; background: transparent; color: #153897; font: inherit; text-decoration: underline; cursor: pointer; }
.site-chat-status { margin: 12px 0; }
.site-chat [hidden] { display: none; }

.site-chat-history {
  min-height: 150px;
  max-height: min(320px, 42dvh);
  overflow-y: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.site-chat-history li { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: #f1f5fd; overflow-wrap: anywhere; white-space: pre-wrap; max-width: 88%; }
.site-chat-history li.is-visitor { align-self: flex-end; background: #e2e5ff; }
.site-chat-history strong { display: block; font-size: .85rem; }
