/* 悬浮客服 + 本地智能客服 · 适配 AI房地产 主题（青绿=accent / 青蓝渐变=grad） */
.sf-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 92; display: flex; flex-direction: column; align-items: flex-end; gap: 12px; }
html[data-theme="dark"] .sf-wrap { z-index: 92; }

/* 悬浮球 */
.sf-fab {
  position: relative; border: none; cursor: pointer; border-radius: 99px;
  background: var(--grad); color: #fff; padding: 13px 17px; display: flex; align-items: center; gap: 8px;
  font-weight: 700; font-size: 14px; box-shadow: 0 14px 34px rgba(20,110,160,.34); min-height: 50px;
  transition: transform .2s;
}
.sf-fab:hover { transform: translateY(-2px); }
.sf-fab .sf-fab-txt { line-height: 1; }
.sf-fab .fab-pulse { position: absolute; inset: 0; border-radius: 99px; box-shadow: 0 0 0 0 var(--accent); animation: sfPulse 2.4s infinite; }
@keyframes sfPulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 70% { box-shadow: 0 0 0 14px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

/* 服务面板 */
.sf-panel { display: flex; flex-direction: column; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; padding: 10px; box-shadow: var(--shadow-lg); opacity: 0; visibility: hidden; transform: translateY(10px); transition: .22s; pointer-events: none; min-width: 168px; }
.sf-panel.open { opacity: 1; visibility: visible; transform: none; pointer-events: auto; }
.sf-item { display: flex; align-items: center; gap: 9px; padding: 10px 12px; border-radius: 11px; font-size: 13.5px; font-weight: 600; color: var(--text); cursor: pointer; text-decoration: none; transition: .16s; background: var(--surface2); border: 1px solid transparent; }
.sf-item:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }
.sf-item .ico { font-size: 16px; line-height: 1; }

/* 对话框 */
.sf-chatbox {
  position: fixed; right: 18px; bottom: 80px; width: 380px; max-width: calc(100vw - 28px); height: 540px; max-height: calc(100vh - 104px);
  background: var(--surface); border: 1px solid var(--border); border-radius: 18px; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden; opacity: 0; visibility: hidden; transform: translateY(12px); transition: .24s; z-index: 96;
}
.sf-chatbox.open { opacity: 1; visibility: visible; transform: none; }
.sf-chat-head { display: flex; align-items: center; gap: 10px; padding: 13px 15px; background: var(--grad); color: #fff; }
.sf-chat-head .ava { width: 34px; height: 34px; border-radius: 10px; background: rgba(255,255,255,.22); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: 0 0 auto; }
.sf-chat-head div:nth-child(2) { flex: 1; display: flex; flex-direction: column; line-height: 1.25; }
.sf-chat-head b { font-size: 14px; }
.sf-chat-head small { font-size: 11px; opacity: .9; }
.sf-chat-head .cls { background: rgba(255,255,255,.2); border: none; color: #fff; width: 28px; height: 28px; border-radius: 8px; cursor: pointer; font-size: 16px; line-height: 1; }
.sf-chat-head .cls:hover { background: rgba(255,255,255,.34); }

.sf-chat-body { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--surface2); }
.msg { max-width: 86%; padding: 9px 13px; border-radius: 14px; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; }
.msg.user { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--surface); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.msg-row { display: flex; gap: 8px; align-items: flex-end; max-width: 90%; }
.msg-row .chat-avatar { width: 28px; height: 28px; border-radius: 9px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; font-size: 11px; flex: 0 0 auto; }
.msg-row .msg.bot { align-self: flex-start; }
.msg-link { align-self: flex-start; margin: -4px 0 4px 36px; font-size: 12.5px; color: var(--accent); text-decoration: underline; font-weight: 600; }

.sf-chat-quick { display: flex; flex-wrap: wrap; gap: 7px; padding: 9px 12px 4px; border-top: 1px solid var(--border); background: var(--surface); }
.chip-q { border: 1px solid var(--border2); background: var(--surface2); color: var(--muted); border-radius: 99px; padding: 5px 11px; font-size: 12px; cursor: pointer; transition: .16s; }
.chip-q:hover { color: var(--accent); border-color: var(--accent); background: var(--accent-soft); }

.sf-chat-foot { display: flex; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--border); background: var(--surface); }
.sf-chat-foot input { flex: 1; min-width: 0; height: 40px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface2); color: var(--text); padding: 0 12px; font-size: 14px; }
.sf-chat-foot input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.sf-send { width: 44px; height: 40px; border: none; border-radius: 10px; background: var(--grad); color: #fff; font-size: 15px; cursor: pointer; flex: 0 0 auto; }
.sf-send:hover { transform: translateY(-1px); }

/* 微信弹窗 */
.sf-wechat-pop { position: fixed; right: 18px; bottom: 80px; z-index: 97; }
.sf-wechat-pop[hidden] { display: none; }
.sw-card { width: 240px; background: var(--surface); border: 1px solid var(--border); border-radius: 16px; box-shadow: var(--shadow-lg); padding: 18px; text-align: center; display: flex; flex-direction: column; gap: 10px; }
.sw-card .sw-avatar { width: 46px; height: 46px; border-radius: 13px; background: var(--grad); color: #fff; display: grid; place-items: center; font-weight: 800; margin: 0 auto; }
.sw-card b { font-size: 15px; }
.sw-card p { margin: 0; font-size: 13px; color: var(--muted); }
.sw-card p b { color: var(--accent); font-size: 14px; }

@media (max-width: 640px) {
  /* 避开底部 62px 高的移动端 Tab 栏，悬浮球与对话层统一上移 */
  .sf-wrap { right: 12px; bottom: 74px; }
  .sf-chatbox { right: 12px; bottom: 134px; width: calc(100vw - 24px); height: min(66vh, calc(100vh - 210px)); }
  .sf-fab .sf-fab-txt { display: none; }
  .sf-fab { padding: 14px; min-height: 48px; }
  .sf-wechat-pop { right: 12px; bottom: 134px; }
}
