.serenity-chat-widget {
  --chat-navy: #172c4b;
  --chat-teal: #24dce2;
  --chat-ink: #24324a;
  --chat-muted: #667085;
  --chat-border: #e3e8ef;
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 10050;
  font-family: "Plus Jakarta Sans", Arial, sans-serif;
}

.serenity-chat-widget *,
.serenity-chat-widget *::before,
.serenity-chat-widget *::after {
  box-sizing: border-box;
}

.serenity-chat-panel {
  position: absolute;
  right: 0;
  bottom: 76px;
  display: flex;
  width: min(360px, calc(100vw - 32px));
  max-height: min(580px, calc(100vh - 116px));
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(23, 44, 75, 0.1);
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 16px 48px rgba(18, 35, 61, 0.24);
  color: var(--chat-ink);
}

.serenity-chat-panel[hidden] {
  display: none;
}

.serenity-chat-header {
  display: flex;
  min-height: 72px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: linear-gradient(110deg, #101a3a, var(--chat-navy));
  color: #fff;
}

.serenity-chat-avatar {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 44px;
  place-items: center;
  border: 2px solid var(--chat-teal);
  border-radius: 50%;
  background: #fff;
  color: var(--chat-navy);
  font-size: 17px;
  font-weight: 700;
}

.serenity-chat-heading {
  flex: 1;
  font-size: 15px;
  font-weight: 650;
}

.serenity-chat-heading small {
  display: block;
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.78);
  font-size: 11px;
  font-weight: 400;
}

.serenity-chat-close {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

.serenity-chat-close:hover,
.serenity-chat-close:focus-visible {
  background: rgba(255, 255, 255, 0.14);
}

.serenity-chat-content {
  overflow-y: auto;
  padding: 20px;
}

.serenity-chat-privacy {
  margin: 0 0 14px;
  color: var(--chat-muted);
  font-size: 11px;
  line-height: 1.5;
}

.serenity-chat-messages {
  display: flex;
  max-height: 230px;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  padding: 2px 2px 8px;
  scroll-behavior: smooth;
}

.serenity-chat-message {
  max-width: 92%;
  margin: 0;
  padding: 14px 16px;
  border-radius: 4px 14px 14px 14px;
  background: #f1f4f8;
  color: var(--chat-ink);
  font-size: 14px;
  line-height: 1.55;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.serenity-chat-message-user {
  align-self: flex-end;
  border-radius: 14px 4px 14px 14px;
  background: #e6fbfb;
}

.serenity-chat-message-pending {
  color: var(--chat-muted);
  font-style: italic;
}

.serenity-chat-message-error,
.serenity-chat-status,
.serenity-chat-contact-status {
  color: #a52a2a;
}

.serenity-chat-status,
.serenity-chat-contact-status {
  min-height: 0;
  margin: 6px 0;
  font-size: 12px;
  line-height: 1.45;
}

.serenity-chat-status:empty,
.serenity-chat-contact-status:empty {
  display: none;
}

.serenity-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin: 6px 0 0;
}

.serenity-chat-compose textarea,
.serenity-chat-contact-form input:not([type="checkbox"]),
.serenity-chat-contact-form textarea {
  width: 100%;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--chat-border);
  border-radius: 9px;
  background: #fff;
  color: var(--chat-ink);
  font: inherit;
  font-size: 13px;
  line-height: 1.4;
}

.serenity-chat-compose textarea {
  resize: vertical;
}

.serenity-chat-compose textarea:focus,
.serenity-chat-contact-form input:focus,
.serenity-chat-contact-form textarea:focus {
  border-color: #168b91;
  outline: 2px solid rgba(36, 220, 226, 0.25);
  outline-offset: 1px;
}

.serenity-chat-compose button {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  place-items: center;
  border: 0;
  border-radius: 10px;
  background: var(--chat-navy);
  color: #fff;
  cursor: pointer;
}

.serenity-chat-compose button:disabled,
.serenity-chat-contact-submit:disabled {
  cursor: wait;
  opacity: 0.65;
}

.serenity-chat-compose button svg {
  width: 20px;
  height: 20px;
}

.serenity-chat-note {
  margin: 9px 0 14px;
  color: var(--chat-muted);
  font-size: 11px;
  line-height: 1.45;
}

.serenity-chat-contact {
  margin: 0 0 16px;
  border-top: 1px solid var(--chat-border);
  border-bottom: 1px solid var(--chat-border);
}

.serenity-chat-contact summary {
  padding: 12px 2px;
  color: var(--chat-navy);
  cursor: pointer;
  font-size: 13px;
  font-weight: 650;
}

.serenity-chat-contact-form {
  display: grid;
  gap: 10px;
  padding: 0 0 14px;
}

.serenity-chat-contact-form[hidden],
.serenity-chat-conversation[hidden] {
  display: none;
}

.serenity-chat-intake-intro {
  margin: 0;
  color: var(--chat-muted);
  font-size: 12px;
  line-height: 1.55;
}

.serenity-chat-contact-form > label {
  display: grid;
  gap: 5px;
  color: var(--chat-ink);
  font-size: 12px;
  font-weight: 600;
}

.serenity-chat-contact-form > label span {
  color: var(--chat-muted);
  font-weight: 400;
}

.serenity-chat-contact-form .serenity-chat-consent {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  color: var(--chat-muted);
  font-size: 11px;
  font-weight: 400;
  line-height: 1.5;
}

.serenity-chat-consent input {
  flex: 0 0 auto;
  margin: 2px 0 0;
}

.serenity-chat-contact-submit {
  min-height: 42px;
  padding: 10px 14px;
  border: 0;
  border-radius: 9px;
  background: var(--chat-navy);
  color: #fff;
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 650;
}

.serenity-chat-sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.serenity-chat-actions {
  display: grid;
  gap: 9px;
}

.serenity-chat-actions a {
  display: block;
  padding: 12px 14px;
  border: 1px solid var(--chat-border);
  border-radius: 10px;
  background: #fff;
  color: var(--chat-navy);
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: border-color 160ms ease, background-color 160ms ease;
}

.serenity-chat-actions a:hover,
.serenity-chat-actions a:focus-visible {
  border-color: var(--chat-teal);
  background: #f3ffff;
}

.serenity-chat-launcher {
  display: grid;
  width: 60px;
  height: 60px;
  margin-left: auto;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: var(--chat-teal);
  box-shadow: 0 8px 22px rgba(20, 47, 75, 0.22);
  color: var(--chat-navy);
  cursor: pointer;
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.serenity-chat-launcher:hover {
  box-shadow: 0 10px 28px rgba(20, 47, 75, 0.3);
  transform: translateY(-2px);
}

.serenity-chat-launcher:focus-visible,
.serenity-chat-close:focus-visible,
.serenity-chat-actions a:focus-visible,
.serenity-chat-contact summary:focus-visible,
.serenity-chat-compose button:focus-visible,
.serenity-chat-contact-submit:focus-visible {
  outline: 3px solid #62a8ff;
  outline-offset: 3px;
}

.serenity-chat-launcher svg {
  width: 27px;
  height: 27px;
}

@media (max-width: 480px) {
  .serenity-chat-widget {
    right: 16px;
    bottom: 16px;
  }

  .serenity-chat-panel {
    right: -4px;
    bottom: 72px;
    max-height: min(640px, calc(100dvh - 100px));
  }

  .serenity-chat-content {
    padding: 16px;
  }

  .serenity-chat-messages {
    max-height: 200px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .serenity-chat-messages {
    scroll-behavior: auto;
  }

  .serenity-chat-actions a,
  .serenity-chat-launcher {
    transition: none;
  }
}
