/* FNC 在线客服挂件 —— 外观对齐原站 LiveChat（白色卡片、蓝色 #427df1、圆角气泡、底部 Home/Chat 标签） */
.fnc-chat {
  position: fixed; right: 0; bottom: 0; z-index: 1400;
  font-family: "Nunito", Arial, Helvetica, sans-serif;
  --lc-blue: #427df1; --lc-blue-dark: #3468d8; --lc-text: #2b2b2b; --lc-muted: #6b7280; --lc-line: #e5e7eb;
}
.fnc-chat *, .fnc-chat *::before, .fnc-chat *::after { box-sizing: border-box; }
#fncChat.fnc-chat { display: block !important; position: fixed !important; right: 0 !important; bottom: 0 !important; left: auto !important; top: auto !important; width: auto !important; }
.fnc-chat button { font-family: inherit; }

/* ---------- 收起状态：LiveChat 风格圆形入口 + 提示气泡 ---------- */
.fnc-chat-launcher {
  position: relative; display: flex; align-items: flex-end; justify-content: flex-end;
  width: 281px; height: 163px; padding: 0; border: 0; background: transparent; cursor: pointer; outline: none;
}
.fnc-chat-launcher:focus:not(:focus-visible) { outline: none; }
.fnc-chat-launcher-eye {
  position: absolute; right: 22px; bottom: 22px; width: 54px; height: 54px; border-radius: 50%;
  background: var(--lc-blue); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 6px 18px rgba(66, 125, 241, .45), 0 2px 6px rgba(0,0,0,.18);
  transition: transform .18s ease;
}
.fnc-chat-launcher-eye svg { width: 26px; height: 26px; fill: currentColor; display: block; }
.fnc-chat-launcher:hover .fnc-chat-launcher-eye { transform: scale(1.06); }
.fnc-chat-eye-catcher {
  position: absolute; right: 14px; bottom: 86px; display: flex; align-items: center; gap: 10px;
  background: #fff; color: var(--lc-text); border-radius: 14px 14px 2px 14px; padding: 10px 16px 10px 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,.18); font-size: 14px; line-height: 1.25; text-align: left;
  opacity: 0; transform: translateY(8px); transition: opacity .25s ease, transform .25s ease; pointer-events: none;
}
.fnc-chat-eye-catcher strong { display: block; font-weight: 700; font-size: 14px; }
.fnc-chat-eye-catcher small { display: block; color: var(--lc-muted); font-size: 12px; }
.fnc-eye-hi { width: 30px; height: 30px; border-radius: 50%; background: #eaf1fe; color: var(--lc-blue); display: flex; align-items: center; justify-content: center; flex: 0 0 30px; }
.fnc-eye-hi svg { width: 16px; height: 16px; fill: currentColor; }
.fnc-chat-launcher:hover .fnc-chat-eye-catcher,
.fnc-chat-launcher:focus-visible .fnc-chat-eye-catcher { opacity: 1; transform: none; }
.fnc-chat-launcher-dot { position: absolute; right: 60px; bottom: 66px; width: 14px; height: 14px; border-radius: 50%; background: #f2544b; border: 2px solid #fff; }
.fnc-chat[data-state="open"] .fnc-chat-launcher { display: none; }

/* ---------- 展开窗口 ---------- */
.fnc-chat-window {
  display: none; flex-direction: column; width: 392px; height: 714px; max-height: calc(100vh - 20px);
  background: #fff; color: var(--lc-text); border-radius: 16px 16px 0 0; overflow: hidden;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .22); margin: 0 0 0 auto;
  animation: fncIn .22s ease;
}
@keyframes fncIn { from { opacity: 0; transform: translateY(16px); } }
.fnc-chat[data-state="open"] .fnc-chat-window { display: flex; }

.fnc-chat-header { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: #fff; border-bottom: 1px solid var(--lc-line); }
.fnc-chat-header-avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--lc-blue); color: #fff; display: flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.fnc-chat-header-avatar svg { width: 22px; height: 22px; fill: currentColor; }
.fnc-chat-header-text { flex: 1 1 auto; min-width: 0; }
.fnc-chat-header-text strong { display: block; font-size: 15px; font-weight: 700; color: var(--lc-text); }
.fnc-chat-header-text span { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--lc-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fnc-chat-header-text span::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #22a06b; flex: 0 0 7px; }
.fnc-chat[data-online="0"] .fnc-chat-header-text span::before { background: #f0a500; }
.fnc-chat-close { width: 32px; height: 32px; border-radius: 50%; border: 0; background: transparent; color: #9aa3af; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.fnc-chat-close:hover { background: #f3f4f6; color: var(--lc-text); }
.fnc-chat-close svg { width: 20px; height: 20px; }

.fnc-chat-body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; background: #fff; }
.fnc-chat-screen { padding: 20px 18px 12px; }
.fnc-chat-hero { background: linear-gradient(160deg, #dbe7fb 0%, #e8f0fe 60%, #ffffff 100%); border-radius: 18px; padding: 18px 18px 20px; margin-bottom: 14px; }
.fnc-chat-hero-icon { width: 42px; height: 42px; border-radius: 50%; background: var(--lc-blue); color: #fff; display: flex; align-items: center; justify-content: center; margin-bottom: 18px; }
.fnc-chat-hero-icon svg { width: 24px; height: 24px; fill: currentColor; }
.fnc-chat-hero h3 { margin: 0; font-size: 28px; font-weight: 800; color: var(--lc-text); line-height: 1.15; }
.fnc-chat-hero h4 { margin: 0; font-size: 28px; font-weight: 800; color: var(--lc-text); line-height: 1.15; }
.fnc-chat-card { border: 1px solid var(--lc-line); border-radius: 16px; padding: 14px; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.fnc-chat-card-row { display: flex; align-items: center; gap: 10px; color: var(--lc-text); font-size: 14px; margin-bottom: 12px; }
.fnc-chat-card-icon { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; background: #fff7e6; color: #f0a500; flex: 0 0 28px; }
.fnc-chat-card-icon svg { width: 18px; height: 18px; fill: currentColor; }
.fnc-chat-leave {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px; height: 42px;
  border: 0; border-radius: 10px; background: var(--lc-blue); color: #fff; font-size: 14px; font-weight: 700; cursor: pointer;
}
.fnc-chat-leave:hover { background: var(--lc-blue-dark); }
.fnc-chat-leave svg { width: 18px; height: 18px; }

.fnc-chat-form { display: flex; flex-direction: column; gap: 8px; }
.fnc-chat-input {
  width: 100%; background: #fff; border: 1px solid var(--lc-line); border-radius: 10px; color: var(--lc-text);
  padding: 10px 12px; font: inherit; font-size: 14px; outline: none; resize: none;
}
.fnc-chat-input:focus { border-color: var(--lc-blue); box-shadow: 0 0 0 3px rgba(66,125,241,.15); }
.fnc-chat-send { width: 100%; border: 0; border-radius: 10px; padding: 11px; font-weight: 700; font-size: 14px; cursor: pointer; background: var(--lc-blue); color: #fff; }
.fnc-chat-send:hover { background: var(--lc-blue-dark); }

.fnc-chat-options { display: flex; flex-direction: column; gap: 8px; }
.fnc-chat-option {
  text-align: left; background: #fff; border: 1px solid var(--lc-line); color: var(--lc-text); border-radius: 12px;
  padding: 10px 12px; font: inherit; font-size: 13.5px; cursor: pointer; display: flex; align-items: center; gap: 10px; transition: border-color .15s, background .15s;
}
.fnc-chat-option:hover { border-color: var(--lc-blue); background: #f5f8ff; }
.fnc-chat-option svg { width: 18px; height: 18px; flex: 0 0 18px; fill: var(--lc-blue); }

/* 会话 */
.fnc-chat-screen[data-chat-screen="conversation"] { padding: 16px 14px 8px; display: flex; flex-direction: column; min-height: 100%; }
.fnc-chat-messages { display: flex; flex-direction: column; gap: 8px; }
.fnc-msg { display: flex; gap: 8px; align-items: flex-end; max-width: 100%; }
.fnc-msg-bubble { max-width: 80%; padding: 9px 13px; border-radius: 16px; font-size: 14px; line-height: 1.45; word-wrap: break-word; white-space: pre-wrap; }
.fnc-msg-time { font-size: 10px; color: #9aa3af; margin-top: 3px; }
.fnc-msg--visitor { justify-content: flex-end; }
.fnc-msg--visitor .fnc-msg-bubble { background: var(--lc-blue); color: #fff; border-bottom-right-radius: 4px; }
.fnc-msg--visitor .fnc-msg-time { text-align: right; }
.fnc-msg--agent .fnc-msg-avatar, .fnc-msg--bot .fnc-msg-avatar { width: 26px; height: 26px; border-radius: 50%; background: #eaf1fe; color: var(--lc-blue); display: flex; align-items: center; justify-content: center; flex: 0 0 26px; font-size: 12px; font-weight: 800; }
.fnc-msg--agent .fnc-msg-bubble { background: #f3f4f6; color: var(--lc-text); border-bottom-left-radius: 4px; }
.fnc-msg--bot .fnc-msg-bubble { background: #f3f4f6; color: var(--lc-text); border-bottom-left-radius: 4px; }
.fnc-msg--system { justify-content: center; }
.fnc-msg--system .fnc-msg-bubble { background: transparent; color: var(--lc-muted); font-size: 12px; padding: 2px 6px; text-align: center; }
.fnc-msg-sender { font-size: 11px; color: var(--lc-blue); margin-bottom: 3px; }
.fnc-msg-img { max-width: 200px; border-radius: 10px; display: block; cursor: zoom-in; }
.fnc-chat-typing { display: flex; align-items: center; gap: 4px; color: var(--lc-muted); font-size: 12px; padding: 8px 2px 2px; }
.fnc-chat-typing span { width: 6px; height: 6px; border-radius: 50%; background: #9aa3af; animation: fncTyping 1.2s infinite; }
.fnc-chat-typing span:nth-child(2) { animation-delay: .15s; } .fnc-chat-typing span:nth-child(3) { animation-delay: .3s; margin-right: 6px; }
@keyframes fncTyping { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.fnc-chat-quick { border-top: 1px solid var(--lc-line); padding: 10px 14px; background: #fafbfc; max-height: 190px; overflow: auto; }
.fnc-chat-quick-title { margin: 0 0 8px; font-size: 12px; color: var(--lc-muted); font-weight: 700; text-transform: uppercase; letter-spacing: .4px; }

.fnc-chat-composer { display: flex; align-items: flex-end; gap: 6px; padding: 10px 12px; border-top: 1px solid var(--lc-line); background: #fff; }
.fnc-chat-attach { width: 36px; height: 38px; border: 0; background: transparent; color: #9aa3af; cursor: pointer; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
.fnc-chat-attach:hover { color: var(--lc-blue); background: #f3f4f6; }
.fnc-chat-attach svg { width: 20px; height: 20px; }
.fnc-chat-composer-input { flex: 1 1 auto; min-height: 38px; max-height: 120px; resize: none; background: #fff; border: 1px solid var(--lc-line); border-radius: 12px; color: var(--lc-text); padding: 9px 12px; font: inherit; font-size: 14px; outline: none; }
.fnc-chat-composer-input:focus { border-color: var(--lc-blue); }
.fnc-chat-composer-send { width: 38px; height: 38px; border: 0; border-radius: 50%; background: var(--lc-blue); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; flex: 0 0 38px; }
.fnc-chat-composer-send:hover { background: var(--lc-blue-dark); }
.fnc-chat-composer-send svg { width: 18px; height: 18px; }

/* 底部 Home / Chat 标签 */
.fnc-chat-tabs { display: flex; border-top: 1px solid var(--lc-line); background: #fff; }
.fnc-chat-tabs button { flex: 1 1 50%; border: 0; background: transparent; padding: 10px 0 8px; font-size: 13px; font-weight: 600; color: var(--lc-muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.fnc-chat-tabs button::before { content: ""; width: 18px; height: 18px; background-repeat: no-repeat; background-position: center; background-size: 18px; opacity: .6; }
.fnc-chat-tabs button[data-chat-tab="home"]::before { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11.5 12 4l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fnc-chat-tabs button[data-chat-tab="conversation"]::before { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 12a8 8 0 0 1-8 8H4l2-3.5A8 8 0 1 1 21 12z' fill='none' stroke='%236b7280' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fnc-chat-tabs button.is-active { color: var(--lc-blue); }
.fnc-chat-tabs button.is-active::before { opacity: 1; }
.fnc-chat-tabs button[data-chat-tab="conversation"].is-active::before { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M21 12a8 8 0 0 1-8 8H4l2-3.5A8 8 0 1 1 21 12z' fill='none' stroke='%23427df1' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.fnc-chat-tabs button[data-chat-tab="home"].is-active::before { background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M3 11.5 12 4l9 7.5V20a1 1 0 0 1-1 1h-5v-6h-6v6H4a1 1 0 0 1-1-1z' fill='none' stroke='%23427df1' stroke-width='1.8' stroke-linejoin='round'/%3E%3C/svg%3E"); }

.fnc-chat-powered { margin: 0; padding: 6px 0 8px; text-align: center; font-size: 11px; color: #b0b6bf; background: #fff; border-top: 1px solid #f1f2f4; }
.fnc-chat-powered strong { color: #8b93a1; font-weight: 700; }

.fnc-chat-composer[hidden], .fnc-chat-typing[hidden], .fnc-chat-quick[hidden], .fnc-chat-form[hidden], [data-chat-screen][hidden] { display: none !important; }

@media (max-width: 480px) {
  .fnc-chat-window { width: 100vw; height: calc(100vh - 10px); border-radius: 16px 16px 0 0; }
  .fnc-chat-launcher { width: 100vw; height: 140px; }
}
