/* 龙虾 · 样式（0926 整改：照微信的样子做——灰底白卡、绿色只用一处、没有装饰）
 * 三个入口：龙虾（对话）/ 天地 / 我。桌面左侧窄栏，手机底部三格。
 * 零外部资源、零构建；图标 = 内联 SVG（stroke: currentColor）。
 */

:root {
  color-scheme: light;
  --bg: #ededed;
  --surface: #fff;
  --raised: #f7f7f7;
  --raised-hi: #ebebeb;
  --line: #e5e5e5;
  --line-soft: #f0f0f0;
  --control-border: #d9d9d9;
  --text: #191919;
  --text-dim: #666;
  --text-faint: #999;
  --accent: #07c160;
  --accent-hi: #06ad56;
  --accent-deep: #05964b;    /* 1004：白字压在上面 3.8:1（#07c160 只有 2.4）——主按钮、选中的底部格 */
  --accent-press: #047f3f;
  --ok-text: #047f3f;        /* 1004：绿字小标签（回执 / 标签）4.4:1 起，原 #07c160 2.0 */
  --warn-text: #b25a00;      /* 1004：橙字 4.1:1，原 #fa9d3b 1.8 */
  --err-text: #d93025;       /* 1004：红字 4.8:1，原 #fa5151 3.3 */
  --accent-tint: rgba(7, 193, 96, .12);
  --brand-ink: #0b1018;      /* 1005 换标：YouTwice 图标的深底和橙（与 icon.svg 同值）——只用在登录页抬头那一块 */
  --brand-hot: #ff6d4a;
  --link: #576b95;
  --bubble-me: #95ec69;
  --bubble-me-line: #8ee05f;
  --ok: #07c160;
  --warn: #fa9d3b;
  --err: #fa5151;
  --badge: #fa5151;
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  --font-mono: 'SF Mono', Menlo, Consolas, monospace;
  --rail-w: 60px;
  --sessions-w: 284px;
  --tab-h: 56px;
  --r-sm: 6px;
  --r-md: 10px;
  --shadow: 0 2px 12px rgba(0, 0, 0, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }
html { min-width: 320px; }
body {
  min-height: 100dvh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
a { color: var(--link); }
button, input, textarea, select { font: inherit; }
button {
  border: 1px solid var(--control-border);
  border-radius: var(--r-sm);
  padding: 7px 14px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
button:hover { background: var(--raised); }
button:disabled { opacity: .5; cursor: default; }
input, textarea, select {
  width: 100%;
  border: 1px solid var(--control-border);
  border-radius: var(--r-sm);
  padding: 9px 12px;
  background: var(--surface);
  color: var(--text);
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); outline: none; }
input::placeholder, textarea::placeholder { color: var(--text-faint); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

/* ── 导航：桌面左侧窄栏（头像在上、退出在下），手机底部三格 ───────── */
body:not([data-page="login"]):not([data-page="install"]) { padding-left: var(--rail-w); }
.topbar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--rail-w);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0 12px;
  background: #f5f5f5;
  border-right: 1px solid var(--line);
  z-index: 40;
}
.topbar nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.topbar nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 52px;
  padding: 7px 0 5px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 12px;   /* 1004：原 11px */
  line-height: 1.2;
}
.topbar nav a:hover { background: var(--raised-hi); }
.topbar nav a[aria-current="page"] { color: var(--accent-deep); font-weight: 600; }
.nav-glyph { display: grid; place-items: center; }
.nav-glyph .ico { width: 24px; height: 24px; }
.nav-avatar {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  font-size: 14px; font-weight: 600;
}
.nav-logout {
  display: grid; place-items: center;
  width: 34px; height: 34px;
  padding: 0;
  border: 0; background: none;
  color: var(--text-faint);
  border-radius: var(--r-sm);
}
.nav-logout:hover { color: var(--err); background: var(--raised-hi); }
.nav-logout .ico { width: 18px; height: 18px; }

/* ── 对话页：会话列表（只给管理员）+ 对话面板 ────────────────────── */
.chat-main { display: flex; height: 100dvh; }
.chat-sessions {
  flex: 0 0 var(--sessions-w);
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--surface);
  border-right: 1px solid var(--line);
}
.sessions-head { padding: 10px 12px; }
.sessions-head input[type="search"] { background: var(--raised); border-color: transparent; padding: 6px 12px; font-size: 14px; }
.session-list { flex: 1; overflow-y: auto; overscroll-behavior: contain; }
.session-group { padding: 12px 14px 4px; color: var(--text-faint); font-size: 12px; }
.session-note { padding: 8px 14px; }
.session-row {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 14px;
  border: 0;
  border-radius: 0;
  background: none;
  text-align: left;
}
.session-row:hover { background: var(--raised); }
.session-row.session-active { background: var(--raised-hi); }
.session-avatar { flex: 0 0 auto; }
.session-mid { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.session-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-preview { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.session-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.session-time { font-size: 11px; color: var(--text-faint); }
.session-badge {
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: var(--badge);
  color: #fff;
  font-size: 11px; font-weight: 600;
  display: grid; place-items: center;
}

/* 头像：龙虾绿底白字，其余灰底 */
.agent-avatar {
  display: grid; place-items: center;
  width: 40px; height: 40px;
  flex: 0 0 auto;
  border-radius: 4px;
  background: var(--raised-hi);
  color: var(--text-dim);
  font-size: 15px; font-weight: 600;
}
.msg-assistant .agent-avatar, .session-mine .agent-avatar, #typingRow .agent-avatar { background: var(--accent); color: #fff; }
.agent-avatar-lg { width: 44px; height: 44px; }

.conversation-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }
.conversation-head {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 52px;
  padding: 8px 14px;
  background: var(--raised);
  border-bottom: 1px solid var(--line);
}
.conversation-title { flex: 1; min-width: 0; }
.conversation-title h1 { font-size: 17px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.head-sub { font-size: 12px; color: var(--text-faint); }
.head-actions { display: flex; gap: 8px; align-items: center; }
.convo-back {
  display: none;
  width: 36px; height: 36px;
  padding: 0;
  border: 0; background: none;
  color: var(--text);
  font-size: 24px; line-height: 1;
}
.convo-live { font-size: 12px; color: var(--ok); white-space: nowrap; }

.conversation-scroll { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 14px 14px 8px; }
.chat-loading { text-align: center; color: var(--text-dim); font-size: 13px; padding: 18px 0; }
.conn-pill {
  position: sticky; top: 0;
  margin: 0 auto 8px;
  width: fit-content;
  padding: 3px 12px;
  border-radius: 999px;
  background: #fff7e6;
  color: var(--warn-text);
  font-size: 13px;
  z-index: 5;
}
#loadEarlierBtn { display: block; margin: 0 auto 10px; padding: 4px 14px; font-size: 12px; color: var(--text-dim); border-radius: 999px; }
.chat-empty { text-align: center; padding: 48px 16px 24px; color: var(--text-dim); font-size: 15px; }
.chat-empty-sub { margin-top: 18px; font-size: 13px; color: var(--text-dim); }
/* 空态示例（1004）：对话页 / 天地占位共用——点一下只预填，不代发 */
.say-hints { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.say-hint { display: block; width: 100%; max-width: 420px; margin: 0 auto; padding: 10px 14px; border: 1px solid var(--control-border); border-radius: var(--r-md); background: var(--surface); color: var(--text); font: inherit; font-size: 14.5px; line-height: 1.5; text-align: left; text-decoration: none; cursor: pointer; }
.say-hint:hover { background: var(--raised); }
.wait-note { text-align: center; margin: 2px 24px 12px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }

/* 气泡：对方白、自己绿，带微信那个小三角 */
.msg { display: flex; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.msg-user { flex-direction: row-reverse; }
.msg-body { max-width: min(72%, 640px); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.msg-user .msg-body { align-items: flex-end; }
.msg-author { display: none; font-size: 11px; color: var(--text-faint); padding: 0 2px; gap: 6px; align-items: center; }
.msg-duo .msg-author { display: flex; }          /* 单聊不署名；旁观两只虾时双方署名 */
.msg-content {
  position: relative;
  padding: 9px 12px;
  border-radius: 6px;
  background: var(--surface);
  white-space: pre-wrap;
  word-break: break-word;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.55;
  width: fit-content;
}
.msg-user .msg-content { background: var(--bubble-me); }
.msg-content::before {
  content: '';
  position: absolute;
  top: 14px; left: -5px;
  border: 5px solid transparent;
  border-left: 0;
  border-right-color: var(--surface);
}
.msg-user .msg-content::before { left: auto; right: -5px; border-right: 0; border-left: 5px solid var(--bubble-me); }
.msg-time { font-size: 13px; color: var(--text-dim); padding: 0 2px; opacity: 0; transition: opacity .15s; }
.msg:hover .msg-time { opacity: 1; }
.msg-cont { margin-top: -6px; }
.msg-day { text-align: center; margin: 12px 0 14px; font-size: 13px; color: var(--text-dim); }
.convo-kind { padding: 1px 7px; border-radius: 999px; background: var(--raised-hi); color: var(--text-dim); font-size: 10px; }

#typingRow { display: flex; align-items: flex-start; gap: 10px; margin: 2px 0 12px; }
.queue-note { align-self: center; min-width: 0; color: var(--text-dim); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }   /* 1004 第三批 ⑥ 排队位置 */
.typing-bubble { display: inline-flex; gap: 5px; padding: 15px 14px; border-radius: 6px; background: var(--surface); }
.typing-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--text-faint); animation: typing 1.2s ease-in-out infinite; }
.typing-dot:nth-child(2) { animation-delay: .18s; }
.typing-dot:nth-child(3) { animation-delay: .36s; }
@keyframes typing { 0%, 60%, 100% { opacity: .35; transform: none; } 30% { opacity: 1; transform: translateY(-3px); } }

#newMsgBadge {
  position: sticky;
  bottom: 8px;
  left: 100%;
  translate: -8px 0;
  padding: 5px 12px;
  border-radius: 999px;
  background: var(--accent);
  border-color: transparent;
  color: #fff;
  font-size: 12px;
  box-shadow: var(--shadow);
}

/* 输入区（0926 照微信补齐）：左语音 · 中文字 · 右表情 + 加号（有字时加号变发送）；下面是表情 / 更多面板 */
#composer { background: var(--raised); border-top: 1px solid var(--line); }
.composer-box { display: flex; align-items: flex-end; gap: 6px; padding: 8px 10px; }
.cmp-btn {
  flex: 0 0 auto;
  display: grid; place-items: center;
  width: 36px; height: 40px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--text);
}
.cmp-btn:hover { background: none; color: #000; }
.cmp-ico { width: 28px; height: 28px; stroke-width: 1.5; }
.cmp-ico .dot, .ico .dot { stroke-width: 2.4; }
.cmp-ico-kbd, .cmp-btn.is-kbd .cmp-ico-voice, .cmp-btn.is-kbd .cmp-ico-emoji { display: none; }
.cmp-btn.is-kbd .cmp-ico-kbd { display: block; }
#msgInput {
  flex: 1;
  min-width: 0;
  min-height: 40px;
  max-height: 152px;
  border: 0;
  border-radius: var(--r-sm);
  padding: 9px 12px;
  resize: none;
  line-height: 1.5;
  background: var(--surface);
}
.hold-talk {
  flex: 1;
  min-width: 0;
  height: 40px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 1px;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  touch-action: none;
}
.hold-talk:hover { background: var(--surface); }
.hold-talk.is-holding { background: #d6d6d6; }
#sendBtn {
  flex: 0 0 auto;
  height: 34px;
  margin: 0 0 3px 2px;
  padding: 0 14px;
  border: 0;
  border-radius: 4px;
  background: var(--accent-deep);
  color: #fff;
  font-weight: 600;
}
#sendBtn:hover { background: var(--accent-press); }
.composer-hint {
  display: block;
  width: fit-content;
  margin: -4px 12px 6px auto;
  padding: 0;
  border: 0; background: none;
  font-size: 11px;
  color: var(--text-faint);
}
.composer-hint:hover { background: none; color: var(--text-dim); }

.cmp-panel { border-top: 1px solid var(--line); background: var(--raised); }
.emoji-panel { position: relative; height: 252px; }
.emoji-grid {
  height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(42px, 1fr));
  align-content: start;
  gap: 2px 0;
  padding: 10px 10px 60px;
}
.emoji-sec { grid-column: 1 / -1; padding: 4px 4px 2px; font-size: 12px; color: var(--text-faint); }
.emoji-cell {
  height: 42px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: none;
  font-size: 26px;
  line-height: 42px;
  font-family: 'Apple Color Emoji', 'Segoe UI Emoji', 'Noto Color Emoji', var(--font-sans);
}
.emoji-cell:hover { background: var(--raised-hi); }
.emoji-actions { position: absolute; right: 12px; bottom: 12px; display: flex; gap: 8px; }
.emoji-actions button {
  height: 38px;
  padding: 0 14px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, .08);
}
#emojiDel { display: grid; place-items: center; padding: 0 12px; }
#emojiDel .ico { width: 24px; height: 24px; stroke-width: 1.5; }
#emojiSend { background: var(--accent-deep); color: #fff; font-weight: 600; }
#emojiSend:disabled { background: var(--surface); color: var(--text-faint); opacity: 1; cursor: default; }
.plus-panel {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  justify-items: center;
  gap: 16px 0;
  padding: 22px 8px 26px;
}
.plus-item {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
  padding: 0;
  border: 0;
  background: none;
  font-size: 12px;
  color: var(--text-dim);
}
.plus-item:hover { background: none; }
.plus-ico {
  display: grid; place-items: center;
  width: 60px; height: 60px;
  border-radius: 14px;
  background: var(--surface);
  color: #333;
}
.plus-item:active .plus-ico { background: var(--raised-hi); }
.plus-ico .ico { width: 28px; height: 28px; stroke-width: 1.5; }
@media (min-width: 768px) {            /* 电脑宽屏：四个格子靠左排，不摊满一整行 */
  .plus-panel { grid-template-columns: repeat(4, 104px); justify-content: start; padding-left: 12px; }
}

/* 按住说话时屏幕中间那块：音量在跳＝在收音；上滑变红＝松手就取消 */
.voice-overlay { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; pointer-events: none;
                 background: rgba(0, 0, 0, .12); }
.voice-card {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  width: 168px;
  padding: 20px 12px 14px;
  border-radius: 12px;
  background: rgba(38, 38, 38, .92);   /* 够实：后面的气泡字不透出来 */
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  color: #fff;
}
.voice-card .ico { width: 46px; height: 46px; stroke-width: 1.6; }
.voice-ico-cancel, .voice-overlay.is-cancel .voice-ico-mic, .voice-overlay.is-cancel .voice-meter { display: none; }
.voice-overlay.is-cancel .voice-ico-cancel { display: block; }
.voice-meter { display: flex; align-items: flex-end; gap: 4px; height: 28px; }
.voice-meter span { width: 4px; height: 18%; border-radius: 2px; background: #fff; }
.voice-time { font-size: 13px; opacity: .85; font-variant-numeric: tabular-nums; }
.voice-tip { padding: 2px 8px; border-radius: 4px; font-size: 13px; }
.voice-overlay.is-cancel .voice-tip { background: #c83c3c; }

/* 确认框（发位置前问一句） */
.sheet { position: fixed; inset: 0; z-index: 140; display: grid; place-items: center; padding: 24px; background: rgba(0, 0, 0, .4); }
.sheet-card { width: min(320px, 100%); border-radius: 12px; background: var(--surface); overflow: hidden; text-align: center; }
.sheet-title { padding: 20px 20px 6px; font-size: 17px; font-weight: 600; }
.sheet-text { padding: 0 20px 20px; font-size: 14px; color: var(--text-dim); }
.sheet-btns { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--line); }
.sheet-btns button { height: 50px; border: 0; border-radius: 0; background: none; font-size: 16px; }
.sheet-btns button + button { border-left: 1px solid var(--line); }
.sheet-ok { color: var(--accent); font-weight: 600; }

.agent-panel-foot { padding: 9px 14px; border-top: 1px solid var(--line); background: var(--raised); color: var(--text-faint); font-size: 12px; }
.agent-panel-foot code { font-family: var(--font-mono); background: var(--raised-hi); padding: 1px 6px; border-radius: 4px; }

/* 消息附件：链接 / 发送态 / 回执 / 引用 / 图片 / 文件 */
.msg-link { color: var(--link); text-decoration: underline; text-underline-offset: 2px; word-break: break-all; }
.msg-state { align-self: center; display: none; }
.msg-sending .msg-state, .msg-failed .msg-state { display: grid; place-items: center; }
.msg-spin {
  display: none;
  width: 15px; height: 15px;
  border: 2px solid var(--text-faint);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
.msg-sending .msg-spin { display: block; }
@keyframes spin { to { transform: rotate(360deg); } }
.msg-retry {
  display: none;
  width: 32px; height: 32px;   /* 1004：原 20px 手指点不中 */
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--badge);
  color: #fff;
  font-size: 17px; font-weight: 700;
  line-height: 1;
}
.msg-failed .msg-retry { display: grid; place-items: center; }
.draft-mark { color: var(--badge); margin-right: 3px; }
.msg-receipt { font-size: 13px; color: var(--text-dim); padding: 0 2px; }
.msg-receipt[data-receipt="processing"] { color: var(--warn-text); }
.msg-receipt[data-receipt="replied"], .msg-receipt[data-receipt="seen"] { color: var(--ok-text); }
.msg-quote {
  display: flex;
  gap: 4px;
  max-width: 100%;
  margin-top: 2px;
  padding: 5px 10px;
  border: 0;
  border-radius: var(--r-sm);
  background: var(--raised-hi);
  color: var(--text-dim);
  font-size: 12px;
  line-height: 1.5;
  text-align: left;
}
.msg-quote-sender { flex: 0 0 auto; color: var(--text-faint); }
.msg-quote-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@keyframes msgflash { from { background: var(--accent-tint); } to { background: transparent; } }
.msg-flash .msg-content { animation: msgflash 1.6s ease; }
.msg-image {
  display: block;
  max-width: min(260px, 100%);
  max-height: 320px;
  width: auto; height: auto;
  border-radius: var(--r-sm);
  background: var(--raised);
  cursor: zoom-in;
}
.img-overlay { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; background: rgba(0, 0, 0, .9); cursor: zoom-out; }
.img-overlay-pic { max-width: 92vw; max-height: 92vh; border-radius: 4px; }
.img-overlay-nav, .img-overlay-close {
  position: absolute;
  width: 44px; height: 44px;
  padding: 0;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 0;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 17px;
}
.img-overlay-prev { left: 18px; top: 50%; translate: 0 -50%; }
.img-overlay-next { right: 18px; top: 50%; translate: 0 -50%; }
.img-overlay-close { top: 16px; right: 18px; width: 40px; height: 40px; font-size: 15px; }
.img-overlay-nav:disabled { opacity: .3; }
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 236px;
  max-width: 100%;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  background: var(--surface);
  text-decoration: none;
}
.msg-user .msg-file { background: var(--bubble-me); }
.msg-file-ico {
  display: grid; place-items: center;
  width: 38px; height: 38px;
  flex: 0 0 auto;
  border-radius: var(--r-sm);
  background: var(--accent-tint);
  color: var(--accent-hi);
  font-size: 11px; font-weight: 700;
}
.msg-file-info { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.msg-file-name { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-file-size { font-size: 11px; color: var(--text-faint); }

.msg-media-wrap { position: relative; max-width: 100%; }
.msg-progress {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .35);
  color: #fff;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.msg-image-broken { min-width: 120px; min-height: 90px; }
.msg-video { display: block; max-width: min(240px, 100%); max-height: 320px; border-radius: var(--r-sm); background: #000; }
.msg-voice-wrap { display: flex; flex-direction: column; gap: 4px; max-width: 100%; }
.msg-user .msg-voice-wrap { align-items: flex-end; }
.msg-voice {
  position: relative;
  display: flex; align-items: center; gap: 6px;
  max-width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 0;
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 15px;
}
.msg-voice:hover { background: var(--surface); }
.msg-user .msg-voice { flex-direction: row-reverse; background: var(--bubble-me); }
.msg-user .msg-voice:hover { background: var(--bubble-me); }
.msg-voice::before {
  content: '';
  position: absolute;
  top: 14px; left: -5px;
  border: 5px solid transparent;
  border-left: 0;
  border-right-color: var(--surface);
}
.msg-user .msg-voice::before { left: auto; right: -5px; border-right: 0; border-left: 5px solid var(--bubble-me); }
.msg-voice-ico { width: 20px; height: 20px; stroke-width: 1.8; flex: 0 0 auto; }
.msg-voice-ico .w1 { stroke-width: 2.8; }
.msg-user .msg-voice-ico { transform: scaleX(-1); }
.msg-voice.is-playing .w2 { animation: vwave 1s steps(1) infinite; }
.msg-voice.is-playing .w3 { animation: vwave 1s steps(1) infinite .33s; }
@keyframes vwave { 0% { opacity: 0; } 50% { opacity: 1; } }
.msg-voice-dur { font-variant-numeric: tabular-nums; }
.msg-voice-text {
  max-width: 100%;
  padding: 7px 10px;
  border-radius: 6px;
  background: var(--surface);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.msg-loc {
  display: flex; flex-direction: column;
  width: 240px; max-width: 100%;
  border-radius: 6px;
  overflow: hidden;
  background: var(--surface);
  color: var(--text);
  text-decoration: none;
}
.msg-loc-text { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 8px; min-width: 0; }
.msg-loc-title { font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-loc-addr {
  font-size: 12px; color: var(--text-faint);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.msg-loc-map {
  display: grid; place-items: center;
  height: 84px;
  background-color: #eef3ea;
  background-image: linear-gradient(rgba(255, 255, 255, .9) 2px, transparent 2px),
                    linear-gradient(90deg, rgba(255, 255, 255, .9) 2px, transparent 2px),
                    linear-gradient(35deg, transparent 46%, #f6d58a 46%, #f6d58a 54%, transparent 54%);
  background-size: 34px 34px, 34px 34px, 100% 100%;
  color: var(--err);
}
.msg-loc-pin { width: 30px; height: 30px; stroke-width: 1.6; fill: #fff; }

/* 业务单卡片 + 待你点头 + 开单表单（只在两只虾的会话里出现，管理员可见） */
.msg-order .msg-content { display: none; }
.order-card { min-width: 240px; max-width: 420px; padding: 10px 12px; border-radius: var(--r-sm); background: var(--surface); border: 1px solid var(--line); }
.msg-user .order-card { background: var(--bubble-me); border-color: var(--bubble-me-line); }
.order-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.order-title { font-size: 14px; }
.order-status { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--accent-tint); color: var(--accent-hi); }
.order-status[data-status="pending"], .order-status[data-status="amended"] { background: #fff7e6; color: var(--warn); }
.order-status[data-status="rejected"], .order-status[data-status="expired"] { background: #fff1f0; color: var(--err); }
.order-line { margin-top: 6px; font-size: 13px; color: var(--text-dim); }
.order-terms { display: grid; grid-template-columns: max-content 1fr; gap: 2px 10px; margin-top: 8px; font-size: 13px; }
.order-terms dt { color: var(--text-faint); }
.order-terms dd { font-variant-numeric: tabular-nums; }
.order-terms dd.order-changed { color: var(--warn); font-weight: 600; }
.order-due { margin-top: 8px; font-size: 12.5px; color: var(--text-dim); }
.order-overdue { color: var(--err); }
.order-note { margin-top: 6px; font-size: 12.5px; color: var(--text-dim); white-space: pre-wrap; }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.order-btn { padding: 5px 14px; border-radius: 999px; font-size: 13px; }
.order-btn-ok { background: var(--accent-deep); border-color: var(--accent-deep); color: #fff; font-weight: 600; }
.order-btn-ok:hover { background: var(--accent-press); }
.order-btn-no { color: var(--err); }
.order-amend { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; margin-top: 4px; }
.order-amend label { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-dim); }
.order-amend input { width: 120px; padding: 4px 8px; }
.order-amend input[placeholder] { width: 100%; }
.approval-block { padding: 6px 10px 2px; }
.approval-card { margin: 6px 0; padding: 10px 12px; border-radius: var(--r-sm); background: #fff7e6; font-size: 13px; line-height: 1.55; }
.approval-card strong { color: var(--warn); font-size: 12px; }
.approval-card p { margin-top: 4px; }
.approval-card .order-actions { margin-top: 8px; }
.order-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  padding: 10px 14px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.order-form label { display: flex; flex-direction: column; gap: 3px; font-size: 12px; color: var(--text-dim); }
.order-form input, .order-form select { padding: 6px 8px; }
.order-form-foot { grid-column: 1 / -1; display: flex; gap: 8px; align-items: center; }
.order-form-hint { font-size: 12px; color: var(--text-faint); }

/* ── 内容页（天地 / 我 / 住户 / 交付物）：灰底白卡 ─────────────── */
.page-main { max-width: 760px; margin: 0 auto; padding: 20px 16px 48px; }
.page-hero { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin-bottom: 16px; }
.page-hero h1 { font-size: 20px; font-weight: 600; }
.page-hero p { color: var(--text-faint); font-size: 13px; margin-top: 2px; }
.hero-count, .chain-badge {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  white-space: nowrap;
}
.chain-badge { color: var(--ok); }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-bottom: 20px; }
.stats-grid article { display: flex; flex-direction: column; align-items: center; padding: 12px 8px; border-radius: var(--r-md); background: var(--surface); }
.stats-grid strong { font-size: 20px; font-weight: 600; }
.stats-grid span { color: var(--text-faint); font-size: 12px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 20px 0 10px; }
.section-head h2 { font-size: 15px; font-weight: 600; }
.section-head p { color: var(--text-faint); font-size: 12px; }

.agent-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.agent-card { padding: 14px; border-radius: var(--r-md); background: var(--surface); }
.agent-card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.agent-card-title { min-width: 0; }
.agent-card-title h3 { font-size: 15px; font-weight: 600; }
.agent-meta { color: var(--text-faint); font-size: 12px; }
.agent-state { color: var(--ok); font-size: 12px; }
.agent-state::before { content: '● '; font-size: 9px; }
.agent-offline { color: var(--text-faint); }
.agent-bio { color: var(--text-dim); font-size: 13px; line-height: 1.65; margin: 6px 0 10px; }
.agent-facts { display: flex; flex-wrap: wrap; gap: 5px; }
.agent-chip { padding: 2px 9px; border-radius: 999px; background: var(--raised); color: var(--text-dim); font-size: 11px; }
.agent-friends { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.agent-friends > span:first-child { color: var(--text-faint); font-size: 12px; margin-right: 2px; }
.friend-proxy { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.friend-tag { display: inline-flex; padding: 3px 11px; border-radius: 999px; border: 0; background: var(--accent-tint); color: var(--accent-hi); font-size: 12px; }
.friend-tag-btn:hover { background: rgba(7, 193, 96, .22); }
.agent-identity { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line-soft); }
.agent-identity summary, .ledger-proof summary { cursor: pointer; color: var(--text-faint); font-size: 12px; list-style: none; }
.agent-identity summary::before, .ledger-proof summary::before { content: '▸ '; }
.agent-identity[open] summary::before, .ledger-proof[open] summary::before { content: '▾ '; }
.agent-pubkey, .ledger-proof code {
  display: block;
  margin-top: 8px;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  background: var(--raised);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-faint);
  word-break: break-all;
}
.ledger-section, .convo-section { margin-top: 22px; }
.ledger-list { display: flex; flex-direction: column; gap: 6px; }
.ledger-row { display: flex; gap: 12px; padding: 10px 14px; border-radius: var(--r-sm); background: var(--surface); }
.ledger-seq { color: var(--text-faint); font-size: 12px; font-family: var(--font-mono); flex: 0 0 auto; padding-top: 1px; }
.ledger-main { flex: 1; min-width: 0; }
.ledger-text { font-size: 13px; color: var(--text-dim); line-height: 1.6; word-break: break-word; }
.ledger-time { display: block; color: var(--text-faint); font-size: 11px; margin-top: 3px; }
.ledger-proof { margin-top: 4px; }
.chain-bad { background: #fff1f0; color: var(--err); }
.ledger-empty, .convo-empty { padding: 8px 2px; }
.convo-body { max-height: 460px; overflow-y: auto; padding: 12px 14px; border-radius: var(--r-md); background: var(--bg); }
.convo-close { font-size: 12px; padding: 4px 12px; }

.dlv-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.dlv-card { display: flex; flex-direction: column; gap: 6px; padding: 14px; border-radius: var(--r-md); background: var(--surface); }
.dlv-card-head { display: flex; align-items: center; gap: 8px; }
.dlv-type { padding: 2px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--ok-text); font-size: 12px; }
.dlv-domain { color: var(--text-dim); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlv-title { font-size: 15px; font-weight: 600; line-height: 1.45; }
.dlv-meta { color: var(--text-dim); font-size: 13px; }
.dlv-open {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
  font-size: 13px;
  text-decoration: none;
}
.rich-empty { text-align: center; padding: 40px 20px; border-radius: var(--r-md); background: var(--surface); color: var(--text-faint); }
.rich-empty h2 { font-size: 15px; color: var(--text-dim); margin: 10px 0 4px; }
.rich-empty p { font-size: 14px; color: var(--text-dim); }
.rich-empty .td-cta { margin-top: 16px; }
.inline-error { color: var(--err); font-size: 13px; padding: 8px 2px; }

/* ── 我：头像卡 + 一格一格的清单（微信「我」的样子） ─────────────── */
.me-card { display: flex; align-items: center; gap: 14px; padding: 22px 16px; margin-bottom: 12px; background: var(--surface); border-radius: var(--r-md); }
.me-avatar { display: grid; place-items: center; width: 60px; height: 60px; flex: 0 0 auto; border-radius: var(--r-sm); background: var(--accent); color: #fff; font-size: 24px; font-weight: 600; }
.profile-name { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; }
.profile-joined { color: var(--text-faint); font-size: 13px; }
.cell-group { display: flex; flex-direction: column; margin-bottom: 12px; background: var(--surface); border-radius: var(--r-md); overflow: hidden; }
.cell-group > * + * { border-top: 1px solid var(--line-soft); }
.cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-radius: 0;
  background: none;
  color: var(--text);
  font-size: 16px;
  text-align: left;
  text-decoration: none;
}
.cell:hover { background: var(--raised); }
.cell-arrow { color: #c8c8c8; font-size: 18px; line-height: 1; }
.cell-state { color: var(--text-dim); font-size: 13px; }
.cell:disabled { color: var(--text-faint); cursor: default; }
.cell-danger { justify-content: center; color: var(--err); }
.pw-section { padding: 4px 16px 16px; }
.pw-section h2 { padding: 8px 0; font-size: 14px; font-weight: 500; color: var(--text-dim); }
.pw-form { display: flex; flex-direction: column; gap: 10px; }
.pw-form button[type="submit"] { padding: 10px 0; border: 0; background: var(--accent-deep); color: #fff; font-weight: 600; }
.pw-form button[type="submit"]:hover { background: var(--accent-press); }
.pw-msg { min-height: 18px; font-size: 13px; line-height: 1.6; color: var(--err-text); }
.pw-msg.pw-ok { color: var(--ok); }

/* ── 登录：白底，一个图标（和桌面图标同一张：深底橙色）、两个格、一个绿按钮 ─────────────────── */
body[data-page="login"] { display: grid; place-items: center; padding: 24px 20px; background: var(--surface); }
.auth-main { width: 100%; max-width: 340px; }
.auth-brand { display: flex; flex-direction: column; align-items: center; gap: 10px; margin-bottom: 36px; }
.auth-brand .brand-mark { display: grid; place-items: center; width: 72px; height: 72px; border-radius: 16px; background: var(--brand-ink); color: var(--brand-hot); }
.auth-brand .brand-mark .brand-glyph { width: 47px; height: 47px; fill: currentColor; }   /* 和桌面图标同一张：图形占色块的 65% */
.auth-brand h1 { font-size: 22px; font-weight: 600; }
.auth-form { display: flex; flex-direction: column; }
.auth-form input { border: 0; border-bottom: 1px solid var(--line); border-radius: 0; padding: 14px 4px; font-size: 16px; }
.auth-form input:focus { border-bottom-color: var(--accent); }
.auth-form button[type="submit"] {
  margin-top: 28px;
  padding: 12px 0;
  border: 0;
  background: var(--accent-deep);
  color: #fff;
  font-size: 16px;
  font-weight: 600;
}
.auth-form button[type="submit"]:hover { background: var(--accent-press); }
/* 显示 / 隐藏密码（1004）：按钮压在输入框右侧，热区 44×32 */
.pw-field { position: relative; display: flex; align-items: center; }
.pw-field input { flex: 1; padding-right: 56px; }
.pw-eye { position: absolute; right: 0; min-width: 44px; height: 32px; padding: 0 8px; border: 0; background: none; color: var(--link); font-size: 14px; }
#authError { min-height: 20px; margin-top: 8px; color: var(--err-text); font-size: 14px; }
#authError[hidden] { display: block !important; visibility: hidden; }   /* 占位不占眼：出错时版式不跳 */
.auth-switch { margin-top: 18px; text-align: center; }
.auth-switch button { border: 0; background: none; padding: 4px 8px; color: var(--link); font-size: 14px; }
.auth-switch button[aria-pressed="true"] { display: none; }           /* 当前在哪个表单，就只留另一个的入口 */
.auth-help { margin-top: 18px; text-align: center; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.auth-footnote { margin-top: 10px; text-align: center; font-size: 13px; }
.auth-footnote a { display: inline-block; min-height: 32px; padding: 8px 12px; line-height: 16px; color: var(--text-dim); text-decoration: none; }   /* 1004：热区 ≥32px */

/* ── toast ───────────────────────────────────────────────────── */
#toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  translate: -50% 0;
  max-width: 86vw;
  padding: 9px 18px;
  border-radius: var(--r-sm);
  background: rgba(0, 0, 0, .78);
  color: #fff;
  font-size: 13px;
  z-index: 90;
  pointer-events: none;   /* 只是提示字：不能挡住底下的「按住 说话」和输入框（0926 真机测：刚提示完再按，按在提示上没反应） */
}
#toast.toast-error { background: rgba(160, 30, 30, .9); }

/* ── 天地（登录后首页）：白卡里一块一块讲 ────────────────────────── */
.td-main { max-width: 760px; }
.td-loading { color: var(--text-faint); font-size: 13px; padding: 24px 0; }
.td-error { margin: 12px 0; padding: 10px 14px; border-radius: var(--r-md); background: #fff1f0; color: var(--err-text); font-size: 14px; }
.td-hero { padding: 20px 18px; background: var(--surface); border-radius: var(--r-md); }
.td-kicker { color: var(--text-dim); font-size: 13px; }
.td-hero h1 { font-size: 24px; font-weight: 600; line-height: 1.35; margin: 2px 0; }
.td-updated { color: var(--text-dim); font-size: 13px; }
.td-lead { margin-top: 12px; color: var(--text-dim); font-size: 14.5px; line-height: 1.8; white-space: pre-line; overflow-wrap: anywhere; }
.td-stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.td-stat { min-width: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--raised); }
.td-stat strong { display: block; font-size: 20px; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.td-stat span { display: block; color: var(--text-dim); font-size: 13px; line-height: 1.45; overflow-wrap: anywhere; }
.td-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.td-cta {
  display: inline-flex; align-items: center;
  padding: 8px 20px;
  border-radius: var(--r-sm);
  background: var(--accent-deep);
  color: #fff;
  text-decoration: none;
  font-size: 15px; font-weight: 600;
}
.td-cta:hover { background: var(--accent-press); }
.td-cta-sub {
  display: inline-flex; align-items: center;
  padding: 8px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--control-border);
  background: var(--surface);
  color: var(--text-dim);
  text-decoration: none;
  font-size: 15px;
}
.td-block { margin-top: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-block-head { display: flex; gap: 12px; align-items: flex-start; }
.td-block-head > div { min-width: 0; }
.td-num {
  flex: 0 0 auto; display: grid; place-items: center;
  width: 30px; height: 30px; margin-top: 2px;
  border-radius: 50%;
  background: var(--accent-tint);
  color: var(--accent-hi);
  font-size: 14px; font-weight: 600;
}
.td-block-head h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.td-block-lead { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.65; white-space: pre-line; overflow-wrap: anywhere; }
.td-block > .td-stats { margin-top: 12px; }
.td-group { margin: 18px 0 2px; }
.td-group h3 { color: var(--text-dim); font-size: 14px; font-weight: 600; line-height: 1.5; overflow-wrap: anywhere; }
.td-group-sub { color: var(--text-faint); font-size: 12.5px; line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
.td-item { margin-top: 8px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); overflow-wrap: anywhere; }
.td-item-title { margin-bottom: 4px; font-size: 15px; font-weight: 600; line-height: 1.5; }
.td-item-text { font-size: 14.5px; line-height: 1.75; white-space: pre-line; }
.td-said { color: var(--link); }
.td-quote { margin-top: 6px; padding-left: 10px; border-left: 3px solid var(--accent); font-size: 14.5px; line-height: 1.7; white-space: pre-line; }
.td-meta { margin-top: 6px; color: var(--text-dim); font-size: 13px; line-height: 1.6; white-space: pre-line; }
.td-link {
  display: inline-block;
  margin-top: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--control-border);
  background: var(--surface);
  text-decoration: none;
  font-size: 13px;
}
.td-ref { margin-top: 8px; padding-top: 6px; border-top: 1px dashed var(--line); color: var(--text-faint); font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; }
.td-admin-only { outline: 1px dashed var(--warn); }
.td-flag { display: inline-block; margin: 2px 0 6px; padding: 1px 9px; border-radius: 999px; background: #fff7e6; color: var(--warn); font-size: 11.5px; }
.td-block > .td-flag { margin-top: 10px; }
.td-none { margin-top: 10px; color: var(--text-faint); font-size: 13px; }
.td-empty { padding: 48px 18px; text-align: center; background: var(--surface); border-radius: var(--r-md); }
.td-empty h1 { font-size: 20px; font-weight: 600; }
.td-empty p { margin-top: 8px; color: var(--text-dim); font-size: 14px; line-height: 1.7; }
.td-empty .td-actions { justify-content: center; }
.td-empty .say-hints { margin-top: 16px; }
.td-admin-bar { margin-bottom: 12px; padding: 10px 14px; border-radius: var(--r-md); background: #fff7e6; color: var(--text-dim); font-size: 13px; line-height: 1.7; overflow-wrap: anywhere; }
.td-admin-bar strong { color: var(--warn); }
.td-admin-back { white-space: nowrap; }
.td-index { padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-index h1 { font-size: 20px; font-weight: 600; line-height: 1.4; }
.td-index-sub { margin-top: 6px; color: var(--text-faint); font-size: 13px; line-height: 1.7; }
.td-index-list { list-style: none; margin: 14px 0 0; display: grid; gap: 8px; }
.td-index-row { min-width: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); }
.td-index-link { display: block; font-size: 16px; font-weight: 600; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.td-index-meta { display: block; margin-top: 4px; color: var(--text-faint); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
/* 绩效表（0929，只给管理员）：每条线一张卡，指标表三列（看什么 / 我们 / 对照） */
.td-perf { margin-bottom: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-perf h1 { font-size: 20px; font-weight: 600; line-height: 1.4; }
.td-perf-line { margin-top: 10px; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); min-width: 0; }
.td-perf-head { display: flex; gap: 8px; align-items: baseline; justify-content: space-between; }
.td-perf-head h2 { font-size: 16px; font-weight: 600; line-height: 1.45; min-width: 0; overflow-wrap: anywhere; }
.td-verdict { flex: none; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 1.7; color: var(--text-dim); background: var(--raised-hi); }
.td-verdict-up { color: var(--ok); background: var(--accent-tint); }
.td-verdict-down { color: var(--err); background: rgba(250, 81, 81, .1); }
.td-verdict-flat { color: var(--warn); background: rgba(250, 157, 59, .12); }
.td-perf-table { width: 100%; margin-top: 8px; border-collapse: collapse; font-size: 13px; line-height: 1.55; }
.td-perf-table th { padding: 4px 6px 4px 0; color: var(--text-faint); font-weight: 400; text-align: left; border-bottom: 1px solid var(--line); }
.td-perf-table th:first-child { width: 38%; }
.td-perf-table td { padding: 6px 6px 6px 0; vertical-align: top; border-bottom: 1px solid var(--line-soft); overflow-wrap: break-word; }
.td-perf-table tr:last-child td { border-bottom: 0; }
.td-perf-ours { font-weight: 600; white-space: nowrap; }   /* 「14%（23/167）」按规则中间断不开，窄列里会被硬拆成两截 */
.td-perf-note { margin-top: 6px; color: var(--text-dim); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.td-perf-foot { margin-top: 6px; color: var(--text-faint); font-size: 12.5px; line-height: 1.6; overflow-wrap: anywhere; }
.td-perf-notes { margin-top: 14px; }
.td-perf-notes h2 { font-size: 15px; font-weight: 600; line-height: 1.5; }
.td-perf-notes ul { margin: 4px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13px; line-height: 1.7; }
.td-perf-notes li { overflow-wrap: anywhere; }
@media (min-width: 640px) { .td-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
/* 1004 第三批顶部三格：任何宽度都一排三个；手机上每格只有 100px 出头，数和名字各缩一号 */
.td-stats.td-stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.td-stats-3 .td-stat { padding: 10px; }
.td-stats-3 .td-stat strong { font-size: 18px; }
.td-stats-3 .td-stat span { font-size: 12.5px; }
.td-stats-notes { margin-top: 8px; color: var(--text-faint); font-size: 12px; line-height: 1.65; overflow-wrap: anywhere; }
.td-stats-notes p + p { margin-top: 2px; }
.td-card-ask { box-shadow: inset 3px 0 0 var(--accent); }
/* 1004 第三批「正在干的活」「能交给它的事」 */
.td-working, .td-handoff { margin-top: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-working h2, .td-handoff h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.td-working-lead, .td-handoff-lead { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.td-working-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.td-working-item { min-width: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--raised); }
.td-working-doing { box-shadow: inset 3px 0 0 var(--accent); }
.td-working-title { display: block; font-size: 14.5px; line-height: 1.55; overflow-wrap: anywhere; }
.td-working-meta { display: block; margin-top: 2px; color: var(--text-dim); font-size: 13px; }
.td-handoff-list { display: grid; gap: 8px; margin-top: 10px; }
.td-handoff-item { display: block; min-width: 0; padding: 12px 14px; border-radius: var(--r-sm); background: var(--raised); color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.td-handoff-item strong { display: block; font-size: 15px; font-weight: 600; line-height: 1.5; }
.td-handoff-note { display: block; margin-top: 2px; color: var(--text-faint); font-size: 12.5px; line-height: 1.6; }
.td-handoff-say { display: block; margin-top: 4px; color: var(--link); font-size: 13.5px; line-height: 1.6; }
@media (min-width: 640px) { .td-handoff-list { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* 1004 第三批「龙虾能替你做到哪一步」 */
.td-ladder { margin-top: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-ladder h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.td-ladder-lead { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.td-ladder-note { margin-top: 6px; font-size: 14px; line-height: 1.7; overflow-wrap: anywhere; }
.td-ladder-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 8px; }
.td-ladder-step { min-width: 0; padding: 10px 12px; border-radius: var(--r-sm); background: var(--raised); overflow-wrap: anywhere; }
.td-ladder-now { box-shadow: inset 3px 0 0 var(--accent); }
.td-ladder-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: baseline; }
.td-ladder-head strong { font-size: 15px; font-weight: 600; line-height: 1.5; }
.td-ladder-badge { padding: 1px 8px; border-radius: 999px; background: var(--accent-tint); color: var(--ok-text); font-size: 12px; line-height: 1.7; }
.td-ladder-can { margin-top: 2px; font-size: 14px; line-height: 1.65; }
.td-ladder-earn { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.td-ladder .td-item-foot { margin-top: 10px; }
/* 1004 第三批「龙虾替你省下的」 */
.td-saved { margin-top: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-saved h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.td-saved-lead { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.td-saved-table { width: 100%; margin-top: 10px; border-collapse: collapse; font-size: 13.5px; line-height: 1.55; }
.td-saved-table th { padding: 4px 6px 4px 0; color: var(--text-faint); font-weight: 400; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
.td-saved-table td { padding: 7px 6px 7px 0; vertical-align: top; border-bottom: 1px solid var(--line-soft); white-space: nowrap; }
.td-saved-table td.td-saved-kind { width: 100%; white-space: normal; overflow-wrap: anywhere; }
.td-saved-note { display: block; color: var(--text-faint); font-size: 12px; }
.td-saved-table tfoot td { border-bottom: 0; font-weight: 600; }
.td-saved-sum { font-weight: 600; text-align: right; }
.td-saved-table th:last-child { text-align: right; }

/* 简报（1004）：每张卡一件事 + 一句预填的话 + 一个按钮；手机单列、电脑两列 */
.td-brief { margin-top: 12px; padding: 18px; background: var(--surface); border-radius: var(--r-md); }
.td-brief-head h2 { font-size: 18px; font-weight: 600; line-height: 1.4; }
.td-brief-lead { margin-top: 2px; color: var(--text-dim); font-size: 13px; line-height: 1.65; overflow-wrap: anywhere; }
.td-cards { display: grid; gap: 10px; margin-top: 12px; }
.td-card { min-width: 0; padding: 14px; border-radius: var(--r-sm); background: var(--raised); overflow-wrap: anywhere; }
.td-card-tag { display: inline-block; margin-bottom: 6px; padding: 1px 9px; border-radius: 999px; background: var(--accent-tint); color: var(--ok-text); font-size: 12px; line-height: 1.7; }
.td-card h3 { font-size: 15.5px; font-weight: 600; line-height: 1.5; }
.td-card-facts { margin: 6px 0 0; padding-left: 18px; color: var(--text-dim); font-size: 13.5px; line-height: 1.7; }
.td-card-say { margin-top: 8px; color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.td-card-say .td-said { color: var(--text); }
.td-card-btn { margin-top: 10px; border: 0; font: inherit; font-size: 15px; font-weight: 600; cursor: pointer; }
.td-card-btn:disabled { opacity: .55; cursor: default; }
/* 发过了（1004）：按钮退成白底灰字，只剩「去看回复」 */
.td-card-btn-done, .td-card-btn-done:hover { background: var(--surface); color: var(--text-dim); border: 1px solid var(--control-border); }
/* 记住的事：每条脚下一个来源标签 + 「改一下」 */
.td-item-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 8px; }
.td-source { padding: 1px 9px; border-radius: 999px; background: var(--raised-hi); color: var(--text-dim); font-size: 12px; line-height: 1.7; }
.td-source-said { background: var(--accent-tint); color: var(--link); }
.td-fix { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 1px solid var(--control-border); border-radius: 999px; background: var(--surface); color: var(--link); font-size: 13px; text-decoration: none; }   /* 1004：原 38×20 的文字链点不中 */
.td-fix:hover { background: var(--raised); }
@media (min-width: 640px) { .td-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* 装到手机桌面说明页（公开、无导航）；装好后全屏打开时不再显示入口 */
.inst-steps { margin-top: 12px; padding: 12px 14px 12px 34px; border-radius: var(--r-sm); background: var(--raised); }
.inst-steps li { font-size: 14.5px; line-height: 1.75; overflow-wrap: anywhere; }
.inst-steps li + li { margin-top: 8px; }
.inst-steps strong { color: var(--link); font-weight: 600; }
@media (display-mode: standalone) { .inst-link { display: none !important; } }
@media (min-width: 1024px) { .inst-link { display: none !important; } }   /* 1004：电脑上不劝「装到手机桌面」 */
/* 微信内置浏览器横幅 + 非本机那段收起（1004） */
.inst-wxbar { margin-bottom: 12px; padding: 12px 14px; border-radius: var(--r-md); background: #fff7e6; color: var(--warn-text); font-size: 14.5px; line-height: 1.6; }
.inst-more { margin-top: 12px; font-size: 14px; }
/* 全站横幅（1004）：改密提醒（橙）/ 装桌面开通知（绿） */
.pw-banner { display: block; padding: 10px 14px; background: #fff7e6; color: var(--warn-text); font-size: 14px; line-height: 1.5; text-decoration: none; border-bottom: 1px solid #f5d9a8; }
.page-main > .pw-banner { margin-bottom: 12px; border: 0; border-radius: var(--r-md); }
.notify-bar { display: flex; align-items: center; gap: 6px; padding: 6px 6px 6px 14px; background: var(--accent-tint); color: var(--text); font-size: 14px; line-height: 1.5; }
.notify-bar-link { flex: 1; color: var(--link); text-decoration: none; }
.notify-bar-close { width: 32px; height: 32px; padding: 0; border: 0; background: none; color: var(--text-dim); font-size: 22px; line-height: 1; }

/* ── 手机 ─────────────────────────────────────────────────────── */
@media (max-width: 860px) {
  body:not([data-page="login"]):not([data-page="install"]) { padding-left: 0; padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .topbar {
    inset: auto 0 0 0;
    width: auto;
    height: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px));   /* 装到桌面后全屏：底部横条那段另加 */
    flex-direction: row;
    gap: 0;
    padding: 0 0 env(safe-area-inset-bottom, 0px);
    background: var(--raised);
    border-right: 0;
    border-top: 1px solid var(--line);
  }
  .nav-avatar, .nav-logout { display: none; }        /* 退出在「我」页 */
  .topbar nav { flex-direction: row; gap: 0; }
  .topbar nav a { flex: 1; width: auto; padding: 6px 0 4px; border-radius: 0; font-size: 12px; }   /* 1004：原 10px */
  .topbar nav a:hover { background: none; }

  .chat-main { height: calc(100dvh - var(--tab-h) - env(safe-area-inset-bottom, 0px)); }
  .chat-sessions { flex: 1 1 auto; border-right: 0; }
  .conversation-panel { position: fixed; inset: 0; z-index: 50; }
  body[data-chat-view="list"] .conversation-panel { display: none; }   /* 两屏切换：列表 ↔ 对话 */
  body[data-chat-view="convo"] .chat-sessions { display: none; }
  .conversation-head { position: relative; justify-content: center; padding: 8px 48px; }
  .conversation-title { text-align: center; }
  .convo-back { display: grid; place-items: center; position: absolute; left: 6px; top: 50%; translate: 0 -50%; }
  .head-actions { position: absolute; right: 8px; top: 50%; translate: 0 -50%; }
  /* 没有会话列表的人（非管理员）：对话不盖住底部三格，也没有返回键 */
  .chat-sessions[hidden] + .conversation-panel { bottom: calc(var(--tab-h) + env(safe-area-inset-bottom, 0px)); }
  .chat-sessions[hidden] + .conversation-panel .convo-back { display: none; }
  .msg-body { max-width: 80%; }
  .conversation-scroll { padding: 12px 10px 8px; }
  #composer { padding-bottom: env(safe-area-inset-bottom, 0px); }
  .chat-sessions[hidden] + .conversation-panel #composer { padding-bottom: 0; }
  #msgInput { font-size: 16px; }             /* 苹果上输入框字号小于 16px，一点进去整页会放大 */
  .composer-hint { display: none; }

  .page-main { padding: 12px 12px 30px; }
  .stats-grid { gap: 6px; }
  .order-card { min-width: 0; max-width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
