.xs-chat-root {
  --xs-ink: #171713;
  --xs-paper: #f4f1ea;
  --xs-white: #fffef9;
  --xs-green: #24563f;
  --xs-sage: #a8b195;
  --xs-muted: #66685f;
  --xs-line: rgba(23, 23, 19, .16);
  --xs-shadow: 0 22px 70px rgba(22, 27, 22, .23);
  position: fixed;
  z-index: 90;
  right: 22px;
  bottom: 22px;
  color: var(--xs-ink);
  font-family: "Instrument Sans", "Noto Sans SC", Arial, sans-serif;
  line-height: 1.45;
}

.xs-chat-root *,
.xs-chat-root *::before,
.xs-chat-root *::after { box-sizing: border-box; }

.xs-chat-launcher {
  min-height: 54px;
  padding: 0 19px 0 13px;
  display: inline-flex;
  align-items: center;
  gap: 11px;
  float: right;
  border: 1px solid rgba(255,255,255,.26);
  border-radius: 999px;
  background: var(--xs-green);
  color: #fff;
  box-shadow: 0 12px 36px rgba(31,76,56,.28);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: .01em;
}

.xs-chat-launcher[hidden] { display: none; }

.xs-chat-launcher:hover { background: #173f2e; }
.xs-chat-launcher:focus-visible,
.xs-chat-panel button:focus-visible,
.xs-chat-panel input:focus-visible,
.xs-chat-panel select:focus-visible,
.xs-chat-panel textarea:focus-visible {
  outline: 3px solid #d0ab52;
  outline-offset: 2px;
}

.xs-chat-launcher-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--xs-sage);
  color: #173522;
  font-family: "Noto Serif SC", serif;
  font-size: 17px;
}

.xs-chat-launcher-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #b8d576;
  box-shadow: 0 0 0 3px rgba(184,213,118,.17);
}

.xs-chat-panel {
  width: min(390px, calc(100vw - 30px));
  height: min(650px, calc(100svh - 105px));
  margin-bottom: 12px;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  overflow: hidden;
  border: 1px solid var(--xs-line);
  border-radius: 18px;
  background: var(--xs-white);
  box-shadow: var(--xs-shadow);
  transform-origin: bottom right;
}

.xs-chat-panel[hidden] { display: none; }

.xs-chat-header {
  min-height: 76px;
  padding: 15px 14px 14px 18px;
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--xs-green);
  color: #fff;
}

.xs-chat-avatar {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--xs-sage);
  color: #173522;
  font-family: "Noto Serif SC", serif;
  font-size: 18px;
}

.xs-chat-heading { min-width: 0; flex: 1; }
.xs-chat-heading strong { display: block; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 500; }
.xs-chat-status { margin-top: 2px; display: flex; align-items: center; gap: 7px; color: rgba(255,255,255,.72); font-size: 11px; }
.xs-chat-status::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #b8d576; }
.xs-chat-header-actions { display: flex; gap: 2px; }
.xs-chat-icon-button {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: rgba(255,255,255,.8);
  cursor: pointer;
  font: inherit;
  font-size: 18px;
}
.xs-chat-icon-button:hover { background: rgba(255,255,255,.1); color: #fff; }

.xs-chat-scroll {
  min-height: 0;
  padding: 20px 16px 16px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 100% 0, rgba(157,168,139,.15), transparent 34%),
    var(--xs-paper);
  overscroll-behavior: contain;
}

.xs-chat-message-row { margin: 0 0 13px; display: flex; }
.xs-chat-message-row[data-role="user"] { justify-content: flex-end; }
.xs-chat-message {
  max-width: 84%;
  padding: 11px 13px;
  border: 1px solid var(--xs-line);
  border-radius: 15px 15px 15px 4px;
  background: var(--xs-white);
  box-shadow: 0 4px 14px rgba(23,23,19,.05);
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.xs-chat-message-row[data-role="user"] .xs-chat-message {
  border-color: var(--xs-green);
  border-radius: 15px 15px 4px 15px;
  background: var(--xs-green);
  color: #fff;
}
.xs-chat-message a { color: inherit; text-underline-offset: 3px; }
.xs-chat-meta { margin: -6px 2px 13px; color: var(--xs-muted); font-size: 10px; }

.xs-chat-quick-replies { margin: 4px 0 17px; display: flex; flex-wrap: wrap; gap: 7px; }
.xs-chat-chip {
  min-height: 34px;
  padding: 7px 11px;
  border: 1px solid rgba(36,86,63,.34);
  border-radius: 999px;
  background: rgba(255,254,249,.82);
  color: var(--xs-green);
  cursor: pointer;
  font: inherit;
  font-size: 11px;
}
.xs-chat-chip:hover { background: var(--xs-green); color: #fff; }

.xs-chat-typing { display: inline-flex; gap: 4px; align-items: center; }
.xs-chat-typing span { width: 5px; height: 5px; border-radius: 50%; background: var(--xs-muted); animation: xs-chat-bounce 1.1s infinite ease-in-out; }
.xs-chat-typing span:nth-child(2) { animation-delay: .14s; }
.xs-chat-typing span:nth-child(3) { animation-delay: .28s; }
@keyframes xs-chat-bounce { 0%, 70%, 100% { transform: translateY(0); opacity: .45; } 35% { transform: translateY(-4px); opacity: 1; } }

.xs-chat-lead-card {
  margin: 8px 0 17px;
  padding: 15px;
  border: 1px solid rgba(36,86,63,.32);
  border-radius: 14px;
  background: var(--xs-white);
}
.xs-chat-lead-card h3 { margin: 0; font-family: "Noto Serif SC", serif; font-size: 16px; font-weight: 500; }
.xs-chat-lead-card > p { margin: 6px 0 13px; color: var(--xs-muted); font-size: 11px; }
.xs-chat-field { margin-top: 10px; }
.xs-chat-field label { display: block; margin-bottom: 4px; color: var(--xs-muted); font-size: 10px; letter-spacing: .06em; text-transform: uppercase; }
.xs-chat-field input,
.xs-chat-field select,
.xs-chat-field textarea {
  width: 100%;
  padding: 9px 10px;
  border: 1px solid var(--xs-line);
  border-radius: 8px;
  background: #fff;
  color: var(--xs-ink);
  font: inherit;
  font-size: 12px;
}
.xs-chat-field textarea { min-height: 68px; resize: vertical; }
.xs-chat-consent { margin: 11px 0; display: flex; gap: 8px; align-items: flex-start; color: var(--xs-muted); font-size: 10px; }
.xs-chat-consent input { margin-top: 2px; }
.xs-chat-submit-lead {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--xs-green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
}
.xs-chat-submit-lead:disabled { cursor: wait; opacity: .65; }
.xs-chat-form-error { margin: 8px 0 0; color: #8a2f21; font-size: 10px; }

.xs-chat-composer-wrap { border-top: 1px solid var(--xs-line); background: var(--xs-white); }
.xs-chat-composer { padding: 12px; display: flex; align-items: flex-end; gap: 9px; }
.xs-chat-input {
  width: 100%;
  min-height: 42px;
  max-height: 104px;
  padding: 10px 12px;
  resize: none;
  border: 1px solid var(--xs-line);
  border-radius: 12px;
  background: #fff;
  color: var(--xs-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
}
.xs-chat-send {
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--xs-green);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 17px;
}
.xs-chat-send:disabled { cursor: not-allowed; opacity: .42; }
.xs-chat-disclosure { margin: -3px 14px 9px; color: var(--xs-muted); font-size: 9px; text-align: center; }

@media (max-width: 680px) {
  .xs-chat-root { right: 14px; bottom: 14px; }
  .join-page .xs-chat-root { bottom: 80px; }
  .xs-chat-panel {
    position: fixed;
    inset: 10px 10px 10px;
    width: auto;
    height: auto;
    max-height: none;
    margin: 0;
    border-radius: 15px;
  }
  .join-page .xs-chat-panel { bottom: 76px; }
  .xs-chat-launcher { min-height: 50px; padding-right: 16px; }
  .xs-chat-launcher-mark { width: 31px; height: 31px; }
}

@media (prefers-reduced-motion: reduce) {
  .xs-chat-typing span { animation: none; }
}
