.thredium-support-launcher {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10020;
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 1px solid #d8ddda;
  border-radius: 50%;
  background: #f5f7f6;
  color: #171a19;
  box-shadow: 0 14px 34px rgba(0, 0, 0, .28);
  cursor: pointer;
  transition: transform .2s ease, background-color .2s ease, opacity .2s ease;
}

.thredium-support-launcher:hover {
  background: #e9edeb;
  transform: translateY(-2px);
}

.thredium-support-launcher:active { transform: translateY(0) scale(.97); }
.thredium-support-launcher.is-chat-open {
  opacity: 0;
  pointer-events: none;
  transform: translateY(8px);
}

.thredium-support-launcher:focus-visible,
.thredium-support-close:focus-visible,
.thredium-support-send:focus-visible,
.thredium-support-back:focus-visible,
.thredium-support-input:focus-visible,
.thredium-support-textarea:focus-visible {
  outline: 3px solid rgba(21, 25, 23, .24);
  outline-offset: 2px;
}

.thredium-support-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.thredium-support-panel {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10021;
  width: min(430px, calc(100vw - 32px));
  max-height: min(680px, calc(100dvh - 44px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(14px) scale(.985);
  transform-origin: right bottom;
  border: 1px solid #d4d9d6;
  border-radius: 16px;
  background: #f5f7f6;
  color: #171a19;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .42);
  font: 14px/1.45 Tektur, system-ui, sans-serif;
  transition: visibility .2s ease, opacity .2s ease, transform .2s ease;
}

.thredium-support-panel.is-open {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0) scale(1);
}

.thredium-support-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid #dce0de;
  background: #f8faf9;
}

.thredium-support-heading { min-width: 0; }
.thredium-support-title {
  margin: 0;
  color: #111413;
  font-size: 17px;
  font-weight: 750;
  letter-spacing: -.02em;
}

.thredium-support-subtitle {
  margin: 5px 0 0;
  color: #626b67;
  font-size: 11px;
  line-height: 1.45;
}

.thredium-support-close {
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0 0 2px;
  border: 1px solid #d2d7d4;
  border-radius: 9px;
  background: #edf0ee;
  color: #515a56;
  cursor: pointer;
  font: 400 24px/1 system-ui, sans-serif;
  transition: background-color .18s ease, color .18s ease;
}

.thredium-support-close:hover {
  background: #e0e5e2;
  color: #171a19;
}

.thredium-support-thread {
  min-height: 148px;
  max-height: 280px;
  overflow: auto;
  padding: 18px 20px;
  background: #e9edeb;
  scrollbar-width: thin;
  scrollbar-color: #b9c0bc transparent;
}

.thredium-support-empty {
  width: min(100%, 35ch);
  margin: 0;
  padding: 24px 0;
  color: #515b57;
  font-size: 12px;
  line-height: 1.65;
}

.thredium-support-message {
  max-width: 86%;
  margin: 0 0 10px;
  padding: 11px 12px;
  border: 1px solid #d0d6d2;
  border-radius: 11px 11px 11px 4px;
  background: #fbfcfb;
  color: #171a19;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: 0 3px 10px rgba(25, 31, 28, .05);
}

.thredium-support-message.is-visitor {
  margin-left: auto;
  border-color: #202523;
  border-radius: 11px 11px 4px;
  background: #202523;
  color: #f3f5f4;
}

.thredium-support-message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
  color: #717a76;
  font-size: 9px;
}

.thredium-support-message.is-visitor .thredium-support-message-meta { color: #b7bfbb; }
.thredium-support-status {
  min-height: 0;
  padding: 0 20px;
  background: #f8faf9;
  color: #9f2632;
  font-size: 11px;
  font-weight: 600;
}

.thredium-support-status:not(:empty) { padding-top: 10px; }
.thredium-support-composer {
  padding: 17px 20px 20px;
  border-top: 1px solid #dce0de;
  background: #f8faf9;
}

.thredium-support-panel.is-onboarding {
  width: min(390px, calc(100vw - 32px));
}

.thredium-support-panel.is-onboarding .thredium-support-thread,
.thredium-support-panel.is-onboarding .thredium-support-status {
  display: none;
}

.thredium-support-panel.is-onboarding .thredium-support-composer {
  padding: 24px 22px 22px;
  border-top: 0;
}

.thredium-support-progress {
  display: grid;
  gap: 8px;
  margin-bottom: 24px;
  color: #69716d;
  font-size: 10px;
  font-weight: 650;
}

.thredium-support-progress i {
  height: 3px;
  overflow: hidden;
  border-radius: 3px;
  background: #dfe3e1;
}

.thredium-support-progress b {
  display: block;
  width: 100%;
  height: 100%;
  border-radius: inherit;
  background: #1f2422;
  transform: scaleX(.5);
  transform-origin: left center;
  transition: transform .2s ease;
}

.thredium-support-panel[data-step="contact"] .thredium-support-progress b { transform: scaleX(1); }
.thredium-support-step-title {
  margin: 0;
  color: #111413;
  font-size: 23px;
  font-weight: 750;
  line-height: 1.2;
  letter-spacing: -.025em;
}

.thredium-support-step-hint {
  max-width: 34ch;
  margin: 8px 0 22px;
  color: #5c6561;
  font-size: 12px;
  line-height: 1.6;
}

.thredium-support-field {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.thredium-support-field.is-message { width: 100%; }
.thredium-support-label {
  color: #3e4743;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .025em;
}

.thredium-support-input,
.thredium-support-textarea {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #c8ceca;
  border-radius: 9px;
  background: #fbfcfb;
  color: #161918;
  font: inherit;
  transition: border-color .18s ease, box-shadow .18s ease;
}

.thredium-support-input {
  height: 48px;
  padding: 0 13px;
}

.thredium-support-textarea {
  display: block;
  min-height: 104px;
  max-height: 170px;
  padding: 12px 13px;
  resize: vertical;
}

.thredium-support-input::placeholder,
.thredium-support-textarea::placeholder { color: #838c88; }
.thredium-support-input:hover,
.thredium-support-textarea:hover { border-color: #9fa8a3; }

.thredium-support-input:focus,
.thredium-support-textarea:focus {
  border-color: #313735;
  box-shadow: 0 0 0 3px rgba(36, 42, 39, .1);
  outline: none;
}

.thredium-support-input[aria-invalid="true"] {
  border-color: #b33a45;
  box-shadow: 0 0 0 3px rgba(179, 58, 69, .1);
}

.thredium-support-actions,
.thredium-support-step-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 14px;
}

.thredium-support-note {
  max-width: 25ch;
  color: #68716d;
  font-size: 9px;
  line-height: 1.5;
}

.thredium-support-send,
.thredium-support-back {
  min-height: 44px;
  padding: 0 17px;
  border-radius: 9px;
  cursor: pointer;
  font: 750 12px/1 Tektur, system-ui, sans-serif;
  white-space: nowrap;
  transition: transform .18s ease, background-color .18s ease, opacity .18s ease;
}

.thredium-support-send {
  min-width: 140px;
  border: 1px solid #202523;
  background: #202523;
  color: #f5f7f6;
}

.thredium-support-back {
  border: 1px solid #cbd1cd;
  background: transparent;
  color: #343b38;
}

.thredium-support-send:hover:not(:disabled) { background: #343a37; transform: translateY(-1px); }
.thredium-support-back:hover { background: #e8ecea; }
.thredium-support-send:active:not(:disabled),
.thredium-support-back:active { transform: translateY(1px); }
.thredium-support-send:disabled { opacity: .55; cursor: wait; }

@media (max-width: 560px) {
  .thredium-support-launcher {
    right: 12px;
    bottom: max(12px, env(safe-area-inset-bottom));
    width: 48px;
    height: 48px;
  }

  .thredium-support-panel,
  .thredium-support-panel.is-onboarding {
    right: 8px;
    bottom: max(8px, env(safe-area-inset-bottom));
    left: 8px;
    width: auto;
    max-height: calc(100dvh - 16px - env(safe-area-inset-bottom));
    border-radius: 14px;
    transform-origin: center bottom;
  }

  .thredium-support-header { padding: 14px 15px; }
  .thredium-support-title { font-size: 15px; }
  .thredium-support-thread {
    min-height: 110px;
    max-height: 210px;
    padding: 14px 15px;
  }
  .thredium-support-empty { padding: 14px 0; font-size: 11px; }
  .thredium-support-composer,
  .thredium-support-panel.is-onboarding .thredium-support-composer { padding: 18px 15px 15px; }
  .thredium-support-step-title { font-size: 21px; }
  .thredium-support-step-hint { margin-bottom: 18px; }
  .thredium-support-textarea { min-height: 92px; max-height: 124px; resize: none; }
  .thredium-support-actions {
    display: grid;
    justify-content: stretch;
    gap: 10px;
  }
  .thredium-support-note { max-width: none; }
  .thredium-support-send { min-height: 46px; }
  .thredium-support-actions .thredium-support-send {
    width: 100%;
    max-width: none;
    justify-self: stretch;
  }
}

@media (max-height: 620px) {
  .thredium-support-subtitle,
  .thredium-support-note { display: none; }
  .thredium-support-thread { min-height: 74px; max-height: 118px; }
  .thredium-support-empty { padding: 8px 0; }
  .thredium-support-textarea { min-height: 68px; }
  .thredium-support-progress { margin-bottom: 14px; }
  .thredium-support-step-hint { margin-bottom: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  .thredium-support-launcher,
  .thredium-support-panel,
  .thredium-support-close,
  .thredium-support-send,
  .thredium-support-back,
  .thredium-support-progress b { transition: none; }
}

.thredium-support-panel--contact .thredium-support-thread {
  min-height: 0;
  padding: 24px;
}
.thredium-support-panel--contact .thredium-support-composer {
  display: block;
  padding: 0 24px 24px;
}
.thredium-support-panel--contact .thredium-support-send {
  display: flex;
  width: 100%;
  text-decoration: none;
}
