#support-chat {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 60;
  color: #0f172a;
  font-family: Inter, system-ui, sans-serif;
}

#support-chat .hidden {
  display: none;
}

#support-chat button:focus-visible,
#support-chat-email-input:focus-visible {
  outline: 2px solid #01204c;
  outline-offset: 2px;
}

#support-chat-preview {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 300px;
  max-width: calc(100vw - 48px);
  padding: 14px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px 16px 4px 16px;
  background: white;
  box-shadow: 0 12px 32px rgb(15 23 42 / 14%);
  text-align: left;
}

.support-chat-preview-heading {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #64748b;
  font-size: 13px;
  line-height: 18px;
}

.support-chat-preview-avatar {
  display: grid;
  width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 50%;
  background: #01204c;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

#support-chat-preview-text {
  display: -webkit-box;
  overflow: hidden;
  margin-top: 6px;
  font-size: 15px;
  line-height: 22px;
  overflow-wrap: anywhere;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

#support-chat-bubble {
  position: relative;
  display: grid;
  width: 56px;
  height: 56px;
  place-items: center;
  border-radius: 50%;
  background: #01204c;
  color: white;
  box-shadow: 0 10px 24px rgb(1 32 76 / 28%);
}

#support-chat-bubble[aria-expanded="true"] .support-chat-icon-open,
#support-chat-bubble[aria-expanded="false"] .support-chat-icon-close {
  display: none;
}

#support-chat-unread {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid white;
  border-radius: 50%;
  background: #dc2626;
  color: white;
  font-size: 11px;
  font-weight: 700;
}

#support-chat-unread:not(.hidden) {
  display: grid;
  place-items: center;
}

#support-chat-panel {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 384px;
  height: 620px;
  max-height: calc(100dvh - 120px);
  overflow: hidden;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 20px;
  background: white;
  box-shadow: 0 24px 56px rgb(15 23 42 / 18%);
}

#support-chat-panel:not(.hidden) {
  display: flex;
}

.support-chat-header {
  display: flex;
  flex: none;
  align-items: center;
  gap: 12px;
  padding: 16px 12px 16px 20px;
  border-bottom: 1px solid #f1f5f9;
}

.support-chat-brand,
.support-chat-message-avatar {
  display: grid;
  flex: none;
  place-items: center;
  border-radius: 50%;
  background: #01204c;
  color: white;
  font-weight: 700;
}

.support-chat-brand {
  position: relative;
  width: 40px;
  height: 40px;
  font-size: 17px;
}

.support-chat-brand::after {
  position: absolute;
  right: -1px;
  bottom: -1px;
  width: 12px;
  height: 12px;
  border: 2px solid white;
  border-radius: 50%;
  background: #22c55e;
  content: "";
}

.support-chat-header:has(#support-chat-status[data-unavailable]) .support-chat-brand::after {
  background: #94a3b8;
}

.support-chat-heading {
  flex: 1;
  min-width: 0;
}

#support-chat-title {
  font-size: 16px;
  font-weight: 600;
  line-height: 22px;
}

#support-chat-status {
  overflow: hidden;
  color: #64748b;
  font-size: 13px;
  line-height: 18px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.support-chat-header button:not([hidden]) {
  display: grid;
  flex: 0 0 40px;
  height: 40px;
  place-items: center;
  border-radius: 10px;
  color: #475569;
}

.support-chat-header button:hover {
  background: #f8fafc;
}

.support-chat-content {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  min-height: 0;
  overflow-y: auto;
  padding: 32px 20px 12px;
}

.support-chat-thread {
  flex: none;
  margin-top: auto;
}

.support-chat-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 4px 12px 4px 4px;
  border: 1px solid #e2e8f0;
  border-radius: 999px;
  margin-bottom: 14px;
  background: #f8fafc;
  color: #334155;
  font-size: 13px;
  font-weight: 500;
  line-height: 18px;
}

.support-chat-chip img {
  border-radius: 50%;
  object-fit: cover;
}

.support-chat-content[data-conversation] {
  padding: 20px 16px 12px;
}

.support-chat-content[data-conversation] .support-chat-context {
  text-align: center;
}

.support-chat-greeting {
  font-size: 22px;
  font-weight: 600;
  line-height: 30px;
  letter-spacing: -0.3px;
}

.support-chat-subtitle {
  margin-top: 4px;
  color: #64748b;
  font-size: 15px;
  line-height: 22px;
}

.support-chat-topics {
  display: grid;
  gap: 8px;
  margin-top: 20px;
}

.support-chat-topic {
  display: flex;
  min-height: 48px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px 8px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 500;
  text-align: left;
}

.support-chat-topic:hover,
.support-chat-topic:focus-visible {
  border-color: #01204c;
  background: #f8fafc;
}

.support-chat-topic svg {
  flex: none;
}

.support-chat-message {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  margin-top: 4px;
}

.support-chat-message[data-group-first] {
  margin-top: 16px;
}

.support-chat-message-item:first-child .support-chat-message {
  margin-top: 0;
}

.support-chat-message-avatar {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.support-chat-message:not([data-group-last]) .support-chat-message-avatar {
  visibility: hidden;
}

.support-chat-message-user {
  justify-content: flex-end;
}

.support-chat-message > div {
  min-width: 0;
  max-width: 264px;
  padding: 10px 14px;
  font-size: 15px;
  line-height: 22px;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.support-chat-message-user > div {
  border-radius: 16px 6px 6px 16px;
  background: #01204c;
  color: white;
}

.support-chat-message-staff > div {
  border-radius: 6px 16px 16px 6px;
  background: #f1f5f9;
}

.support-chat-message-user[data-group-first] > div {
  border-top-right-radius: 16px;
}

.support-chat-message-staff[data-group-first] > div {
  border-top-left-radius: 16px;
}

.support-chat-message-user[data-group-last] > div {
  border-bottom-right-radius: 4px;
}

.support-chat-message-staff[data-group-last] > div {
  border-bottom-left-radius: 4px;
}

.support-chat-message-meta {
  margin: 4px 0 0;
  color: #64748b;
  font-size: 12px;
  line-height: 16px;
  text-align: right;
}

.support-chat-message-item[data-staff] .support-chat-message-meta {
  padding-left: 36px;
  text-align: left;
}

#support-chat-day {
  margin: 0 0 16px;
  color: #64748b;
  font-size: 12px;
  font-weight: 500;
  line-height: 16px;
  text-align: center;
}

.support-chat-notice {
  display: flex;
  width: fit-content;
  max-width: 300px;
  align-items: flex-start;
  gap: 8px;
  margin: 8px auto 16px;
  padding: 10px 14px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 19px;
}

.support-chat-notice svg {
  flex: 0 0 16px;
  margin-top: 2px;
}

#support-chat-email {
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  background: #f8fafc;
  color: #475569;
  font-size: 13px;
  line-height: 18px;
}

.support-chat-email-fields {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

#support-chat-email-input {
  flex: 1;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  background: white;
  color: #0f172a;
}

#support-chat-email-save {
  padding: 6px 12px;
  border-radius: 8px;
  background: #01204c;
  color: white;
  font-weight: 600;
}

#support-chat-form {
  flex: none;
  padding: 12px 16px 16px;
}

#support-chat-error {
  margin: 6px 4px 0;
  color: #b91c1c;
  font-size: 13px;
  line-height: 18px;
}

#support-chat-resolved {
  flex: none;
  padding: 16px;
  border-top: 1px solid #f1f5f9;
}

#support-chat-restart {
  width: 100%;
  min-height: 48px;
  padding: 8px 14px;
  border-radius: 12px;
  background: #01204c;
  color: white;
  font-size: 15px;
  font-weight: 600;
}

.support-chat-composer {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 6px 6px 6px 16px;
  border: 1px solid #e2e8f0;
  border-radius: 16px;
}

.support-chat-composer:focus-within {
  border-color: #01204c;
  box-shadow: 0 0 0 3px rgb(1 32 76 / 10%);
}

#support-chat-input {
  flex: 1;
  min-width: 0;
  min-height: 36px;
  max-height: 120px;
  padding: 8px 0;
  border: 0;
  background: transparent;
  font-size: 15px;
  line-height: 20px;
  outline: none;
  resize: none;
}

#support-chat-input::placeholder {
  color: #757575;
}

#support-chat-send {
  display: grid;
  flex: 0 0 36px;
  height: 36px;
  place-items: center;
  border-radius: 50%;
  background: #01204c;
  color: white;
}

#support-chat-send:disabled {
  background: #e2e8f0;
  color: #94a3b8;
}

@media (max-width: 480px) {
  #support-chat {
    right: 16px;
    bottom: 16px;
  }

  #support-chat-panel {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  #support-chat-preview {
    max-width: calc(100vw - 32px);
  }

  #support-chat-bubble[aria-expanded="true"] {
    display: none;
  }

  #support-chat-form,
  #support-chat-resolved {
    padding-bottom: max(16px, env(safe-area-inset-bottom));
  }
}

@media (max-width: 360px) {
  .support-chat-header {
    gap: 6px;
    padding-inline: 10px 8px;
  }

  #support-chat-status {
    text-overflow: clip;
    white-space: normal;
  }
}
