.tf-chat {
  --tf-chat-primary: #e21b71;
  --tf-chat-on-primary: #ffffff;
  --tf-chat-primary-hover: #c21761;
  --tf-chat-primary-soft: rgba(226, 27, 113, 0.12);
  --tf-chat-bg: #ffffff;
  --tf-chat-text: #1c1c1c;
  --tf-chat-muted: #5c5c5c;
  --tf-chat-border: #e4e4e4;
  --tf-chat-visitor: #f4f4f4;
  --tf-chat-shadow: 0 10px 30px rgba(28, 28, 28, 0.18);
  --tf-chat-radius: 16px;
  --tf-chat-font: "Comfortaa", sans-serif;
  position: relative;
  z-index: 99999;
  font-family: var(--tf-chat-font);
  color: var(--tf-chat-text);
  line-height: 1.45;
}

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

.tf-chat button,
.tf-chat input,
.tf-chat textarea,
.tf-chat select {
  font: inherit;
}

.tf-chat button.tf-chat-launcher,
body .tf-chat .tf-chat-launcher {
  all: unset;
  box-sizing: border-box !important;
  position: fixed !important;
  right: 16px !important;
  bottom: 16px !important;
  width: 56px !important;
  height: 56px !important;
  min-width: 56px !important;
  min-height: 56px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 2px solid #ffffff !important;
  border-radius: 50% !important;
  background: #e21b71 !important;
  background-color: #e21b71 !important;
  background-image: none !important;
  color: #ffffff !important;
  box-shadow: 0 8px 24px rgba(28, 28, 28, 0.4), 0 0 0 1px rgba(28, 28, 28, 0.12) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  isolation: isolate;
  z-index: 100000 !important;
}

.tf-chat button.tf-chat-launcher:hover,
.tf-chat button.tf-chat-launcher:focus-visible,
body .tf-chat .tf-chat-launcher:hover,
body .tf-chat .tf-chat-launcher:focus-visible {
  background: #c21761 !important;
  background-color: #c21761 !important;
  color: #ffffff !important;
  filter: none !important;
  opacity: 1 !important;
}

.tf-chat-launcher:focus-visible,
.tf-chat-panel button:focus-visible,
.tf-chat-panel a:focus-visible,
.tf-chat-panel input:focus-visible,
.tf-chat-panel textarea:focus-visible,
.tf-chat-panel select:focus-visible {
  outline: 3px solid var(--tf-chat-primary);
  outline-offset: 2px;
}

.tf-chat .tf-chat-launcher-face {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 50% !important;
  background: #e21b71 !important;
  background-color: #e21b71 !important;
  color: #ffffff !important;
  pointer-events: none;
}

.tf-chat button.tf-chat-launcher:hover .tf-chat-launcher-face,
.tf-chat button.tf-chat-launcher:focus-visible .tf-chat-launcher-face {
  background: #c21761 !important;
  background-color: #c21761 !important;
}

.tf-chat button.tf-chat-launcher svg,
.tf-chat button.tf-chat-launcher svg path,
body .tf-chat .tf-chat-launcher svg,
body .tf-chat .tf-chat-launcher svg path {
  width: 26px !important;
  height: 26px !important;
  fill: #ffffff !important;
  stroke: none !important;
  color: #ffffff !important;
  opacity: 1 !important;
  display: block !important;
}

.tf-chat-panel {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: min(380px, calc(100vw - 24px));
  max-height: min(640px, calc(100vh - 104px));
  background: var(--tf-chat-bg);
  border: 1px solid var(--tf-chat-border);
  border-radius: var(--tf-chat-radius);
  box-shadow: var(--tf-chat-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.tf-chat-panel[hidden] {
  display: none !important;
}

.tf-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 12px 12px 10px;
  background: var(--tf-chat-primary);
  color: var(--tf-chat-on-primary);
}

.tf-chat-header h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.3;
}

.tf-chat button.tf-chat-close,
.tf-chat-header button.tf-chat-close,
body .tf-chat .tf-chat-close {
  all: unset;
  box-sizing: border-box !important;
  flex: 0 0 auto !important;
  width: 40px !important;
  height: 40px !important;
  min-width: 40px !important;
  min-height: 40px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 2px solid #ffffff !important;
  border-radius: 8px !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  background-image: none !important;
  color: #e21b71 !important;
  box-shadow: 0 1px 4px rgba(28, 28, 28, 0.28) !important;
  cursor: pointer !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  opacity: 1 !important;
  filter: none !important;
  mix-blend-mode: normal !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  font-size: 0 !important;
  line-height: 0 !important;
}

.tf-chat button.tf-chat-close:hover,
.tf-chat button.tf-chat-close:focus-visible,
.tf-chat-header button.tf-chat-close:hover,
.tf-chat-header button.tf-chat-close:focus-visible {
  background: #ffffff !important;
  background-color: #ffffff !important;
  border-color: #ffffff !important;
  color: #c21761 !important;
  filter: none !important;
  opacity: 1 !important;
}

.tf-chat .tf-chat-close-face {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 100% !important;
  height: 100% !important;
  border-radius: 6px !important;
  background: #ffffff !important;
  background-color: #ffffff !important;
  pointer-events: none;
}

.tf-chat button.tf-chat-close svg,
.tf-chat-header button.tf-chat-close svg,
body .tf-chat .tf-chat-close svg {
  width: 22px !important;
  height: 22px !important;
  display: block !important;
  overflow: visible !important;
}

.tf-chat-intro,
.tf-chat-privacy {
  margin: 8px 12px 0;
  font-size: 0.9rem;
  color: var(--tf-chat-muted);
}

.tf-chat-intro a,
.tf-chat-privacy a,
.tf-chat-log a {
  color: var(--tf-chat-primary);
}

.tf-chat-consent,
.tf-chat-email {
  margin: 10px 12px 0;
  font-size: 0.9rem;
}

.tf-chat-consent label {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.tf-chat-consent input {
  margin-top: 3px;
}

.tf-chat-email label {
  display: block;
  font-weight: 600;
  margin-bottom: 4px;
}

.tf-chat-email input,
.tf-chat-composer textarea {
  width: 100%;
  border: 1px solid var(--tf-chat-border);
  border-radius: 10px;
  padding: 8px 10px;
  font: inherit;
  color: inherit;
  background: #fff;
}

.tf-chat-hint {
  margin: 4px 0 0;
  color: var(--tf-chat-muted);
  font-size: 0.8rem;
}

.tf-chat-log {
  flex: 1 1 auto;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 120px;
}

.tf-chat-bubble {
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 12px;
  font-size: 0.95rem;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.tf-chat-bubble--visitor {
  align-self: flex-end;
  background: var(--tf-chat-visitor);
}

.tf-chat-bubble--assistant {
  align-self: flex-start;
  background: var(--tf-chat-primary-soft);
  border: 1px solid rgba(214, 32, 78, 0.18);
}

.tf-chat-bubble__who {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.02em;
  color: var(--tf-chat-muted);
  margin-bottom: 4px;
}

.tf-chat-bubble--assistant .tf-chat-bubble__who {
  text-transform: uppercase;
}

.tf-chat-bubble--visitor .tf-chat-bubble__who {
  text-transform: none;
}

.tf-chat-typing {
  align-self: flex-start;
  max-width: 88%;
  padding: 8px 10px;
  border-radius: 12px;
  background: var(--tf-chat-primary-soft);
  border: 1px solid rgba(226, 27, 113, 0.18);
  border: 1px solid color-mix(in srgb, var(--tf-chat-primary) 18%, transparent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.tf-chat-typing[hidden] {
  display: none !important;
}

.tf-chat-typing__row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tf-chat-dots {
  display: inline-flex;
  gap: 5px;
  align-items: center;
  height: 14px;
}

.tf-chat-dots i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--tf-chat-primary);
  opacity: 0.35;
  animation: tf-chat-dot 1.2s infinite ease-in-out;
}

.tf-chat-dots i:nth-child(2) {
  animation-delay: 0.16s;
}

.tf-chat-dots i:nth-child(3) {
  animation-delay: 0.32s;
}

.tf-chat-typing__label {
  font-size: 0.9rem;
  color: var(--tf-chat-text);
}

.tf-chat-status {
  margin: 0 12px 8px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--tf-chat-primary-soft);
  color: var(--tf-chat-text);
  font-size: 0.9rem;
}

.tf-chat-status[hidden],
.tf-chat-error[hidden] {
  display: none !important;
}

.tf-chat-error {
  margin: 0 12px 8px;
  color: #8a1530;
  font-size: 0.9rem;
}

.tf-chat-composer {
  display: flex;
  gap: 8px;
  padding: 8px 12px 12px;
  border-top: 1px solid var(--tf-chat-border);
  align-items: flex-end;
}

.tf-chat-composer textarea {
  min-height: 44px;
  max-height: 120px;
  resize: vertical;
}

.tf-chat-send {
  flex: 0 0 auto;
  border: 0;
  border-radius: 10px;
  background: var(--tf-chat-primary);
  color: var(--tf-chat-on-primary);
  font: inherit;
  font-weight: 650;
  padding: 10px 14px;
  cursor: pointer;
  min-height: 44px;
}

.tf-chat-send:not(:disabled):hover,
.tf-chat-send:not(:disabled):focus-visible {
  background: var(--tf-chat-primary-hover);
}

.tf-chat-send:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.tf-chat-hp {
  position: absolute;
  left: -9999px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

@media (max-width: 480px) {
  .tf-chat-panel {
    right: 0;
    bottom: 0;
    width: 100vw;
    max-height: 100vh;
    height: 100vh;
    border-radius: 0;
    border: 0;
  }

  .tf-chat button.tf-chat-launcher,
  body .tf-chat .tf-chat-launcher {
    right: 12px !important;
    bottom: 12px !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tf-chat-launcher,
  .tf-chat-panel,
  .tf-chat-send {
    transition: none;
  }

  .tf-chat-dots i {
    animation: none;
    opacity: 0.8;
  }
}

@keyframes tf-chat-dot {
  0%,
  80%,
  100% {
    opacity: 0.3;
    transform: translateY(0);
  }
  40% {
    opacity: 1;
    transform: translateY(-3px);
  }
}
