.chat-widget {
  position: absolute;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}
.chat-fab {
  width: 54px; height: 54px; border-radius: 50%;
  background: linear-gradient(135deg, #4f8cff, #6a5cff);
  border: none; color: #fff; font-size: 24px; cursor: move;
  box-shadow: 0 6px 20px rgba(79,140,255,.4);
  position: relative; transition: transform .15s;
  touch-action: none;
}
.chat-fab:hover { transform: scale(1.06); }
.chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: #ff4d4f; color: #fff;
  min-width: 18px; height: 18px; border-radius: 9px;
  font-size: 11px; line-height: 18px; text-align: center;
  padding: 0 4px; font-weight: 600;
  pointer-events: none;
}

.chat-panel {
  position: fixed;
  z-index: 99998;
  width: 340px;
  height: 480px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 10px 40px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  touch-action: pan-y;
  -webkit-user-select: text;
  user-select: text;
}
.chat-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 12px 16px; background: #4f8cff; color: #fff; font-weight: 600;
  flex-shrink: 0;
}
.chat-close {
  background: none; border: none; color: #fff; font-size: 18px;
  cursor: pointer; padding: 2px 6px;
}
.chat-body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  touch-action: pan-y;
  padding: 12px;
  background: #f6f8fb;
}
.chat-hint { text-align: center; color: #999; font-size: 13px; margin-top: 20px; }
.chat-msg { margin-bottom: 10px; display: flex; flex-direction: column; }
.chat-msg-user { align-items: flex-end; }
.chat-msg-staff { align-items: flex-start; }
.chat-bubble {
  max-width: 78%; padding: 8px 12px; border-radius: 12px;
  font-size: 14px; line-height: 1.5; word-break: break-word; background: #fff;
}
.chat-msg-user .chat-bubble { background: #4f8cff; color: #fff; }
.chat-msg-staff .chat-bubble { background: #fff; }

.chat-meta { display: flex; align-items: center; gap: 5px; margin-top: 3px; padding: 0 4px; }
.chat-time { font-size: 11px; color: #999; }

.chat-read-mark {
  font-size: 10px; padding: 0 5px; border-radius: 3px;
  font-weight: 500; line-height: 1.5; white-space: nowrap;
}
.chat-read-yes {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.1);
  border: 1px solid rgba(22, 163, 74, 0.22);
}
.chat-read-no {
  color: #94a3b8;
  background: rgba(148, 163, 184, 0.1);
  border: 1px solid rgba(148, 163, 184, 0.22);
}

.chat-input-bar {
  display: flex; border-top: 1px solid #eee; background: #fff;
  flex-shrink: 0;
}
.chat-input-bar textarea {
  flex: 1; border: none; resize: none; padding: 10px 12px;
  font-size: 16px;
  outline: none; height: 44px; font-family: inherit;
  -webkit-user-select: text;
  user-select: text;
  touch-action: auto;
}
.chat-input-bar button {
  border: none;
  background: #4f8cff;
  color: #fff;
  padding: 0 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s;
}
.chat-input-bar button:hover { background: #3d7bf0; }
.chat-input-bar button svg {
  display: block;
  width: 20px;
  height: 20px;
}