/* 悬浮客服样式 */
  #floating-kefu-widget {
    position: fixed;
    z-index: 1000;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  }

  /* 悬浮按钮 - 手机端优化 */
  .kefu-float-button {
    position: fixed;
    bottom: 170px;
    right: 40px;
    width: 65px;
    /* 缩小宽度 */
    height: 65px;
    /* 缩小高度 */
    background: transparent;
    /* 透明背景 */
    cursor: move;
    /* 拖动光标 */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    transition: all 0.3s ease;
    user-select: none;
    touch-action: none;
    /* 防止移动端滚动冲突 */
  }

  .kefu-float-button.dragging {
    transition: none;
    /* 拖动时禁用过渡动画 */
    cursor: grabbing;
    z-index: 10000;
    transform: scale(1.1);
    /* 拖动时稍微放大 */
  }

  .kefu-float-button:hover {
    transform: translateY(-3px) scale(1.05);
  }

  .kefu-float-button:hover .kefu-btn-icon svg {
    box-shadow: 0 4px 12px rgba(79, 195, 247, 0.4);
    /* 悬停时SVG阴影变蓝 */
  }

  .kefu-float-button:hover .kefu-btn-text {
    color: #1e88e5;
    /* 悬停时文字变成深蓝色 */
  }

  .kefu-float-button:hover .kefu-btn-icon svg path {
    fill: #1e88e5;
    /* 悬停时图标变深蓝色 */
  }

  .kefu-float-button:active {
    transform: translateY(-1px) scale(1.02);
  }

  .kefu-btn-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 4px;
  }

  .kefu-btn-icon {
    margin-bottom: 2px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .kefu-btn-icon svg {
    width: 42px !important;
    height: 42px !important;
    background: #ffffff;
    border-radius: 50%;
    padding: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .kefu-btn-text {
    font-size: 12px;
    font-weight: 500;
    margin-top: 2px;
    line-height: 1;
    color: #29b6f6;
    white-space: nowrap;
    text-align: center;
    letter-spacing: 0.2px;
    background-color: #fff;
  }

  /* 未读消息徽章 */
  .kefu-unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff4757;
    color: white;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    font-weight: bold;
    border: 2px solid white;
    box-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
    z-index: 10;
  }

  /* 新消息闪动效果 */
  .kefu-unread-badge.new-message {
    animation: messageFlash 2s ease-in-out infinite;
  }

  /* 悬浮按钮整体闪动效果 - 类似QQ消息 */
  .kefu-float-button.has-new-message {
    animation: qqMessageFlash 1s ease-in-out infinite;
  }

  /* 红点闪动效果 */
  .kefu-unread-badge.new-message {
    animation: badgeFlash 1s ease-in-out infinite;
  }

  /* QQ风格消息闪动动画 */
  @keyframes qqMessageFlash {

    0%,
    100% {
      transform: scale(1);
      box-shadow: 0 4px 20px rgba(79, 195, 247, 0.3);
    }

    25% {
      transform: scale(1.05);
      box-shadow: 0 4px 25px rgba(79, 195, 247, 0.6);
    }

    50% {
      transform: scale(1.1);
      box-shadow: 0 4px 30px rgba(79, 195, 247, 0.8), 0 0 20px rgba(255, 71, 87, 0.6);
    }

    75% {
      transform: scale(1.05);
      box-shadow: 0 4px 25px rgba(79, 195, 247, 0.6);
    }
  }

  /* 红点闪动动画 */
  @keyframes badgeFlash {

    0%,
    100% {
      opacity: 1;
      transform: scale(1);
      box-shadow: 0 0 10px rgba(255, 71, 87, 0.6);
    }

    50% {
      opacity: 0.8;
      transform: scale(1.2);
      box-shadow: 0 0 20px rgba(255, 71, 87, 1);
    }
  }

  /* 聊天窗口 - 手机端全屏优化 */
  .kefu-chat-window {
    position: fixed;
    bottom: 80px;
    right: 10px;
    left: 10px;
    width: auto;
    height: 80vh;
    /* 屏幕高度的三分之二 */
    max-height: 1000px;
    min-height: 350px;
    background: white;
    display: flex;
    flex-direction: column;
    border-radius: 12px;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.15);
    overflow: hidden;
    animation: slideInUp 0.3s ease-out;
    z-index: 9998;
    border: 1px solid rgba(0, 0, 0, 0.1);
  }

  @keyframes slideInUp {
    from {
      opacity: 0;
      transform: translateY(20px);
    }

    to {
      opacity: 1;
      transform: translateY(0);
    }
  }

  /* 聊天头部 - 参考原页面样式 */
  .kefu-chat-header {
    flex-shrink: 0;
    height: 60px;
    background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
    /* 天蓝色渐变 */
    color: white;
    display: flex;
    align-items: center;
    padding: 0 15px;
    border-bottom: 1.5px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  }

  .kefu-chat-header-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 2px solid rgba(255, 255, 255, 0.3);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  }

  .kefu-chat-header-title {
    flex: 1;
    font-weight: 500;
    font-size: 18px;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
  }

  .kefu-chat-header-tool {
    display: flex !important;
    align-items: center;
    justify-content: flex-end;
    gap: 5px;
    padding-right: 5px;
  }

  .kefu-chat-header-tool button {
    background: none;
    border: none;
    color: white;
    cursor: pointer;
    padding: 6px;
    border-radius: 6px;
    transition: all 0.2s;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 28px;
    min-height: 28px;
  }

  .kefu-chat-header-tool button:hover {
    background: rgba(255, 255, 255, 0.15);
    transform: scale(1.05);
  }

  .kefu-chat-header-tool .kefu-minimize-btn {
    background: rgba(255, 255, 255, 0.1);
    border-radius: 50%;
  }

  .kefu-chat-header-tool .kefu-minimize-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
  }

  /* 聊天内容区域 - 参考原页面绝对定位 */
  .kefu-chat-body {
    position: absolute;
    top: 60px;
    bottom: 148px;
    left: 0;
    right: 0;
    overflow-y: auto;
    padding: 18px 16px 12px 16px;
    background: #f9f9fb;
    display: flex;
    flex-direction: column;
  }

  .kefu-chat-box {
    height: 100%;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 15px;
  }

  /* 聊天底部 - 参考原页面样式 */
  .kefu-chat-footer {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 148px;
    background-color: #fff;
    box-shadow: 0 -1px 0 0 rgba(0, 0, 0, 0.04), 0 -2px 0 0 rgba(0, 0, 0, 0.01);
    border-bottom: 1px solid #e2e2e2;
    z-index: 10;
    padding-bottom: 2px;
    box-sizing: border-box;
  }

  /* 工具栏位于输入框上方 */
  .kefu-tool-box {
    height: 30px;
    width: 100%;
    padding-left: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    box-sizing: border-box;
  }

  /* 输入框区域 */
  .kefu-text-holder {
    position: relative;
    height: 116px;
    padding-top: 4px;
    padding-right: 10px;
    padding-left: 10px;
    box-sizing: border-box;
  }

  .kefu-text-holder textarea {
    display: block;
    width: 100%;
    height: 108px;
    padding: 10px 88px 40px 10px;
    overflow-x: hidden;
    overflow-y: auto;
    resize: none;
    outline: 0;
    background-color: #fff;
    border: 0;
    word-break: break-all;
    font-size: 13px;
    line-height: 17px;
    -webkit-appearance: none;
    appearance: none;
    border-radius: 4px;
    box-sizing: border-box;
  }

  .kefu-text-holder textarea:focus {
    border-color: #4fc3f7;
    /* 天蓝色边框 */
    background: white;
    box-shadow: 0 0 0 2px rgba(79, 195, 247, 0.15);
    /* 天蓝色阴影 */
  }

  .kefu-tool-box i {
    margin-left: 10px;
    font-size: 16px;
    color: #c2c2c2;
    cursor: pointer;
  }

  .kefu-tool-box i:hover {
    color: #4fc3f7;
    /* 天蓝色 */
  }

  .kefu-send-btn-div {
    position: absolute;
    right: 18px;
    bottom: 10px;
    width: 68px;
    height: 30px;
  }

  .kefu-send-input {
    width: 100%;
    height: 100%;
    font-size: 13px;
    border: 0;
    outline: none;
    background-color: #4fc3f7;
    /* 天蓝色 */
    color: #fff;
    cursor: pointer;
    padding: 0;
    border-radius: 4px;
    transition: background 0.2s;
    box-sizing: border-box;
  }

  .kefu-send-input:enabled {
    background-color: #4fc3f7;
    /* 天蓝色 */
    color: #fff;
  }

  .kefu-send-input:hover:not(:disabled) {
    background-color: #29b6f6;
    /* 深蓝色 */
  }

  .kefu-send-input:disabled {
    background: #ccc;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
  }

  /* 消息样式 */
  .kefu-chat-message {
    margin-bottom: 15px;
  }

  .kefu-system-msg {
    text-align: center;
    color: #999;
    font-size: 12px;
    padding: 8px 16px;
    background: rgba(0, 0, 0, 0.05);
    border-radius: 12px;
    margin: 8px auto;
    max-width: 80%;
    display: block;
  }

  .kefu-msg-row {
    display: flex;
    align-items: flex-start;
    gap: 10px;
  }

  .kefu-msg-row.kefu-msg-right {
    flex-direction: row-reverse;
  }

  /* 确保机器人消息左对齐 */
  .kefu-msg-row.kefu-msg-left {
    justify-content: flex-start;
  }

  .kefu-msg-avatar {
    width: 35px;
    height: 35px;
    border-radius: 50%;
    flex-shrink: 0;
  }

  .kefu-msg-bubble {
    max-width: 70%;
  }

  /* 机器人消息气泡 - 更宽的显示 */
  .kefu-msg-left .kefu-msg-bubble:has(.kefu-robot-quick-replies) {
    max-width: 85%;
    /* 机器人快速回复消息占用更多宽度 */
  }

  /* 兼容性：如果不支持:has选择器，使用类名 */
  .kefu-msg-left .kefu-msg-bubble.kefu-robot-message {
    max-width: 85%;
  }

  .kefu-msg-content {
    background: #f5f5f5;
    padding: 12px 16px;
    border-radius: 18px;
    font-size: 14px;
    line-height: 1.5;
    word-wrap: break-word;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
  }

  .kefu-msg-right .kefu-msg-content {
    background: #e6f7ff;
    color: #222;
  }

  .kefu-msg-info {
    margin-top: 5px;
    font-size: 12px;
    color: #999;
    display: flex;
    align-items: center;
    gap: 10px;
  }

  .kefu-msg-right .kefu-msg-info {
    justify-content: flex-end;
  }

  .kefu-msg-image {
    max-width: 200px;
    border-radius: 8px;
    cursor: pointer;
  }

  /* 图片预览 */
  .kefu-image-preview-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
  }

  .kefu-image-preview-content {
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
  }

  /* 机器人快捷回复 - 移动端优化 */
  .kefu-robot-quick-replies {
    background: #f8f9fa;
    border-radius: 12px;
    padding: 10px;
    width: 100%;
    max-width: none;
    /* 移除最大宽度限制 */
    margin: 0;
    /* 确保没有外边距 */
    text-align: left;
    /* 左对齐 */
    margin-left: -8px;
  }

  .kefu-quick-reply-title {
    font-weight: 500;
    margin-bottom: 6px;
    /* 减少间距 */
    color: #333;
    font-size: 14px;
    line-height: 1.2;
    /* 减少行高 */
  }

  .kefu-quick-reply-buttons {
    display: flex;
    flex-wrap: wrap;
    /* 允许换行 */
    gap: 4px;
    /* 减少间距 */
    justify-content: flex-start;
    /* 左对齐 */
    align-items: flex-start;
    /* 顶部对齐 */
  }

  .kefu-quick-reply-btn {
    background: white;
    border: 1px solid #e0e0e0;
    border-radius: 16px;
    /* 稍微减少圆角 */
    padding: 6px 12px;
    /* 减少内边距 */
    cursor: pointer;
    font-size: 12px;
    /* 稍微减少字体大小 */
    line-height: 1.2;
    /* 减少行高 */
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
    /* 减少阴影 */
    flex: 0 0 auto;
    /* 不拉伸，根据内容自适应 */
    white-space: nowrap;
    /* 不换行 */
    min-width: 0;
    /* 允许收缩 */
  }

  /* 移动端优化：小屏幕时调整按钮大小 */
  @media (max-width: 480px) {
    .kefu-quick-reply-btn {
      font-size: 11px;
      padding: 5px 10px;
      /*max-width: calc(50% - 2px); !* 小屏幕时最多占一行的一半 *!*/
    }

    .kefu-robot-quick-replies {
      padding: 8px;
    }

    .kefu-quick-reply-title {
      font-size: 13px;
      margin-bottom: 5px;
    }
  }

  /* 超小屏幕优化 */
  @media (max-width: 360px) {
    .kefu-quick-reply-btn {
      font-size: 10px;
      padding: 4px 8px;
      max-width: calc(50% - 1px);
    }

    .kefu-quick-reply-buttons {
      gap: 3px;
    }
  }

  .kefu-quick-reply-btn:hover {
    background: linear-gradient(135deg, #4fc3f7 0%, #29b6f6 100%);
    /* 天蓝色渐变 */
    color: white;
    border-color: #4fc3f7;
    /* 天蓝色边框 */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(79, 195, 247, 0.3);
    /* 天蓝色阴影 */
  }

  /* 状态指示器 */
  .kefu-msg-status.kefu-read {
    color: #28a745;
  }

  .kefu-msg-status.kefu-unread {
    color: #ffc107;
  }

  .kefu-recall-btn {
    background: none;
    border: none;
    color: #999;
    cursor: pointer;
    font-size: 12px;
    padding: 2px 5px;
    border-radius: 3px;
    transition: background 0.2s;
  }

  .kefu-recall-btn:hover {
    background: #f0f0f0;
  }

  /* WebSocket状态 */
  .kefu-websocket-status.connected {
    color: #06f571;
  }

  .kefu-websocket-status.disconnected {
    color: #dc3545;
  }

  .kefu-websocket-status.connecting {
    color: #ffc107;
  }

  /* 工具按钮 */
  .kefu-staff-service {
    background: #28a745;
    color: white;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 12px;
    cursor: pointer;
    transition: background 0.2s;
  }

  .kefu-staff-service:hover {
    background: #218838;
  }

  .kefu-sound-toggle {
    font-size: 16px;
  }

  .kefu-chat-header-tool .van-icon {
    font-size: 16px;
  }

  /* 提取的内联样式 - CSS类 */
  .kefu-float-hidden {
    display: none;
  }

  .kefu-btn-flex {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    padding: 0;
    margin: 0;
  }

  .kefu-unread-hidden {
    display: none;
  }

  .kefu-chat-hidden {
    display: none;
  }

  .kefu-app-full-height {
    height: 100%;
  }

  .kefu-video-player {
    position: relative;
    cursor: pointer;
  }

  .kefu-video-element {
    width: 100%;
    max-width: 300px;
    border-radius: 8px;
  }

  .kefu-video-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
  }

  .kefu-play-button {
    width: 50px;
    height: 50px;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 20px;
    color: #333;
  }

  .kefu-video-info {
    position: absolute;
    bottom: 8px;
    right: 8px;
    background: rgba(0, 0, 0, 0.7);
    color: white;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 12px;
  }

  .kefu-file-input-hidden {
    display: none;
  }

  .kefu-praise-box {
    display: none;
    text-align: center;
    padding-top: 19%;
  }

  .kefu-msg-box-hidden {
    display: none;
  }

  .kefu-phone-input {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
    outline: none;
  }

  .kefu-msg-form-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 10px;
  }

  .kefu-msg-form-label {
    width: 60px;
    flex: none;
    color: #333;
    font-size: 14px;
  }

  .kefu-msg-form-action {
    margin-top: 12px;
  }

  .kefu-submit-btn {
    width: 100%;
    height: 40px;
    border: 0;
    border-radius: 20px;
    background: var(--van-primary-color);
    color: #fff;
    font-size: 14px;
  }

  .kefu-tool-icon {
    box-sizing: border-box;
    width: 28px;
    height: 28px;
    flex: 0 0 28px;
    margin: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    color: var(--van-primary-color);
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 6px rgba(0, 0, 0, 0.08);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    vertical-align: middle;
  }

  .kefu-tool-icon::before {
    display: block;
    font-size: 16px;
    line-height: 1;
  }

  .kefu-tool-icon:hover {
    background: #f0f9ff;
  }

  .kefu-popup {
    position: fixed;
    inset: 0;
    z-index: 10001;
  }

  .kefu-popup-mask {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
  }

  .kefu-popup-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(320px, calc(100vw - 24px));
    max-height: calc(100vh - 24px);
    overflow: auto;
    background: #fff;
    border-radius: 12px;
    padding: 10px;
    box-sizing: border-box;
  }

  .kefu-popup-close {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.3);
    color: #fff;
    font-size: 18px;
    line-height: 28px;
  }

  .kefu-popup-button {
    width: 100%;
    height: 38px;
    margin-top: 16px;
    border: 0;
    border-radius: 19px;
    background: #f3f4f6;
    color: #333;
    font-size: 14px;
  }

  .kefu-audio-hidden {
    display: none;
  }

  /* 历史消息加载条 */
  .kefu-history-load-bar {
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
    color: #999;
  }

  .kefu-load-more {
    cursor: pointer;
    color: #4fc3f7;
    text-decoration: underline;
  }

  .kefu-load-more:hover {
    color: #29b6f6;
  }

  .kefu-no-more {
    color: #ccc;
  }

  [v-cloak] {
    display: none !important;
  }

  .kefu-emoji-panel {
    position: absolute;
    right: 0;
    bottom: 148px;
    left: 0;
    z-index: 20;
    width: 100%;
    max-height: 320px;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 8px;
    overflow: auto;
    background: #fff;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.08);
    box-sizing: border-box;
  }

  .kefu-emoji-item {
    width: 100%;
    height: 36px;
    border: 0;
    border-radius: 6px;
    background: #f7f8fa;
    font-size: 18px;
    line-height: 36px;
  }

  .kefu-video-popup,
  .kefu-image-preview-popup {
    width: min(92vw, 360px);
    padding: 16px;
    box-sizing: border-box;
    background: #fff;
  }

  .kefu-video-popup video {
    width: 100%;
    max-height: 70vh;
    border-radius: 8px;
  }

  .kefu-phone-form {
    width: min(320px, calc(100vw - 24px));
    padding: 16px 16px 20px;
    box-sizing: border-box;
    background: #fff;
  }

  .kefu-phone-form-actions {
    margin-top: 16px;
  }

  .kefu-subscribe-panel,
  .kefu-error-panel {
    width: min(320px, calc(100vw - 24px));
    padding: 16px;
    box-sizing: border-box;
    background: #fff;
    text-align: center;
  }

  .kefu-subscribe-title,
  .kefu-error-title {
    font-size: 16px;
    font-weight: 600;
    color: #323233;
    margin-bottom: 12px;
  }

  .kefu-subscribe-tip,
  .kefu-subscribe-hint,
  .kefu-error-message {
    font-size: 13px;
    color: #646566;
    line-height: 1.5;
  }

  .kefu-subscribe-tip {
    margin-bottom: 12px;
  }

  .kefu-subscribe-hint {
    margin: 12px 0 16px;
  }

  .common-questions {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 148px;
    z-index: 2;
    background: #fff;
    border-top: 1px solid #ebedf0;
    box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.04);
  }

  .question-list {
    max-height: 220px;
    overflow: auto;
  }

  .powered-by {
    padding: 8px 12px 10px;
    text-align: center;
    font-size: 12px;
    color: #969799;
  }

  .powered-by a {
    color: var(--van-primary-color);
  }

  .kefu-chat-empty {
    padding: 24px 0 8px;
  }
