#chatWidgetRoot {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 1500;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}
.chat-widget-btn {
  position: relative;
  display: grid;
  place-items: center;
  width: 60px;
  height: 60px;
  margin-left: auto;
  border: 1px solid rgba(76, 141, 255, 0.55);
  border-radius: 16px;
  background:
    linear-gradient(145deg, rgba(76, 141, 255, 0.16), rgba(225, 187, 140, 0.06) 45%, rgba(6, 16, 31, 0.9)),
    linear-gradient(145deg, #0B1830, #16294A 60%, #0D1A33);
  color: #9CC4FF;
  box-shadow:
    0 18px 42px rgba(0, 0, 0, 0.38),
    0 0 0 3px rgba(59, 130, 246, 0.14),
    0 0 26px rgba(59, 130, 246, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  cursor: pointer;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}
.chat-widget-btn::before {
  content: "";
  position: absolute;
  inset: -6px;
  border: 1px solid rgba(76, 141, 255, 0.35);
  border-radius: 20px;
  pointer-events: none;
  animation: zmRadar 2.4s ease-out infinite;
}
.chat-widget-btn::after {
  content: "在线咨询";
  position: absolute;
  right: 70px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px 10px;
  border: 1px solid rgba(225, 187, 140, 0.3);
  border-radius: 6px;
  background: rgba(6, 16, 31, 0.92);
  color: #F4E8D7;
  font-size: 12px;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}
.chat-widget-btn:hover::after {
  opacity: 1;
  visibility: visible;
}
@keyframes zmRadar {
  0% { transform: scale(0.92); opacity: 0.8; }
  70% { transform: scale(1.18); opacity: 0; }
  100% { transform: scale(1.18); opacity: 0; }
}
.chat-widget-btn:hover {
  transform: translateY(-2px) scale(1.04);
  box-shadow:
    0 22px 50px rgba(0, 0, 0, 0.44),
    0 0 0 4px rgba(59, 130, 246, 0.2),
    0 0 34px rgba(59, 130, 246, 0.36),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
}
.chat-widget-unread {
  position: absolute;
  top: -4px;
  right: -4px;
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #D92D20;
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  box-shadow: 0 4px 10px rgba(217, 45, 32, 0.4);
}
.chat-widget-panel {
  position: fixed;
  right: 18px;
  bottom: 88px;
  width: min(380px, calc(100vw - 36px));
  height: min(540px, calc(100vh - 130px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(76, 141, 255, 0.34);
  border-radius: 14px;
  background: linear-gradient(165deg, rgba(6, 16, 31, 0.99), rgba(10, 27, 51, 0.97));
  box-shadow:
    0 34px 90px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
  opacity: 0;
  visibility: hidden;
  transform: translateY(16px) scale(0.96);
  transition: opacity 0.22s ease, transform 0.22s ease, visibility 0.22s ease;
}
.chat-widget-panel.open {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}
.chat-widget-panel::before {
  content: "";
  position: absolute;
  top: 0;
  left: 20px;
  right: 20px;
  height: 2px;
  background: linear-gradient(90deg, transparent, #3B82F6, #D9B57E, transparent);
  z-index: 2;
}
.chat-widget-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 14px;
  background-image:
    linear-gradient(rgba(76, 141, 255, 0.05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(76, 141, 255, 0.05) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: 0.55;
  pointer-events: none;
  z-index: 1;
}
.chat-widget-head,
.chat-widget-body {
  position: relative;
  z-index: 2;
}
.chat-widget-head {
  padding: 16px 18px 14px;
  background: linear-gradient(135deg, rgba(10, 19, 36, 0.98), rgba(20, 34, 58, 0.96) 58%, rgba(27, 44, 74, 0.96));
  color: #fff;
  border-bottom: 1px solid rgba(76, 141, 255, 0.2);
}
.chat-widget-head-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.chat-widget-head h3 {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 17px;
  color: #F0D8AC;
}
.chat-widget-head h3::before {
  content: "志";
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  border: 1px solid rgba(225, 187, 140, 0.5);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(76, 141, 255, 0.2), rgba(225, 187, 140, 0.1));
  color: #E1BB8C;
  font-size: 14px;
  font-weight: 800;
}
.chat-widget-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.62);
}
.chat-widget-close {
  flex: 0 0 auto;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
}
.chat-widget-status {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding: 5px 11px;
  border-radius: 999px;
  background: rgba(74, 222, 128, 0.12);
  color: #7FDC9F;
  font-size: 11px;
  font-weight: 700;
}
.chat-widget-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ADE80;
  box-shadow: 0 0 10px rgba(74, 222, 128, 0.8);
}
.chat-widget-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.chat-widget-status::after {
  content: "";
  position: absolute;
  left: -5px;
  top: 50%;
  width: 17px;
  height: 17px;
  margin-top: -8.5px;
  border: 1px solid rgba(74, 222, 128, 0.4);
  border-radius: 50%;
  animation: zmStatusPulse 1.8s ease-out infinite;
  pointer-events: none;
}
@keyframes zmStatusPulse {
  0% { transform: scale(0.8); opacity: 0.9; }
  70% { transform: scale(1.8); opacity: 0; }
  100% { transform: scale(1.8); opacity: 0; }
}
.chat-widget-name-form {
  padding: 16px;
  background: rgba(10, 20, 38, 0.7);
  border-bottom: 1px solid rgba(76, 141, 255, 0.18);
}
.chat-widget-name-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 13px;
  font-weight: 800;
  color: #E8EEF7;
}
.chat-widget-name-row {
  display: flex;
  gap: 8px;
}
.chat-widget-name-row input {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  padding: 0 12px;
  border: 1px solid rgba(76, 141, 255, 0.3);
  border-radius: 8px;
  background: #0B1521;
  color: #FFFFFF;
  font: inherit;
  font-size: 13px;
}
.chat-widget-name-row button {
  min-height: 40px;
  padding: 0 15px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}
.chat-widget-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 14px 8px;
  background: transparent;
}
.chat-widget-msg {
  max-width: 78%;
  margin-bottom: 10px;
  padding: 9px 12px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.65;
  box-shadow: 0 6px 16px rgba(23, 35, 61, 0.06);
}
.chat-widget-msg .meta {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.72;
}
.chat-widget-msg.visitor {
  margin-left: auto;
  border-bottom-right-radius: 4px;
  background: linear-gradient(135deg, #2563EB, #3B82F6);
  color: #fff;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.28);
}
.chat-widget-msg.admin {
  margin-right: auto;
  border: 1px solid rgba(76, 141, 255, 0.24);
  border-bottom-left-radius: 4px;
  background: rgba(11, 21, 33, 0.9);
  color: #EAF1FB;
}
.chat-widget-composer {
  display: flex;
  gap: 8px;
  padding: 12px 14px 14px;
  border-top: 1px solid rgba(76, 141, 255, 0.18);
  background: rgba(6, 16, 31, 0.94);
}
.chat-widget-composer-row {
  display: flex;
  gap: 8px;
  width: 100%;
}
.chat-widget-composer input {
  flex: 1;
  min-width: 0;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid rgba(76, 141, 255, 0.3);
  border-radius: 8px;
  background: #0B1521;
  color: #FFFFFF;
  font: inherit;
  font-size: 13px;
}
.chat-widget-composer input::placeholder {
  color: rgba(244, 232, 215, 0.45);
}
.chat-widget-upload {
  flex: 0 0 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 141, 255, 0.3) !important;
  border-radius: 8px !important;
  background: rgba(11, 21, 33, 0.9) !important;
  color: #9CC4FF !important;
  cursor: pointer;
  box-shadow: none !important;
}
.chat-widget-upload:hover {
  background: rgba(37, 99, 235, 0.22) !important;
  border-color: #3B82F6 !important;
}
.chat-widget-voice {
  flex: 0 0 42px !important;
  min-height: 42px !important;
  padding: 0 !important;
  display: grid;
  place-items: center;
  border: 1px solid rgba(76, 141, 255, 0.3) !important;
  border-radius: 8px !important;
  background: rgba(11, 21, 33, 0.9) !important;
  color: #9CC4FF !important;
  cursor: pointer;
  box-shadow: none !important;
  transition: background .18s ease, color .18s ease, width .18s ease;
  overflow: hidden;
  white-space: nowrap;
}
.chat-widget-voice:hover { background: rgba(37, 99, 235, 0.22) !important; border-color: #3B82F6 !important; }
.chat-widget-voice.recording {
  background: #D92D20 !important;
  border-color: #D92D20 !important;
  color: #fff !important;
  font-size: 12px;
  font-weight: 800;
  box-shadow: 0 0 16px rgba(217,45,32,.35) !important;
}
.chat-widget-audio {
  display: block;
  width: 210px;
  max-width: 100%;
  height: 38px;
  margin-bottom: 6px;
  border-radius: 8px;
}
.chat-widget-msg .chat-widget-attach {
  display: block;
  margin-bottom: 6px;
  line-height: 0;
}
.chat-widget-msg .chat-widget-attach img {
  display: block;
  max-width: 220px;
  max-height: 170px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: #fff;
}
.chat-widget-msg .chat-widget-file {
  display: inline-block;
  margin-bottom: 5px;
  padding: 6px 10px;
  border: 1px solid rgba(76, 141, 255, 0.3);
  border-radius: 8px;
  background: rgba(37, 99, 235, 0.16);
  color: #9CC4FF;
  font-weight: 700;
  text-decoration: none;
}
.chat-widget-composer input:focus {
  outline: none;
  border-color: #3B82F6;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.2);
}
.chat-widget-composer button {
  min-height: 42px;
  padding: 0 16px;
  border: 0;
  border-radius: 8px;
  background: linear-gradient(135deg, #3B82F6, #1D4ED8);
  color: #fff;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(37, 99, 235, 0.28);
}
.chat-widget-hint {
  padding: 8px 14px;
  color: rgba(244, 232, 215, 0.55);
  font-size: 11px;
  text-align: center;
  background: rgba(6, 16, 31, 0.94);
  border-top: 1px solid rgba(76, 141, 255, 0.14);
}
.chat-widget-btn.notify {
  animation: zmWidgetPulse 0.9s ease-in-out 4;
}
@keyframes zmWidgetPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 18px 42px rgba(0,0,0,.38), 0 0 0 3px rgba(59,130,246,.14), 0 0 26px rgba(59,130,246,.22); }
  50% { transform: scale(1.14); box-shadow: 0 22px 52px rgba(0,0,0,.44), 0 0 0 12px rgba(59,130,246,.2), 0 0 36px rgba(59,130,246,.5); }
}
.chat-widget-pop {
  position: absolute;
  right: 0;
  bottom: 72px;
  width: 260px;
  padding: 12px 14px;
  border: 1px solid rgba(76, 141, 255, 0.35);
  border-radius: 12px;
  background: rgba(6, 16, 31, 0.96);
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.42), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #EAF1FB;
  font-size: 13px;
  line-height: 1.6;
  z-index: 1501;
  animation: zmPopIn .25s ease;
}
.chat-widget-pop b { display: block; margin-bottom: 4px; color: #E1BB8C; font-size: 13px; }
@keyframes zmPopIn {
  from { opacity: 0; transform: translateY(10px) scale(.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.chat-widget-msg.new { animation: zmMsgIn .4s ease; }
@keyframes zmMsgIn {
  from { opacity: 0; transform: translateY(10px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@media (max-width: 640px) {
  .chat-widget-btn::after {
    display: none;
  }
  .chat-widget-composer input,
  .chat-widget-name-row input {
    font-size: 16px !important;
  }
  #chatWidgetRoot {
    right: 14px;
    bottom: calc(76px + env(safe-area-inset-bottom));
  }
  .chat-widget-btn {
    width: 52px;
    height: 52px;
    border-radius: 16px;
  }
  .chat-widget-panel {
    right: 10px;
    left: 10px;
    bottom: calc(76px + env(safe-area-inset-bottom));
    width: auto;
    height: min(560px, calc(100vh - 110px));
    max-height: calc(100vh - 110px);
    min-height: 320px;
  }
  .chat-widget-pop {
    bottom: calc(70px + env(safe-area-inset-bottom));
  }
}
