/* 右下角即时消息 */
.sq-im-root {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 10050;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
}

.sq-im-fab {
  min-width: 56px;
  height: 56px;
  padding: 0 16px;
  border-radius: 28px;
  border: none;
  background: linear-gradient(135deg, #409eff 0%, #337ecc 100%);
  color: #fff;
  box-shadow: 0 6px 20px rgba(64, 158, 255, 0.45);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: transform 0.2s, box-shadow 0.2s;
  font-size: 15px;
  font-weight: 600;
}

/* 用户前台：渐变字「在线客服」 */
.sq-im-root:not(.sq-im-admin) .sq-im-fab {
  min-width: auto;
  height: auto;
  padding: 11px 18px;
  border-radius: 999px;
  background: #fff;
  border: 1px solid rgba(64, 128, 255, 0.18);
  box-shadow: 0 6px 24px rgba(64, 128, 255, 0.18);
}

.sq-im-root:not(.sq-im-admin) .sq-im-fab:hover {
  box-shadow: 0 8px 28px rgba(64, 128, 255, 0.28);
}

.sq-im-fab-text {
  background: linear-gradient(120deg, #4080ff 0%, #6366f1 45%, #06b6d4 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.12em;
  line-height: 1.2;
  white-space: nowrap;
}

.sq-im-fab-label {
  line-height: 1;
  letter-spacing: 0.05em;
}

.sq-im-fab:hover {
  transform: scale(1.05);
}

.sq-im-fab-icon {
  font-size: 26px;
  line-height: 1;
}

.sq-im-badge {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: #f56c6c;
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 600;
}

.sq-im-badge.is-hidden {
  display: none;
}

.sq-im-panel {
  position: absolute;
  right: 0;
  bottom: 68px;
  width: 360px;
  max-width: calc(100vw - 24px);
  height: 480px;
  max-height: calc(100vh - 100px);
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid #e4e7ed;
}

.sq-im-panel.is-hidden {
  display: none;
}

.sq-im-root.sq-im-admin .sq-im-panel {
  width: 520px;
  height: 520px;
}

.sq-im-header {
  flex-shrink: 0;
  padding: 12px 14px;
  background: linear-gradient(135deg, #409eff 0%, #337ecc 100%);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 15px;
  font-weight: 600;
}

.sq-im-close {
  background: transparent;
  border: none;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.9;
}

.sq-im-body {
  flex: 1;
  display: flex;
  min-height: 0;
  overflow: hidden;
}

.sq-im-sessions {
  width: 140px;
  flex-shrink: 0;
  border-right: 1px solid #ebeef5;
  overflow-y: auto;
  background: #f5f7fa;
}

.sq-im-sessions.is-hidden {
  display: none;
}

.sq-im-session-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 8px;
  border: none;
  border-bottom: 1px solid #ebeef5;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
}

.sq-im-session-item:hover,
.sq-im-session-item.is-active {
  background: #ecf5ff;
}

.sq-im-session-email {
  display: block;
  color: #303133;
  word-break: break-all;
  line-height: 1.3;
}

.sq-im-session-meta {
  display: block;
  color: #909399;
  margin-top: 4px;
  font-size: 11px;
}

.sq-im-session-unread {
  display: inline-block;
  min-width: 16px;
  padding: 0 4px;
  background: #f56c6c;
  color: #fff;
  border-radius: 8px;
  font-size: 10px;
  margin-left: 4px;
}

.sq-im-chat {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
}

.sq-im-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  background: #f9fafb;
}

.sq-im-messages::after {
  content: '';
  display: table;
  clear: both;
}

.sq-im-hint {
  text-align: center;
  color: #909399;
  font-size: 13px;
  padding: 24px 12px;
  line-height: 1.6;
}

.sq-im-msg {
  margin-bottom: 12px;
  max-width: 88%;
  clear: both;
}

.sq-im-msg.is-me {
  float: right;
}

.sq-im-msg.is-other {
  float: left;
}

.sq-im-msg-bubble {
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 14px;
  line-height: 1.5;
  word-break: break-word;
  white-space: pre-wrap;
}

.sq-im-msg.is-me .sq-im-msg-bubble {
  background: #409eff;
  color: #fff;
  border-bottom-right-radius: 2px;
}

.sq-im-msg.is-other .sq-im-msg-bubble {
  background: #fff;
  color: #303133;
  border: 1px solid #e4e7ed;
  border-bottom-left-radius: 2px;
}

.sq-im-msg-time {
  font-size: 11px;
  color: #c0c4cc;
  margin-top: 4px;
}

.sq-im-msg.is-me .sq-im-msg-time {
  text-align: right;
}

.sq-im-msg-bubble .sq-im-img-link {
  display: block;
  line-height: 0;
}

.sq-im-img {
  max-width: 200px;
  max-height: 200px;
  border-radius: 6px;
  display: block;
  cursor: pointer;
}

.sq-im-input-wrap {
  flex-shrink: 0;
  padding: 10px;
  border-top: 1px solid #ebeef5;
  background: #fff;
}

.sq-im-toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}

.sq-im-tool-btn {
  padding: 4px 12px;
  font-size: 13px;
  color: #409eff;
  background: #ecf5ff;
  border: 1px solid #c6e2ff;
  border-radius: 6px;
  cursor: pointer;
}

.sq-im-tool-btn:hover:not(:disabled) {
  background: #d9ecff;
}

.sq-im-tool-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sq-im-input-row {
  display: flex;
  gap: 8px;
  align-items: flex-end;
}

.sq-im-input {
  flex: 1;
  min-height: 36px;
  max-height: 80px;
  padding: 8px 10px;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  resize: none;
  font-size: 14px;
  line-height: 1.4;
  font-family: inherit;
}

.sq-im-send {
  flex-shrink: 0;
  padding: 8px 16px;
  background: #409eff;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
}

.sq-im-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.sq-im-login-tip {
  padding: 20px;
  text-align: center;
  color: #606266;
  font-size: 14px;
}

.sq-im-login-tip a {
  color: #409eff;
}

@media (max-width: 480px) {
  .sq-im-root {
    right: 12px;
    bottom: 12px;
  }
  .sq-im-panel {
    width: calc(100vw - 24px);
    height: calc(100vh - 90px);
  }
  .sq-im-root.sq-im-admin .sq-im-panel {
    width: calc(100vw - 24px);
  }
  .sq-im-sessions {
    width: 110px;
  }
}
