.qkj-chat-root {
  --qkj-chat: #c60f1c;
  font-family: "Microsoft YaHei", "PingFang SC", sans-serif;
  z-index: 99990;
}
.qkj-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 44px;
  padding: 0 18px 0 14px;
  border: none;
  border-radius: 4px;
  background: var(--qkj-chat);
  color: #fff;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(198, 15, 28, 0.35);
  z-index: 99991;
}
.qkj-chat-launcher svg { width: 20px; height: 20px; flex-shrink: 0; }
.qkj-chat-launcher.is-hidden { display: none; }
.qkj-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  width: 360px;
  height: 560px;
  max-height: calc(100vh - 40px);
  background: #f3f3f3;
  border-radius: 6px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 99992;
}
.qkj-chat-panel[hidden] { display: none !important; }
.qkj-chat-head {
  height: 56px;
  background: var(--qkj-chat);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 12px 0 14px;
  flex-shrink: 0;
}
.qkj-chat-head-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 15px;
  font-weight: 600;
}
.qkj-chat-head-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}
.qkj-chat-head-actions {
  display: flex;
  align-items: center;
  gap: 2px;
}
.qkj-chat-head-btn {
  width: 30px;
  height: 30px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  opacity: 0.92;
  transition: background .15s ease, opacity .15s ease;
}
.qkj-chat-head-btn:hover {
  background: rgba(255, 255, 255, 0.16);
  opacity: 1;
}
.qkj-chat-head-btn svg {
  width: 16px;
  height: 16px;
  display: block;
  fill: currentColor;
}
.qkj-chat-head-btn .ico-sound-off { display: none; }
.qkj-chat-head-btn.is-muted .ico-sound-on { display: none; }
.qkj-chat-head-btn.is-muted .ico-sound-off { display: block; }
.qkj-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px 14px;
  background: #f0f0f0;
}
.qkj-chat-more {
  text-align: center;
  color: #999;
  font-size: 12px;
  margin-bottom: 12px;
  cursor: pointer;
}
.qkj-chat-msg { margin-bottom: 14px; }
.qkj-chat-msg-meta {
  font-size: 12px;
  color: #999;
  margin-bottom: 4px;
}
.qkj-chat-msg.visitor .qkj-chat-msg-meta { text-align: right; }
.qkj-chat-msg.visitor { text-align: right; }
.qkj-chat-bubble {
  display: inline-block;
  max-width: 80%;
  text-align: left;
  background: #fff;
  border: 1px solid #e5e5e5;
  border-radius: 2px;
  padding: 10px 12px;
  line-height: 1.55;
  font-size: 14px;
  color: #222;
  word-break: break-word;
}
.qkj-chat-msg.visitor .qkj-chat-bubble {
  background: #fff5f5;
  border-color: #f0c8cb;
}
.qkj-chat-bubble.is-media {
  padding: 0;
  background: transparent;
  border: none;
  box-shadow: none;
}
.qkj-chat-msg.visitor .qkj-chat-bubble.is-media {
  background: transparent;
  border: none;
}
.qkj-chat-bubble img {
  max-width: 200px;
  max-height: 200px;
  width: auto;
  height: auto;
  display: block;
  border-radius: 4px;
  object-fit: contain;
  vertical-align: top;
}
.qkj-chat-bubble.is-media img {
  border: 1px solid #e6e6e6;
  background: #fff;
}
.qkj-chat-bubble.is-media a {
  display: block;
  line-height: 0;
}
.qkj-chat-bubble.is-media a:hover img {
  border-color: var(--qkj-chat);
}
.qkj-chat-bubble video {
  max-width: 200px;
  max-height: 160px;
  display: block;
  background: #000;
}
.qkj-chat-foot {
  background: #fff;
  border-top: 1px solid #e8e8e8;
  flex-shrink: 0;
  position: relative;
}
.qkj-chat-input {
  width: 100%;
  min-height: 72px;
  border: none;
  resize: none;
  outline: none;
  padding: 10px 12px 0;
  font-size: 14px;
  box-sizing: border-box;
}
.qkj-chat-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 10px 10px;
}
.qkj-chat-tools-left { display: flex; gap: 4px; }
.qkj-chat-tool {
  width: 32px;
  height: 28px;
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 18px;
  color: #666;
}
.qkj-chat-send {
  min-width: 64px;
  height: 30px;
  border: none;
  border-radius: 2px;
  background: var(--qkj-chat);
  color: #fff;
  cursor: pointer;
  font-size: 13px;
}
.qkj-chat-send:disabled { opacity: .5; cursor: default; }
.qkj-chat-emoji {
  position: absolute;
  left: 8px;
  bottom: 100%;
  width: 280px;
  max-height: 160px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 4px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 2px;
  box-shadow: 0 -4px 16px rgba(0,0,0,.08);
  z-index: 2;
}
.qkj-chat-emoji[hidden] { display: none !important; }
.qkj-chat-foot input[type="file"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}
.qkj-chat-emoji button {
  border: none;
  background: transparent;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
}
@media (max-width: 480px) {
  .qkj-chat-panel {
    right: 0;
    bottom: 0;
    width: 100%;
    height: 100%;
    max-height: 100%;
    border-radius: 0;
  }
  .qkj-chat-launcher { right: 12px; bottom: 70px; }
}
