/* ==========================================================================
   小暖客服 · 设计系统
   暖纸 / 陶土红 / 松针绿。认真小店的气质，不要紫色渐变与玻璃拟态。
   ========================================================================== */
:root {
  --bg: #F6F1E8;
  --bg-deep: #EFE7DA;
  --surface: #FFFDF8;
  --surface-2: #FBF7F0;
  --ink: #242019;
  --ink-2: #5C554A;
  --muted: #8B8173;
  --line: #E8DFD2;
  --line-strong: #D8CCBA;
  --primary: #CC5F3F;
  --primary-deep: #AE4A2E;
  --primary-soft: #F7E4DB;
  --primary-line: #EFD2C4;
  --sage: #456B57;
  --sage-soft: #E4EDE6;
  --gold: #B9863C;
  --gold-soft: #F6ECD9;
  --danger: #B4472F;
  --danger-soft: #F9E6E1;
  --shadow-sm: 0 1px 2px rgba(36, 32, 25, .05);
  --shadow-md: 0 10px 30px -12px rgba(36, 32, 25, .18);
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 18px;
  --r-xl: 24px;
  --font: "Microsoft YaHei", "PingFang SC", "Hiragino Sans GB", "Noto Sans CJK SC", system-ui, sans-serif;
  --mono: "Cascadia Code", "SFMono-Regular", Consolas, monospace;
  --grain: rgba(36, 32, 25, .028);
  --rail-w: 88px;
  --tabbar-h: 60px;
  color-scheme: light;
}
html[data-theme="dark"] {
  --bg: #171411;
  --bg-deep: #12100D;
  --surface: #201C17;
  --surface-2: #26211B;
  --ink: #F3EADF;
  --ink-2: #C9BDAC;
  --muted: #9C8F7D;
  --line: #342D24;
  --line-strong: #463C30;
  --primary: #E27A58;
  --primary-deep: #F09070;
  --primary-soft: #3A261E;
  --primary-line: #4C3127;
  --sage: #7FA98F;
  --sage-soft: #223027;
  --gold: #D6A860;
  --gold-soft: #33291B;
  --danger: #E0745C;
  --danger-soft: #3B241E;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .35);
  --shadow-md: 0 12px 34px -14px rgba(0, 0, 0, .6);
  --grain: rgba(255, 250, 240, .022);
  color-scheme: dark;
}

/* ---------- reset ---------- */
*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14.5px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: radial-gradient(var(--grain) .7px, transparent .7px);
  background-size: 4px 4px;
}
h1, h2, h3, h4, p, ul, ol, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: var(--primary-deep); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { -webkit-tap-highlight-color: transparent; }
img, svg { max-width: 100%; }
::selection { background: var(--primary-soft); color: var(--primary-deep); }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; border-radius: 4px; }
.muted { color: var(--muted); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.num { font-variant-numeric: tabular-nums; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hide-sm { display: initial; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- 应用外壳 ---------- */
.app {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr);
  height: 100vh;
  height: var(--app-height, 100dvh);
  max-width: 1600px;
  margin: 0 auto;
  background: var(--bg);
  overflow: hidden;
}
.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; height: 100%; }
.view { display: flex; flex-direction: column; flex: 1; min-height: 0; min-width: 0; }
.page-head {
  flex: none;
  display: flex;
  align-items: center;
  gap: 12px;
  height: 64px;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: var(--bg);
  position: relative;
  z-index: 6;
}
.page-head__title { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.page-title { font-size: 18px; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; }
.page-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.head-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.page-body { flex: 1; min-height: 0; min-width: 0; overflow: auto; overscroll-behavior: contain; }
.view--inbox .page-body { overflow: hidden; }

/* ---------- 品牌 ---------- */
.brand-mark {
  display: inline-grid;
  place-items: center;
  background: linear-gradient(145deg, var(--primary) 0%, var(--primary-deep) 100%);
  color: #FFFDF8;
  border-radius: 12px;
  box-shadow: 0 6px 14px -8px rgba(174, 74, 46, .75);
  flex: none;
}
.brand-mark svg { width: 62%; height: 62%; }
.brand-mark--sm { width: 30px; height: 30px; border-radius: 9px; }
.brand-mark--md { width: 40px; height: 40px; }
.brand-mark--lg { width: 52px; height: 52px; border-radius: 15px; }
.brand-word { font-weight: 700; letter-spacing: .14em; }

/* ---------- 左侧导航 ---------- */
.rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 0 14px;
  height: 100%;
  background: var(--surface);
  border-right: 1px solid var(--line);
  overflow: hidden;
}
.rail__brand { display: block; margin-bottom: 10px; border-radius: 14px; }
.rail__nav { display: flex; flex-direction: column; align-items: center; gap: 4px; width: 100%; }
.rail__link {
  position: relative;
  width: 66px;
  padding: 7px 0 6px;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.25;
  transition: background .16s, color .16s;
}
.rail__link .ico { width: 21px; height: 21px; }
.rail__link:hover { background: var(--surface-2); color: var(--ink-2); }
.rail__link[aria-current="page"] { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.rail__link[aria-current="page"] .ico { stroke-width: 1.9; }
.rail__badge {
  position: absolute; top: 3px; right: 11px;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px; background: var(--primary); color: #FFFDF8;
  font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
  box-shadow: 0 0 0 2px var(--surface);
}
.rail__bottom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.rail__ai { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.rail__ai .dot { background: var(--sage); }
.rail__ai.is-off .dot { background: var(--muted); }

/* 底部 5 栏（移动端） */
.tabbar { display: none; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px;
  border: 1px solid transparent; background: transparent; color: var(--ink);
  font-size: 14px; font-weight: 600; line-height: 1;
  cursor: pointer; white-space: nowrap; user-select: none;
  transition: background .16s, border-color .16s, color .16s, transform .16s, box-shadow .16s;
}
.btn:active { transform: translateY(1px); }
.btn .ico { width: 18px; height: 18px; }
.btn--primary { background: var(--primary); border-color: var(--primary); color: #FFFDF8; box-shadow: 0 6px 14px -10px rgba(174, 74, 46, .8); }
.btn--primary:hover { background: var(--primary-deep); border-color: var(--primary-deep); }
.btn--ghost { border-color: var(--line-strong); background: var(--surface); color: var(--ink-2); }
.btn--ghost:hover { border-color: var(--muted); color: var(--ink); background: var(--surface); }
.btn--quiet { color: var(--ink-2); padding: 0 10px; }
.btn--quiet:hover { background: var(--surface-2); }
.btn--danger { background: var(--danger); border-color: var(--danger); color: #FFFDF8; }
.btn--danger:hover { filter: brightness(.94); }
.btn--sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 8px; }
.btn--sm .ico { width: 15px; height: 15px; }
.btn--block { width: 100%; }
.btn--link { height: auto; padding: 0; border: 0; color: var(--primary-deep); font-weight: 600; background: none; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; text-decoration-color: var(--primary-line); }
.btn--link:hover { text-decoration-color: var(--primary); }
.btn[disabled], .btn.is-loading { opacity: .4; pointer-events: none; }
.btn.is-loading { opacity: .65; }
.icon-btn {
  width: 34px; height: 34px; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: 9px; background: transparent;
  color: var(--ink-2); cursor: pointer; transition: background .15s, color .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--line); color: var(--ink); }
.icon-btn.is-active { background: var(--primary-soft); color: var(--primary-deep); }
.icon-btn .ico { width: 19px; height: 19px; }

/* ---------- 表单 ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field__label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field__hint { font-size: 12px; color: var(--muted); line-height: 1.6; }
.input, .select, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px;
  font-size: 14px; line-height: 1.5;
  transition: border-color .16s, box-shadow .16s, background .16s;
}
.textarea { resize: vertical; min-height: 92px; line-height: 1.7; }
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:hover, .select:hover, .textarea:hover { border-color: var(--line-strong); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238B8173' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box .ico { position: absolute; left: 10px; width: 17px; height: 17px; color: var(--muted); pointer-events: none; }
.search-box .input { height: 36px; min-height: 36px; padding-left: 33px; border-radius: 9px; font-size: 13px; }
.search-box--wide .input { width: 220px; }
.input-group { display: flex; gap: 8px; align-items: center; }
.input-group .input { flex: 1; min-width: 0; width: auto; }
.input-suffix { position: relative; }
.input-suffix .input { padding-right: 42px; }
.input-suffix .icon-btn { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 32px; height: 32px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 18px; }
.form-grid--3 { grid-template-columns: repeat(3, 1fr); }

.switch {
  position: relative; flex: none;
  width: 42px; height: 24px; padding: 0;
  border: 0; border-radius: 99px; background: var(--line-strong);
  cursor: pointer; transition: background .18s;
}
.switch::after {
  content: ""; position: absolute; top: 3px; left: 3px;
  width: 18px; height: 18px; border-radius: 50%;
  background: #FFFDF8; box-shadow: 0 1px 2px rgba(36, 32, 25, .22);
  transition: transform .18s;
}
.switch[aria-checked="true"] { background: var(--sage); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
.switch:disabled { opacity: .45; cursor: not-allowed; }
.switch--sm { width: 34px; height: 20px; }
.switch--sm::after { top: 3px; left: 3px; width: 14px; height: 14px; }
.switch--sm[aria-checked="true"]::after { transform: translateX(14px); }
.switch-row { display: flex; align-items: center; gap: 10px; }
.switch-row__label { font-size: 13.5px; color: var(--ink-2); font-weight: 600; }

/* ---------- 徽标 / 标签 / 状态 ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 99px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 11.5px; font-weight: 600; white-space: nowrap;
}
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--muted); flex: none; }
.badge--ai { color: var(--sage); border-color: transparent; background: var(--sage-soft); }
.badge--ai .dot { background: var(--sage); }
.badge--human { color: var(--primary-deep); border-color: transparent; background: var(--primary-soft); }
.badge--human .dot { background: var(--primary); }
.badge--pending { color: var(--gold); border-color: transparent; background: var(--gold-soft); }
.badge--pending .dot { background: var(--gold); }
.badge--closed { color: var(--muted); }
.badge--closed .dot { background: var(--muted); }
.state-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; flex: none; }
.state-dot--ai { background: var(--sage); }
.state-dot--human { background: var(--primary); }
.state-dot--pending { background: var(--gold); }
.state-dot--closed { background: var(--line-strong); }
.tag {
  display: inline-flex; align-items: center; height: 22px; padding: 0 8px;
  border-radius: 6px; background: var(--surface-2); border: 1px solid var(--line);
  color: var(--ink-2); font-size: 11.5px; white-space: nowrap;
}
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 30px; padding: 0 12px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface);
  color: var(--ink-2); font-size: 12.5px; font-weight: 600;
  cursor: pointer; white-space: nowrap; transition: .15s;
}
.chip:hover { border-color: var(--line-strong); background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--primary-soft); border-color: var(--primary-line); color: var(--primary-deep); }
.chip .count { font-size: 11px; color: var(--muted); font-weight: 500; }
.chip[aria-pressed="true"] .count { color: var(--primary); }
.chip--ghost { background: transparent; border-style: dashed; }
.tag-input { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.tag-input .input { flex: 1; min-width: 120px; }

/* ---------- 头像 ---------- */
.avatar {
  --hue: 24;
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, hsl(var(--hue) 48% 76%), hsl(calc(var(--hue) + 18) 42% 61%));
  color: #3D2A20; font-weight: 700; font-size: 14px; letter-spacing: 0;
  box-shadow: inset 0 0 0 1px rgba(255, 253, 248, .35);
  user-select: none;
}
.avatar--sm { width: 32px; height: 32px; font-size: 12.5px; }
.avatar--lg { width: 56px; height: 56px; font-size: 19px; }
.avatar--xl { width: 72px; height: 72px; font-size: 25px; }
.avatar-stack { display: flex; align-items: center; }

/* ---------- 卡片 ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-sm); }
.card--hover { transition: transform .18s, border-color .18s, box-shadow .18s; }
.card--hover:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.card__head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card__title { font-size: 14px; font-weight: 700; }
.card__body { padding: 16px; }
.card__foot { padding: 12px 16px; border-top: 1px solid var(--line); }
.section-title { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 12px; }
.section-title .ico { width: 16px; height: 16px; color: var(--muted); }
.divider { height: 1px; background: var(--line); margin: 16px 0; }

/* ---------- Toast ---------- */
.toasts {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 200; display: flex; flex-direction: column; align-items: center; gap: 8px;
  pointer-events: none; width: max-content; max-width: min(92vw, 460px);
}
.toast {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 15px; border-radius: 10px;
  background: #2B261E; color: #FFFDF8;
  font-size: 13px; line-height: 1.5;
  box-shadow: 0 14px 30px -12px rgba(0, 0, 0, .45);
  opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s;
}
html[data-theme="dark"] .toast { background: #F3EADF; color: #242019; }
.toast .ico { width: 17px; height: 17px; flex: none; opacity: .9; }
.toast--error .ico { color: #FFB19A; }
html[data-theme="dark"] .toast--error .ico { color: var(--danger); }
.toast.is-in { opacity: 1; transform: translateY(0); }

/* ---------- 弹窗 ---------- */
.modal-layer { position: fixed; inset: 0; z-index: 150; display: flex; align-items: center; justify-content: center; padding: 20px; }
.modal__scrim { position: absolute; inset: 0; background: rgba(36, 32, 25, .38); opacity: 0; transition: opacity .2s; backdrop-filter: blur(2px); }
.modal-layer.is-in .modal__scrim { opacity: 1; }
.modal {
  position: relative; width: min(440px, 100%); max-height: min(86dvh, 720px);
  display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg);
  box-shadow: var(--shadow-md);
  transform: translateY(10px) scale(.985); opacity: 0;
  transition: transform .2s, opacity .2s;
}
.modal-layer.is-in .modal { transform: none; opacity: 1; }
.modal--wide { width: min(620px, 100%); }
.modal__head { display: flex; align-items: center; gap: 10px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal__head h3 { font-size: 15px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.modal__body { padding: 18px; overflow: auto; }
.modal__text { font-size: 13.5px; line-height: 1.75; color: var(--ink-2); white-space: pre-wrap; }
.modal__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 18px; border-top: 1px solid var(--line); }
.modal__body .field:last-child { margin-bottom: 0; }

/* ---------- 抽屉 ---------- */
.scrim {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(36, 32, 25, .3);
  opacity: 0; transition: opacity .2s;
}
.scrim.is-in { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 100;
  width: min(420px, 100%); display: flex; flex-direction: column;
  background: var(--surface); border-left: 1px solid var(--line);
  box-shadow: -18px 0 44px -26px rgba(36, 32, 25, .5);
  transform: translateX(100%); transition: transform .22s ease;
}
.drawer--wide { width: min(480px, 100%); }
.drawer.is-in { transform: none; }
.drawer__head { flex: none; display: flex; align-items: center; gap: 10px; height: 58px; padding: 0 16px 0 20px; border-bottom: 1px solid var(--line); }
.drawer__head h3 { font-size: 15px; font-weight: 700; flex: 1; letter-spacing: -.01em; }
.drawer__body { flex: 1; overflow: auto; padding: 18px 20px calc(24px + env(safe-area-inset-bottom)); }
.drawer__body .field:last-child { margin-bottom: 0; }
body.has-drawer { overflow: hidden; }

/* ---------- 骨架屏 ---------- */
.sk {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--bg-deep) 37%, var(--surface-2) 63%);
  background-size: 400% 100%;
  animation: shimmer 1.5s ease infinite;
  border-radius: 5px;
}
@keyframes shimmer { 0% { background-position: 100% 0; } 100% { background-position: 0 0; } }
.sk-list { padding: 6px 12px; }
.sk-row { display: flex; gap: 10px; padding: 10px 4px; align-items: center; }
.sk--avatar { width: 40px; height: 40px; border-radius: 50%; flex: none; }
.sk-lines { flex: 1; display: flex; flex-direction: column; gap: 7px; }
.sk--line { height: 10px; border-radius: 4px; }
.sk--line.w25 { width: 25%; } .sk--line.w40 { width: 40%; } .sk--line.w45 { width: 45%; } .sk--line.w60 { width: 60%; } .sk--line.w70 { width: 70%; }
.sk-msgs { padding: 24px; display: flex; flex-direction: column; gap: 16px; }
.sk-bubble { max-width: 62%; padding: 11px 13px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); display: flex; flex-direction: column; gap: 6px; }
.sk-bubble.right { align-self: flex-end; background: var(--surface-2); }
.sk-bubble .sk--line { height: 9px; }
.sk-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; padding: 20px; }
.sk-card { height: 150px; border-radius: var(--r-md); }

/* ---------- 空状态 ---------- */
.empty { display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 44px 22px; gap: 6px; color: var(--muted); }
.empty__art { width: 132px; max-width: 60%; margin-bottom: 4px; color: var(--line-strong); }
.empty__art svg { width: 100%; height: auto; }
.empty__title { font-size: 14px; font-weight: 600; color: var(--ink-2); }
.empty__text { font-size: 12.5px; color: var(--muted); max-width: 30em; line-height: 1.7; }
.empty .btn { margin-top: 10px; }

/* ---------- SSE / 状态点 ---------- */
.sse { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); white-space: nowrap; padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface); }
.sse .dot { width: 6px; height: 6px; background: var(--muted); }
.sse--live { color: var(--sage); border-color: transparent; background: var(--sage-soft); }
.sse--live .dot { background: var(--sage); animation: pulse 2.4s ease infinite; }
.sse--reconnecting, .sse--connecting { color: var(--gold); }
.sse--reconnecting .dot, .sse--connecting .dot { background: var(--gold); animation: pulse 1.2s ease infinite; }
.sse--offline { color: var(--muted); }
.sse--offline .dot { background: var(--muted); }
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ---------- 页面通用 ---------- */
.stack { display: flex; flex-direction: column; gap: 16px; }
.row { display: flex; align-items: center; gap: 8px; }
.row--between { justify-content: space-between; }
.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.mt-8 { margin-top: 8px; } .mt-12 { margin-top: 12px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-8 { margin-bottom: 8px; } .mb-12 { margin-bottom: 12px; } .mb-16 { margin-bottom: 16px; }
.text-sm { font-size: 12.5px; } .text-xs { font-size: 11.5px; }
.text-sage { color: var(--sage); } .text-primary { color: var(--primary-deep); } .text-gold { color: var(--gold); } .text-danger { color: var(--danger); }
.strike { text-decoration: line-through; color: var(--muted); }

/* ---------- 登录页 ---------- */
.login { display: grid; grid-template-columns: minmax(0, 1fr) 480px; min-height: 100vh; min-height: 100dvh; background: var(--bg); }
.login__story { position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: center; padding: 64px clamp(40px, 7vw, 112px); }
.login__story::before, .login__story::after { content: ""; position: absolute; border-radius: 50%; pointer-events: none; }
.login__story::before { width: 520px; height: 520px; right: -190px; top: -170px; background: radial-gradient(circle, var(--primary-soft) 0%, transparent 68%); opacity: .9; }
.login__story::after { width: 420px; height: 420px; left: -180px; bottom: -190px; background: radial-gradient(circle, var(--sage-soft) 0%, transparent 70%); }
.login__brand { display: flex; align-items: center; gap: 12px; margin-bottom: 44px; position: relative; z-index: 1; }
.login__brand-name { font-size: 19px; font-weight: 700; letter-spacing: .04em; }
.login__brand-sub { font-size: 11.5px; color: var(--muted); letter-spacing: .18em; }
.login__quote { position: relative; z-index: 1; font-size: clamp(30px, 3.3vw, 46px); line-height: 1.32; font-weight: 700; letter-spacing: -.03em; max-width: 12em; }
.login__quote em { font-style: normal; color: var(--primary); position: relative; }
.login__quote em::after { content: ""; position: absolute; left: 0; right: 0; bottom: -6px; height: 3px; border-radius: 3px; background: var(--primary-soft); }
.login__points { position: relative; z-index: 1; margin-top: 34px; display: flex; flex-direction: column; gap: 12px; }
.login__point { display: flex; gap: 10px; align-items: flex-start; color: var(--ink-2); font-size: 13.5px; }
.login__point .ico { flex: none; width: 18px; height: 18px; margin-top: 2px; color: var(--sage); }
.login__foot { position: absolute; left: clamp(40px, 7vw, 112px); bottom: 34px; font-size: 11.5px; color: var(--muted); z-index: 1; }
.login__story .login__brand { animation: rise .5s ease both; }
.login__quote { animation: rise .55s .05s ease both; }
.login__points { animation: rise .55s .12s ease both; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.login__panel { display: flex; align-items: center; justify-content: center; padding: 36px 30px; background: var(--surface); border-left: 1px solid var(--line); }
.login__card { width: 100%; max-width: 356px; }
.login__card-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.login__card h1 { font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 6px; }
.login__card .login__lead { font-size: 13px; color: var(--muted); line-height: 1.7; margin-bottom: 24px; }
.code-inputs { display: flex; gap: 10px; margin-bottom: 6px; }
.code-inputs input {
  width: 100%; height: 62px; min-width: 0;
  text-align: center; font-size: 26px; font-weight: 700;
  font-variant-numeric: tabular-nums;
  background: var(--surface-2); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: 12px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.code-inputs input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.login__error { min-height: 20px; font-size: 12.5px; color: var(--danger); margin: 4px 0 14px; }
.login__error:empty { visibility: hidden; }
.login--error .code-inputs { animation: shake .38s ease; }
.login--error .code-inputs input { border-color: var(--danger); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(5px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(3px); } }
.login__hint { font-size: 12px; color: var(--muted); line-height: 1.7; text-align: center; margin-top: 18px; }
.login__hint code { font-family: var(--mono); font-size: 11.5px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; }
.login__mobile-brand { display: none; }

/* 登录页独立布局（无左侧导航与底部栏） */
body.auth-mode { background: var(--bg); }
body.auth-mode .app { display: block; max-width: none; height: auto; min-height: 100vh; min-height: 100dvh; padding: 0; background: transparent; overflow: visible; }
body.auth-mode .rail, body.auth-mode .tabbar { display: none !important; }
body.auth-mode .main { display: block; height: auto; }
body.auth-mode .view { display: block; min-height: 100vh; min-height: 100dvh; }
@media (max-width: 859px) {
  .login { grid-template-columns: minmax(0, 1fr); }
  .login__story { display: none; }
  .login__panel { min-height: 100vh; min-height: 100dvh; align-items: flex-start; border-left: 0; background: var(--bg); padding: calc(28px + env(safe-area-inset-top)) 22px calc(28px + env(safe-area-inset-bottom)); }
  .login__card { max-width: 400px; margin: 0 auto; }
  .login__mobile-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
  .login__card h1 { font-size: 23px; }
  .code-inputs input { height: 60px; font-size: 25px; }
}
.menu.is-in { animation: menuIn .14s ease both; }
@keyframes menuIn { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }


.page-head--inbox .search-box { margin-left: auto; width: 220px; flex: none; }
.page-head--inbox .search-box .input { width: 100%; }
.page-head--inbox .head-actions { margin-left: 4px; }

/* 会话工作台 */
.inbox { display: grid; grid-template-columns: 340px minmax(0, 1fr) 300px; height: 100%; min-height: 0; }
.inbox__side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.metrics { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; background: var(--line); border-bottom: 1px solid var(--line); flex: none; }
.metric {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px;
  padding: 9px 13px 10px; border: 0; background: var(--surface);
  font: inherit; color: var(--ink); text-align: left; cursor: pointer; min-width: 0;
  transition: background .15s;
}
.metric:hover { background: var(--surface-2); }
.metric__value { display: flex; align-items: baseline; gap: 2px; font-size: 20px; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.metric__unit { font-size: 11px; font-weight: 600; color: var(--muted); }
.metric__label { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.metric--warn .metric__value { color: var(--primary-deep); }
.filters {
  display: flex; gap: 4px; padding: 10px 12px; overflow-x: auto;
  border-bottom: 1px solid var(--line); flex: none; scrollbar-width: none;
  scroll-padding-right: 22px;
}
.filters::-webkit-scrollbar { display: none; }
.filters.is-overflow {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
  mask-image: linear-gradient(to right, #000 calc(100% - 22px), transparent 100%);
}
.filters .chip { flex: none; height: 28px; padding: 0 8px; font-size: 12px; gap: 4px; }
.filters .chip .count { font-size: 10.5px; }
.conv-list { flex: 1; overflow: auto; min-height: 0; padding-bottom: 8px; }
.conv {
  display: flex; gap: 10px; width: 100%; padding: 11px 12px 11px 14px;
  border: 0; border-left: 3px solid transparent; background: transparent;
  text-align: left; font: inherit; color: inherit; cursor: pointer;
  transition: background .14s, border-color .14s;
}
.conv:hover { background: var(--surface-2); }
.conv[aria-selected="true"] { background: var(--primary-soft); border-left-color: var(--primary); }
.conv__main { flex: 1; min-width: 0; }
.conv__top { display: flex; align-items: center; gap: 6px; }
.conv__name { font-size: 13.5px; font-weight: 700; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__channel { font-size: 10px; color: var(--muted); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; line-height: 15px; flex: none; }
.conv__time { margin-left: auto; flex: none; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.conv__bottom { display: flex; align-items: center; gap: 8px; margin-top: 2px; }
.conv__last { flex: 1; min-width: 0; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv__last.is-intent { color: var(--ink-2); }
.conv__unread { flex: none; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 99px; background: var(--primary); color: #FFFDF8; font-size: 10px; font-weight: 700; line-height: 17px; text-align: center; }
.conv__tags { display: flex; gap: 4px; margin-top: 3px; }

/* 聊天区 */
.chat { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--bg); }
.chat__head { flex: none; display: flex; align-items: center; gap: 10px; padding: 0 16px; height: 64px; background: var(--surface); border-bottom: 1px solid var(--line); z-index: 4; }
.chat__back { display: none; margin-left: -6px; }
.chat__who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.chat__name { display: flex; align-items: center; gap: 6px; font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; min-width: 0; }
.chat__name .ellipsis { max-width: 15em; }
.chat__status { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--muted); margin-top: 1px; white-space: nowrap; }
.chat__actions { margin-left: auto; display: flex; align-items: center; gap: 6px; flex: none; }
.chat__body { flex: 1; min-height: 0; overflow: auto; padding: 18px clamp(14px, 3vw, 28px) 10px; overscroll-behavior: contain; }
.chat__inner { max-width: 880px; margin: 0 auto; display: flex; flex-direction: column; }
.handoff-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; margin: 0 clamp(14px, 3vw, 28px); background: var(--gold-soft); color: var(--gold); font-size: 12px; border: 1px solid transparent; border-radius: 10px; flex-wrap: wrap; }
.handoff-bar .ico { width: 15px; height: 15px; flex: none; }
.handoff-bar strong { font-weight: 700; }
.handoff-bar .btn { margin-left: auto; }
.day-sep { display: flex; align-items: center; gap: 12px; margin: 18px 0 16px; color: var(--muted); font-size: 11.5px; }
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.sys { display: flex; justify-content: center; margin: 14px 0; }
.sys span { max-width: 80%; padding: 3px 10px; border-radius: 99px; background: var(--surface-2); color: var(--muted); font-size: 11.5px; text-align: center; }
.msg { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-end; }
.msg--out { justify-content: flex-end; }
.msg__stack { display: flex; flex-direction: column; max-width: 78%; min-width: 0; }
.msg--out .msg__stack { align-items: flex-end; }
.msg__who { font-size: 10.5px; color: var(--muted); margin: 0 4px 3px; }
.bubble {
  position: relative;
  max-width: 100%; padding: 9px 13px;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-radius: 14px 14px 14px 4px;
  font-size: 14px; line-height: 1.72; word-break: break-word; white-space: pre-wrap;
  box-shadow: var(--shadow-sm);
}
.msg--out .bubble { background: var(--primary-soft); border-color: var(--primary-line); border-radius: 14px 14px 4px 14px; box-shadow: none; }
.msg__meta { display: flex; align-items: center; gap: 6px; margin: 3px 4px 0; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.msg__meta .ico { width: 12px; height: 12px; }
.bubble.is-pending { opacity: .62; }
.bubble.is-failed { border-color: var(--danger); background: var(--danger-soft); }
.msg__retry { border: 0; background: none; color: var(--danger); font: inherit; font-size: 11px; cursor: pointer; text-decoration: underline; padding: 0; }
.source-link {
  display: inline-flex; align-items: center; gap: 4px; margin: 0 4px 2px;
  padding: 0; border: 0; background: none; color: var(--muted);
  font: inherit; font-size: 10.5px; cursor: pointer; text-align: left;
}
.source-link:hover { color: var(--primary-deep); text-decoration: underline; text-underline-offset: 2px; }
.source-link .ico { width: 12px; height: 12px; }

/* 产品卡 */
.product-card { display: flex; gap: 10px; align-items: center; margin-top: 8px; padding: 9px 10px; min-width: 228px; max-width: 320px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 12px; }
.msg--out .product-card { background: var(--surface); }
.product-card__swatch { position: relative; width: 44px; height: 44px; flex: none; border-radius: 10px; background: var(--pcolor, #C97B5A); overflow: hidden; }
.product-card__swatch::after { content: ""; position: absolute; inset: 0; background: linear-gradient(140deg, rgba(255, 253, 248, .34), transparent 62%); }
.product-card__main { min-width: 0; flex: 1; }
.product-card__name { font-size: 12.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card__sub { font-size: 10.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card__price { display: flex; align-items: baseline; gap: 5px; margin-top: 2px; font-size: 12.5px; }
.product-card__price b { color: var(--primary-deep); font-weight: 700; }
.product-card__price s { font-size: 10.5px; }

/* 打字指示 */
.typing { display: inline-flex; align-items: center; gap: 8px; align-self: flex-start; padding: 9px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; color: var(--muted); font-size: 11.5px; box-shadow: var(--shadow-sm); }
.typing__dots { display: inline-flex; gap: 4px; align-items: center; height: 12px; }
.typing__dots i { width: 4px; height: 4px; border-radius: 50%; background: var(--muted); animation: typingDot 1.3s infinite ease-in-out; }
.typing__dots i:nth-child(2) { animation-delay: .16s; }
.typing__dots i:nth-child(3) { animation-delay: .32s; }
@keyframes typingDot { 0%, 60%, 100% { transform: translateY(0); opacity: .45; } 30% { transform: translateY(-3px); opacity: 1; } }

/* 输入区 */
.composer { flex: none; background: var(--surface); border-top: 1px solid var(--line); padding: 9px 16px calc(11px + env(safe-area-inset-bottom)); }
.composer__inner { max-width: 880px; margin: 0 auto; }
.composer__quick { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.composer__quick::-webkit-scrollbar { display: none; }
.composer__quick .chip { height: 27px; font-size: 12px; }
.composer__quick-label { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; color: var(--muted); flex: none; padding-right: 2px; }
.composer__box { display: flex; align-items: flex-end; gap: 6px; padding: 5px 6px 5px 10px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, box-shadow .15s, background .15s; }
.composer__box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.composer__input { flex: 1; min-width: 0; min-height: 28px; max-height: 132px; padding: 4px 0 5px; border: 0; background: none; resize: none; outline: none; font-size: 14.5px; line-height: 1.6; overflow-y: auto; }
.composer__tools { display: flex; align-items: center; gap: 2px; flex: none; }
.composer__send { width: 37px; height: 37px; border-radius: 10px; padding: 0; }
.composer__send .ico { width: 18px; height: 18px; }
.composer__hint { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.composer__mode { display: inline-flex; align-items: center; gap: 5px; }
.composer__panel { margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-md); max-height: 230px; overflow: auto; }
.composer__panel[hidden] { display: none; }
.quick-item { display: flex; flex-direction: column; gap: 1px; width: 100%; padding: 9px 12px; border: 0; border-bottom: 1px solid var(--line); background: none; text-align: left; font: inherit; cursor: pointer; }
.quick-item:last-child { border-bottom: 0; }
.quick-item:hover { background: var(--surface-2); }
.quick-item b { font-size: 12px; font-weight: 700; color: var(--ink-2); }
.quick-item span { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.emoji-grid { display: grid; grid-template-columns: repeat(9, 1fr); gap: 2px; padding: 8px; }
.emoji-grid button { height: 32px; border: 0; border-radius: 7px; background: none; font-size: 18px; line-height: 1; cursor: pointer; }
.emoji-grid button:hover { background: var(--surface-2); }
.suggest-list { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 8px; scrollbar-width: none; }
.suggest-list::-webkit-scrollbar { display: none; }
.suggest-pill { display: inline-flex; align-items: center; gap: 6px; max-width: 360px; padding: 6px 10px; border-radius: 9px; border: 1px dashed var(--line-strong); background: var(--surface); color: var(--ink-2); font-size: 11.5px; line-height: 1.5; text-align: left; cursor: pointer; flex: none; }
.suggest-pill:hover { border-color: var(--primary); color: var(--primary-deep); background: var(--primary-soft); }
.suggest-pill b { font-size: 10px; color: var(--primary); font-weight: 700; flex: none; }
.suggest-pill span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-pill--empty { border-style: solid; color: var(--muted); cursor: default; }
.suggest-pill--empty:hover { border-color: var(--line); color: var(--muted); background: var(--surface); }

/* 右侧资料栏 */
.profile { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-left: 1px solid var(--line); overflow: auto; overscroll-behavior: contain; }
.profile__hero { display: flex; align-items: center; gap: 12px; padding: 20px 18px 16px; border-bottom: 1px solid var(--line); }
.profile__name { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
.profile__sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.profile__section { padding: 14px 18px; border-bottom: 1px solid var(--line); }
.profile__section:last-child { border-bottom: 0; }
.profile__section h4 { display: flex; align-items: center; gap: 6px; margin-bottom: 9px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.profile__section h4 .ico { width: 13px; height: 13px; }
.profile__section .badge { margin-bottom: 2px; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); column-gap: 10px; row-gap: 4px; padding: 2.5px 0; font-size: 12.5px; }
.kv dt { color: var(--muted); }
.kv dd { min-width: 0; margin: 0; text-align: right; color: var(--ink-2); word-break: break-word; }
.kv dd .tag { margin: 1px 0 1px 3px; }
.profile__note { font-size: 12.5px; color: var(--ink-2); line-height: 1.7; white-space: pre-wrap; }
.profile__empty { font-size: 12px; color: var(--muted); }
.profile__actions { display: flex; gap: 6px; margin-top: 10px; }
.order-card { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.order-card__no { font-family: var(--mono); font-size: 10.5px; color: var(--muted); }
.order-card__name { font-size: 12.5px; font-weight: 700; margin: 2px 0; }
.order-card__meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 11.5px; color: var(--muted); }
.lead-card { padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); }
.lead-card__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; }
.lead-card__row + .lead-card__row { margin-top: 6px; }
.citation-item { display: flex; align-items: center; gap: 6px; width: 100%; padding: 6px 0; border: 0; background: none; color: var(--ink-2); font: inherit; font-size: 12px; text-align: left; cursor: pointer; }
.citation-item:hover { color: var(--primary-deep); }
.citation-item .ico { width: 14px; height: 14px; flex: none; color: var(--muted); }
.citation-item span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.citation-item em { font-style: normal; font-size: 10.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.quick-reply-item { display: flex; flex-direction: column; width: 100%; padding: 6px 0; border: 0; background: none; text-align: left; font: inherit; cursor: pointer; color: var(--ink-2); font-size: 12px; }
.quick-reply-item b { font-size: 11px; color: var(--muted); font-weight: 600; }
.quick-reply-item:hover { color: var(--primary-deep); }
.quick-reply-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: 15px; height: 15px; }
.stars .is-off { color: var(--line-strong); }

/* 菜单 */
.menu { position: absolute; z-index: 60; min-width: 176px; padding: 6px; background: var(--surface); border: 1px solid var(--line); border-radius: 11px; box-shadow: var(--shadow-md); }
.menu__item { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; }
.menu__item:hover { background: var(--surface-2); color: var(--ink); }
.menu__item .ico { width: 16px; height: 16px; }
.menu__item--danger { color: var(--danger); }
.menu__item--danger:hover { background: var(--danger-soft); color: var(--danger); }
.menu__sep { height: 1px; margin: 5px 4px; background: var(--line); }

/* ==========================================================================
   响应式：会话工作台
   ========================================================================== */
@media (max-width: 1179px) {
  .app { grid-template-columns: 72px minmax(0, 1fr); }
  .rail__link { width: 48px; height: 46px; padding: 0; justify-content: center; gap: 0; }
  .rail__link > span:not(.rail__badge) { display: none; }
  .rail__link .ico { width: 22px; height: 22px; }
  .rail__badge { top: 2px; right: 1px; }
  .rail__brand .brand-mark { width: 38px; height: 38px; }
  .inbox { grid-template-columns: 300px minmax(0, 1fr); }
  .profile { display: none; }
  .page-head--inbox .search-box { width: 180px; }
  .chat__actions .btn .label { display: none; }
  .chat__actions .btn { padding: 0 10px; }
}

@media (max-width: 859px) {
  .app { grid-template-columns: minmax(0, 1fr); padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
  .rail { display: none; }
  .tabbar {
    display: flex; align-items: stretch;
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--line);
  }
  .tabbar__link { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 10.5px; line-height: 1.2; position: relative; }
  .tabbar__link .ico { width: 21px; height: 21px; }
  .tabbar__link[aria-current="page"] { color: var(--primary-deep); font-weight: 600; }
  .tabbar__link[aria-current="page"] .ico { stroke-width: 1.9; }
  .tabbar__badge { position: absolute; top: 7px; left: 50%; margin-left: 4px; min-width: 15px; height: 15px; padding: 0 4px; border-radius: 99px; background: var(--primary); color: #FFFDF8; font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center; }
  .page-head { height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 14px 0; gap: 8px; }
  .page-title { font-size: 16.5px; }
  .page-sub { display: none; }
  .page-head--inbox { flex-wrap: wrap; align-items: center; height: auto; min-height: calc(56px + env(safe-area-inset-top)); padding: calc(env(safe-area-inset-top) + 7px) 14px 9px; row-gap: 8px; }
  .page-head--inbox .page-head__title { flex: 1; }
  .page-head--inbox .head-actions { margin-left: auto; gap: 6px; }
  .page-head--inbox .search-box { order: 9; flex: 1 0 100%; width: 100%; margin-left: 0; }
  .page-head--inbox .search-box .input { width: 100%; height: 38px; min-height: 38px; font-size: 16px; }
  .page-head--inbox .auto-toggle__label { display: none; }
  .page-head--inbox .btn--simulate .label { display: none; }
  .page-head--kb { flex-wrap: wrap; height: auto; min-height: calc(56px + env(safe-area-inset-top)); padding: calc(env(safe-area-inset-top) + 7px) 14px 9px; row-gap: 8px; }
  .page-head--kb .page-head__title { flex: 1 0 auto; }
  .page-head--kb .segmented { order: 5; flex: 1 0 100%; }
  .page-head--kb .head-actions { order: 6; flex: 1 0 100%; margin-left: 0; flex-wrap: wrap; }
  .page-head--kb .head-actions .btn { flex: 1; }
  .page-head--kb .head-actions .sse { flex: none; }
  .head-actions .hide-sm { display: none; }
  .inbox { position: relative; display: block; height: 100%; }
  .inbox__side { height: 100%; border-right: 0; }
  .conv-list { padding-bottom: calc(70px + env(safe-area-inset-bottom)); }
  .filters { gap: 4px; padding: 8px 10px; scroll-padding-right: 16px; }
  .filters .chip { height: 28px; padding: 0 8px; font-size: 11.5px; }
  .filters .chip .count { font-size: 10px; }
  .settings__nav { scroll-padding-inline: 14px; }
  .chat { display: none; height: 100%; }
  .view--inbox.mobile-chat .page-head { display: none; }
  .view--inbox.mobile-chat .inbox__side { display: none; }
  .view--inbox.mobile-chat .chat { display: flex; }
  body.mobile-chat .tabbar { display: none; }
  body.mobile-chat .app { padding-bottom: 0; }
  .chat__back { display: inline-flex; }
  .chat__head { height: calc(56px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) 8px 0; gap: 6px; }
  .chat__name { font-size: 14px; }
  .chat__name .ellipsis { max-width: 9.5em; }
  .chat__actions { gap: 2px; }
  .chat__actions .btn .label { display: none; }
  .chat__actions [data-action="suggest"], .chat__actions [data-action="toggle-mode"] { display: none; }
  .chat__actions .hide-mobile { display: none; }
  .chat__body { padding: 14px 12px 8px; }
  .msg__stack { max-width: 86%; }
  .bubble { font-size: 14.5px; padding: 9px 12px; }
  .composer { padding: 7px 10px calc(8px + env(safe-area-inset-bottom)); }
  .composer__input { font-size: 16px; }
  .composer__hint { display: none; }
  .composer__box { padding: 5px 5px 5px 11px; border-radius: 13px; }
  .composer__send { width: 38px; height: 38px; }
  .composer__quick .chip { height: 28px; }
  .handoff-bar { margin: 0 12px; }
  .empty { padding: 34px 22px; }
}

@media (max-width: 360px) {
  .metrics { grid-template-columns: 1fr; }
}

/* ==========================================================================
   知识库
   ========================================================================== */
.segmented { display: inline-flex; gap: 2px; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; flex: none; }
.segmented button { height: 28px; padding: 0 12px; border: 0; border-radius: 7px; background: none; color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; cursor: pointer; transition: .15s; }
.segmented button:hover { color: var(--ink-2); }
.segmented button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.segmented button .count { margin-left: 4px; color: var(--muted); font-weight: 500; font-size: 11px; }
.kb { display: grid; grid-template-columns: 320px minmax(0, 1fr); height: 100%; min-height: 0; }
.kb__list { display: flex; flex-direction: column; min-height: 0; background: var(--surface); border-right: 1px solid var(--line); }
.kb__list-head { flex: none; display: flex; flex-direction: column; gap: 8px; padding: 12px 12px; border-bottom: 1px solid var(--line); }
.kb__count { font-size: 11px; color: var(--muted); white-space: nowrap; }
.kb__items { flex: 1; overflow: auto; min-height: 0; padding: 8px; }
.kb-item { display: block; width: 100%; padding: 10px 11px; margin-bottom: 2px; border: 1px solid transparent; border-radius: 10px; background: none; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.kb-item:hover { background: var(--surface-2); }
.kb-item[aria-selected="true"] { background: var(--primary-soft); border-color: var(--primary-line); }
.kb-item__top { display: flex; align-items: center; gap: 6px; }
.kb-item__title { flex: 1; min-width: 0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item__q { margin-top: 2px; font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-item__meta { display: flex; align-items: center; gap: 6px; margin-top: 5px; font-size: 10.5px; color: var(--muted); }
.kb-item__meta .tag { height: 19px; font-size: 10.5px; }
.kb__editor { min-width: 0; overflow: auto; padding: 22px clamp(16px, 3vw, 32px) 56px; }
.editor { max-width: 740px; margin: 0 auto; }
.editor__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.editor__head h2 { font-size: 17px; font-weight: 700; letter-spacing: -.02em; flex: 1; min-width: 0; }
.editor__head h2 small { display: block; font-size: 11px; font-weight: 500; color: var(--muted); letter-spacing: 0; margin-top: 2px; }
.kb-mobile-back { display: none; flex: none; margin-right: 2px; }
.editor__toolbar { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.editor__card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 14px; }
.editor__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.editor__hint { font-size: 11.5px; color: var(--muted); margin-top: -8px; margin-bottom: 14px; line-height: 1.7; }
.editor__foot { display: flex; align-items: center; gap: 8px; padding-top: 4px; }
.editor__foot .grow { flex: 1; }
.priority-row { display: flex; align-items: center; gap: 10px; }
.priority-row .input { width: 90px; }
.products-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 16px clamp(14px, 2.5vw, 26px) 0; }
.kb-policy { width: 100%; max-width: 860px; margin: 0 auto; padding: 20px clamp(16px, 3vw, 32px) 44px; }
.kb-policy .settings-card { margin-bottom: 14px; }
.kb-policy .policy-flow { margin-top: 2px; }
.products { display: grid; grid-template-columns: repeat(auto-fill, minmax(244px, 1fr)); gap: 14px; padding: 16px clamp(14px, 2.5vw, 26px) 40px; }
.product-tile { display: flex; flex-direction: column; align-items: stretch; padding: 0; overflow: hidden; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-align: left; font: inherit; color: inherit; cursor: pointer; transition: transform .16s, border-color .16s, box-shadow .16s; }
.product-tile:hover { transform: translateY(-1px); border-color: var(--line-strong); box-shadow: var(--shadow-md); }
.product-tile.is-off { opacity: .6; }
.product-tile__top { position: relative; height: 78px; background: var(--pcolor, #C97B5A); display: flex; align-items: flex-end; padding: 9px 11px; }
.product-tile__top::after { content: ""; position: absolute; inset: 0; background: linear-gradient(150deg, rgba(255, 253, 248, .3), transparent 60%); }
.product-tile__top .tag { position: relative; z-index: 1; background: rgba(255, 253, 248, .82); border-color: transparent; color: rgba(36, 32, 25, .8); }
.product-tile__badge { position: absolute; top: 8px; right: 8px; z-index: 1; font-size: 10px; background: rgba(36, 32, 25, .5); color: #FFFDF8; border-radius: 99px; padding: 1px 7px; }
.product-tile__body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.product-tile__name { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-tile__meta { font-size: 11px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-tile__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 5px; }
.price { font-size: 16px; font-weight: 700; color: var(--primary-deep); font-variant-numeric: tabular-nums; }
.price s { font-size: 11px; font-weight: 400; color: var(--muted); margin-left: 5px; }
.stock { font-size: 11px; color: var(--muted); }
.stock--low { color: var(--gold); font-weight: 600; }
.stock--out { color: var(--muted); }
.test-panel { display: flex; flex-direction: column; gap: 12px; }
.test-bubbles { display: flex; flex-direction: column; gap: 8px; min-height: 60px; }
.test-bubble { align-self: flex-start; max-width: 92%; padding: 9px 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; font-size: 12.5px; line-height: 1.7; animation: rise .24s ease both; }
.test-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.test-result-row { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.test-result-row b { color: var(--ink-2); font-weight: 600; }

/* ==========================================================================
   客户
   ========================================================================== */
.customers { padding: 18px clamp(14px, 2.4vw, 28px) 44px; max-width: 1320px; margin: 0 auto; width: 100%; }
.lead-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.lead-stat { padding: 13px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.lead-stat__label { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); }
.lead-stat__label .dot { background: var(--gold); }
.lead-stat:nth-child(2) .dot { background: var(--sage); }
.lead-stat:nth-child(3) .dot { background: var(--primary); }
.lead-stat__value { margin-top: 2px; font-size: 24px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.data-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.data-table th { padding: 11px 16px; background: var(--surface-2); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .05em; text-align: left; white-space: nowrap; }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .14s; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.cell-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.cell-person b { font-weight: 600; }
.cell-person__meta { font-size: 11px; color: var(--muted); }
.cell-sub { font-size: 11.5px; color: var(--muted); }
.cell-tags { display: flex; flex-wrap: wrap; gap: 4px; max-width: 190px; }
.cust-list { display: none; flex-direction: column; gap: 10px; padding: 12px; }
.cust-card { display: flex; flex-direction: column; gap: 8px; width: 100%; padding: 13px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 13px; text-align: left; font: inherit; color: inherit; cursor: pointer; }
.cust-card:active { background: var(--surface-2); }
.cust-card__top { display: flex; align-items: center; gap: 10px; }
.cust-card__name { font-size: 14px; font-weight: 700; }
.cust-card__meta { font-size: 11px; color: var(--muted); }
.cust-card__row { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 12px; color: var(--ink-2); }
.cust-card__row .muted { font-size: 11px; }
.detail-hero { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.detail-hero h4 { font-size: 16px; font-weight: 700; }
.detail-hero p { font-size: 11.5px; color: var(--muted); }
.detail-block { padding: 14px 0; border-top: 1px solid var(--line); }
.detail-block:first-of-type { border-top: 0; padding-top: 0; }
.detail-block h5 { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; font-size: 11px; font-weight: 700; letter-spacing: .06em; color: var(--muted); }
.detail-block h5 .ico { width: 13px; height: 13px; }

/* ==========================================================================
   数据
   ========================================================================== */
.stats { width: 100%; max-width: 1320px; margin: 0 auto; padding: 18px clamp(14px, 2.4vw, 28px) 48px; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.kpi { padding: 14px 16px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.kpi__label { font-size: 11.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi__value { display: flex; align-items: baseline; gap: 2px; margin-top: 2px; font-size: 24px; font-weight: 700; letter-spacing: -.025em; line-height: 1.25; font-variant-numeric: tabular-nums; }
.kpi__value small { font-size: 11px; font-weight: 600; color: var(--muted); letter-spacing: 0; }
.kpi__hint { margin-top: 2px; font-size: 10.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chart-grid { display: grid; grid-template-columns: minmax(0, 1.62fr) minmax(0, 1fr); gap: 14px; margin-bottom: 16px; }
.chart-grid--even { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-card { padding: 16px 18px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; }
.chart-card__head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.chart-card__head h3 { font-size: 13.5px; font-weight: 700; }
.chart-card__head .muted { font-size: 11px; margin-left: auto; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font-family: var(--font); fill: var(--muted); font-size: 9.5px; }
.chart .grid-line { stroke: var(--line); stroke-width: 1; }
.chart .axis-line { stroke: var(--line-strong); stroke-width: 1; }
.chart .series-primary { fill: none; stroke: var(--primary); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart .series-sage { fill: none; stroke: var(--sage); stroke-width: 1.8; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot-primary { fill: var(--surface); stroke: var(--primary); stroke-width: 1.6; }
.chart .dot-sage { fill: var(--surface); stroke: var(--sage); stroke-width: 1.6; }
.chart .area-primary { fill: var(--primary); opacity: .07; }
.chart .bar-primary { fill: var(--primary); opacity: .85; }
.chart .bar-sage { fill: var(--sage); opacity: .7; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 8px; font-size: 11px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.chart-legend i { width: 10px; height: 3px; border-radius: 2px; background: var(--primary); }
.chart-legend i.sage { background: var(--sage); }
.bars { display: flex; flex-direction: column; gap: 11px; }
.bar-row { display: grid; grid-template-columns: 74px minmax(0, 1fr) 34px; align-items: center; gap: 10px; font-size: 12px; }
.bar-row__label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.bar-row__value { text-align: right; color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.bar-track { height: 7px; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; background: var(--sage); transition: width .5s ease; }
.bar-fill--primary { background: var(--primary); }
.unanswered { display: flex; flex-direction: column; }
.unanswered__row { display: flex; align-items: center; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 12.5px; }
.unanswered__row:last-child { border-bottom: 0; }
.unanswered__text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.unanswered__count { flex: none; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.channel-list { display: flex; flex-direction: column; gap: 9px; }
.channel-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.channel-row .bar-track { flex: 1; }
.channel-row b { width: 34px; text-align: right; font-size: 11px; color: var(--muted); font-weight: 500; }

/* ==========================================================================
   设置
   ========================================================================== */
.view--settings .page-body { overflow: hidden; }
.settings { display: grid; grid-template-columns: 214px minmax(0, 1fr); height: 100%; min-height: 0; }
.settings__nav { padding: 14px 10px; background: var(--surface); border-right: 1px solid var(--line); overflow: auto; }
.settings__nav button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 11px; margin-bottom: 2px; border: 1px solid transparent; border-radius: 9px; background: none; color: var(--ink-2); font: inherit; font-size: 12.5px; text-align: left; cursor: pointer; transition: .15s; }
.settings__nav button .ico { width: 16px; height: 16px; color: var(--muted); flex: none; }
.settings__nav button:hover { background: var(--surface-2); }
.settings__nav button[aria-current="true"] { background: var(--primary-soft); color: var(--primary-deep); font-weight: 600; }
.settings__nav button[aria-current="true"] .ico { color: var(--primary); }
.settings__nav-note { margin: 14px 11px 0; padding-top: 12px; border-top: 1px solid var(--line); font-size: 10.5px; color: var(--muted); line-height: 1.7; }
.settings__body { overflow: auto; padding: 22px clamp(16px, 3vw, 36px) 72px; }
.settings__inner { max-width: 760px; margin: 0 auto; }
.settings-card { padding: 20px 22px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 14px; }
.settings-card h3 { font-size: 14.5px; font-weight: 700; letter-spacing: -.01em; }
.settings-card__desc { margin: 4px 0 18px; font-size: 12px; color: var(--muted); line-height: 1.75; }
.settings-card .field:last-child { margin-bottom: 0; }
.settings-card--soft { background: var(--surface-2); }
.settings-note { display: flex; gap: 8px; padding: 10px 12px; background: var(--sage-soft); color: var(--sage); border-radius: 10px; font-size: 11.5px; line-height: 1.7; margin-bottom: 16px; }
.settings-note .ico { width: 15px; height: 15px; flex: none; margin-top: 1px; }
.settings-note--warn { background: var(--gold-soft); color: var(--gold); }
.settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.save-bar { position: static; display: flex; align-items: center; gap: 10px; margin-top: 8px; padding: 11px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-sm); }
.save-bar--sticky { position: sticky; bottom: 0; z-index: 6; box-shadow: var(--shadow-md); }
.save-bar__text { font-size: 11.5px; color: var(--muted); flex: 1; min-width: 0; }
.qr-box { width: 232px; max-width: 100%; aspect-ratio: 1; margin: 0 auto; padding: 12px; display: grid; place-items: center; background: #FFFDF8; border: 1px solid var(--line); border-radius: 16px; }
.qr-box svg { display: block; width: 100%; height: 100%; }
.qr-box--empty { color: #8B8173; font-size: 12px; text-align: center; line-height: 1.7; }
.qr-caption { margin-top: 10px; text-align: center; font-size: 11.5px; color: var(--muted); line-height: 1.7; }
.device-url { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; font-family: var(--mono); font-size: 12px; color: var(--ink-2); word-break: break-all; }
.device-url .icon-btn { margin-left: auto; flex: none; }
.steps { counter-reset: step; display: flex; flex-direction: column; gap: 12px; margin: 4px 0 0; }
.steps li { position: relative; padding-left: 34px; font-size: 12.5px; line-height: 1.7; color: var(--ink-2); list-style: none; }
.steps li::before { counter-increment: step; content: counter(step); position: absolute; left: 0; top: 0; width: 22px; height: 22px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep); font-size: 11px; font-weight: 700; line-height: 22px; text-align: center; }
.steps li b { font-weight: 700; color: var(--ink); }
.test-out { margin-top: 12px; padding: 11px 13px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--line); font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.test-out--ok { border-color: transparent; background: var(--sage-soft); color: var(--sage); }
.test-out--err { border-color: transparent; background: var(--danger-soft); color: var(--danger); }
.test-out b { font-weight: 700; }
.preview-phone { position: sticky; top: 0; width: 100%; max-width: 300px; margin-left: auto; padding: 14px 14px 16px; background: var(--bg); border: 1px solid var(--line); border-radius: 22px; }
.preview-phone__bar { display: flex; align-items: center; gap: 7px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.preview-phone__name { font-size: 12px; font-weight: 700; }
.preview-phone__status { font-size: 9.5px; color: var(--sage); }
.preview-phone__body { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; min-height: 210px; }
.preview-bubble { align-self: flex-start; max-width: 88%; padding: 8px 11px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px 12px 12px 4px; font-size: 11.5px; line-height: 1.65; color: var(--ink-2); white-space: pre-wrap; word-break: break-word; }
.preview-bubble--warm { background: var(--primary-soft); border-color: var(--primary-line); color: var(--ink); }
.preview-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.preview-chips span { padding: 2px 8px; border: 1px solid var(--line); border-radius: 99px; font-size: 9.5px; color: var(--muted); background: var(--surface); }
.preview-phone__hint { margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--line); font-size: 10px; color: var(--muted); text-align: center; }
.danger-zone { border-color: var(--danger-soft); }
.danger-zone h3 { color: var(--danger); }
.meta-list { display: flex; flex-direction: column; gap: 6px; font-size: 12px; }
.meta-list div { display: flex; justify-content: space-between; gap: 12px; }
.meta-list dt, .meta-list span:first-child { color: var(--muted); }
.meta-list dd, .meta-list span:last-child { margin: 0; color: var(--ink-2); text-align: right; word-break: break-all; }

/* 设置响应式 */
@media (max-width: 1023px) {
  .settings-grid { grid-template-columns: 1fr; }
  .preview-phone { position: static; max-width: 320px; margin: 0 auto; }
  .kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .chart-grid { grid-template-columns: 1fr; }
  .chart-grid--even { grid-template-columns: 1fr; }
}
@media (max-width: 859px) {
  .view--settings .page-body { overflow: auto; }
  .settings { display: block; height: auto; }
  .settings__nav { position: sticky; top: 0; z-index: 8; display: flex; gap: 6px; padding: 9px 12px; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); scrollbar-width: none; background: var(--bg); }
  .settings__nav::-webkit-scrollbar { display: none; }
  .settings__nav button { flex: none; width: auto; height: 31px; margin: 0; padding: 0 12px; border-radius: 99px; border-color: var(--line); background: var(--surface); white-space: nowrap; }
  .settings__nav button[aria-current="true"] { border-color: var(--primary-line); }
  .settings__nav button .ico { width: 14px; height: 14px; }
  .settings__nav-note { display: none; }
  .settings__body { overflow: visible; padding: 14px 12px 40px; }
  .settings-card { padding: 16px 14px; border-radius: 14px; }
  .form-grid, .editor__grid { grid-template-columns: 1fr; }
  .form-grid--3 { grid-template-columns: 1fr; }
  .save-bar { border-radius: 12px; }
  .qr-box { width: 220px; }
  .kb { display: block; height: auto; }
  .kb__list { border-right: 0; height: auto; }
  .kb__items { overflow: visible; }
  .kb__editor { padding: 16px 12px 40px; }
  .kb-mobile-back { display: inline-flex; }
  .kb--editing .kb__list { display: none; }
  .kb:not(.kb--editing) .kb__editor { display: none; }
  .editor__head { margin-bottom: 14px; }
  .products { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; padding: 12px; }
  .products-toolbar { padding: 12px 12px 0; }
  .products-toolbar .search-box { flex: 1; }
  .products-toolbar .search-box .input { width: 100%; }
  .kb-mobile-hide { display: none !important; }
  .kb-policy { padding: 14px 12px 34px; }
  .segmented button { padding: 0 9px; }
  .kb-policy .segmented button { flex: 0 0 auto; }
  .customers { padding: 12px 12px 32px; }
  .lead-stats { gap: 8px; margin-bottom: 12px; }
  .lead-stat { padding: 10px 12px; }
  .lead-stat__value { font-size: 20px; }
  .table-wrap { display: none; }
  .cust-list { display: flex; }
  .stats { padding: 12px 12px 32px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .kpi { padding: 11px 12px; }
  .kpi__value { font-size: 21px; }
  .chart-card { padding: 13px 13px 10px; }
  .chart-grid { gap: 10px; }
  .bar-row { grid-template-columns: 66px minmax(0, 1fr) 30px; gap: 7px; font-size: 11.5px; }
  .lead-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* ==========================================================================
   顾客聊天页 /c/<token>
   ========================================================================== */
body.chat-body { background: var(--bg-deep); }
.chat-page {
  position: relative;
  display: flex; flex-direction: column;
  height: 100vh; height: var(--app-height, 100dvh);
  width: 100%; max-width: min(720px, 100vw); margin: 0 auto;
  background: var(--bg);
  border-left: 1px solid var(--line); border-right: 1px solid var(--line);
  box-shadow: 0 0 60px -30px rgba(36, 32, 25, .3);
  overflow: hidden;
}
.chat-page__bar {
  flex: none; display: flex; align-items: center; gap: 10px;
  height: calc(60px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 16px 0;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  z-index: 6;
}
.chat-page__shop { display: flex; align-items: center; gap: 9px; min-width: 0; }
.chat-page__shop-name { font-size: 14px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-page__status { display: flex; align-items: center; gap: 5px; font-size: 10.5px; color: var(--sage); white-space: nowrap; }
.chat-page__status .dot { width: 5px; height: 5px; background: var(--sage); animation: pulse 2.4s ease infinite; }
.chat-page__bar-actions { margin-left: auto; display: flex; align-items: center; gap: 4px; flex: none; }
.chat-page__stream { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 14px; scroll-behavior: auto; }
.chat-page__inner { max-width: 640px; margin: 0 auto; }
.chat-welcome {
  position: relative; overflow: hidden;
  margin: 0 -16px 16px; padding: 24px 18px 18px;
  background:
    radial-gradient(120% 90% at 88% 0%, var(--primary-soft) 0%, transparent 62%),
    radial-gradient(90% 80% at 0% 100%, var(--sage-soft) 0%, transparent 60%),
    var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.chat-welcome::after { content: ""; position: absolute; inset: 0; background-image: radial-gradient(var(--grain) .8px, transparent .8px); background-size: 5px 5px; pointer-events: none; }
.chat-welcome__top { position: relative; z-index: 1; display: flex; align-items: center; gap: 11px; }
.chat-welcome__name { font-size: 16px; font-weight: 700; letter-spacing: -.02em; }
.chat-welcome__role { font-size: 11.5px; color: var(--muted); }
.chat-welcome__text { position: relative; z-index: 1; margin-top: 13px; font-size: 14px; line-height: 1.8; color: var(--ink); max-width: 26em; white-space: pre-wrap; }
.chat-welcome__chips { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.chat-welcome__chips .chip { background: var(--surface); height: 31px; font-size: 12.5px; }
.chat-welcome__hint { position: relative; z-index: 1; margin-top: 12px; font-size: 10.5px; color: var(--muted); }
.cmsg { display: flex; align-items: flex-end; gap: 8px; margin-bottom: 12px; }
.cmsg--me { flex-direction: row-reverse; }
.cmsg__stack { display: flex; flex-direction: column; align-items: flex-start; max-width: 80%; min-width: 0; }
.cmsg--me .cmsg__stack { align-items: flex-end; }
.cmsg__bubble { position: relative; padding: 9px 13px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px 14px 14px 4px; font-size: 14.5px; line-height: 1.75; white-space: pre-wrap; word-break: break-word; color: var(--ink); box-shadow: var(--shadow-sm); }
.cmsg--me .cmsg__bubble { background: var(--primary); border-color: var(--primary); color: #FFFDF8; border-radius: 14px 14px 4px 14px; box-shadow: 0 6px 14px -12px rgba(174, 74, 46, .8); }
.cmsg--agent .cmsg__bubble { background: var(--sage-soft); border-color: transparent; }
.cmsg--me .cmsg__bubble.is-pending { opacity: .65; }
.cmsg__bubble.is-failed { border-color: var(--danger); }
.cmsg__meta { display: flex; align-items: center; gap: 6px; margin: 3px 4px 0; font-size: 10px; color: var(--muted); }
.cmsg__retry { border: 0; background: none; padding: 0; color: var(--danger); font-size: 10.5px; text-decoration: underline; cursor: pointer; }
.cmsg .avatar { width: 30px; height: 30px; font-size: 12px; }
.cmsg--me .avatar { display: none; }
.chat-page .product-card { background: var(--surface); }
.chat-page__composer {
  flex: none; padding: 9px 14px calc(10px + env(safe-area-inset-bottom));
  background: var(--surface); border-top: 1px solid var(--line);
  z-index: 5;
}
.chat-page__composer-inner { max-width: 640px; margin: 0 auto; }
.chat-page__input-row { display: flex; align-items: flex-end; gap: 8px; padding: 5px 6px 5px 13px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 16px; transition: border-color .15s, box-shadow .15s, background .15s; }
.chat-page__input-row:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: var(--surface); }
.chat-page__input { flex: 1; min-width: 0; min-height: 30px; max-height: 120px; padding: 5px 0; border: 0; background: none; resize: none; outline: none; font-size: 16px; line-height: 1.6; }
.chat-page__send { width: 38px; height: 38px; border-radius: 11px; padding: 0; flex: none; }
.chat-page__send .ico { width: 18px; height: 18px; }
.chat-page__foot { margin-top: 6px; text-align: center; font-size: 10px; color: var(--muted); }
.chat-page .typing { margin-bottom: 12px; }
.rating-card { margin: 18px 0 8px; padding: 18px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; text-align: center; box-shadow: var(--shadow-sm); }
.rating-card h4 { font-size: 14px; font-weight: 700; }
.rating-card p { margin-top: 4px; font-size: 12px; color: var(--muted); }
.rating-stars { display: flex; justify-content: center; gap: 6px; margin: 14px 0 6px; }
.rating-stars button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface-2); color: var(--line-strong); display: grid; place-items: center; cursor: pointer; transition: .15s; }
.rating-stars button .ico { width: 22px; height: 22px; }
.rating-stars button:hover, .rating-stars button.is-on { color: var(--gold); border-color: var(--gold); background: var(--gold-soft); transform: translateY(-1px); }
.rating-card .textarea { min-height: 60px; margin-top: 10px; font-size: 13px; text-align: left; }
.rating-card .btn { margin-top: 10px; }
.rating-thanks { font-size: 12.5px; color: var(--sage); }
.chat-notice { display: flex; align-items: center; justify-content: center; gap: 6px; margin: 12px 0; padding: 7px 12px; border-radius: 9px; background: var(--sage-soft); color: var(--sage); font-size: 11.5px; text-align: center; }
.chat-error { margin: 16px; padding: 20px; text-align: center; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.chat-error h3 { font-size: 15px; font-weight: 700; margin-bottom: 6px; }
.chat-error p { font-size: 12.5px; color: var(--muted); line-height: 1.7; margin-bottom: 14px; }
body.embed .chat-page { max-width: none; border: 0; box-shadow: none; height: 100vh; height: var(--app-height, 100dvh); }
body.embed .chat-page__bar { display: none; }
body.embed .chat-page__stream { padding-top: 0; }
body.embed .chat-welcome { margin-top: 0; border-radius: 0; }
@media (max-width: 720px) {
  .chat-page { border: 0; box-shadow: none; max-width: none; }
  .chat-page__bar { padding-left: 12px; padding-right: 12px; }
  .chat-welcome { margin-left: -12px; margin-right: -12px; padding-left: 14px; padding-right: 14px; }
  .chat-page__stream { padding-left: 12px; padding-right: 12px; }
  .cmsg__stack { max-width: 84%; }
  .cmsg__bubble { font-size: 15px; }
  .chat-page__composer { padding-left: 10px; padding-right: 10px; }
}
@media (min-width: 721px) {
  body.chat-body { padding: 0; }
}

/* ---------- 启动骨架 ---------- */
.boot { height: 100dvh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; color: var(--muted); }
.boot__logo { animation: bootPulse 1.8s ease-in-out infinite; }
.boot__text { font-size: 12px; letter-spacing: .08em; }
@keyframes bootPulse { 0%, 100% { opacity: 1; transform: translateY(0); } 50% { opacity: .55; transform: translateY(-2px); } }

/* ---------- 动效偏好 / 可访问性 ---------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
    scroll-behavior: auto !important;
  }
  .sk { background: var(--surface-2); }
}
@media (prefers-reduced-motion: no-preference) {
  .msg--new { animation: msgIn .18s ease both; }
  @keyframes msgIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
}
/* ==========================================================================
   截图回复 · 工作台
   ========================================================================== */
.shot { display: grid; grid-template-columns: minmax(0, 1.02fr) minmax(0, .98fr); gap: 16px; align-items: start; width: 100%; max-width: 1480px; margin: 0 auto; padding: 16px clamp(14px, 2vw, 24px) 44px; }
.shot__col { display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.shot-card { padding: 16px 18px 18px; border-radius: 16px; min-width: 0; }
.shot-card__head { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 12px; }
.shot-card__head > div:first-child { flex: 1; min-width: 0; }
.shot-card__head > .badge, .shot-card__head > .segmented { flex: none; }
.shot-card__head h3 { display: flex; align-items: center; gap: 6px; font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.shot-card__head h3 .muted { font-size: 11px; font-weight: 500; }
.shot-card__head p { margin-top: 2px; font-size: 11.5px; line-height: 1.65; color: var(--muted); max-width: 36em; }
.shot-card__head .segmented { margin-left: auto; flex: none; }
.shot-card .section-title { margin-bottom: 10px; }

/* 上传 */
.upload-paper { position: relative; display: flex; align-items: center; justify-content: center; min-height: 196px; padding: 14px; border: 1px dashed var(--line-strong); border-radius: 14px; background: var(--surface-2); cursor: pointer; transition: background .16s, border-color .16s, box-shadow .16s; overflow: hidden; }
.upload-paper:hover { border-color: var(--primary); background: var(--surface); }
.upload-paper.has-image { border-style: solid; background: var(--bg-deep); padding: 18px 14px 20px; min-height: 0; cursor: default; }
.upload-paper.is-drag { border-color: var(--primary); background: var(--primary-soft); box-shadow: 0 0 0 3px var(--primary-soft); }
.upload-empty { padding: 12px; text-align: center; }
.upload-empty__art { display: grid; place-items: center; width: 56px; height: 56px; margin: 0 auto 10px; border-radius: 17px; background: var(--primary-soft); color: var(--primary); }
.upload-empty__art .ico { width: 27px; height: 27px; }
.upload-empty__title { font-size: 13.5px; font-weight: 700; }
.upload-empty__text { margin-top: 4px; font-size: 11.5px; line-height: 1.8; color: var(--muted); }
.shot-paper { position: relative; width: 100%; max-width: 430px; margin: 0 auto; padding: 10px; background: #FFFDF8; border: 1px solid #E8DFD2; border-radius: 8px; box-shadow: 0 18px 34px -20px rgba(36, 32, 25, .45); }
.shot-paper img { display: block; width: 100%; height: auto; max-height: 430px; object-fit: contain; border-radius: 4px; background: #FFFDF8; }
.shot-paper__tape { position: absolute; top: -8px; left: 50%; width: 76px; height: 18px; transform: translateX(-50%) rotate(-1.4deg); background: rgba(204, 95, 63, .16); border: 1px solid rgba(204, 95, 63, .14); border-radius: 2px; }
.upload-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 9px; background: color-mix(in srgb, var(--surface) 82%, transparent); backdrop-filter: blur(2px); font-size: 12.5px; color: var(--ink-2); }
.upload-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; margin-top: 11px; }
.upload-hint { margin-top: 9px; font-size: 11px; line-height: 1.7; color: var(--muted); }

/* 识别对话 */
.transcript-list { display: flex; flex-direction: column; gap: 6px; max-height: 400px; overflow: auto; padding: 2px 2px 2px 0; }
.transcript-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) 26px; gap: 7px; align-items: flex-start; }
.role-pill { height: 26px; margin-top: 3px; padding: 0; border: 1px solid transparent; border-radius: 7px; background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 11px; font-weight: 700; cursor: pointer; transition: .15s; }
.role-pill:hover { border-color: var(--line-strong); }
.role-pill--customer { background: var(--sage-soft); color: var(--sage); }
.role-pill--agent, .role-pill--seller { background: var(--primary-soft); color: var(--primary-deep); }
.transcript-text { width: 100%; min-height: 30px; max-height: 220px; padding: 5px 9px; border: 1px solid transparent; border-radius: 7px; background: var(--surface-2); color: var(--ink); font: inherit; font-size: 12.5px; line-height: 1.65; resize: none; overflow-y: auto; }
.transcript-text:hover { border-color: var(--line); }
.transcript-text:focus { outline: none; background: var(--surface); border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-soft); }
.transcript-del { width: 26px; height: 26px; margin-top: 4px; color: var(--muted); }
.transcript-del:hover { color: var(--danger); }

/* 最后一句 / 上下文 */
.shot-context__actions { display: grid; grid-template-columns: 96px 110px minmax(0, 1fr); gap: 8px; align-items: center; }
.shot-context__actions .select { min-height: 36px; font-size: 12px; }
.shot-context__actions .btn { height: 36px; justify-content: center; }

/* 分析 */
.analysis-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.analysis-tile { padding: 9px 11px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 10px; min-width: 0; }
.analysis-tile span { display: block; font-size: 10.5px; color: var(--muted); }
.analysis-tile b { display: block; margin-top: 1px; font-size: 14px; font-weight: 700; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.analysis-tile--high { background: var(--danger-soft); border-color: transparent; }
.analysis-tile--high b { color: var(--danger); }
.analysis-tile--mid { background: var(--gold-soft); border-color: transparent; }
.analysis-tile--mid b { color: var(--gold); }
.analysis-tile--low { background: var(--sage-soft); border-color: transparent; }
.analysis-tile--low b { color: var(--sage); }
.analysis-summary { margin-top: 11px; font-size: 12.5px; line-height: 1.78; color: var(--ink-2); }
.analysis-signals { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 10px; }
.analysis-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; margin-top: 9px; font-size: 11px; color: var(--muted); }
.analysis-meta > span:first-child { margin-right: 2px; }
.policy-exceptions { display: flex; flex-direction: column; gap: 7px; }
.policy-exceptions li { display: flex; flex-direction: column; gap: 1px; padding-left: 0; font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.policy-exceptions li::before { display: none; }
.policy-exceptions li b { font-size: 11px; font-weight: 700; color: var(--muted); }
.policy-exceptions li span { color: var(--ink-2); }
.shot-skeleton { padding: 4px 0; }

/* 回复方案 */
.shot-options { display: flex; flex-direction: column; gap: 10px; }
.shot-options__head { display: flex; align-items: flex-start; gap: 10px; padding: 2px 2px 0; }
.shot-options__head h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -.02em; }
.shot-options__head p { margin-top: 2px; font-size: 11.5px; color: var(--muted); line-height: 1.6; }
.shot-options__head .btn { margin-left: auto; flex: none; }
.reply-list { display: flex; flex-direction: column; gap: 11px; }
.reply-skeletons { display: flex; flex-direction: column; gap: 11px; }
.reply-skeleton { padding: 17px 18px; display: flex; flex-direction: column; gap: 8px; }
.reply-card { position: relative; padding: 15px 16px 14px; border-radius: 16px; transition: border-color .18s, box-shadow .18s; }
.reply-card.is-recommended { border-color: var(--primary); box-shadow: 0 0 0 1px var(--primary), 0 12px 28px -20px rgba(174, 74, 46, .55); }
.reply-card.is-recommended::before { content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px; border-radius: 3px; background: var(--primary); }
.reply-card__head { display: flex; align-items: flex-start; gap: 9px; margin-bottom: 11px; }
.reply-card__no { display: grid; place-items: center; width: 24px; height: 24px; flex: none; margin-top: 1px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-deep); font-size: 12px; font-weight: 700; }
.reply-card__head h3 { font-size: 14px; font-weight: 700; letter-spacing: -.01em; }
.reply-card__head p { margin-top: 1px; font-size: 10.5px; color: var(--muted); }
.reply-card__head .badge { margin-left: auto; flex: none; }
.reply-bubbles { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.reply-bubble { align-self: flex-end; max-width: 94%; padding: 9px 12px; background: var(--primary-soft); border: 1px solid transparent; border-radius: 12px 12px 4px 12px; font-size: 13px; line-height: 1.72; white-space: pre-wrap; word-break: break-word; }
.reply-why, .reply-next { margin-top: 10px; padding: 9px 11px; border-radius: 9px; background: var(--surface-2); border-left: 2px solid var(--line-strong); }
.reply-next { border-left-color: var(--sage); }
.reply-why span, .reply-next span { display: block; margin-bottom: 2px; font-size: 10px; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.reply-why p, .reply-next p { font-size: 12px; line-height: 1.72; color: var(--ink-2); }
.reply-compliance { display: flex; flex-direction: column; gap: 5px; margin-top: 9px; }
.reply-compliance p { display: flex; align-items: flex-start; gap: 6px; padding: 6px 9px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); font-size: 11px; line-height: 1.65; }
.reply-compliance .ico { flex: none; width: 13px; height: 13px; margin-top: 1px; }
.reply-card__actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; margin-top: 12px; }

/* 政策 */
.policy-block { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }
.policy-block h4 { display: flex; align-items: center; gap: 6px; margin-bottom: 7px; font-size: 11px; font-weight: 700; letter-spacing: .05em; color: var(--muted); }
.policy-flow { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.policy-flow span { padding: 3px 9px; border-radius: 99px; background: var(--primary-soft); color: var(--primary-deep); font-size: 11.5px; font-weight: 600; }
.policy-flow i { font-style: normal; font-size: 11px; color: var(--muted); }
.policy-steps { display: flex; flex-direction: column; gap: 5px; list-style: none; counter-reset: ps; }
.policy-steps li { position: relative; padding-left: 22px; font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.policy-steps li::before { counter-increment: ps; content: counter(ps); position: absolute; left: 0; top: 2px; width: 15px; height: 15px; border-radius: 50%; background: var(--surface-2); color: var(--muted); font-size: 9.5px; font-weight: 700; line-height: 15px; text-align: center; }
.policy-list { display: flex; flex-direction: column; gap: 5px; font-size: 12px; line-height: 1.7; color: var(--ink-2); }
.policy-list li { position: relative; padding-left: 12px; }
.policy-list li::before { content: ""; position: absolute; left: 0; top: .68em; width: 4px; height: 4px; border-radius: 50%; background: var(--line-strong); }
.policy-list--rules li { display: flex; flex-direction: column; gap: 1px; }
.policy-list--rules b { font-weight: 600; color: var(--ink); }
.policy-list--rules span { font-size: 11.5px; color: var(--muted); }
.policy-empty { font-size: 12px; line-height: 1.7; color: var(--muted); }
.policy-notice { margin: 2px 0 8px; padding: 7px 10px; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 10.5px; line-height: 1.65; }
.policy-principle { margin: 2px 0 4px; font-size: 11px; line-height: 1.7; color: var(--ink-2); }
.policy-warning { display: flex; align-items: flex-start; gap: 5px; margin-top: 7px; padding: 6px 9px; border-radius: 8px; background: var(--gold-soft); color: var(--gold); font-size: 10.5px; line-height: 1.65; }
.policy-warning .ico { flex: none; width: 12px; height: 12px; margin-top: 1px; }
.policy-unverified { display: inline-block; margin-left: 5px; font-style: normal; font-size: 9.5px; color: var(--gold); border: 1px solid var(--gold-soft); border-radius: 4px; padding: 0 4px; line-height: 14px; }.rule-unverified { display: inline-block; margin-left: 4px; font-style: normal; font-size: 9.5px; color: var(--gold); border: 1px solid var(--gold-soft); border-radius: 4px; padding: 0 4px; line-height: 14px; }
.policy-link { margin-top: 12px; }
.shot-policy { border-top: 3px solid var(--line-strong); }

/* 历史 */
.history-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.history-item { display: flex; flex: none; flex-direction: column; gap: 3px; width: 104px; padding: 5px; border: 1px solid var(--line); border-radius: 9px; background: var(--surface-2); text-align: left; font: inherit; color: inherit; cursor: pointer; }
.history-item:hover { border-color: var(--line-strong); background: var(--surface); }
.history-item img { width: 100%; height: 56px; object-fit: cover; border-radius: 5px; background: var(--surface); }
.history-item span { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; height: 26px; font-size: 9.5px; line-height: 1.4; color: var(--ink-2); }
.history-item em { font-style: normal; font-size: 9px; color: var(--muted); }

@media (max-width: 1179px) {
  .shot { grid-template-columns: 1fr; max-width: 900px; }
}
@media (max-width: 859px) {
  .shot { gap: 12px; padding: 12px 12px 34px; }
  .shot__col { display: contents; }
  .shot-upload { order: 1; }
  .shot-options { order: 2; }
  .shot-analysis { order: 3; }
  .shot-policy { order: 4; }
  .shot-transcript { order: 5; }
  .shot-context { order: 6; }
  .shot-history { order: 7; }
  .shot-card { padding: 14px; border-radius: 14px; }
  .shot-card__head { flex-wrap: wrap; }
  .shot-card__head .segmented { width: 100%; margin-left: 0; }
  .segmented button { flex: 1; }
  .upload-paper { min-height: 170px; }
  .shot-paper img { max-height: 340px; }
  .transcript-list { max-height: none; }
  .transcript-row { grid-template-columns: 42px minmax(0, 1fr) 24px; }
  .shot-context__actions { grid-template-columns: 1fr 1fr; }
  .shot-context__actions .btn { grid-column: 1 / -1; }
  .reply-card__actions .btn { flex: 1 1 auto; justify-content: center; }
  .reply-card__actions .muted { flex: 1 0 100%; }
  .analysis-grid { gap: 6px; }
  .analysis-tile { padding: 8px 9px; }
  .analysis-tile b { font-size: 13px; }
  .shot-options__head { padding: 0 2px; }
  .shot-options__head h2 { font-size: 15.5px; }
  .page-head--shot .head-actions .btn .label { display: none; }
}

/* 手机联动页 */
.mobile-main { flex: 1; min-height: 0; overflow: auto; overflow-x: hidden; display: flex; flex-direction: column; gap: 12px; padding: 14px 14px calc(22px + env(safe-area-inset-bottom)); }
.mobile-main .settings-card { margin: 0; }
.mobile-note .settings-card__desc b { color: var(--ink-2); }
.mobile-upload { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 4px; }
.mobile-main .shot-paper { max-width: 100%; }
.mobile-main .shot-paper img { max-height: 300px; }
.mobile-main .steps { margin-top: 8px; }
.mobile-note summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mobile-note summary::-webkit-details-marker { display: none; }
.mobile-note summary .ico { color: var(--muted); flex: none; }
.mobile-note[open] summary { margin-bottom: 8px; }
.mobile-note .settings-card__desc { font-size: 11.5px; }
.mobile-install summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mobile-install summary::-webkit-details-marker { display: none; }
.mobile-install summary .ico { color: var(--primary); flex: none; }
.mobile-install[open] summary { margin-bottom: 8px; }
.tone-chips { display: flex; gap: 7px; margin: 10px 0 2px; }
.tone-chips button { padding: 7px 14px; border: 1px solid var(--line); border-radius: 99px; background: var(--surface-2); color: var(--ink-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.tone-chips button.is-active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary-deep); }
.mobile-result-actions { display: flex; gap: 6px; margin-left: auto; flex: none; }
.mobile-result-actions .btn { white-space: nowrap; }
.mobile-history__list { display: flex; flex-direction: column; gap: 7px; margin-top: 10px; }
.mobile-history__item { display: flex; flex-direction: column; gap: 2px; width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); color: var(--ink); font: inherit; text-align: left; cursor: pointer; }
.mobile-history__item:hover { border-color: var(--primary); background: var(--surface); }
.mobile-history__item span { font-size: 12.5px; line-height: 1.5; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mobile-history__item em { font-style: normal; font-size: 10.5px; color: var(--muted); }
.mobile-error { border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); background: var(--danger-soft); }
.mobile-error h3 { color: var(--danger); }
.mobile-policy summary { display: flex; align-items: center; gap: 6px; cursor: pointer; list-style: none; font-size: 12px; font-weight: 700; color: var(--ink-2); }
.mobile-policy summary::-webkit-details-marker { display: none; }
.mobile-policy summary .ico { color: var(--sage); flex: none; }
.mobile-policy[open] summary { margin-bottom: 4px; }
.mobile-policy .policy-list { margin-top: 8px; }

@media (max-width: 859px) {
  html { -webkit-tap-highlight-color: transparent; }
  .toasts { bottom: calc(74px + env(safe-area-inset-bottom)); }
  body.mobile-chat .toasts, body.chat-body .toasts { bottom: calc(14px + env(safe-area-inset-bottom)); }
  .shot-options__head { flex-wrap: wrap; }
  .mobile-result-actions { width: 100%; margin: 8px 0 0; }
  .mobile-result-actions .btn { flex: 1; justify-content: center; }
}


