.live-chat {
  --chat-ink: var(--color-black, #171717);
  --chat-paper: var(--color-sand-light, #f6f5f1);
  --chat-cyan: var(--color-cyan, #69eee6);
  --chat-muted: #63615e;
  --chat-border: #d8d4ce;
  position: fixed;
  right: 1rem;
  bottom: 1.25rem;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.75rem;
  font-family: var(--font-sans, Inter, Arial, sans-serif);
  font-size: 16px;
  font-weight: 400;
  line-height: 1.5;
  letter-spacing: normal;
  text-align: left;
  color: var(--chat-ink);
  color-scheme: light;
}

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

.live-chat h2,
.live-chat p {
  margin: 0;
}

.live-chat__panel {
  display: flex;
  flex-direction: column;
  width: min(24rem, calc(100vw - 2rem));
  max-height: calc(100dvh - 140px);
  overflow-y: auto;
  border: 1px solid var(--chat-border);
  border-radius: 1rem;
  background: var(--chat-paper);
  box-shadow: 0 25px 50px rgb(0 0 0 / 25%);
}

.live-chat__header {
  display: flex;
  flex-shrink: 0;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--chat-border);
  background: var(--chat-ink);
  color: white;
}

.live-chat__title { font-size: 1rem; font-weight: 700; }
.live-chat__subtitle { font-size: 0.75rem; color: rgb(255 255 255 / 75%); }
.live-chat__transcript { min-height: 0; overflow-y: auto; }

.live-chat__messages {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  min-height: 6rem;
  padding: 1rem;
}

.live-chat__muted { font-size: 0.875rem; color: var(--chat-muted); }
.live-chat__message { max-width: 90%; padding: 0.5rem 0.75rem; border-radius: 1rem; }
.live-chat__message--visitor { align-self: flex-end; background: color-mix(in srgb, var(--chat-cyan) 20%, transparent); }
.live-chat__message--staff { align-self: flex-start; background: var(--color-sand, #e9e3dd); }
.live-chat .live-chat__sender { margin-bottom: 0.25rem; font-size: 0.75rem; font-weight: 700; }
.live-chat__body { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 0.875rem; }
.live-chat .live-chat__delivery { margin-top: 0.25rem; font-size: 0.75rem; color: var(--chat-muted); }
.live-chat__composer { flex-shrink: 0; padding: 1rem; border-top: 1px solid var(--chat-border); }
.live-chat .live-chat__error { margin-bottom: 0.75rem; font-size: 0.875rem; color: #b42318; }
.live-chat__form { display: flex; flex-direction: column; gap: 0.75rem; margin: 0; }
.live-chat__identity { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.5rem; }
.live-chat__field { display: flex; flex-direction: column; gap: 0.375rem; min-width: 0; font-size: 0.875rem; font-weight: 700; color: var(--chat-muted); }
.live-chat__field-heading { display: flex; align-items: center; justify-content: space-between; }
.live-chat__count { font-weight: 400; }

.live-chat input,
.live-chat textarea {
  width: 100%;
  min-width: 0;
  padding: 0.625rem 1rem;
  border: 1px solid var(--chat-border);
  border-radius: 0.75rem;
  font: inherit;
  font-size: 1rem;
  font-weight: 400;
  background: white;
  color: var(--chat-ink);
}

.live-chat textarea { max-height: 7rem; resize: none; }
.live-chat__actions { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; }
.live-chat__contact { font-size: 0.75rem; color: var(--chat-muted); text-decoration: underline; }

.live-chat__button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 0;
  border-radius: 0.75rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 700;
  cursor: pointer;
  background: var(--chat-cyan);
  color: var(--chat-ink);
  transition: background-color 150ms ease, transform 150ms ease;
}

.live-chat__close { padding: 0.625rem; background: transparent; color: white; }
.live-chat__button:active:not(:disabled) { transform: translateY(1px); }
.live-chat__button:disabled { opacity: 0.5; cursor: not-allowed; }
.live-chat button:focus-visible,
.live-chat input:focus-visible,
.live-chat textarea:focus-visible,
.live-chat a:focus-visible { outline: 2px solid var(--chat-cyan); outline-offset: 2px; }
.live-chat__toggle { display: flex; flex-direction: column; align-items: center; gap: 0.375rem; }
.live-chat__launcher { position: relative; width: 3.5rem; height: 3.5rem; padding: 0; border-radius: 50%; box-shadow: 0 10px 15px rgb(0 0 0 / 15%); }
.live-chat__icon { flex-shrink: 0; width: 1.25rem; height: 1.25rem; }
.live-chat__icon--small { width: 1rem; height: 1rem; }
.live-chat__icon--large { width: 1.5rem; height: 1.5rem; }
.live-chat__unread { position: absolute; top: -0.25rem; right: -0.25rem; display: flex; align-items: center; justify-content: center; min-width: 1.25rem; height: 1.25rem; border-radius: 999px; background: var(--chat-ink); color: white; font-size: 0.75rem; }
.live-chat__caption { padding: 0.25rem 0.625rem; border-radius: 999px; background: var(--chat-ink); color: white; font-size: 0.75rem; font-weight: 700; box-shadow: 0 1px 3px rgb(0 0 0 / 10%); }

@media (min-width: 640px) {
  .live-chat { right: 1.5rem; bottom: 1.5rem; }
}

@media (hover: hover) {
  .live-chat__button:hover:not(:disabled) { background: color-mix(in srgb, var(--chat-cyan) 90%, var(--chat-ink)); }
  .live-chat__close:hover { background: rgb(255 255 255 / 15%); }
}

@media (prefers-reduced-motion: reduce) {
  .live-chat__button { transition: none; }
  .live-chat__button:active:not(:disabled) { transform: none; }
}
