#wechat-panel {
  position: fixed; inset: var(--wx-top, 58px) var(--wx-right, 22px) auto auto;
  margin: 0; padding: 0; width: min(360px, calc(100vw - 24px));
  max-height: min(540px, calc(100dvh - var(--wx-top, 58px) - 12px));
  overflow: hidden; background: #fff; color: #1b202b;
  border: 1px solid #e6e8ec; border-radius: 14px; box-shadow: 0 18px 48px rgba(15,23,42,.16);
  font: inherit;
}
#wechat-panel[open] { display: flex; flex-direction: column; }
#wechat-panel::backdrop { background: transparent; }
#wechat-panel header {
  display: flex; align-items: center; justify-content: space-between; flex-shrink: 0;
  padding: 11px 12px 11px 15px; border-bottom: 1px solid #eef0f3;
}
#wechat-panel header div { display: flex; flex-direction: column; gap: 3px; }
#wechat-panel b { font-size: 14px; }
#wechat-panel header small, #wechat-panel footer { color: #67727f; font-size: 11px; }
#wechat-panel header button { width: 40px; height: 40px; background: transparent; border: 0; border-radius: 8px; color: #66707b; cursor: pointer; font-size: 22px; }
#wechat-panel header button:hover { background: #f3f5f7; }
#wechat-panel .wx-body { display: flex; flex-direction: column; align-items: center; min-height: 0; overflow: auto; gap: 12px; padding: 19px 18px; }
#wechat-panel .wx-body.is-messages { align-items: stretch; padding: 14px; }
#wechat-panel p { margin: 0; line-height: 1.7; text-align: center; font-size: 13px; color: #596670; }
#wechat-panel .wx-steps { max-width: 260px; font-size: 12px; }
#wechat-panel .wx-qr { display: block; width: 200px; height: 200px; object-fit: contain; border-radius: 10px; border: 1px solid #e7ece9; }
#wechat-panel .wx-action { padding: 7px 15px; font: inherit; font-size: 13px; color: #25382a; background: white; border: 1px solid #d8e0da; border-radius: 7px; cursor: pointer; }
#wechat-panel .wx-action:hover { background: #eff9f2; }
#wechat-panel footer { flex-shrink: 0; padding: 10px 15px; background: #fafbfc; border-top: 1px solid #eef0f3; }
#wechat-panel .wx-connection { display:flex; align-items:center; justify-content:space-between; }
#wechat-panel .wx-connection span { color:#246246; font-size:12px; }
#wechat-panel .wx-connection button { padding:5px 9px; font-size:12px; }
#wechat-panel .wx-message { display: flex; flex-direction: column; align-items: flex-start; align-self: flex-start; max-width: 85%; gap: 3px; }
#wechat-panel .wx-message.mine { align-items: flex-end; align-self: flex-end; }
#wechat-panel .wx-message span { padding: 8px 11px; border-radius: 12px; background: #f4f5f7; color: #1b202b; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
#wechat-panel .wx-message.mine span { color: #10351f; background: #d7f5e3; }
#wechat-panel .wx-message time { font-size: 10px; color: #697782; }
/* 助手的回答按 Markdown 画（wechat.js 用 chat.js 的 renderMarkdown）：面板窄，标题、表格都收小，字一律深色。 */
#wechat-panel .wx-message:has(.table-wrap) { max-width: 100%; }
#wechat-panel .wx-md { min-width: 0; max-width: 100%; padding: 8px 11px; border-radius: 12px; background: #f4f5f7; color: #1b202b; overflow-wrap: anywhere; font-size: 13px; line-height: 1.6; }
#wechat-panel .wx-md > :first-child { margin-top: 0; }
#wechat-panel .wx-md > :last-child { margin-bottom: 0; }
#wechat-panel .wx-md p { margin: 0 0 6px; text-align: left; font-size: 13px; color: inherit; line-height: 1.6; }
#wechat-panel .wx-md h1, #wechat-panel .wx-md h2, #wechat-panel .wx-md h3, #wechat-panel .wx-md h4 { margin: 10px 0 4px; font-size: 14px; font-weight: 600; line-height: 1.5; }
#wechat-panel .wx-md strong { font-weight: 600; }
#wechat-panel .wx-md ul, #wechat-panel .wx-md ol { margin: 0 0 6px; padding-left: 1.3em; }
#wechat-panel .wx-md li { margin: 2px 0; }
#wechat-panel .wx-md li > p { margin: 0; }
#wechat-panel .wx-md blockquote { margin: 0 0 6px; padding: 2px 0 2px 9px; border-left: 3px solid #d5dae0; }
#wechat-panel .wx-md hr { margin: 8px 0; border: 0; border-top: 1px solid #e3e7eb; }
#wechat-panel .wx-md code { padding: 0 4px; border-radius: 4px; background: #e8ebef; font-family: var(--mono, monospace); font-size: 12px; }
#wechat-panel .wx-md pre { margin: 0 0 6px; padding: 8px; overflow: auto; border-radius: 8px; background: #fff; }
#wechat-panel .wx-md pre code { padding: 0; background: none; }
#wechat-panel .wx-md .table-wrap { margin: 4px 0 8px; overflow-x: auto; border: 1px solid #e3e7eb; border-radius: 8px; background: #fff; }
#wechat-panel .wx-md table { border-collapse: collapse; font-size: 12px; line-height: 1.5; }
#wechat-panel .wx-md th, #wechat-panel .wx-md td { padding: 5px 9px; border-bottom: 1px solid #edf0f2; text-align: left; white-space: nowrap; }
#wechat-panel .wx-md th { background: #f7f8fa; font-weight: 600; }
#wechat-panel .wx-md tr:last-child td { border-bottom: 0; }
#wechat-panel .wx-md td.num, #wechat-panel .wx-md th.num { text-align: right; font-variant-numeric: tabular-nums; }
@media (max-width: 500px) { #wechat-panel { inset-inline: 12px; width: auto; } }
