.support-chat-root {
  position: fixed !important;
  right: 0;
  top: 0;
  z-index: 10000;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  pointer-events: none;
}

.support-chat-root > * {
  pointer-events: auto;
}

.support-chat-launcher,
.support-chat-close,
.support-chat-send,
.support-chat-attach,
.support-chat-primary {
  border: none;
  cursor: pointer;
  background: none;
}

.support-chat-launcher {
  position: fixed !important;
  right: 0;
  top: 0;
  z-index: 10001;
  width: 156px;
  height: 156px;
  padding: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
  display: block;
  overflow: visible;
  transition: opacity 0.18s ease;
}

.support-chat-launcher-img {
  width: 156px;
  height: 156px;
  object-fit: contain;
  display: block;
  pointer-events: none;
}

.support-chat-badge {
  position: absolute;
  top: 36px;
  left: 12px;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45);
  animation: support-badge-pulse 2s ease-in-out infinite;
  pointer-events: none;
  line-height: 1;
}

@keyframes support-badge-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 2px 8px rgba(239, 68, 68, 0.45); }
  50% { transform: scale(1.15); box-shadow: 0 2px 14px rgba(239, 68, 68, 0.65); }
}

.support-chat-launcher.open {
  opacity: 1;
  pointer-events: auto;
}

.support-chat-panel {
  position: fixed !important;
  right: 0;
  top: 160px;
  z-index: 10000;
  width: 380px;
  max-width: calc(100vw - 24px);
  height: 520px;
  max-height: calc(100vh - 72px);
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.16);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-12px) scale(0.98);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: #1c1917;
  color: #fff;
}

.support-chat-header-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.support-chat-header-avatar {
  width: 40px;
  height: 40px;
  object-fit: contain;
  flex-shrink: 0;
}

.support-chat-title {
  font-size: 16px;
  font-weight: 700;
}

.support-chat-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.72);
  margin-top: 2px;
}

.support-chat-close {
  color: #fff;
  font-size: 24px;
  line-height: 1;
  padding: 4px 8px;
}

.support-chat-intro,
.support-chat-main,
.support-chat-loading {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.support-chat-loading {
  align-items: center;
  justify-content: center;
  padding: 24px 18px;
  color: #57534e;
  font-size: 14px;
}

.support-chat-loading p {
  margin: 0;
}

.support-chat-intro {
  padding: 20px 18px;
  gap: 12px;
}

.support-chat-intro p {
  margin: 0 0 8px;
  color: #57534e;
  font-size: 14px;
  line-height: 1.5;
}

.support-chat-intro label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #57534e;
}

.support-chat-intro input {
  height: 42px;
  border: 1px solid #e7e5e4;
  border-radius: 10px;
  padding: 0 12px;
  font-size: 14px;
}

.support-chat-primary {
  margin-top: 8px;
  height: 42px;
  border-radius: 10px;
  background: #1c1917;
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.support-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  background: #fafaf9;
}

.support-msg {
  max-width: 85%;
  margin-bottom: 12px;
}

.support-msg-agent {
  margin-right: auto;
}

.support-msg-visitor {
  margin-left: auto;
}

.support-msg-meta {
  font-size: 11px;
  color: #a8a29e;
  margin-bottom: 4px;
}

.support-msg-body {
  background: #fff;
  border: 1px solid #e7e5e4;
  border-radius: 14px;
  padding: 10px 12px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}

.support-msg-visitor .support-msg-body {
  background: #1c1917;
  color: #fff;
  border-color: #1c1917;
}

.support-msg-attachment {
  display: block;
  margin-top: 6px;
}

.support-msg-attachment img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid #e7e5e4;
}

.support-chat-pending {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 14px 8px;
}

.support-pending-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f5f5f4;
  border: 1px solid #e7e5e4;
  border-radius: 999px;
  padding: 4px 8px 4px 10px;
  font-size: 12px;
}

.support-pending-remove {
  border: none;
  background: none;
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  color: #78716c;
}

.support-chat-compose {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid #e7e5e4;
  background: #fff;
}

.support-chat-attach,
.support-chat-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #57534e;
  flex-shrink: 0;
}

.support-chat-send {
  background: #1c1917;
  color: #fff;
}

.support-chat-attach svg,
.support-chat-send svg {
  width: 18px;
  height: 18px;
}

#support-chat-input {
  flex: 1;
  min-height: 40px;
  max-height: 120px;
  resize: none;
  border: 1px solid #e7e5e4;
  border-radius: 12px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
}

@media (max-width: 640px) {
  .support-chat-panel {
    width: 100vw;
    max-width: 100vw;
    height: calc(100vh - 160px);
    max-height: calc(100vh - 160px);
    border-radius: 0;
    border-left: none;
    border-right: none;
    top: 160px;
  }

  .support-chat-launcher {
    right: 4px;
    top: 4px;
  }
}
