/* 锚点云财务Pro - 唐人云1:1复刻 (wwkf) */

/* ===== 自定义字体 (CDN) ===== */
@font-face {
  font-family: 'codeB';
  src: local('DINPro-Medium'), url('https://fonts.cdnfonts.com/s/13729/DINPro-Medium_13936.woff') format('woff');
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* ===== 字体隔离（仅此一项重置，其余照搬 tryai 原始样式） ===== */
#wwkf-root,
#wwkf-root *,
#wwkf-root *::before,
#wwkf-root *::after {
  font-family: 'codeB', "Microsoft YaHei", sans-serif !important;
  box-sizing: border-box;
}

/* ===== 悬浮球样式（tryai 原样） ===== */
#wwkf-root {
  position: fixed;
  bottom: 24px;
  z-index: 99990;
  -webkit-font-smoothing: auto;
  -moz-osx-font-smoothing: auto;
}
#wwkf-root.wwkf-pos-right { right: 24px; }
#wwkf-root.wwkf-pos-left { left: 24px; }

.wwkf-fab {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wwkf-color, #5867dd);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(0,0,0,.22);
  transition: transform .2s, box-shadow .2s;
  border: none;
  overflow: hidden;
}
.wwkf-fab:hover { transform: scale(1.08); box-shadow: 0 8px 26px rgba(0,0,0,.3); }
.wwkf-fab svg { width: 30px; height: 30px; fill: #fff; }
.wwkf-fab img { width: 100%; height: 100%; object-fit: cover; }

.wwkf-panel {
  position: absolute;
  bottom: 72px;
  width: 400px;
  max-width: calc(100vw - 32px);
  height: 600px;
  max-height: calc(100vh - 120px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 16px 48px rgba(0,0,0,.2);
  display: none;
  flex-direction: column;
  overflow: hidden;
}
#wwkf-root.wwkf-pos-right .wwkf-panel { right: 0; }
#wwkf-root.wwkf-pos-left .wwkf-panel { left: 0; }
.wwkf-panel.wwkf-open { display: flex; }

/* 顶栏 */
.wwkf-head {
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
  border-bottom: 1px solid #f0f0f3;
}
.wwkf-head .wwkf-h-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  overflow: hidden;
  flex-shrink: 0;
  background: var(--wwkf-color, #5867dd);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wwkf-head .wwkf-h-av img { width: 100%; height: 100%; object-fit: cover; }
.wwkf-head .wwkf-h-av svg { width: 18px; height: 18px; fill: #fff; }
.wwkf-head .wwkf-title { font-size: 15px; font-weight: 600; color: #1a1a1a; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.wwkf-head .wwkf-acts { display: flex; align-items: center; gap: 6px; }
.wwkf-head .wwkf-ico-btn {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
}
.wwkf-head .wwkf-ico-btn:hover { background: #f2f3f5; color: #333; }

/* 主体 */
.wwkf-body {
  flex: 1;
  overflow-y: auto;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* 首屏(欢迎页) */
.wwkf-home { padding: 24px 22px 8px; display: flex; flex-direction: column; }
.wwkf-home-av {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--wwkf-color, #5867dd);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.wwkf-home-av img { width: 100%; height: 100%; object-fit: cover; }
.wwkf-home-av svg { width: 38px; height: 38px; fill: #fff; }
.wwkf-home-title { font-size: 21px; font-weight: 700; color: #1a1a1a; line-height: 1.45; margin-bottom: 10px; }
.wwkf-home-sub { font-size: 13px; color: #8a8f99; line-height: 1.6; margin-bottom: 18px; }
.wwkf-quick { display: flex; flex-direction: column; gap: 10px; }
.wwkf-q {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #ebedf0;
  border-radius: 12px;
  padding: 13px 15px;
  font-size: 13.5px;
  color: #333;
  cursor: pointer;
  background: #fff;
  transition: .15s;
  text-align: left;
}
.wwkf-q:hover { border-color: var(--wwkf-color, #5867dd); background: #fafbff; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.wwkf-q .wwkf-q-dot { color: var(--wwkf-color, #5867dd); font-weight: 700; flex: none; }
.wwkf-q .wwkf-q-tx { flex: 1; min-width: 0; }
.wwkf-q .wwkf-q-arr { color: #c2c6cc; flex: none; font-size: 14px; }

/* 对话区 */
.wwkf-msgs {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 12px;
  display: none;
  min-height: 0;
  background: #fff;
}
.wwkf-msgs.wwkf-on { display: block; }
.wwkf-msg { margin-bottom: 14px; display: flex; align-items: flex-start; gap: 9px; }
.wwkf-msg.wwkf-user { flex-direction: row-reverse; }
.wwkf-m-av {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  flex: none;
  overflow: hidden;
  background: var(--wwkf-color, #5867dd);
  display: flex;
  align-items: center;
  justify-content: center;
}
.wwkf-m-av img { width: 100%; height: 100%; object-fit: cover; }
.wwkf-m-av svg { width: 17px; height: 17px; fill: #fff; }
.wwkf-m-av .wwkf-av-letter { color: #fff; font-size: 14px; font-weight: 600; line-height: 1; text-transform: uppercase; }
.wwkf-msg.wwkf-user .wwkf-m-av { background: var(--wwkf-color, #5867dd); }
.wwkf-bubble {
  max-width: 78%;
  padding: 10px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.6;
  word-break: break-word;
  white-space: normal;
}
.wwkf-bubble p { margin: 0 0 8px; line-height: 1.6; }
.wwkf-bubble p:last-child { margin-bottom: 0; }
.wwkf-bubble strong { font-weight: 700; }
.wwkf-msg.wwkf-bot .wwkf-bubble { background: #f4f5f7; color: #2a2a2a; border-top-left-radius: 3px; }
.wwkf-msg.wwkf-user .wwkf-bubble { background: var(--wwkf-color, #5867dd); color: #fff; border-top-right-radius: 3px; }
.wwkf-bubble a { color: #2563eb; text-decoration: underline; word-break: break-all; }
.wwkf-bubble a:hover { color: #1d4ed8; }
.wwkf-msg.wwkf-user .wwkf-bubble a { color: #e0e7ff; }

/* 输入区：永久预留「正在输入」行高，避免突然冒白条挤布局；提示在输入框上方 */
.wwkf-input {
  padding: 4px 12px 12px;
  border-top: 1px solid #f0f0f3;
  background: #fff;
  flex-shrink: 0;
}
.wwkf-typing {
  height: 28px;
  line-height: 28px;
  font-size: 12px;
  color: #aaa;
  padding: 0 4px;
  margin: 0;
  visibility: hidden;
  opacity: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
  transition: opacity .15s ease;
}
.wwkf-typing.wwkf-on {
  visibility: visible;
  opacity: 1;
}

/* 输入框本体 */
.wwkf-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #e6e8eb;
  border-radius: 12px;
  padding: 8px 10px;
  transition: border-color .15s;
}
.wwkf-input-box:focus-within { border-color: var(--wwkf-color, #5867dd); }
.wwkf-input textarea {
  flex: 1;
  resize: none;
  border: none;
  outline: none;
  font-size: 13.5px;
  line-height: 1.5;
  height: 24px;
  max-height: 96px;
  font-family: inherit;
  background: transparent;
  color: #2a2a2a;
}
.wwkf-send {
  background: var(--wwkf-color, #5867dd);
  color: #fff;
  border: none;
  border-radius: 9px;
  width: 36px;
  height: 36px;
  cursor: pointer;
  flex: none;
  display: flex;
  align-items: center;
  justify-content: center;
}
.wwkf-send:disabled { opacity: .45; cursor: not-allowed; }
.wwkf-send svg { width: 18px; height: 18px; fill: #fff; }
.wwkf-foot { text-align: center; font-size: 11px; color: #bbb; padding: 8px 0 2px; }

/* 人工客服 */
.wwkf-human { padding: 16px; display: none; min-height: 0; }
.wwkf-human.wwkf-on { display: block; }
.wwkf-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #fff;
  border: 1px solid #ebedf0;
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 12px;
  cursor: pointer;
  text-decoration: none;
  color: #333;
  transition: .15s;
}
.wwkf-item:hover { border-color: var(--wwkf-color, #5867dd); background: #fafbff; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.wwkf-item .wwkf-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--wwkf-color, #5867dd);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
  overflow: hidden;
}
.wwkf-item .wwkf-ic img { width: 100%; height: 100%; object-fit: cover; }
.wwkf-item .wwkf-ic:has(img) { background: transparent; border-radius: 50%; }
.wwkf-item .wwkf-meta { flex: 1; min-width: 0; }
.wwkf-item .wwkf-meta b { display: block; font-size: 14px; font-weight: 400; margin-bottom: 2px; }
.wwkf-item .wwkf-meta span { font-size: 12px; color: #999; word-break: break-all; }

/* 人工客服 - 实时聊天 */
.wwkf-human.wwkf-live-on { padding: 0; display: flex; flex-direction: column; height: 100%; min-height: 0; }
.wwkf-live-box { display: flex; flex-direction: column; height: 100%; min-height: 0; padding: 16px; background: #fff; }
.wwkf-live-back { display: inline-block; margin-bottom: 10px; font-size: 12px; color: var(--wwkf-color, #5867dd); cursor: pointer; }
.wwkf-live-status { font-size: 12px; color: #94a3b8; padding: 0 0 10px; line-height: 1.5; flex: none; }
.wwkf-live-msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 4px; background: #fff; }
.wwkf-live-msg { margin-bottom: 14px; display: flex; align-items: flex-start; gap: 9px; }
.wwkf-live-msg.me { flex-direction: row-reverse; }
.wwkf-live-msg.system { justify-content: center; }
.wwkf-live-av { width: 30px; height: 30px; border-radius: 50%; flex: none; overflow: hidden; background: var(--wwkf-color, #5867dd); display: flex; align-items: center; justify-content: center; }
.wwkf-live-av img { width: 100%; height: 100%; object-fit: cover; object-position: center; display: block; }
.wwkf-live-av svg { width: 17px; height: 17px; fill: #fff; }
.wwkf-live-av .wwkf-av-letter { width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 600; color: #fff; }
.wwkf-live-bubble { max-width: 78%; padding: 10px 13px; border-radius: 12px; background: #f4f5f7; color: #2a2a2a; font-size: 13.5px; line-height: 1.6; white-space: pre-wrap; word-break: break-word; border-top-left-radius: 3px; }
.wwkf-live-msg.me .wwkf-live-bubble { background: var(--wwkf-color, #5867dd); color: #fff; border-top-left-radius: 12px; border-top-right-radius: 3px; }
.wwkf-live-msg.system .wwkf-live-bubble { font-size: 12px; color: #aaa; background: transparent; border: none; padding: 3px 8px; max-width: 92%; text-align: center; }
.wwkf-live-input { display: flex; align-items: flex-end; gap: 8px; border: 1px solid #e6e8eb; border-radius: 12px; padding: 8px 10px; margin-top: 10px; background: #fff; flex: none; }
.wwkf-live-input:focus-within { border-color: var(--wwkf-color, #5867dd); }
.wwkf-live-input textarea { flex: 1; resize: none; border: none; outline: none; font-size: 13.5px; line-height: 1.5; height: 24px; max-height: 96px; font-family: inherit; background: transparent; color: #2a2a2a; padding: 0; }
.wwkf-live-input button { background: var(--wwkf-color, #5867dd); color: #fff; border: none; border-radius: 9px; width: 46px; height: 36px; cursor: pointer; }
.wwkf-live-input button:disabled { opacity: .55; cursor: not-allowed; }
.wwkf-rate-bubble { max-width: 78%; }
.wwkf-rate-bubble-tx { margin-bottom: 8px; font-size: 13.5px; line-height: 1.5; color: #2a2a2a; }
.wwkf-rate-stars { display: flex; align-items: center; gap: 4px; }
.wwkf-rate-star {
  border: none; background: transparent; padding: 0 2px; margin: 0;
  font-size: 26px; line-height: 1; color: #d0d5dd; cursor: pointer;
}
.wwkf-rate-star.on { color: #f5a623; }
.wwkf-rate-star:disabled { cursor: default; }
.wwkf-rate-msg.wwkf-rate-done .wwkf-rate-star.on { color: #f5a623; }
.wwkf-rate-skip {
  display: inline-block; margin-top: 8px; border: none; background: transparent;
  color: #94a3b8; font-size: 12px; cursor: pointer; padding: 0;
}
.wwkf-rate-skip:hover { color: var(--wwkf-color, #5867dd); }

/* 底部 Tab 切换(AI/人工) */
.wwkf-switch { display: flex; border-top: 1px solid #f0f0f3; flex-shrink: 0; background: #fafafa; }
.wwkf-switch .wwkf-sw {
  flex: 1;
  text-align: center;
  padding: 10px 0;
  font-size: 12.5px;
  color: #888;
  cursor: pointer;
  border-top: 2px solid transparent;
  margin-top: -1px;
}
.wwkf-switch .wwkf-sw.wwkf-active {
  color: var(--wwkf-color, #5867dd);
  border-top-color: var(--wwkf-color, #5867dd);
  font-weight: 600;
  background: #fff;
}

/* 未登录提示 */
.wwkf-login-tip {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 280px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0,0,0,.18);
  padding: 18px 18px 14px;
  display: none;
  z-index: 99991;
}
.wwkf-login-tip.wwkf-open { display: block; }
.wwkf-login-tip .wwkf-lt-msg { font-size: 14px; color: #333; line-height: 1.6; margin-bottom: 12px; }
.wwkf-login-tip .wwkf-lt-btns { display: flex; justify-content: flex-end; gap: 8px; }
.wwkf-login-tip .wwkf-lt-btn {
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.wwkf-login-tip .wwkf-lt-btn.wwkf-lt-cancel { background: #f2f3f5; color: #666; }
.wwkf-login-tip .wwkf-lt-btn.wwkf-lt-login  { background: var(--wwkf-color, #5867dd); color: #fff; }

/* 与 web-ssh AI 分析同款 Markdown 渲染（.ai-rich-text） */
.wwkf-bubble--md {
  white-space: normal;
}
.wwkf-bubble.ai-rich-text {
  font-size: 13.5px;
  line-height: 1.55;
  color: #1f2937;
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.wwkf-bubble.ai-rich-text p {
  margin: 0 0 8px;
}
.wwkf-bubble.ai-rich-text p:last-child {
  margin-bottom: 0;
}
.wwkf-bubble.ai-rich-text strong {
  font-weight: 700;
  color: #111827;
}
.wwkf-bubble.ai-rich-text em {
  font-style: italic;
}
.wwkf-bubble.ai-rich-text del {
  text-decoration: line-through;
  opacity: .75;
}
.wwkf-bubble.ai-rich-text .ai-md-heading {
  margin: 12px 0 6px;
  font-weight: 700;
  color: #111827;
  line-height: 1.35;
}
.wwkf-bubble.ai-rich-text .ai-md-heading:first-child {
  margin-top: 0;
}
.wwkf-bubble.ai-rich-text .ai-md-h1 { font-size: 16px; }
.wwkf-bubble.ai-rich-text .ai-md-h2 { font-size: 15px; }
.wwkf-bubble.ai-rich-text .ai-md-h3 { font-size: 14px; }
.wwkf-bubble.ai-rich-text .ai-md-h4,
.wwkf-bubble.ai-rich-text .ai-md-h5,
.wwkf-bubble.ai-rich-text .ai-md-h6 { font-size: 13px; }
.wwkf-bubble.ai-rich-text .ai-md-hr {
  border: none;
  border-top: 1px solid rgba(128, 128, 128, .35);
  margin: 10px 0;
}
.wwkf-bubble.ai-rich-text .ai-md-quote {
  margin: 8px 0;
  padding: 8px 10px;
  border-left: 3px solid rgba(88, 103, 221, .45);
  background: rgba(88, 103, 221, .07);
  border-radius: 0 6px 6px 0;
}
.wwkf-bubble.ai-rich-text .ai-md-list {
  margin: 6px 0 8px;
  padding-left: 1.2em;
}
.wwkf-bubble.ai-rich-text .ai-md-list li {
  margin: 4px 0;
  line-height: 1.55;
}
.wwkf-bubble.ai-rich-text .ai-inline-code {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(88, 103, 221, .08);
  color: #111827;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-all;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
}
.wwkf-bubble.ai-rich-text .ai-md-code-block {
  margin: 8px 0;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(15, 23, 42, .06);
  border: 1px solid rgba(0, 0, 0, .08);
  overflow-x: auto;
  max-width: 100%;
  font-family: ui-monospace, "Cascadia Code", Menlo, monospace;
  font-size: 12px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
}
.wwkf-bubble.ai-rich-text .ai-md-code-block code {
  font-family: inherit;
  background: transparent;
  padding: 0;
}
.wwkf-bubble.ai-rich-text .ai-md-link,
.wwkf-bubble.ai-rich-text a {
  color: var(--wwkf-color, #5867dd);
  text-decoration: underline;
  text-underline-offset: 2px;
  word-break: break-all;
  font-weight: 500;
  cursor: pointer;
}
.wwkf-bubble.ai-rich-text .ai-md-link:hover,
.wwkf-bubble.ai-rich-text a:hover {
  opacity: .85;
}
.wwkf-bubble.ai-rich-text .ai-md-table-wrap {
  overflow-x: auto;
  max-width: 100%;
  margin: 8px 0;
  -webkit-overflow-scrolling: touch;
}
.wwkf-bubble.ai-rich-text .ai-md-table {
  width: 100%;
  min-width: 240px;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
}
.wwkf-bubble.ai-rich-text .ai-md-table th,
.wwkf-bubble.ai-rich-text .ai-md-table td {
  border: 1px solid rgba(128, 128, 128, .35);
  padding: 6px 8px;
  text-align: left;
  vertical-align: top;
  word-break: break-word;
  overflow-wrap: anywhere;
}
.wwkf-bubble.ai-rich-text .ai-md-table th {
  font-weight: 600;
  background: rgba(88, 103, 221, .08);
}

@media (max-width: 480px) {
  .wwkf-panel { width: calc(100vw - 24px); height: calc(100vh - 100px); }
}
