/* 管理端顶栏入口 */
.yile-kefu-nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  margin: 0 12px 0 0;
  padding: 0 14px;
  border: 1px solid #409eff;
  border-radius: 4px;
  background: #ecf5ff;
  color: #409eff;
  font-size: 13px;
  cursor: pointer;
  vertical-align: middle;
  position: relative;
  white-space: nowrap;
}
.yile-kefu-nav-btn:hover {
  background: #409eff;
  color: #fff;
}
.yile-kefu-nav-btn .badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.yile-kefu-drawer {
  position: fixed;
  inset: 0;
  z-index: 100000;
  pointer-events: none;
  visibility: hidden;
}
.yile-kefu-drawer.open {
  pointer-events: auto;
  visibility: visible;
}
.yile-kefu-drawer-mask {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
}
.yile-kefu-drawer-panel {
  position: absolute;
  top: 0;
  right: 0;
  width: min(920px, 100vw);
  height: 100%;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  transform: translateX(100%);
  transition: transform 0.25s ease;
}
.yile-kefu-drawer.open .yile-kefu-drawer-panel {
  transform: translateX(0);
}
.yile-kefu-drawer-panel iframe {
  width: 100%;
  height: 100%;
  border: none;
}
.yile-kefu-drawer-close {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 2;
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.45);
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 32px;
}

/* 在线客服 — 管理端 + 会员端共用样式 */
.yile-kefu-fab {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 99990;
  width: 56px;
  height: 56px;
  border: none;
  border-radius: 50%;
  background: linear-gradient(135deg, #409eff, #337ecc);
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(64, 158, 255, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s;
}
.yile-kefu-fab:hover {
  transform: scale(1.06);
}
.yile-kefu-fab .badge {
  position: absolute;
  top: -2px;
  right: -2px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
}
.yile-kefu-panel {
  position: fixed;
  right: 24px;
  bottom: 92px;
  z-index: 99989;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 480px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: none;
  flex-direction: column;
  overflow: hidden;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.yile-kefu-panel.open {
  display: flex;
}
.yile-kefu-head {
  padding: 14px 16px;
  background: linear-gradient(135deg, #409eff, #337ecc);
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.yile-kefu-head button {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}
.yile-kefu-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f5f7fa;
}
.yile-kefu-msg {
  margin-bottom: 10px;
  display: flex;
}
.yile-kefu-msg.me {
  justify-content: flex-end;
}
.yile-kefu-msg .bubble {
  max-width: 78%;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}
.yile-kefu-msg.them .bubble {
  background: #fff;
  color: #303133;
  border: 1px solid #ebeef5;
}
.yile-kefu-msg.me .bubble {
  background: #409eff;
  color: #fff;
}
.yile-kefu-msg .time {
  font-size: 11px;
  color: #909399;
  margin-top: 4px;
  text-align: right;
}
.yile-kefu-foot {
  padding: 10px;
  border-top: 1px solid #ebeef5;
  background: #fff;
  display: flex;
  gap: 8px;
}
.yile-kefu-foot textarea {
  flex: 1;
  resize: none;
  height: 56px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  outline: none;
}
.yile-kefu-foot textarea:focus {
  border-color: #409eff;
}
.yile-kefu-foot button {
  width: 64px;
  border: none;
  border-radius: 8px;
  background: #409eff;
  color: #fff;
  font-size: 14px;
  cursor: pointer;
}
.yile-kefu-foot button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.yile-kefu-empty {
  color: #909399;
  text-align: center;
  padding: 40px 16px;
  font-size: 14px;
}

/* 管理端全页 */
.yile-kefu-admin {
  display: flex;
  height: 100vh;
  background: #f0f2f5;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}
.yile-kefu-admin .sidebar {
  width: 280px;
  background: #fff;
  border-right: 1px solid #ebeef5;
  display: flex;
  flex-direction: column;
}
.yile-kefu-admin .sidebar-head {
  padding: 16px;
  border-bottom: 1px solid #ebeef5;
  font-size: 16px;
  font-weight: 600;
}
.yile-kefu-admin .back {
  display: inline-block;
  margin-bottom: 8px;
  color: #409eff;
  text-decoration: none;
  font-size: 13px;
  font-weight: normal;
}
.yile-kefu-admin .session-list {
  flex: 1;
  overflow-y: auto;
}
.yile-kefu-admin .session-item {
  padding: 12px 16px;
  border-bottom: 1px solid #f2f6fc;
  cursor: pointer;
}
.yile-kefu-admin .session-item:hover,
.yile-kefu-admin .session-item.active {
  background: #ecf5ff;
}
.yile-kefu-admin .session-item .name {
  font-size: 14px;
  font-weight: 600;
  color: #303133;
}
.yile-kefu-admin .session-item .preview {
  font-size: 12px;
  color: #909399;
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.yile-kefu-admin .session-item .meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 4px;
}
.yile-kefu-admin .session-item .unread {
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
  border-radius: 9px;
  padding: 0 5px;
}
.yile-kefu-admin .chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fff;
}
.yile-kefu-admin .chat-head {
  padding: 14px 20px;
  border-bottom: 1px solid #ebeef5;
  font-size: 15px;
  font-weight: 600;
}
.yile-kefu-admin .chat .yile-kefu-msgs {
  flex: 1;
}
.yile-kefu-admin .chat .yile-kefu-foot textarea {
  height: 72px;
}
