.support-chat-root {
  position: fixed;
  z-index: 10050;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
  --support-ink: #111827;
  --support-muted: #64748b;
  --support-midnight: #102338;
  --support-sapphire: #164e63;
  --support-teal: #0f766e;
  --support-gold: #c9a35f;
  --support-cream: #fffaf1;
  --support-line: rgba(15, 23, 42, 0.1);
  --support-shadow: 0 18px 46px rgba(15, 23, 42, 0.16);
}

.support-chat-top-left {
  top: 24px;
  left: 24px;
  align-items: flex-start;
}

.support-chat-top-right {
  top: 24px;
  right: 24px;
}

.support-chat-bottom-left {
  bottom: 24px;
  left: 24px;
  align-items: flex-start;
  flex-direction: column-reverse;
}

.support-chat-bottom-right {
  right: 24px;
  bottom: 24px;
  flex-direction: column-reverse;
}

.support-chat-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 13px;
  min-width: 186px;
  max-width: 300px;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 999px;
  padding: 10px 18px 10px 10px;
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.97), rgba(248, 250, 252, 0.96)),
    linear-gradient(135deg, rgba(201, 163, 95, 0.18), rgba(15, 118, 110, 0.1));
  color: var(--support-ink);
  box-shadow: var(--support-shadow);
  cursor: pointer;
  overflow: visible;
  backdrop-filter: blur(14px);
  transform-origin: bottom right;
  animation: support-chat-arrive 0.38s ease-out both;
  transition: min-width 0.22s ease, padding 0.22s ease, transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
}

.support-chat-toggle:hover {
  transform: translateY(-2px);
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 22px 56px rgba(15, 23, 42, 0.2);
}

.support-chat-toggle[aria-expanded="true"] {
  width: 66px;
  height: 66px;
  min-width: 62px;
  max-width: 66px;
  gap: 0;
  padding: 7px;
  justify-content: center;
  border-radius: 50%;
  border-color: rgba(201, 163, 95, 0.36);
  background: rgba(255, 255, 255, 0.94);
}

.support-chat-toggle[aria-expanded="true"] .support-chat-toggle__content {
  position: absolute;
  width: 0;
  opacity: 0;
  visibility: hidden;
  transform: translateX(6px);
}

.support-chat-toggle:focus-visible,
.support-chat-panel__close:focus-visible,
.support-chat-attach-button:focus-visible,
.support-chat-send-button:focus-visible,
.support-chat-auth-button:focus-visible,
.support-chat-jump:focus-visible {
  outline: 3px solid rgba(15, 118, 110, 0.24);
  outline-offset: 3px;
}

.support-chat-toggle__icon {
  position: relative;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.68), transparent 28%),
    linear-gradient(145deg, #d8b66f 0%, #0f766e 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 10px 24px rgba(15, 118, 110, 0.22);
}

.support-chat-toggle__icon::before {
  content: "";
  position: absolute;
  inset: -5px;
  border: 1px solid rgba(201, 163, 95, 0.28);
  border-radius: inherit;
  opacity: 0.8;
}

.support-chat-icon {
  width: 30px;
  height: 30px;
  display: block;
}

.support-chat-icon--small {
  width: 28px;
  height: 28px;
}

.support-chat-icon__bubble {
  fill: currentColor;
}

.support-chat-icon__sparkle {
  fill: rgba(255, 255, 255, 0.92);
}

.support-chat-icon__line {
  fill: none;
  stroke: #0b4f49;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.support-chat-toggle__pulse {
  position: absolute;
  right: 1px;
  bottom: 3px;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #14b8a6;
  box-shadow: 0 0 0 5px rgba(20, 184, 166, 0.12);
  animation: support-chat-pulse 2.2s ease-out infinite;
}

.support-chat-toggle__content {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  min-width: 0;
  line-height: 1.1;
  overflow: hidden;
  transition: width 0.22s ease, opacity 0.18s ease, transform 0.18s ease, visibility 0.18s ease;
}

.support-chat-toggle__eyebrow {
  display: block;
  color: var(--support-muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-chat-toggle__label {
  display: block;
  margin-top: 3px;
  color: var(--support-ink);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0;
  white-space: nowrap;
}

.support-chat-toggle__badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 26px;
  height: 26px;
  border-radius: 999px;
  padding: 0 7px;
  background: #b91c1c;
  border: 3px solid #fff;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 12px 28px rgba(185, 28, 28, 0.32);
}

.support-chat-panel {
  position: relative;
  width: min(410px, calc(100vw - 28px));
  height: min(76vh, 720px);
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  overflow: hidden;
  background: linear-gradient(180deg, #ffffff, #f8fafc 72%);
  border: 1px solid var(--support-line);
  box-shadow: 0 28px 84px rgba(15, 23, 42, 0.2);
  isolation: isolate;
  animation: support-chat-panel-in 0.24s ease-out both;
}

.support-chat-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 16px;
  background:
    radial-gradient(circle at 18% 0%, rgba(201, 163, 95, 0.24), transparent 34%),
    radial-gradient(circle at 88% 0%, rgba(20, 184, 166, 0.18), transparent 30%),
    linear-gradient(135deg, #0f172a 0%, #12334f 58%, #164e63 100%);
  color: #f8fafc;
}

.support-chat-panel__brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.support-chat-panel__avatar {
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(circle at 32% 24%, rgba(255, 255, 255, 0.62), transparent 28%),
    linear-gradient(145deg, #d8b66f 0%, #0f766e 100%);
  color: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.32),
    0 10px 24px rgba(0, 0, 0, 0.18);
}

.support-chat-panel__identity {
  min-width: 0;
}

.support-chat-panel__eyebrow {
  display: block;
  margin-bottom: 2px;
  color: rgba(226, 232, 240, 0.74);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.support-chat-panel__header h4 {
  margin: 0 0 4px;
  color: #fff;
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: 0;
}

.support-chat-panel__header p {
  margin: 0;
  color: rgba(226, 232, 240, 0.82);
  font-size: 13px;
}

.support-chat-panel__status {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.support-chat-panel__status-dot {
  width: 8px;
  height: 8px;
  flex: 0 0 8px;
  border-radius: 50%;
  background: #14b8a6;
  box-shadow: 0 0 0 4px rgba(20, 184, 166, 0.14);
}

.support-chat-panel__close {
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  width: 40px;
  height: 40px;
  flex: 0 0 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.18s ease, transform 0.18s ease;
}

.support-chat-panel__close:hover {
  background: rgba(255, 255, 255, 0.18);
  transform: translateY(-1px);
}

.support-chat-panel__notice {
  margin: 14px 16px 0;
  padding: 11px 13px;
  border-radius: 16px;
  background: #fef3c7;
  color: #92400e;
  font-size: 12px;
}

.support-chat-panel__auth,
.support-chat-panel__body {
  flex: 1 1 auto;
  min-height: 0;
}

.support-chat-panel__auth {
  display: flex;
  overflow: hidden;
}

.support-chat-panel__body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
  position: relative;
  background:
    radial-gradient(circle at top left, rgba(201, 163, 95, 0.09), transparent 32%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.08), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), #f8fafc 74%);
}

.support-chat-empty {
  height: 100%;
  padding: 34px 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.support-chat-empty__icon {
  width: 58px;
  height: 58px;
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  color: #111827;
  font-size: 22px;
  margin-bottom: 14px;
  box-shadow: 0 14px 32px rgba(148, 163, 184, 0.16);
}

.support-chat-empty h5 {
  margin-bottom: 8px;
  font-size: 18px;
  font-weight: 800;
}

.support-chat-empty p {
  margin-bottom: 18px;
  color: #6b7280;
  font-size: 14px;
  line-height: 1.65;
}

.support-chat-auth-button {
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #0f172a, #164e63);
  color: #fff;
  padding: 12px 18px;
  font-weight: 700;
  box-shadow: 0 14px 30px rgba(15, 23, 42, 0.18);
}

.support-chat-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding: 18px 18px 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(148, 163, 184, 0.8) transparent;
  scrollbar-gutter: stable both-edges;
}

.support-chat-messages::-webkit-scrollbar {
  width: 8px;
}

.support-chat-messages::-webkit-scrollbar-track {
  background: transparent;
}

.support-chat-messages::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.7);
}

.support-chat-message {
  display: flex;
  margin-bottom: 16px;
}

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

.support-chat-bubble {
  width: fit-content;
  max-width: min(82%, 320px);
  border-radius: 20px 20px 20px 8px;
  padding: 14px 16px 12px;
  background: rgba(255, 255, 255, 0.98);
  color: #0f172a;
  border: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 14px 32px rgba(148, 163, 184, 0.14);
  backdrop-filter: blur(10px);
}

.support-chat-message--mine .support-chat-bubble {
  border-radius: 20px 20px 8px 20px;
  background: linear-gradient(135deg, #0b1220 0%, #12334f 54%, #0b5f59 100%);
  border-color: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  box-shadow: 0 18px 38px rgba(15, 118, 110, 0.18);
}

.support-chat-bubble__text {
  margin: 0;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
  line-height: 1.62;
  color: inherit;
  font-weight: 500;
}

.support-chat-bubble__text a {
  color: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.support-chat-bubble__meta {
  margin-top: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-size: 11px;
  color: #64748b;
  opacity: 1;
}

.support-chat-message--mine .support-chat-bubble__meta {
  color: rgba(255, 255, 255, 0.82);
}

.support-chat-file {
  margin-top: 12px;
  display: block;
  border-radius: 18px;
  overflow: hidden;
  background: rgba(15, 23, 42, 0.06);
}

.support-chat-file img,
.support-chat-file video {
  width: 100%;
  max-height: 240px;
  object-fit: cover;
  display: block;
}

.support-chat-file__doc {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 13px;
  color: inherit;
}

.support-chat-file__doc i {
  font-size: 18px;
}

.support-chat-typing {
  flex: 0 0 auto;
  padding: 0 18px 14px;
  color: #6b7280;
  font-size: 12px;
}

.support-chat-jump {
  position: absolute;
  right: 18px;
  bottom: 18px;
  z-index: 3;
  border: 0;
  border-radius: 999px;
  min-width: 52px;
  height: 44px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #0f172a, #164e63);
  color: #fff;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.22);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.support-chat-jump:hover {
  transform: translateY(-1px);
  box-shadow: 0 20px 44px rgba(15, 23, 42, 0.26);
}

.support-chat-jump__count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 999px;
  background: rgba(201, 163, 95, 0.18);
  color: #f7d99f;
  font-size: 12px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.support-chat-panel__footer {
  flex: 0 0 auto;
  border-top: 1px solid rgba(15, 23, 42, 0.08);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), #ffffff 76%);
  padding: 14px 14px 15px;
}

.support-chat-attachment {
  margin-bottom: 10px;
  padding: 11px 13px;
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f3f4f6);
  box-shadow: 0 14px 32px rgba(148, 163, 184, 0.14);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.support-chat-attachment button {
  border: 0;
  background: transparent;
  color: #ef4444;
  font-weight: 700;
}

.support-chat-input {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  border-radius: 20px;
  background: rgba(248, 250, 252, 0.96);
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.9);
  padding: 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.support-chat-input:focus-within {
  border-color: rgba(15, 118, 110, 0.34);
  background: #fff;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 0 0 4px rgba(15, 118, 110, 0.08);
}

.support-chat-attach-button,
.support-chat-send-button {
  width: 46px;
  height: 46px;
  flex: 0 0 46px;
  border-radius: 14px;
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.support-chat-attach-button {
  background: linear-gradient(180deg, #ffffff, #f8fafc);
  color: var(--support-sapphire);
  box-shadow: 0 10px 24px rgba(148, 163, 184, 0.14);
}

.support-chat-send-button {
  background: linear-gradient(135deg, #0f172a, #164e63);
  color: #fff;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.18);
}

.support-chat-attach-button:hover,
.support-chat-send-button:hover {
  transform: translateY(-1px);
}

.support-chat-input textarea {
  flex: 1;
  border: 0;
  background: transparent;
  resize: none;
  min-height: 46px;
  max-height: 110px;
  padding: 11px 2px 0;
  font-size: 15px;
  line-height: 1.5;
  color: #111827;
}

.support-chat-input textarea:focus {
  outline: none;
}

.support-chat-input textarea::placeholder {
  color: #94a3b8;
}

.support-chat-panel__hint {
  display: block;
  margin-top: 9px;
  color: #64748b;
  font-size: 11px;
  line-height: 1.4;
}

@keyframes support-chat-arrive {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes support-chat-panel-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes support-chat-pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0.34);
  }
  70% {
    box-shadow: 0 0 0 8px rgba(20, 184, 166, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(20, 184, 166, 0);
  }
}

@media (max-width: 575.98px) {
  .support-chat-root {
    left: auto;
    right: 16px;
    top: auto;
    bottom: 16px;
    align-items: flex-end;
    gap: 12px;
  }

  /* Keep left-aligned if it was originally on the left */
  .support-chat-top-left,
  .support-chat-bottom-left {
    left: 16px;
    right: auto;
    align-items: flex-start;
  }

  .support-chat-toggle {
    width: 58px;
    height: 58px;
    min-width: 58px;
    max-width: 58px;
    flex: 0 0 58px;
    aspect-ratio: 1 / 1;
    gap: 0;
    padding: 0;
    justify-content: center;
    align-items: center;
    border-radius: 50%;
    box-shadow: 0 12px 32px rgba(15, 23, 42, 0.28);
  }

  .support-chat-toggle[aria-expanded="true"] {
    width: 58px;
    height: 58px;
    min-width: 58px;
    max-width: 58px;
    flex-basis: 58px;
    padding: 0;
  }

  .support-chat-toggle__content {
    display: none;
  }

  .support-chat-toggle__icon {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    aspect-ratio: 1 / 1;
    border-radius: 50%;
  }

  .support-chat-toggle__icon::before {
    inset: -3px;
  }

  .support-chat-icon {
    width: 31px;
    height: 31px;
  }

  .support-chat-panel {
    width: calc(100vw - 32px);
    max-width: 400px;
    height: min(calc(100vh - 100px), 700px);
    border-radius: 24px;
  }

  .support-chat-panel__header {
    padding: 18px 18px 16px;
  }

  .support-chat-panel__header h4 {
    font-size: 20px;
  }

  .support-chat-messages {
    padding: 16px 16px 12px;
  }

  .support-chat-bubble {
    max-width: 88%;
  }
}
