.header-cta { border: 0; cursor: pointer; font: inherit; }

.floating-contact-stack {
  position: fixed; right: 22px; bottom: 22px; z-index: 900;
  display: flex; flex-direction: column; gap: 12px;
}
.floating-contact {
  width: 58px; height: 58px; border: 0; border-radius: 50%;
  display: grid; place-items: center; color: #fff; cursor: pointer;
  box-shadow: 0 8px 24px #0005;
}
.floating-contact svg { width: 29px; height: 29px; }
.floating-telegram { background: #229ed9; }
.floating-support-button { background: #06c7ad; }

.support-chat-panel {
  position: fixed; right: 22px; bottom: 94px; z-index: 950;
  width: min(360px, calc(100vw - 28px)); height: 440px; max-height: 70vh;
  background: #fff; color: #14201e; border-radius: 16px;
  box-shadow: 0 16px 48px #0004; overflow: hidden;
  display: flex; flex-direction: column;
}
.support-chat-panel[hidden] { display: none; }
.support-chat-head {
  padding: 14px 16px; background: #06241f; color: #fff;
  display: flex; align-items: center; justify-content: space-between;
}
.support-chat-head button {
  color: #fff; background: transparent; border: 0; font-size: 25px; cursor: pointer;
}
.support-chat-messages {
  flex: 1; overflow-y: auto; padding: 14px; display: flex;
  flex-direction: column; gap: 10px; background: #f5f8f7;
}
.support-bubble {
  max-width: 85%; padding: 9px 11px; border-radius: 12px;
  overflow-wrap: anywhere; font-size: 14px;
}
.support-bubble small { display: block; opacity: .65; margin-top: 5px; font-size: 11px; }
.support-bubble.from-admin { align-self: flex-start; background: #fff; }
.support-bubble.from-visitor { align-self: flex-end; background: #c9f6ea; }
.support-chat-form {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid #e3e9e7;
}
.support-chat-form input {
  min-width: 0; flex: 1; border: 1px solid #d6dfdc; border-radius: 9px; padding: 10px;
}
.support-chat-form button {
  border: 0; border-radius: 9px; padding: 0 14px; color: #fff;
  background: #06bda4; cursor: pointer;
}
.support-chat-form button:disabled { opacity: .6; }

.support-admin { max-width: 1200px; margin: 24px auto; padding: 0 18px; }
.support-admin-top { display: flex; justify-content: space-between; align-items: center; gap: 16px; }
.support-admin-top h1 { margin: 0 0 18px; }
.telegram-settings {
  display: flex; align-items: end; gap: 12px; flex-wrap: wrap;
  background: #fff; padding: 16px; border-radius: 12px; margin-bottom: 18px;
}
.telegram-settings label { flex: 1; min-width: 240px; }
.telegram-settings input { width: 100%; box-sizing: border-box; padding: 10px; margin-top: 6px; }
#telegramStatus { font-size: 13px; }
.support-admin-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 16px; min-height: 520px; }
.support-session-list, .support-conversation {
  background: #fff; border-radius: 12px; overflow: hidden; border: 1px solid #e5e9e8;
}
.support-session-list h2 { font-size: 17px; padding: 14px 16px; margin: 0; border-bottom: 1px solid #e5e9e8; }
#supportSessions { max-height: 600px; overflow-y: auto; }
.support-session {
  width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 5px;
  padding: 12px 16px; border: 0; border-bottom: 1px solid #edf0ef;
  background: #fff; text-align: left; cursor: pointer;
}
.support-session.active { background: #eaf8f4; }
.support-session span, .support-session small { color: #66716e; overflow-wrap: anywhere; }
.support-session span { max-width: 100%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.support-conversation { display: flex; flex-direction: column; min-height: 520px; }
.support-conversation-head { padding: 14px 16px; border-bottom: 1px solid #e5e9e8; font-weight: 600; }
.support-admin-messages { flex: 1; min-height: 300px; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 12px; }
.support-message { max-width: 78%; padding: 10px 12px; border-radius: 10px; overflow-wrap: anywhere; }
.support-message.from-visitor { align-self: flex-start; background: #f0f2f1; }
.support-message.from-admin { align-self: flex-end; background: #d8f5ec; }
.support-message small { display: block; margin-top: 5px; opacity: .65; }
.support-reply-form { display: flex; gap: 8px; padding: 12px; border-top: 1px solid #e5e9e8; }
.support-reply-form input { min-width: 0; flex: 1; padding: 10px; }
@media (max-width: 700px) {
  .floating-contact-stack { right: 14px; bottom: 16px; }
  .support-chat-panel { right: 14px; bottom: 88px; }
  .support-admin-grid { grid-template-columns: 1fr; }
  .support-session-list { max-height: 280px; }
}

/* 联系图标与客服后台可读性 */
.floating-whatsapp-icon { background: #20c968; }
.floating-whatsapp-icon img { width: 32px; height: 32px; }
.support-admin, .support-admin h1, .support-admin h2,
.support-conversation-head, .telegram-settings, .support-message,
.support-session { color: #17312c; }
.support-admin .eyebrow, .support-session small,
.support-session span, .support-message small { color: #52645f; }
.support-session.active { color: #123d34; }

/* icon and conversation contrast fix */
.floating-contact-stack { gap: 8px; }
.floating-contact { width: 46px; height: 46px; }
.floating-contact svg { width: 22px; height: 22px; }
.floating-whatsapp-icon { background: #25D366 !important; }
.floating-whatsapp-icon img { width: 25px; height: 25px; }
.floating-telegram { background: #229ED9 !important; }
.floating-support-button { background: #06C7AD !important; }
.support-admin .support-session-list h2,
.support-admin .support-conversation-head,
.support-admin .support-message,
.support-admin .support-message *,
.support-admin .support-session,
.support-admin .support-session * { color: #17312C !important; }
.support-admin .support-message.from-visitor { background: #E8EDF0 !important; }
.support-admin .support-message.from-admin { background: #CFF2E4 !important; }
.support-admin .support-message small,
.support-admin .support-session small { color: #52645F !important; }

/* breathing contact icons and new-reply alert */
@keyframes contact-breathe {
  0%, 100% { transform: scale(1); box-shadow: 0 8px 24px #0005; }
  50% { transform: scale(1.045); box-shadow: 0 10px 28px #0007; }
}
@keyframes contact-alert {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
.floating-contact {
  animation: contact-breathe 2.6s ease-in-out infinite;
  transform-origin: center;
}
.floating-contact-stack .floating-telegram { animation-delay: .25s; }
.floating-contact-stack .floating-support-button { animation-delay: .5s; }
.floating-support-button.has-reply {
  animation: contact-alert .75s ease-in-out infinite;
  background: #ff9f1c !important;
}
.floating-support-button.has-reply::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  top: 1px;
  right: 1px;
  border-radius: 50%;
  background: #ef3340;
  border: 2px solid #fff;
}
.floating-support-button { position: relative; }
.support-reply-toast {
  position: fixed;
  z-index: 980;
  right: 78px;
  bottom: 26px;
  max-width: min(320px, calc(100vw - 110px));
  padding: 12px 15px;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: #153b34;
  box-shadow: 0 8px 24px #0005;
  text-align: left;
  cursor: pointer;
}
.support-reply-toast[hidden] { display: none; }
@media (prefers-reduced-motion: reduce) {
  .floating-contact, .floating-support-button.has-reply { animation: none; }
}
