/* ============================================================
   清仓挑款助手 — 用户端样式（仿 DeepSeek App）
   设计基调：纯白画布 + 大留白 + 极简图标 + 大圆角输入卡
   品牌蓝 #4D6BFE；AI 回复纯文字无气泡；用户消息浅灰气泡
   移动端优先；≥960px 桌面端侧边栏常驻
   ============================================================ */

:root {
  /* 画布与层次 */
  --bg: #FFFFFF;
  --surface: #FFFFFF;
  --surface-2: #F4F5F7;
  --surface-3: #EDEFF2;
  --line: #ECEEF2;
  --line-strong: #DFE2E8;
  /* 文字层级 */
  --ink-1: #1F2126;
  --ink-2: #5C6470;
  --ink-3: #9AA0AB;
  /* 品牌（DeepSeek 蓝） */
  --brand: #4D6BFE;
  --brand-deep: #3B5BE0;
  --brand-light: #6B85FF;
  --brand-soft: #EDF2FF;
  --brand-soft-deep: #DEE7FF;
  --brand-line: #C6D4FF;
  --gold: #E8A23D;
  --gold-deep: #D4881F;
  --gold-light: #F5C065;
  --green: #0EA97F;
  /* 形状 */
  --r-lg: 22px;
  --r-md: 16px;
  --r-sm: 12px;
  /* 阴影（极克制） */
  --shadow-1: 0 1px 2px rgba(23, 24, 28, .03);
  --shadow-2: 0 4px 16px rgba(23, 24, 28, .06);
  --shadow-3: 0 16px 48px rgba(23, 24, 28, .1);
  --shadow-brand: 0 4px 12px rgba(77, 107, 254, .22);
  --brand-shadow: 0 6px 16px rgba(77, 107, 254, .26);
  /* 衍生色 */
  --mask: rgba(15, 18, 25, .35);
  --toast-bg: rgba(24, 26, 32, .88);
  --brand-ring: rgba(77, 107, 254, .14);
  --brand-dash: rgba(77, 107, 254, .4);
  --brand-tint: rgba(77, 107, 254, .1);
  --typing-dot: #C2CADA;
  --err-bg: #FDF4F2;
  --err-line: #FBE0D8;
  --err-ink: #D4380D;
  /* 危险操作（删除等） */
  --danger: #E5484D;
  --danger-deep: #CE3439;
  --danger-soft: #FDECEC;
  --wechat-1: #2BAE67;
  --wechat-2: #0E8A4A;
  --wechat-shadow: 0 6px 16px rgba(14, 138, 74, .28);
  /* 海报（导出图）配色 */
  --poster-bg-1: #FBFCFE;
  --poster-bg-2: #EFF3FB;
  --poster-dash: #DBE3F2;
  --poster-line: #E5EBF7;
  --poster-img-bg: #ECF0F9;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "HarmonyOS Sans SC", "MiSans", "Microsoft YaHei", sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

/* ⚠️ 必留：作者样式里的 display 会覆盖浏览器默认的 [hidden]{display:none}
   （本项目大量用 el.hidden = true/false 切换显隐），所以用 !important 兜底，
   否则会出现"JS 已 hidden 但元素照样显示"的 bug。 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink-1);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.65;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--brand-ring); }

/* ============================================================
   应用容器
   ============================================================ */
.app {
  position: relative;
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  max-width: 780px;
  margin: 0 auto;
  background: var(--bg);
}

/* ============================================================
   侧边栏（对话历史）
   ============================================================ */
.sidebar {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: min(300px, 84vw);
  background: var(--bg);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 90;
  transform: translateX(-102%);
  transition: transform .26s cubic-bezier(.22, .9, .3, 1);
  padding-top: env(safe-area-inset-top);
}
.sidebar.open { transform: none; box-shadow: var(--shadow-3); }

.sb-search {
  position: relative;
  margin: 14px 12px 6px;
  flex: none;
}
.sb-search svg {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--ink-3);
  pointer-events: none;
}
.sb-search input {
  width: 100%;
  height: 40px;
  border: none;
  border-radius: 12px;
  background: var(--surface-2);
  padding: 0 12px 0 36px;
  font-size: 16px;
  font-family: var(--font);
  color: var(--ink-1);
  outline: none;
  transition: background .15s ease, box-shadow .15s ease;
  appearance: none;
}
.sb-search input::placeholder { color: var(--ink-3); }
.sb-search input:focus { background: var(--surface-3); box-shadow: 0 0 0 3px var(--brand-ring); }
.sb-search input::-webkit-search-cancel-button { display: none; }

.sb-list {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 10px 10px;
}
.conv-group {
  font-size: 13.5px;
  color: var(--ink-3);
  padding: 16px 10px 6px;
  font-weight: 500;
}
.conv-item {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 100%;
  text-align: left;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink-1);
  padding: 3px 5px 3px 11px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .14s ease;
  line-height: 1.5;
  min-height: 38px;
  outline: none;
}
.conv-item:hover { background: var(--surface-2); }
.conv-item.active { background: var(--surface-2); font-weight: 600; }
.conv-item:focus-visible { box-shadow: 0 0 0 3px var(--brand-ring); }
.conv-title {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 0;
}
.conv-del {
  flex: none;
  width: 28px; height: 28px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.conv-item:hover .conv-del,
.conv-item.active .conv-del { opacity: 1; }
.conv-del:hover { background: var(--danger-soft); color: var(--danger); }
.conv-del:active { transform: scale(.88); }
@media (hover: none) {
  .conv-del { opacity: .7; }
}
/* 重命名按钮（与删除按钮并列，平时隐藏、悬停/选中时出现） */
.conv-rename {
  flex: none;
  width: 28px; height: 28px;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--ink-3);
  display: grid;
  place-items: center;
  cursor: pointer;
  opacity: 0;
  transition: opacity .15s ease, background .15s ease, color .15s ease;
}
.conv-item:hover .conv-rename,
.conv-item.active .conv-rename { opacity: 1; }
.conv-rename:hover { background: var(--brand-soft); color: var(--brand); }
.conv-rename:active { transform: scale(.88); }
@media (hover: none) {
  .conv-rename { opacity: .7; }
}
.conv-empty {
  padding: 40px 12px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}

.sb-foot {
  flex: none;
  border-top: 1px solid var(--line);
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
}
.sb-user { display: flex; align-items: center; gap: 10px; }
.sb-avatar {
  width: 34px; height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-deep));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
/* 侧边栏头像：有 LOGO 时显示 LOGO（圆形裁切），没有则显示站点名首字 */
.sb-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}
.sb-avatar span { line-height: 1; }
.sb-user-text { min-width: 0; display: flex; flex-direction: column; }.sb-user-text b {
  font-size: 13.5px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sb-user-text span { font-size: 13px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 侧边栏底部：清仓截止提示 */
.sb-deadline {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--ink-3);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 8px 11px;
  margin-bottom: 10px;
  line-height: 1.4;
}
.sb-deadline[hidden] { display: none; }
.sb-deadline .sb-deadline-icon { flex: none; color: var(--brand); }
.sb-deadline span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 侧边栏：跨设备保存记录（恢复码）入口 */
.sb-sync {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: 14px;
  color: var(--ink-2);
  padding: 8px 11px;
  border-radius: 10px;
  cursor: pointer;
  text-align: left;
  margin-bottom: 6px;
  transition: background .14s ease, color .14s ease;
}
.sb-sync:hover { background: var(--surface-2); color: var(--ink-1); }
.sb-sync:active { transform: scale(.99); }
.sb-sync .sb-sync-icon { flex: none; color: var(--brand); }
.sb-sync-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sb-sync .sb-sync-arrow { flex: none; color: var(--ink-3); }

.sb-mask {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: var(--mask);
  animation: fadeIn .2s ease;
}
.sb-mask[hidden] { display: none; }

/* ============================================================
   顶栏（极简图标）
   ============================================================ */
.topbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 8px;
  height: 56px;
  padding: 0 12px;
  padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
}
.topbar .tb-btn:first-child { margin-right: auto; }
.topbar .tb-btn:last-child { margin-left: auto; }
.tb-btn {
  width: 40px; height: 40px;
  flex: none;
  border: none;
  border-radius: 50%;
  background: none;
  color: #2B2D33;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease;
}
.tb-btn:hover { background: var(--surface-2); }
.tb-btn:active { transform: scale(.92); }

/* ============================================================
   对话滚动区
   ============================================================ */
.chat-scroll {
  flex: 1;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  display: flex;
  flex-direction: column;
  scrollbar-width: thin;
}
.chat-scroll::-webkit-scrollbar { width: 6px; }
.chat-scroll::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: 3px; }
.chat-scroll::-webkit-scrollbar-track { background: transparent; }

/* 欢迎区（仿 DeepSeek 居中问候） */
.welcome {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 0 28px 8vh;
  text-align: center;
  animation: fadeIn .35s ease;
}
.welcome[hidden] { display: none; }
.welcome-logo {
  width: 64px; height: 64px;
  border-radius: 20px;
  display: grid;
  place-items: center;
  box-shadow: 0 8px 24px rgba(77, 107, 254, .2);
}
.welcome-logo svg { display: block; border-radius: 20px; }
/* 后台可上传自定义 LOGO：固定 1:1 尺寸，用 object-fit 保证不变形 */
.welcome-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 20px;
  display: block;
}
.welcome-logo .logo-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-deep));
  color: #fff;
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
}
.welcome h2 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -.2px;
  color: var(--ink-1);
}
.welcome-sub {
  font-size: 14px;
  color: var(--ink-3);
  max-width: 420px;
  line-height: 1.7;
}
.welcome-sub[hidden] { display: none; }

.chat-list {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 8px 18px 20px;
  width: 100%;
}
.chat-scroll.has-msg .chat-list { padding-top: 14px; }

/* ============================================================
   消息（AI 纯文字无气泡；用户浅灰气泡）
   ============================================================ */
.msg { display: flex; gap: 10px; animation: msgIn .3s ease both; }
@keyframes msgIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.msg-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}
.msg.ai .msg-avatar {
  background: linear-gradient(135deg, var(--brand-light), var(--brand-deep));
  color: #fff;
}
.msg.user { flex-direction: row-reverse; }
.msg.user .msg-avatar {
  background: var(--surface-2);
  color: var(--ink-2);
}
/* AI 头像使用站点 LOGO 图片时：去掉品牌底色，图片铺满圆形（固定 1:1，不变形） */
.msg.ai .msg-avatar.has-logo { background: transparent; }
.msg-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

.msg-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.msg.user .msg-body { flex: none; max-width: 82%; align-items: flex-end; }

/* AI：无气泡，纯文字直排 */
.bubble { word-break: break-word; }
.msg.ai .bubble {
  background: none;
  border: none;
  box-shadow: none;
  padding: 2px 0;
  font-size: 15.5px;
  line-height: 1.78;
  color: var(--ink-1);
}
/* 用户：浅灰气泡 */
.msg.user .bubble {
  background: var(--surface-2);
  color: var(--ink-1);
  padding: 10px 15px;
  border-radius: 18px;
  border-bottom-right-radius: 6px;
  font-size: 15.5px;
  line-height: 1.62;
  white-space: pre-wrap;
}
.msg.user .bubble a { color: var(--brand-deep); }

/* Markdown 内容 */
.bubble.md p { margin: 0 0 .6em; }
.bubble.md p:last-child { margin-bottom: 0; }
.bubble.md img {
  max-width: 100%;
  border-radius: 12px;
  margin: 6px 0;
  display: block;
}
.bubble.md strong { color: inherit; font-weight: 700; }
.msg.ai .bubble.md strong { color: var(--ink-1); }
.bubble.md ul, .bubble.md ol { padding-left: 1.25em; margin: .35em 0; }
.bubble.md li { margin: .2em 0; }
.bubble.md a { color: var(--brand); text-decoration: none; }
.bubble.md a:hover { text-decoration: underline; }
.bubble.md code {
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 13.5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.bubble.md blockquote {
  border-left: 3px solid var(--brand-line);
  padding-left: 12px;
  margin: .5em 0;
  color: var(--ink-2);
}

/* 打字指示 */
.typing { display: inline-flex; gap: 4px; padding: 4px 0; }
.typing i {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--typing-dot);
  animation: blink 1.3s infinite both;
}
.typing i:nth-child(2) { animation-delay: .18s; }
.typing i:nth-child(3) { animation-delay: .36s; }
@keyframes blink { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }
.msg-extra { font-size: 13.5px; color: var(--ink-3); }

/* ============================================================
   商品卡片
   ============================================================ */
.product-card {
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: box-shadow .2s ease, transform .2s ease;
}
@media (hover: hover) {
  .product-card:hover { box-shadow: var(--shadow-2); transform: translateY(-1px); }
}
.product-main { display: flex; gap: 12px; padding: 12px; }
.product-imgbox {
  position: relative;
  width: 96px; height: 96px;
  border-radius: 12px;
  overflow: hidden;
  flex: none;
  background: var(--surface-2);
}
.product-imgbox img { width: 100%; height: 100%; object-fit: cover; display: block; cursor: zoom-in; }
.product-imgbox .stock-tag {
  position: absolute;
  left: 0; bottom: 0; right: 0;
  font-size: 13px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, .62));
  padding: 10px 6px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.product-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.product-name {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-point {
  font-size: 13.5px;
  color: var(--ink-2);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.product-price { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; margin-top: 1px; }
.price-now { color: var(--brand); font-weight: 800; font-size: 20px; font-variant-numeric: tabular-nums; letter-spacing: -.3px; }
.price-now small { font-size: 13px; font-weight: 600; }
.price-old { color: var(--ink-3); font-size: 13.5px; text-decoration: line-through; }
.price-off {
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: 5px;
  padding: 2px 6px;
  letter-spacing: .2px;
}
.product-thumbs { display: flex; gap: 6px; padding: 0 12px 10px; }
.product-thumbs img {
  width: 44px; height: 44px;
  object-fit: cover;
  border-radius: 9px;
  border: 1px solid var(--line);
  cursor: zoom-in;
  transition: border-color .15s ease;
}
.product-thumbs img:hover { border-color: var(--brand-line); }
.product-actions { display: flex; gap: 8px; padding: 0 12px 12px; }
.btn-buy {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  height: 38px;
  border-radius: var(--r-sm);
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  font-size: 13.5px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--shadow-brand);
  border: none;
  cursor: pointer;
  transition: transform .12s ease, box-shadow .16s ease;
}
.btn-buy:hover { box-shadow: var(--brand-shadow); }
.btn-buy:active { transform: scale(.97); }
.btn-poster {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 38px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--ink-1);
  font-size: 13.5px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  font-family: var(--font);
  transition: background .15s ease, transform .12s ease;
}
.btn-poster:hover { background: var(--surface-3); }
.btn-poster:active { transform: scale(.97); }

/* ============================================================
   快捷提问（输入卡上方）
   ============================================================ */
.quick-chips {
  flex: none;
  display: flex;
  gap: 8px;
  padding: 0 16px 10px;
  overflow-x: auto;
  scrollbar-width: none;
}
.quick-chips::-webkit-scrollbar { display: none; }
.quick-chips[hidden] { display: none; }
.chip {
  flex: none;
  font-size: 14px;
  color: var(--ink-1);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 8px 15px;
  cursor: pointer;
  white-space: nowrap;
  font-family: var(--font);
  transition: all .15s ease;
}
.chip:active { transform: scale(.96); }
.chip:hover { border-color: var(--brand-line); color: var(--brand-deep); background: var(--brand-soft); }

/* ============================================================
   底部：输入卡（仿 DeepSeek 大圆角卡片）
   ============================================================ */
.composer {
  flex: none;
  padding: 0 16px calc(10px + env(safe-area-inset-bottom));
}
.composer-card {
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-lg);
  padding: 12px 14px 10px;
  transition: border-color .18s ease, box-shadow .18s ease;
}
.composer-card:focus-within {
  border-color: var(--brand-line);
  box-shadow: 0 2px 14px rgba(77, 107, 254, .1);
}
#msgInput {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  background: none;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--ink-1);
  max-height: 110px;
  min-height: 24px;
  padding: 0;
  display: block;
}
#msgInput::placeholder { color: var(--ink-3); }

.composer-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.tool-left { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; overflow: hidden; }
.tool-right { flex: none; display: flex; align-items: center; gap: 8px; }
/* 输入卡内的模型切换（原「清仓截止」位置） */
.model-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 28px;
  max-width: 100%;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: var(--ink-2);
  font-size: 13.5px;
  font-weight: 600;
  font-family: var(--font);
  cursor: pointer;
  transition: all .16s ease;
}
.model-chip > svg:first-child { flex: none; color: var(--brand); }
.model-chip #modelChipName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.model-chip .ms-arrow { flex: none; color: var(--ink-3); }
.model-chip:hover { border-color: var(--brand-line); color: var(--brand-deep); background: var(--brand-soft); }
.model-chip:active { transform: scale(.96); }
.model-chip[hidden] { display: none; }
.round-btn {
  width: 38px; height: 38px;
  flex: none;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  color: #33363C;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background .15s ease, transform .12s ease, opacity .15s ease;
}
.round-btn:hover { background: var(--surface-2); }
.round-btn:active { transform: scale(.93); }
.round-btn.send {
  border: none;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  box-shadow: var(--shadow-brand);
}
.round-btn.send:hover { box-shadow: var(--brand-shadow); }
.round-btn:disabled {
  opacity: .45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.composer-foot {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 0 2px;
  font-size: 13px;
  color: var(--ink-3);
}
.composer-foot a { color: var(--ink-3); text-decoration: none; }
.composer-foot a:hover { color: var(--ink-2); text-decoration: underline; }

/* ============================================================
   企微悬浮按钮
   ============================================================ */
.wechat-pill {
  position: fixed;
  right: 14px;
  bottom: calc(120px + env(safe-area-inset-bottom));
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 15px 0 12px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--wechat-1), var(--wechat-2));
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: var(--wechat-shadow);
  z-index: 60;
  transition: transform .14s ease;
  max-width: calc(100vw - 28px);
}
.wechat-pill[hidden] { display: none; }
.wechat-pill:active { transform: scale(.96); }
.wechat-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ============================================================
   模型选择面板（底部弹层）
   ============================================================ */
.model-sheet { position: fixed; inset: 0; z-index: 120; display: flex; align-items: flex-end; justify-content: center; }
.model-sheet[hidden] { display: none; }
.model-sheet-mask { position: absolute; inset: 0; background: var(--mask); animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.model-sheet-panel {
  position: relative;
  width: 100%;
  max-width: 480px;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 18px 18px calc(20px + env(safe-area-inset-bottom));
  animation: slideUp .28s cubic-bezier(.2, .9, .3, 1);
  box-shadow: var(--shadow-3);
}
@keyframes slideUp { from { transform: translateY(80px); opacity: 0; } to { transform: none; opacity: 1; } }
.model-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.model-sheet-head button {
  border: none; background: var(--surface-2);
  width: 30px; height: 30px;
  border-radius: 50%;
  font-size: 17px; cursor: pointer; color: var(--ink-2);
  line-height: 1;
}
.model-sheet-head button:hover { background: var(--surface-3); }
.model-sheet-list { display: flex; flex-direction: column; gap: 8px; }
.model-empty { padding: 22px 8px; text-align: center; color: var(--ink-3); font-size: 13.5px; line-height: 1.7; }
.model-opt {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--ink-1);
  font-family: var(--font);
  cursor: pointer;
  text-align: left;
  transition: all .15s ease;
}
.model-opt:hover { border-color: var(--line-strong); background: var(--surface-2); }
.model-opt:active { transform: scale(.985); }
.model-opt.active { border-color: var(--brand); background: var(--brand-soft); color: var(--brand-deep); }
.mo-radio {
  width: 18px; height: 18px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  flex: none;
  position: relative;
  transition: border-color .15s ease;
}
.model-opt.active .mo-radio { border-color: var(--brand); }
.model-opt.active .mo-radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: var(--brand);
}
.mo-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mo-tag {
  font-size: 13px;
  font-weight: 700;
  color: var(--brand-deep);
  background: var(--brand-tint);
  border-radius: 5px;
  padding: 1px 6px;
  flex: none;
}
/* 能力标签：识图 / 画图 */
.mo-cap {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0 6px;
  flex: none;
}
.model-sheet-tip { font-size: 13.5px; color: var(--ink-3); margin-top: 12px; line-height: 1.6; }

/* ============================================================
   通用确认弹窗
   ============================================================ */
.dialog {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.dialog[hidden] { display: none; }
.dialog-mask { position: absolute; inset: 0; background: var(--mask); animation: fadeIn .18s ease; }
.dialog-card {
  position: relative;
  width: 100%;
  max-width: 320px;
  background: var(--surface);
  border-radius: var(--r-md);
  padding: 22px 20px 16px;
  box-shadow: var(--shadow-3);
  text-align: center;
  animation: dlgIn .22s cubic-bezier(.2, .9, .3, 1);
}
@keyframes dlgIn { from { transform: scale(.94); opacity: 0; } to { transform: none; opacity: 1; } }
.dialog-title { font-size: 16.5px; font-weight: 700; color: var(--ink-1); }
.dialog-text { font-size: 13.5px; color: var(--ink-2); margin-top: 8px; line-height: 1.65; word-break: break-word; }
.dialog-actions { display: flex; gap: 10px; margin-top: 18px; }
.dialog-btn {
  flex: 1;
  height: 42px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease, transform .12s ease;
}
.dialog-btn:hover { background: var(--surface-2); }
.dialog-btn:active { transform: scale(.97); }
.dialog-btn.danger { border-color: transparent; background: var(--danger); color: #fff; }
.dialog-btn.danger:hover { background: var(--danger-deep); }
.dialog-btn.primary { border-color: transparent; background: var(--brand); color: #fff; }
.dialog-btn.primary:hover { background: var(--brand-deep); }
/* 重命名输入框：手机端 16px，避免 iOS Safari 聚焦时强制放大整页 */
.dialog-input {
  box-sizing: border-box;
  width: 100%;
  height: 44px;
  margin-top: 14px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: 16px;
}
.dialog-input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

/* ============================================================
   记录找回弹窗（跨设备恢复码）
   ============================================================ */
.sync-card {
  max-width: 380px;
  text-align: left;
  padding: 20px 20px 18px;
}
.sync-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.sync-head b { font-size: 16.5px; font-weight: 700; color: var(--ink-1); }
.sync-x {
  flex: none;
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--ink-3);
  font-size: 20px;
  line-height: 1;
  font-family: var(--font);
  border-radius: 8px;
  cursor: pointer;
  transition: background .14s ease, color .14s ease;
}
.sync-x:hover { background: var(--surface-2); color: var(--ink-1); }
.sync-lead { font-size: 13.5px; color: var(--ink-3); line-height: 1.7; margin: 10px 0 0; }
.sync-sec { margin-top: 18px; }
.sync-label { font-size: 14px; font-weight: 600; color: var(--ink-2); margin-bottom: 9px; }
.sync-code-row { display: flex; align-items: center; gap: 10px; }
.sync-code {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: .06em;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-sm);
  padding: 11px 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sync-code.on {
  color: var(--brand-deep);
  background: var(--brand-soft);
  border-color: var(--brand-line);
  border-style: solid;
}
.sync-mini {
  flex: none;
  height: 40px;
  padding: 0 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-1);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, border-color .14s ease;
}
.sync-mini:hover { background: var(--surface-2); border-color: var(--line-strong); }
.sync-main {
  width: 100%;
  height: 42px;
  margin-top: 10px;
  border: none;
  border-radius: var(--r-sm);
  background: var(--brand);
  color: #fff;
  font-family: var(--font);
  font-size: 14.5px;
  font-weight: 600;
  cursor: pointer;
  transition: background .14s ease, transform .12s ease, opacity .14s ease;
}
.sync-main:hover { background: var(--brand-deep); }
.sync-main:active { transform: scale(.98); }
.sync-main:disabled { opacity: .6; cursor: default; }
.sync-main.inline { width: auto; flex: none; height: 44px; margin-top: 0; padding: 0 18px; }
.sync-input-row { display: flex; gap: 9px; }
.sync-input {
  flex: 1;
  min-width: 0;
  height: 44px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink-1);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .12em;
  padding: 0 13px;
  outline: none;
  transition: border-color .14s ease, box-shadow .14s ease;
}
.sync-input::placeholder { font-family: var(--font); font-size: 13.5px; font-weight: 400; letter-spacing: 0; color: var(--ink-3); }
.sync-input:focus { border-color: var(--brand-line); box-shadow: 0 0 0 3px var(--brand-soft); }
.sync-tip { margin: 8px 0 0; font-size: 13px; line-height: 1.6; color: var(--ink-3); }
.sync-hint { min-height: 17px; margin-top: 12px; font-size: 13.5px; line-height: 1.6; color: var(--ink-3); }
.sync-hint.ok { color: var(--green); }
.sync-hint.err { color: var(--danger); }

/* ============================================================
   海报弹窗
   ============================================================ */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; justify-content: center; }
.modal[hidden] { display: none; }
.modal-mask { position: absolute; inset: 0; background: var(--mask); animation: fadeIn .2s ease; }
.modal-body {
  position: relative;
  width: 100%;
  max-width: 420px;
  max-height: 92dvh;
  overflow-y: auto;
  background: var(--surface);
  border-radius: 22px 22px 0 0;
  padding: 16px 16px calc(18px + env(safe-area-inset-bottom));
  animation: slideUp .3s cubic-bezier(.2, .9, .3, 1);
  box-shadow: var(--shadow-3);
}
@media (min-width: 720px) {
  .modal { align-items: center; }
  .modal-body { border-radius: var(--r-lg); }
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
}
.modal-close {
  width: 30px; height: 30px;
  border: none;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 18px;
  cursor: pointer;
  line-height: 1;
  transition: background .15s ease;
}
.modal-close:hover { background: var(--surface-3); }
.poster-stage { display: grid; place-items: center; min-height: 200px; }
.poster-stage img, .poster-stage canvas {
  max-width: 100%;
  border-radius: 12px;
  box-shadow: var(--shadow-2);
  display: block;
}
.poster-loading { color: var(--ink-3); font-size: 14px; padding: 40px 0; text-align: center; }
.modal-foot { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; align-items: center; }
.poster-tip { font-size: 13.5px; color: var(--ink-3); text-align: center; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 46px;
  padding: 0 40px;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  text-decoration: none;
  border: none;
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: transform .12s ease, box-shadow .16s ease;
  font-family: var(--font);
}
.btn-primary:hover { box-shadow: var(--brand-shadow); }
.btn-primary:active { transform: scale(.97); }

/* ============================================================
   Toast
   ============================================================ */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(140px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  background: var(--toast-bg);
  backdrop-filter: blur(8px);
  color: #fff;
  font-size: 14px;
  padding: 9px 18px;
  border-radius: 999px;
  z-index: 200;
  animation: toastIn .25s ease;
  max-width: 82%;
  text-align: center;
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }

/* ============================================================
   海报模板（html2canvas 渲染目标，固定 750px 宽，2x 导出）
   ============================================================ */
.poster {
  width: 750px;
  padding: 40px 36px 32px;
  background: linear-gradient(180deg, var(--poster-bg-1) 0%, var(--poster-bg-2) 100%);
  font-family: var(--font);
  color: var(--ink-1);
  box-sizing: border-box;
}
.poster-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 22px;
  border-bottom: 2px dashed var(--poster-dash);
  margin-bottom: 26px;
}
.poster-logo {
  width: 64px; height: 64px;
  border-radius: 18px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand-deep));
  color: #fff;
  font-size: 32px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
}
.poster-head-text h3 { font-size: 26px; font-weight: 800; }
/* 海报头部 LOGO：后台配了就用图片，否则退回站点名首字（固定 1:1，不变形） */
.poster-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 18px;
  display: block;
}
.poster-head-text p { font-size: 16px; color: var(--ink-3); margin-top: 2px; }

.poster-chat { display: flex; flex-direction: column; gap: 18px; margin-bottom: 30px; }
.poster-bubble {
  max-width: 88%;
  padding: 16px 20px;
  border-radius: 18px;
  font-size: 19px;
  line-height: 1.6;
  background: #fff;
  border: 1px solid var(--poster-line);
  box-shadow: 0 2px 8px rgba(28, 31, 36, .04);
}
.poster-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: #fff;
  border: none;
}
.poster-bubble .who {
  display: block;
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 5px;
}
.poster-bubble.user .who { color: rgba(255, 255, 255, .75); }

.poster-product {
  background: #fff;
  border-radius: 22px;
  overflow: hidden;
  border: 1px solid var(--poster-line);
  box-shadow: 0 6px 20px rgba(28, 31, 36, .06);
  margin-bottom: 28px;
}
.poster-product-img { width: 100%; height: 380px; object-fit: cover; display: block; background: var(--poster-img-bg); }
.poster-product-body { padding: 22px 26px 24px; }
.poster-product-name { font-size: 25px; font-weight: 800; line-height: 1.35; }
.poster-product-point { font-size: 17px; color: var(--ink-2); margin-top: 6px; }
.poster-product-price { display: flex; align-items: baseline; gap: 14px; margin-top: 14px; }
.poster-price-now { color: var(--brand); font-size: 40px; font-weight: 800; }
.poster-price-now small { font-size: 20px; }
.poster-price-old { color: var(--ink-3); font-size: 18px; text-decoration: line-through; }
.poster-price-off {
  font-size: 15px; font-weight: 700; color: #fff;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: 8px; padding: 3px 10px;
}
.poster-product-meta { font-size: 15px; color: var(--ink-3); margin-top: 12px; }

.poster-qr { display: flex; align-items: center; gap: 22px; }
.poster-qr-img {
  width: 168px; height: 168px;
  border-radius: 16px;
  background: #fff;
  border: 1px solid var(--poster-line);
  padding: 8px;
  flex: none;
}
.poster-qr-img img, .poster-qr-img canvas, .poster-qr-img svg { width: 100% !important; height: 100% !important; display: block; }
.poster-qr-text { flex: 1; }
.poster-qr-text h4 { font-size: 21px; font-weight: 800; }
.poster-qr-text p { font-size: 16px; color: var(--ink-2); margin-top: 8px; line-height: 1.6; }
.poster-foot {
  margin-top: 30px;
  padding-top: 18px;
  border-top: 2px dashed var(--poster-dash);
  text-align: center;
  font-size: 14px;
  color: var(--ink-3);
}

/* 错误提示 */
.msg-error .bubble {
  background: var(--err-bg);
  border: 1px solid var(--err-line);
  border-radius: 14px;
  padding: 10px 14px;
  color: var(--err-ink);
  font-size: 13.5px;
}
.retry-link {
  color: var(--brand-deep);
  font-weight: 700;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 6px;
}

/* 图片消息 */
.msg-img {
  max-width: 200px;
  border-radius: 14px;
  border-bottom-right-radius: 6px;
  display: block;
  cursor: zoom-in;
}
/* AI 画出来的图：比用户上传的缩略图大一些，看得清 */
.msg-imgbox { margin-bottom: 8px; }
.msg-imgbox .msg-img {
  max-width: min(260px, 70vw);
  border-radius: 14px;
  border-bottom-left-radius: 6px;
  box-shadow: var(--shadow-1, 0 2px 10px rgba(23, 24, 28, .06));
}

/* 图片预览 */
.img-viewer {
  position: fixed; inset: 0; z-index: 300;
  background: rgba(0, 0, 0, .92);
  display: grid;
  place-items: center;
  animation: fadeIn .2s ease;
}
.img-viewer[hidden] { display: none; }
.img-viewer img { max-width: 92%; max-height: 88%; border-radius: 8px; }

/* ============================================================
   桌面端（≥960px）：侧边栏常驻
   ============================================================ */
@media (min-width: 960px) {
  .sidebar {
    transform: none;
    width: 280px;
    box-shadow: none;
  }
  .sb-mask { display: none !important; }
  .app { margin-left: 280px; max-width: none; }
  .topbar { max-width: 780px; margin: 0 auto; width: 100%; }
  .chat-list { max-width: 780px; margin: 0 auto; width: 100%; }
  .quick-chips { max-width: 780px; margin: 0 auto; width: 100%; }
  .composer { max-width: 780px; margin: 0 auto; width: 100%; }
  /* 桌面端：汉堡与新建合并语义，隐藏汉堡 */
  #menuBtn { display: none; }
  .topbar .tb-btn:first-child { margin-right: auto; }
}
