/* MyDesk — 移动端优先简洁样式（配色参考飞书：清爽浅色 + 蓝色强调） */
:root {
  --accent: #3370ff; --accent-dark: #2454d6; --accent-soft: #eef3ff;
  --bg: #f5f6f7; --surface: #fff; --border: #e5e6eb;
  --text: #1f2329; --text-2: #4e5969; --text-3: #8f959e;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
/* hidden 属性必须真的隐藏。
   浏览器默认样式表里 [hidden] 是 display:none，但那是 UA 规则——作者写的
   任何 display（哪怕只是 .foo { display: flex }）特异性都更高，会把它盖掉，
   于是 el.hidden = true 变成一句空话，元素照常显示。
   2026-08-22 真实踩到两次：会话头「关联」的折叠、后台 AI 员工卡的折叠，
   两处都用 el.hidden 控制显隐，而容器各自写了 display:flex，点了按钮毫无反应
   （fbsys #259）。这条规则从根上消灭这一类 bug，不用每加一个可折叠容器
   就记得配一条 [hidden]{display:none}。 */
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 15px; line-height: 1.6; color: var(--text); background: var(--bg);
}
a { color: var(--accent); text-decoration: none; }

/* 顶栏 */
.topbar {
  display: flex; align-items: center; gap: 14px;
  background: var(--surface); color: var(--text); padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 10;
}
.brand { color: var(--accent); font-weight: 700; font-size: 16px; letter-spacing: .2px; }
.nav { display: flex; gap: 18px; flex: 1; }
.nav a { color: var(--text-2); padding: 3px 2px; font-size: 14px; border-bottom: 2px solid transparent; }
.nav a.active { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.lang-switch { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.lang-switch a { color: var(--text-3); padding: 2px 4px; }
.lang-switch a.active { color: var(--accent); font-weight: 600; }
.lang-switch-login { justify-content: center; margin-bottom: 4px; }
.logout-form { display: flex; align-items: center; gap: 10px; }
.whoami { color: var(--text-3); font-size: 13px; }
.btn-link {
  background: none; border: none; color: var(--text-3); cursor: pointer; font-size: 14px; padding: 0;
}
.btn-link:hover { color: var(--accent); }

/* 布局 */
.container { max-width: 720px; margin: 0 auto; padding: 14px 12px 90px; }
body.page-dashboard .container { margin-left: 0; }
.page-title { font-size: 18px; margin-bottom: 12px; }
.section-title { font-size: 15px; margin: 18px 0 8px; color: var(--text-2); }
.back { margin-bottom: 10px; }
.empty { color: var(--text-3); text-align: center; padding: 24px 0; }

/* 表单 */
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack label { display: flex; flex-direction: column; gap: 5px; font-size: 14px; color: var(--text-2); }
/* 表单控件不从 body 继承 font-family——浏览器给的是 UA 默认字体（Chrome 多为 Arial，
   textarea 在部分浏览器甚至是等宽），所以不显式 inherit 就会出现"输入框里的字跟页面
   其它地方不一样"（#215）。button 同理，一并收进来，免得按钮文字又是另一种字形。
   全站没有任何输入框刻意用等宽，这条不会覆盖掉谁的有意设定。 */
input, select, textarea, button { font-family: inherit; }
input[type="text"], input[type="password"], input[type="url"], input[type="email"], input[type="search"], select, textarea {
  width: 100%; padding: 9px 10px; font-size: 15px; color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
.btn {
  display: inline-block; text-align: center; padding: 9px 16px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--surface); color: var(--text); cursor: pointer;
}
.btn:hover { border-color: #c9cdd4; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn-block { display: block; width: 100%; }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 14px; }
.alert-error { background: #ffece8; color: #d54941; border: 1px solid #ffd0c7; }

/* 登录页 */
body.page-login { background: var(--bg); }
.login-box {
  max-width: 360px; margin: 12vh auto 0; padding: 32px 28px; display: flex; flex-direction: column; gap: 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 16px;
  box-shadow: 0 8px 28px rgba(31, 35, 41, .07);
}
.login-title { font-size: 22px; font-weight: 700; color: var(--accent); text-align: center; margin-bottom: 2px; }
.login-divider { display: flex; align-items: center; gap: 10px; color: var(--text-3); font-size: 12px; margin: -4px 0; }
.login-divider::before, .login-divider::after { content: ''; flex: 1 1 auto; height: 1px; background: var(--border); }

/* 筛选 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters select { flex: 1 1 30%; min-width: 105px; width: auto; }
.filters .btn { flex: 0 0 auto; }

/* 反馈卡片 */
.feedback-list { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.card { background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; }
.card-link { display: block; padding: 12px; color: inherit; }
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.card-path { font-size: 13px; color: #57606a; }
.card-desc { font-size: 14px; margin-bottom: 8px; word-break: break-word; }
.card-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; font-size: 12px; color: #8b949e; }

.card-body { padding: 12px; }
.card-id { margin-left: auto; font-size: 13px; white-space: nowrap; }
.card-url {
  display: block; font-size: 13px; color: var(--accent); word-break: break-all;
  margin-bottom: 6px; text-decoration: underline;
}
.card-link-plain { display: block; color: inherit; }
.tag-project {
  font-size: 12px; color: #57606a; background: #eef0f2;
  border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.tag-img {
  font-size: 12px; color: #0a6b3b; background: #e6f6ec;
  border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.tag-assignee {
  font-size: 12px; color: #7a4d00; background: #fdf1d9;
  border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
.tag-assignee.is-unassigned { color: #8b949e; background: #eef0f2; }

/* 图片缩略图（聊天输入框粘贴/选择的图片预览，.composer-previews 里用） */
.img-thumb {
  position: relative; width: 84px; height: 84px; border-radius: 8px; overflow: hidden;
  border: 1px solid #e3e6ea; background: #f0f2f4;
}
.img-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.img-del {
  position: absolute; top: 2px; right: 2px; width: 20px; height: 20px; line-height: 18px;
  border: none; border-radius: 50%; background: rgba(0,0,0,.6); color: #fff;
  font-size: 15px; cursor: pointer; padding: 0;
}

/* 详情页图片 */
.detail-images { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.img-thumb-link {
  display: block; width: 96px; height: 96px; border-radius: 8px; overflow: hidden;
  border: 1px solid #e3e6ea; background: #f0f2f4;
}
.img-thumb-link img { width: 100%; height: 100%; object-fit: cover; display: block; }
.path-chip { font-size: 13px; color: #57606a; margin-bottom: 10px; }
.path-chip code { background: #eef0f2; border-radius: 4px; padding: 1px 6px; }
.path-chip a { margin-left: 6px; }

/* 状态徽章 */
.badge { font-size: 12px; padding: 2px 8px; border-radius: 999px; color: #fff; white-space: nowrap; }
.badge-open       { background: #e8590c; }
.badge-processing { background: var(--accent); }
.badge-resolved   { background: #2da44e; }
.badge-wontfix    { background: #8b949e; }
.badge-closed     { background: #30363d; }

/* 底部固定提交按钮 */
.fab-wrap {
  position: fixed; left: 0; right: 0; bottom: 0; padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, #f5f6f8 40%);
}
.fab-wrap .btn { max-width: 720px; margin: 0 auto; box-shadow: 0 4px 12px rgba(26, 111, 212, .35); }

/* 详情页 */
.detail-card { padding: 12px; }
.detail-desc { margin: 10px 0; word-break: break-word; }
.status-form { display: flex; align-items: flex-end; gap: 8px; margin-top: 12px; }
.status-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: #57606a; flex: 1; }
.reply-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.reply { background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; padding: 10px 12px; }
.reply-admin { border-color: #b6d4fe; background: #f2f8ff; }
.reply-head { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.reply-user { font-weight: 600; }
.tag-official { font-size: 11px; color: var(--accent); border: 1px solid #b6d4fe; border-radius: 4px; padding: 0 5px; }
.reply-time { margin-left: auto; color: #8b949e; font-size: 12px; }
.reply-body { font-size: 14px; word-break: break-word; }
.reply-form { margin-top: 16px; }

/* 汇总表 */
.summary-section-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 28px 0 12px; }
.summary-section-title:first-of-type { margin-top: 8px; }
.table-wrap { overflow-x: auto; background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; }
.summary-table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 420px; }
.summary-table th, .summary-table td { padding: 8px 6px; text-align: center; border-bottom: 1px solid #eef0f2; }
.summary-table .col-page { text-align: left; padding-left: 12px; }
.summary-table thead th { background: #f7f8fa; color: #57606a; font-weight: 600; }
.project-row td { background: #eef3f9; font-weight: 700; text-align: left; padding-left: 12px; }
.cnt-open { color: #e8590c; font-weight: 600; }
.cnt-processing { color: var(--accent); font-weight: 600; }
.cnt-resolved { color: #2da44e; font-weight: 600; }
.cnt-wontfix { color: #8b949e; font-weight: 600; }
.cnt-closed { color: #30363d; font-weight: 600; }
.cnt-zero { color: #c9d1d9; }

/* 处理量统计（/activity） */
.activity-days { display: flex; flex-direction: column; gap: 20px; margin-top: 16px; }
.activity-day-title { font-size: 15px; font-weight: 700; margin-bottom: 8px; }
.activity-tables { display: flex; flex-wrap: wrap; gap: 14px; }
.activity-table { min-width: 240px; }
.activity-table .col-page { width: 70%; }

.error-box { max-width: 420px; margin: 10vh auto 0; display: flex; flex-direction: column; gap: 12px; text-align: center; }

@media (min-width: 640px) {
  body { font-size: 15px; }
  .container { padding-top: 20px; }
}

/* form field labels (2026-08-19 polish) */
.field-label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; color: #12233d; }
.field-label .req { color: #e02929; font-style: normal; }
.field-hint { display: block; margin-top: 5px; font-size: 12px; color: #9db1c7; word-break: break-all; }

/* 「我提的反馈」筛选 + 一键关闭/重开（2026-08-19） */
.filters .chk { display: flex; align-items: center; gap: 5px; font-size: 13px; color: #57606a; flex: 0 0 auto; cursor: pointer; user-select: none; }
.filters .chk input { margin: 0; }
.quick-status-form { margin-top: 8px; }
.btn-close-fb { background: #2da44e; border-color: #2da44e; color: #fff; }
.btn-reopen { background: #d29922; border-color: #d29922; color: #fff; }

/* ============ 会话式改版（2026-08-19）：主从布局 + 聊天流 ============ */
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 6px; }
.f-search { flex: 1 1 100%; }
.tag-bot { font-size: 11px; color: #8250df; border: 1px solid #d8c5f5; border-radius: 4px; padding: 0 5px; }

/* /all 项目快筛卡片 */
.project-quick-filter { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; }
.project-quick-card {
  flex: 0 0 auto; display: flex; flex-direction: column; gap: 4px; padding: 6px 10px;
  background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; color: inherit; white-space: nowrap;
  transition: border-color .15s;
}
.project-quick-card:hover { border-color: var(--accent); }
.project-quick-card.is-on { border-color: var(--accent); background: var(--accent-soft); }
.project-quick-name { font-size: 12px; font-weight: 600; border-radius: 4px; padding: 1px 6px; align-self: flex-start; }
.project-quick-counts { display: flex; gap: 8px; font-size: 11px; }

/* 状态计数标签页 */
.status-tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.stab { font-size: 12px; padding: 4px 10px; border-radius: 999px; background: #fff; border: 1px solid #e3e6ea; color: #57606a; white-space: nowrap; }
.stab.is-on { background: var(--accent); color: #fff; border-color: var(--accent); }
.stab b { font-weight: 700; margin-left: 2px; }

/* 会话列表（LINE 风） */
.conv-list { list-style: none; display: flex; flex-direction: column; background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; overflow: hidden; }
.conv { position: relative; border-bottom: 1px solid #f0f2f4; }
.conv:last-child { border-bottom: none; }
.conv.is-active { background: var(--accent-soft); }
.conv:hover { background: #f7f9fc; }
.conv.is-active:hover { background: #e2ebff; }
.conv-link { display: flex; gap: 10px; padding: 10px 12px; color: inherit; }
.conv-main { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.conv-r1 { display: flex; gap: 8px; align-items: baseline; }
.conv-title { flex: 1 1 auto; min-width: 0; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-time { flex: 0 0 auto; font-size: 11px; color: #8b949e; }
.conv-r2 { display: flex; gap: 8px; align-items: center; }
.conv-preview { flex: 1 1 auto; min-width: 0; font-size: 13px; color: #57606a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-ai-icon { margin-right: 3px; }
.conv.unread .conv-title { font-weight: 800; }
.conv.unread .conv-preview { font-weight: 700; color: #1f2933; }
.dot { flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: #e02929; box-shadow: 0 0 0 2px #fff; }
.conv-r3 { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11px; color: #8b949e; }
.conv-r3 .badge { font-size: 11px; padding: 1px 7px; }
.conv-path { max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conv-cnt { white-space: nowrap; }
.conv-quick { position: absolute; right: 10px; bottom: 8px; }
.conv-close { width: 26px; height: 26px; border-radius: 50%; border: 1px solid #d0d7de; background: #fff; color: #2da44e; cursor: pointer; line-height: 1; }
.conv-close:hover { background: #2da44e; color: #fff; border-color: #2da44e; }
.pri { font-size: 11px; border-radius: 4px; padding: 0 6px; white-space: nowrap; }
.pri-1 { background: #fff4e5; color: #b35309; border: 1px solid #ffd8a8; }
.pri-2 { background: #ffe3e3; color: #c92a2a; border: 1px solid #ffc9c9; }

/* 主从容器 */
.md-wrap { display: block; }
.md-panel { background: #fff; }
.panel-empty { color: #8b949e; text-align: center; padding: 40px 16px; }

/* 会话面板 */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.new-compose-layout { display: flex; height: 100%; min-height: 0; }
.new-compose-layout .chat { flex: 1 1 480px; min-width: 0; }
.new-compose-tasks { display: none; }
.new-compose-tasks-title { font-size: 13px; font-weight: 700; color: var(--text-2); margin-bottom: 10px; }
.new-compose-tasks-list { display: flex; flex-direction: column; gap: 8px; list-style: none; }
.new-compose-task-link {
  display: block; background: #fff; border: 1px solid var(--border); border-radius: 8px;
  padding: 8px 10px; color: inherit; transition: border-color .15s;
}
.new-compose-task-link:hover { border-color: var(--accent); }
.new-compose-task-title { display: block; font-size: 13px; color: var(--text); line-height: 1.4; }
.new-compose-task-meta { display: block; font-size: 11px; color: var(--text-3); margin-top: 4px; }
.chat-head { flex: 0 0 auto; padding: 10px 12px; border-bottom: 1px solid #eef0f2; background: #fff; }
.chat-head-top { display: flex; align-items: center; gap: 8px; }
.chat-back { display: none; border: none; background: none; font-size: 26px; line-height: 1; color: var(--accent); cursor: pointer; padding: 0 4px 0 0; }
.chat-title { flex: 1 1 auto; min-width: 0; }
.chat-name { font-weight: 700; font-size: 15px; }
.chat-id { color: #8b949e; font-weight: 400; font-size: 12px; margin-left: 6px; }
.chat-sub { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; font-size: 11px; color: #8b949e; }
.chat-path { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 50%; }
.chat-open { flex: 0 0 auto; color: #8b949e; font-size: 16px; }
/* 会话头右上角「复制工单链接」，也是 .copy-btn（复用复制逻辑/已复制态），
   默认胶囊按钮跟旁边 ↗ 独立页面图标不协调，改成同款纯图标小按钮 */
.chat-copy-link.copy-btn {
  flex: 0 0 auto; border: none; background: none; padding: 0; border-radius: 4px;
  font-size: 15px; line-height: 1; color: #8b949e; cursor: pointer;
}
.chat-copy-link.copy-btn:hover { border-color: transparent; color: var(--accent); }
.chat-copy-link.copy-btn.is-copied { border-color: transparent; color: #2da44e; }
.chat-url { display: block; margin-top: 6px; font-size: 12px; color: var(--accent); word-break: break-all; text-decoration: underline; }
.chat-tools { display: flex; gap: 12px; flex-wrap: wrap; }
.chat-tools select { width: auto; padding: 4px 8px; font-size: 13px; }
.btn-row { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: 8px; }
.btn-row-label { font-size: 12px; color: #8b949e; }
.chip { font-size: 12px; padding: 4px 10px; border-radius: 999px; border: 1px solid #d0d7de; background: #fff; color: #57606a; cursor: pointer; }
.chip:hover { border-color: #8b949e; }
.chip.is-on { color: #fff; border-color: transparent; font-weight: 600; }
.chip-open.is-on { background: #e8590c; }
.chip-processing.is-on { background: var(--accent); }
.chip-resolved.is-on { background: #2da44e; }
.chip-wontfix.is-on { background: #8b949e; }
.chip-closed.is-on { background: #30363d; }
.chip-pri-0.is-on { background: #57606a; }
.chip-pri-1.is-on { background: #f08c00; }
.chip-pri-2.is-on { background: #e03131; }

/* 消息流 */
.msg-list { flex: 1 1 auto; min-height: 0; overflow-y: auto; list-style: none; padding: 12px; background: #eef1f5; }
.msg { display: flex; gap: 8px; margin-bottom: 10px; align-items: flex-start; }
.msg-mine { flex-direction: row-reverse; }
/* 气泡宽度上限从 80% 提到 92%（PM 两次提「会话框再加大」）。
   留 8% 而不是拉满，是为了保住"自己的消息靠右、别人的靠左"这个视觉区分——
   拉到 100% 两侧就对齐了，一眼看不出谁说的。 */
.msg-main { max-width: 92%; min-width: 0; }
.msg-who { display: flex; align-items: center; gap: 6px; font-size: 12px; color: #57606a; margin-bottom: 2px; }
.msg-name { font-weight: 600; }
/* 气泡与下方的时间/复制/收藏改成竖排（PM 在 h5html #232 提的）。
   原先是横排：按钮挤在气泡右侧，长内容会把气泡宽度压窄，而 AI 回复动辄几屏，
   按钮贴在顶端离读完的位置很远。竖排之后气泡能吃满宽度，按钮就在读完的地方。 */
.msg-row { display: flex; flex-direction: column; align-items: flex-start; gap: 3px; min-width: 0; }
.msg-mine .msg-row { align-items: flex-end; }
.msg-foot { display: flex; align-items: center; gap: 6px; padding: 0 2px; }
/* min-width: 0 是必须的——.bubble 是 flex 子项，默认 min-width:auto 会被内部宽内容
   （比如 Markdown 表格 th/td 的 white-space:nowrap）撑开到超过 .msg-main 的 80% 上限，
   .msg-table-wrap 自己的 overflow-x:auto 因此永远没机会生效，窄屏下整个气泡会溢出屏幕外 */
.bubble { background: #fff; border-radius: 12px; padding: 8px 11px; box-shadow: 0 1px 1px rgba(0,0,0,.06); word-break: break-word; font-size: 14px; min-width: 0; }
.msg-mine .bubble { background: #dce8fc; color: #1f2933; }
.msg-mine .bubble a, .msg-mine .bubble .bubble-url { color: #2454d6; }
.bubble-url { display: block; font-size: 12px; margin-bottom: 4px; word-break: break-all; text-decoration: underline; }
.bubble-body a { text-decoration: underline; word-break: break-all; }
.msg-conclusion {
  display: inline-block; font-weight: 700; font-size: 13px; color: #fff; background: var(--accent);
  border-radius: 6px; padding: 3px 9px; margin-bottom: 6px;
}
.bubble-images { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }

/* 回复正文里的极简 Markdown 渲染（render_message_body()/md_render_blocks()），
   气泡本来就窄，标题/间距都按缩小版处理，不能照搬正常页面的排版尺寸 */
.bubble-body p { margin: 4px 0; }
.bubble-body p:first-child { margin-top: 0; }
.bubble-body p:last-child { margin-bottom: 0; }
.msg-h { margin: 8px 0 4px; line-height: 1.3; }
.msg-h:first-child { margin-top: 0; }
h1.msg-h { font-size: 17px; }
h2.msg-h { font-size: 16px; }
h3.msg-h, h4.msg-h, h5.msg-h, h6.msg-h { font-size: 14px; }
.msg-hr { border: none; border-top: 1px solid #e5e6eb; margin: 8px 0; }
.msg-md-list { margin: 4px 0; padding-left: 20px; }
.msg-md-list li { margin: 2px 0; }
.bubble-body code { background: rgba(0,0,0,.06); border-radius: 4px; padding: 1px 5px; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
/* 整段是 URL 的行内代码会被包成链接：外观保持 code 小胶囊，但要看得出可点 */
.bubble-body code.code-link { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.bubble-body a:hover code.code-link { background: var(--accent-soft); }
.msg-mine .bubble-body code { background: rgba(0,0,0,.1); }
.msg-code { background: rgba(0,0,0,.06); border-radius: 8px; padding: 8px 10px; margin: 6px 0; overflow-x: auto; }
.msg-code code { background: none; padding: 0; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre; }
.msg-table-wrap { overflow-x: auto; margin: 6px 0; }
.msg-table { border-collapse: collapse; font-size: 13px; width: 100%; }
.msg-table th, .msg-table td { border: 1px solid #e5e6eb; padding: 4px 8px; text-align: left; white-space: nowrap; }
.msg-table th { background: rgba(0,0,0,.04); font-weight: 600; }
.msg-mine .msg-table th, .msg-mine .msg-table td { border-color: rgba(0,0,0,.12); }
.msg-mine .msg-table th { background: rgba(0,0,0,.06); }
.msg-time { flex: 0 0 auto; font-size: 11px; color: #8b949e; white-space: nowrap; }
.msg-bookmark-form { flex: 0 0 auto; }
.msg-bookmark-btn {
  border: none; background: none; cursor: pointer; font-size: 15px; line-height: 1;
  color: #c1c8d1; padding: 2px; border-radius: 4px;
}
.msg-bookmark-btn:hover { color: #d9a521; }
.msg-bookmark-btn.is-on { color: #f0b429; }
/* 消息也是 .copy-btn（复用通用复制逻辑/已复制态），但那边默认是圆角胶囊按钮，
   放消息气泡这种小地方太抢眼，这里用更高特异性把外观改成跟星标一致的纯图标小按钮 */
.msg-copy-btn.copy-btn {
  border: none; background: none; padding: 2px; border-radius: 4px; font-size: 14px; line-height: 1;
  color: #c1c8d1;
}
.msg-copy-btn.copy-btn:hover { border-color: transparent; color: var(--accent); }
.msg-copy-btn.copy-btn.is-copied { border-color: transparent; color: #2da44e; }

/* 收藏页 */
.bookmarks-page { max-width: 720px; margin: 0 auto; padding: 20px 0; }
.empty-hint { color: #8b949e; padding: 24px 0; }
.bookmark-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.bookmark-item { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.bookmark-item-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.bookmark-item-link { font-weight: 600; text-decoration: none; color: inherit; }
.bookmark-item-link:hover { text-decoration: underline; }
.bookmark-item-body { font-size: 14px; color: #1f2933; background: #f6f8fa; border-radius: 8px; padding: 8px 11px; margin-bottom: 8px; }
.bookmark-item-foot { display: flex; align-items: center; gap: 10px; font-size: 12px; color: #8b949e; }
.bookmark-item-author { font-weight: 600; }
.bookmark-item-foot .msg-bookmark-form { margin-left: auto; }
.msg-compact { margin-top: -6px; }
.msg-avatar { width: 32px; height: 32px; border-radius: 50%; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 600; flex: 0 0 auto; }
.msg-avatar-blank { background: transparent !important; }
.msg-avatar-ai {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from 180deg, #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #30b0c7, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30) border-box;
  border: 6px solid transparent; /* 32px 头像半径 16px 的 2/5 */
  font-size: 16px;
}
.msg-day { text-align: center; margin: 12px 0; }
.msg-day span { background: rgba(31,41,51,.10); color: #57606a; font-size: 12px; padding: 2px 10px; border-radius: 999px; }
.msg-sys { justify-content: center; font-size: 12px; color: #8b949e; margin: 8px 0; }

/* 输入框 */
.composer { flex: 0 0 auto; display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid #eef0f2; background: #fff; }
.composer { flex-direction: column; align-items: stretch; }
.composer-row { display: flex; gap: 8px; align-items: flex-end; }
.composer textarea { flex: 1 1 auto; resize: none; max-height: 140px; border-radius: 18px; padding: 9px 14px; }
.btn-send { flex: 0 0 auto; border-radius: 18px; }
.composer-pick { flex: 0 0 auto; cursor: pointer; font-size: 20px; line-height: 34px; padding: 0 2px; user-select: none; }
.composer-previews { display: none; flex-wrap: wrap; gap: 6px; }
.composer-previews.has-items { display: flex; margin-bottom: 8px; }
.composer-previews .img-thumb { width: 64px; height: 64px; }
.new-url-input { margin-bottom: 8px; }
.new-compose-hint { text-align: center; font-size: 12px; color: #8b949e; margin: 8px 0; }
.new-compose-hint-error { color: #d54941; }
.new-compose-hint-warn {
  text-align: left; color: #8a6a3a; background: #fdf1d9; border: 1px solid #f0ddb0;
  border-radius: 10px; padding: 10px 12px; margin: 8px 12px; font-size: 13px;
}
.new-compose-activate { margin-top: 6px; }
.new-compose-activate .admin-field { padding: 4px 0; border-top: none; }
.new-compose-tier-dot { position: static; box-shadow: none; }
.new-compose-agent-status { font-size: 11px; color: var(--text-3); }
.new-pick-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding: 16px 12px; }
.new-pick-section-title { font-size: 13px; font-weight: 700; color: var(--text-3); margin: 14px 0 8px; }
.new-pick-section-title:first-child { margin-top: 0; }
.new-pick-grid { margin: 0; }
.dash-grid.new-pick-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }

/* 独立会话页 */
.standalone-chat { background: #fff; border: 1px solid #e3e6ea; border-radius: 10px; overflow: hidden; height: calc(100vh - 160px); min-height: 420px; }

/* 门户 dashboard */
.dash { padding: 24px 0 8px; }
.dash-title { font-size: 22px; font-weight: 700; color: var(--text); }
.dash-sub { color: var(--text-3); font-size: 14px; margin-top: 4px; }
.dash-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 20px 20px 24px; box-shadow: 0 1px 2px rgba(31, 35, 41, .04); margin-top: 20px;
}
.dash-section-title { font-size: 15px; font-weight: 700; color: var(--text); margin: 0; }
.dash-section .dash-grid { margin-top: 14px; }
.dash-row { display: flex; gap: 16px; align-items: flex-start; flex-wrap: wrap; margin-top: 20px; }
.dash-row .dash-section, .dash-row .admin-info-card { margin-top: 0; }
.dash-section-grow { flex: 3 1 480px; }
.dash-section-grow .dash-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.dash-section-aside { flex: 1 1 300px; max-width: 380px; }
/* 固定 5 列改成按宽度自动换行（PM 在 fbsys #256 提的）：原来无论几个应用、屏幕多宽
   都硬切 5 列，应用一多就被挤成窄条，标题和描述全部折行叠在一起。
   auto-fill + minmax(200px, 1fr)：一行放得下几个放几个，放不下自动换行，
   每张卡不会窄于 200px。不用写断点，窄屏自然退化成 2 列、手机 1 列。 */
.dash-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-top: 22px; }
.dash-card-status { font-size: 12px; color: var(--text-3); }
.dash-card {
  position: relative; display: flex; align-items: center; gap: 12px; padding: 18px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px; color: inherit;
  box-shadow: 0 1px 2px rgba(31, 35, 41, .04); transition: box-shadow .15s, border-color .15s, transform .15s;
}
.dash-card:hover { border-color: var(--accent); box-shadow: 0 6px 20px rgba(31, 35, 41, .08); transform: translateY(-1px); }
.dash-card-icon {
  flex: 0 0 auto; width: 44px; height: 44px; border-radius: 12px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.dash-card-icon[data-kind="ai"] {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from 180deg, #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #30b0c7, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30) border-box;
  border: 9px solid transparent; /* 44px 图标半径 22px 的 2/5 */
}
.dash-card-icon[data-kind="human"] { background: #fff1e0; }
.dash-card-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.dash-card-name { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; font-weight: 600; font-size: 15px; }
.dash-card-code { font-size: 11px; font-weight: 400; color: var(--text-3); background: var(--bg); border-radius: 4px; padding: 1px 5px; }
.dash-card-desc { font-size: 13px; color: var(--text-3); }
/* 整卡可点：铺满卡片的隐形链接（配合 _dashboard_agents.php 里外层由 <a> 改 <div>），
   名称旁的复制按钮用更高 z-index 浮在它上面，点复制不会连带跳转 */
.dash-card-hit { position: absolute; inset: 0; z-index: 1; border-radius: inherit; }
.dash-card-name .copy-btn { position: relative; z-index: 2; }
/* 「复制名称」：跟消息气泡里的复制按钮一致的纯图标小按钮，别在卡片里太抢眼 */
.dash-card-copy.copy-btn {
  border: none; background: none; padding: 2px; border-radius: 4px; font-size: 13px; line-height: 1;
  color: #c1c8d1;
}
.dash-card-copy.copy-btn:hover { color: var(--accent); }
.dash-card-copy.copy-btn.is-copied { color: #2da44e; font-size: 11px; }
/* 代号本身也可点复制：外观保持原来的 <code> 小胶囊，只在 hover/已复制时变色 */
.dash-card-code.copy-btn {
  border: 1px solid transparent; cursor: pointer; line-height: 1.6;
  font-size: 11px; font-weight: 400; color: var(--text-3);
  background: var(--bg); border-radius: 4px; padding: 1px 5px;
}
.dash-card-code.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.dash-card-code.copy-btn.is-copied { border-color: #2da44e; color: #2da44e; }
.dash-card-badge {
  position: absolute; top: 12px; right: 12px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: #f53f3f; color: #fff; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
/* /new 选人页 AI 员工卡的活跃度指示：30 分钟内绿、超 2 小时灰、中间橙 */
.activity-tier-dot { position: absolute; top: 12px; right: 12px; width: 10px; height: 10px; border-radius: 50%; box-shadow: 0 0 0 2px #fff; }
.activity-tier-dot.activity-tier-active { background: #2da44e; }
.activity-tier-dot.activity-tier-warm { background: #e8590c; }
.activity-tier-dot.activity-tier-stale { background: #c9d1d9; }

/* 宽屏：左右并排，各自独立滚动 */
@media (min-width: 900px) {
  /* 工作台是主要内容区，宽屏下靠左铺开，不居中浮在页面中间 */
  /* 会话区加宽（PM 在 h5html #232 提了两次）：容器上限 1360 → 1680，左侧列表列
     上限 400 → 340。两处一起动，会话区净增约 380px；只动一处效果不明显。
     列表列收窄到 340 仍够显示「状态徽章 + 标题两行 + 元信息」，不影响扫读。 */
  body.page-list .container, body.page-admin .container, body.page-dashboard .container { max-width: 1680px; padding-bottom: 16px; margin-left: 0; }
  .md-wrap { display: grid; grid-template-columns: minmax(300px, 340px) 1fr; gap: 12px; height: calc(100vh - 92px); }
  .md-list { overflow-y: auto; min-height: 0; padding-right: 2px; }
  .md-panel { min-height: 0; overflow: hidden; border: 1px solid #e3e6ea; border-radius: 10px; }
  .new-compose-tasks {
    display: flex; flex-direction: column; flex: 0 0 280px; max-width: 320px;
    border-left: 1px solid #e3e6ea; background: #fafbfc; padding: 16px 14px; overflow-y: auto;
  }
  .md-list .filters, .md-list .status-tabs { position: sticky; top: 0; z-index: 2; background: #f5f6f8; padding-top: 2px; }
  .md-list .status-tabs { top: 44px; }
}

/* 管理后台（AI 员工 + 项目字典 + 接入方式） */
.admin-head { margin-bottom: 16px; }
.admin-sub { color: var(--text-3); font-size: 13px; margin-top: 4px; }
.admin-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; }
.admin-tab { padding: 9px 4px; font-size: 14px; color: var(--text-2); border-bottom: 2px solid transparent; margin-right: 16px; }
.admin-tab b { font-weight: 600; color: var(--text-3); margin-left: 3px; }
.admin-tab.is-on { color: var(--accent); font-weight: 600; border-bottom-color: var(--accent); }
.admin-tab.is-on b { color: var(--accent); }
.admin-panel { animation: admin-panel-in .12s ease; }
@keyframes admin-panel-in { from { opacity: 0; transform: translateY(2px); } to { opacity: 1; transform: none; } }

/* 员工卡默认收起后一张只有百来像素高，再排成两列，十来个员工也能一屏看全（#207）。
   auto-fill + minmax 让窄屏自动退回单列，不用额外写断点。卡片高度各不相同（有没有令牌、
   展开没展开），align-items:start 免得同一行的矮卡被拉长留一片空白 */
/* 后台一次性提示：成功绿、失败红，出现在标签栏上方，刷新即消失 */
.admin-flash {
  display: flex; align-items: flex-start; gap: 8px; max-width: 1100px;
  margin: 12px 0 0; padding: 10px 14px; border-radius: 10px;
  border: 1px solid transparent; font-size: 14px; line-height: 1.6;
}
.admin-flash-icon { flex: 0 0 auto; font-weight: 700; }
.admin-flash-ok    { background: #e3f6e8; border-color: #b7e4c4; color: #1a7f37; }
.admin-flash-error { background: #fdeceb; border-color: #f5c2c0; color: #c0392b; }

.admin-agent-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  max-width: 1100px; margin-bottom: 10px; font-size: 13px;
}
.admin-agent-count { color: var(--text-3); }
.admin-agent-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  align-items: start; gap: 12px; max-width: 1100px;
}
.agent-card {
  display: flex; flex-direction: column; gap: 12px; padding: 20px 24px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(31, 35, 41, .04); transition: box-shadow .15s, border-color .15s;
}
.agent-card:focus-within, .agent-card:hover { border-color: #c9cdd4; box-shadow: 0 4px 14px rgba(31, 35, 41, .06); }
.agent-card-new { border-style: dashed; background: var(--bg); }
.agent-card-head { display: flex; gap: 14px; align-items: center; }
/* input[type="text"] 的全局规则 specificity 是 (0,1,1)，比单个 class 选择器 (0,1,0) 高——
   这里全部改用 .agent-card-head 前缀把 specificity 提到 (0,2,0)/(0,2,1)，
   确保头像宽高/输入框去边框这些覆盖能真正生效，不然头像会被撑成 100% 宽把标题挤出卡片外 */
.agent-card-head .agent-avatar {
  flex: 0 0 auto; width: 52px; height: 52px; border-radius: 14px; text-align: center;
  font-size: 24px; padding: 0; border: 1px solid transparent; background: var(--accent-soft); color: var(--text);
}
.agent-card-head .agent-avatar[data-kind="ai"] {
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from 180deg, #ff3b30, #ff9500, #ffcc00, #34c759, #00c7be, #30b0c7, #007aff, #5856d6, #af52de, #ff2d55, #ff3b30) border-box;
  border: 10px solid transparent; /* 52px 头像半径 26px 的 2/5 */
}
.agent-card-head .agent-avatar[data-kind="human"] { background: #fff1e0; }
.agent-card-head .agent-avatar:focus { border-color: var(--accent); outline: none; }
.agent-card-title { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.agent-card-title .agent-name-input { border: none; background: none; padding: 2px 0; font-weight: 700; font-size: 17px; width: 100%; }
.agent-card-title .agent-name-input:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.agent-card-title .agent-code-tag {
  align-self: flex-start; font-size: 12px; color: var(--text-3); background: var(--bg);
  border-radius: 4px; padding: 2px 7px; border: none; width: auto;
}
.agent-card-title .agent-code-tag.agent-code-input { border: 1px dashed var(--border); width: auto; }
.agent-card-title .agent-code-tag.agent-code-input:focus { outline: none; border-color: var(--accent); }
/* 代号 + 所属项目并排：收起状态下这一行就是"这个员工是谁、管什么"的全部信息 */
.agent-card-tags { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; min-width: 0; }
.agent-card-tags .agent-code-tag { align-self: auto; }
.agent-project-tag {
  font-size: 12px; color: var(--accent); background: var(--accent-soft);
  border-radius: 4px; padding: 2px 7px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 160px;
}
.agent-project-tag.is-none { color: var(--text-3); background: var(--bg); }

/* 折叠条：左边是展开/收起，右边是「保存」。保存永远露在外面——收起时也能改名字和职责，
   要是把保存一起藏进折叠区，改完却找不到保存按钮就是新的坑 */
.agent-card-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; }
.agent-fold-toggle {
  border: none; background: none; padding: 2px 0; font-size: 13px; color: var(--text-3);
  cursor: pointer; display: inline-flex; align-items: center; gap: 4px;
}
.agent-fold-toggle::before { content: "⌃"; display: inline-block; transition: transform .15s ease; }
.agent-card.is-folded .agent-fold-toggle::before { transform: rotate(180deg); }
.agent-fold-toggle:hover { color: var(--accent); }
.agent-card-more { display: flex; flex-direction: column; gap: 12px; }
/* 收起后卡片内边距收窄一点，一屏能塞下更多 */
.agent-card.is-folded { padding: 14px 20px; gap: 8px; }
@media (prefers-reduced-motion: reduce) { .agent-fold-toggle::before { transition: none; } }
.agent-card-head .status-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 50%; background: #c9cdd4; }
.status-dot.status-idle { background: #8f959e; }
.status-dot.status-working { background: #2da44e; box-shadow: 0 0 0 3px #e3f6e8; }
.status-dot.status-blocked { background: #f53f3f; }
.status-dot.status-offline { background: #d7dae0; }
.status-dot.status-online { background: #2da44e; box-shadow: 0 0 0 3px #e3f6e8; }
.agent-card .agent-blurb-input { font-size: 14px; color: var(--text-2); border: none; background: none; padding: 0; width: 100%; }
.agent-card .agent-blurb-input:focus { outline: none; }
.agent-blurb-input::placeholder { color: var(--text-3); }
.agent-ops-input {
  width: 100%; font-size: 12px; color: var(--text-2); border: 1px solid var(--border);
  border-radius: 6px; background: var(--bg); padding: 5px 8px; margin-top: 6px;
}
.agent-ops-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.agent-ops-cmd { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.agent-activity-note { font-size: 12px; color: var(--text-3); margin-top: -4px; }
/* 巡查守约：正常的低调，逾期/从未巡查要一眼看见——这条的价值全在"没守约时被看到" */
.agent-poll-note { font-size: 12px; margin-top: -6px; }
.agent-poll-ok    { color: var(--text-3); }
.agent-poll-late  { color: #c0392b; font-weight: 600; }
.agent-poll-never { color: #8f5a00; }
.agent-poll-field { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; color: var(--text-2); margin-top: 6px; }
.agent-poll-field input[type="number"] { width: 76px; flex: 0 0 auto; padding: 5px 8px; font-size: 12px; }
.agent-poll-field small { flex: 1 1 100%; color: var(--text-3); line-height: 1.5; }
.agent-card-row { display: flex; gap: 10px; }
.agent-card-row select { font-size: 13px; padding: 6px 8px; }
.agent-token-row { font-size: 12px; }
.agent-token-row .copy-row code { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: inline-block; vertical-align: middle; }
.agent-card-foot { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px 16px; padding-top: 6px; border-top: 1px solid var(--bg); font-size: 13px; }
.agent-delete:hover { color: #d54941; }
.agent-save:hover { color: var(--accent); }

.admin-project-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.admin-project-row {
  display: flex; gap: 10px; align-items: center; padding: 9px 12px; background: var(--surface);
}
.admin-project-head { background: var(--bg); font-size: 12px; color: var(--text-3); padding: 7px 12px; }
.admin-project-row:not(.admin-project-head):not(.admin-project-row-new):hover { background: #fafbfc; }
.admin-project-row input, .admin-project-row .admin-project-code { background: none; }
.admin-project-code, .admin-project-code-input { flex: 0 0 100px; }
.admin-project-code { color: var(--text-3); font-size: 12px; }
.admin-project-row input[name="name"], .admin-project-row input[name="display_name"] { flex: 1 1 auto; border: none; padding: 4px 2px; }
.admin-project-row:not(.admin-project-head) input[name="name"]:focus,
.admin-project-row:not(.admin-project-head) input[name="display_name"]:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.admin-project-code-input { border: 1px solid var(--border); border-radius: 6px; padding: 4px 7px; font-size: 12px; }
.admin-sort-input { width: 56px; flex: 0 0 auto; border: none; padding: 4px 2px; }
.admin-color-input { width: 32px; height: 26px; flex: 0 0 auto; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: none; cursor: pointer; }
.admin-project-row:not(.admin-project-head) .admin-sort-input:focus { outline: none; box-shadow: 0 1px 0 var(--accent); }
.admin-project-row button { flex: 0 0 auto; }

.admin-info-stack { display: flex; flex-direction: column; gap: 14px; max-width: 640px; }
.admin-info-card {
  padding: 18px 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  box-shadow: 0 1px 2px rgba(31, 35, 41, .04);
}
.admin-info-card h3 { font-size: 15px; margin-bottom: 6px; }
.dash-integrate-head { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.dash-integrate-head h3 { margin-bottom: 0; }
.dash-integrate-icon {
  flex: 0 0 auto; width: 36px; height: 36px; border-radius: 10px; background: var(--accent-soft);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
}
.admin-info-card code { background: var(--bg); border-radius: 4px; padding: 1px 6px; font-size: 12px; }
.admin-info-desc { font-size: 13px; color: var(--text-2); line-height: 1.6; margin-bottom: 14px; }

.admin-field { display: flex; flex-direction: column; gap: 3px; padding: 8px 0; border-top: 1px solid var(--bg); font-size: 13px; }
.admin-field:first-of-type { border-top: none; padding-top: 0; }
.admin-field-label { font-size: 11px; color: var(--text-3); }

.admin-scope-list { display: flex; flex-direction: column; gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.admin-scope-row { display: flex; align-items: center; gap: 8px; padding: 9px 12px; background: var(--surface); font-size: 13px; }
.admin-scope-arrow { color: var(--text-3); }
.admin-scope-row > span:nth-child(3) { flex: 1 1 auto; }
.admin-scope-state { font-size: 11px; color: var(--text-3); background: var(--bg); border-radius: 999px; padding: 2px 9px; }
.admin-scope-state.is-active { color: #2da44e; background: #e3f6e8; }

.copy-row { display: inline-flex; align-items: center; gap: 6px; }
.copy-btn {
  font-size: 11px; padding: 1px 8px; border-radius: 999px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text-3); cursor: pointer; line-height: 1.6;
}
.copy-btn:hover { border-color: var(--accent); color: var(--accent); }
.copy-btn.is-copied { border-color: #2da44e; color: #2da44e; }

/* 窄屏：会话从右侧滑入全屏，返回按钮关闭（列表滚动位置不丢） */
@media (max-width: 899px) {
  .md-panel { position: fixed; inset: 0; z-index: 60; transform: translateX(100%); visibility: hidden; transition: transform .22s ease, visibility .22s; display: flex; flex-direction: column; }
  .md-wrap.md-open .md-panel { transform: none; visibility: visible; }
  .md-panel .chat { height: 100%; }
  body.has-panel { overflow: hidden; }
  .chat-back { display: inline-block; }
  .md-panel .panel-empty { display: none; }
  .standalone-chat { height: calc(100vh - 120px); }
}

/* 图片弹窗（lightbox） */
.lightbox {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 17, 20, .86);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: lightbox-in .12s ease;
}
@keyframes lightbox-in { from { opacity: 0; } to { opacity: 1; } }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 6px; box-shadow: 0 10px 40px rgba(0, 0, 0, .4); }
.lightbox-close {
  position: absolute; top: 16px; right: 20px; width: 40px; height: 40px; border-radius: 50%;
  border: none; background: rgba(255, 255, 255, .15); color: #fff; font-size: 22px; line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255, 255, 255, .28); }
body.lightbox-open { overflow: hidden; }

/* 工单弹窗预览（/new 页「TA 现在处理中」点开用），跟图片 lightbox 同一个遮罩样式，
   盒子换成会话面板大小，复用 body.lightbox-open 控制页面滚动锁定 */
.task-preview-modal {
  position: fixed; inset: 0; z-index: 200; background: rgba(15, 17, 20, .78);
  display: flex; align-items: center; justify-content: center; padding: 24px;
  animation: lightbox-in .12s ease;
}
.task-preview-box {
  position: relative; width: 100%; max-width: 560px; height: 80vh;
  background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .4);
}
.task-preview-body { height: 100%; display: flex; flex-direction: column; }
.task-preview-close {
  position: absolute; top: 10px; right: 10px; z-index: 1; width: 32px; height: 32px; border-radius: 50%;
  border: none; background: rgba(15, 17, 20, .5); color: #fff; font-size: 18px; line-height: 1; cursor: pointer;
}
.task-preview-close:hover { background: rgba(15, 17, 20, .7); }
/* 弹窗里注入的会话面板自带「‹」返回按钮，桌面宽屏下平时是隐藏的（.chat-back 只在窄屏可见），
   但点它在弹窗里已经接管成"关闭弹窗"，逻辑上通的，就不该藏起来，弹窗内强制显示 */
.task-preview-box .chat-back { display: inline-block; }

/* 会话头里的关联单（fbsys #81）：一行一条，方向词用不同底色区分——
   out（衍生出/重复于）是本单指向别人，in（来源/被重复）是别人指向本单 */
.chat-links { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
/* 关联多了会把会话头顶得老长（一张单挂十条衍生单，输入框都被推下去了），
   超过阈值默认收起成这一行摘要，点一下展开 */
.chat-links-toggle {
  display: flex; align-items: center; gap: 8px; min-width: 0; align-self: flex-start;
  border: none; background: none; padding: 2px 0; font-size: 12px; color: var(--text-3); cursor: pointer;
}
.chat-links-toggle::after { content: "⌃"; display: inline-block; transition: transform .15s ease; }
.chat-links.is-folded .chat-links-toggle::after { transform: rotate(180deg); }
.chat-links-toggle:hover { color: var(--accent); }
.chat-links-count { font-weight: 600; color: var(--text-2); }
.chat-links-summary { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-links-list { display: flex; flex-direction: column; gap: 4px; }
@media (prefers-reduced-motion: reduce) { .chat-links-toggle::after { transition: none; } }
.chat-link-item {
  display: flex; align-items: center; gap: 8px; min-width: 0; padding: 5px 9px;
  border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: 8px;
  background: var(--bg); color: inherit; font-size: 12px; text-decoration: none;
}
.chat-link-item:hover { border-color: var(--accent); background: var(--surface); }
.chat-link-rel { flex: 0 0 auto; font-weight: 600; border-radius: 4px; padding: 1px 6px; }
.chat-link-rel-out { color: var(--accent); background: var(--accent-soft); }
.chat-link-rel-in  { color: #8f5a00; background: #fff1e0; }
.chat-link-id { flex: 0 0 auto; font-weight: 600; }
.chat-link-proj { flex: 0 0 auto; color: var(--text-3); }
.chat-link-desc { flex: 1 1 auto; min-width: 0; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 轻提示：底部居中浮一条，2.6 秒后自己淡出。给"操作成功但界面看不出变化"的场景用
   （转派点了同一个人）。z-index 压过浮动派单按钮，但低于 lightbox/弹窗遮罩(200)。
   pointer-events:none —— 它只是通知，绝不能挡住底下的按钮 */
.toast {
  position: fixed; left: 50%; bottom: 32px; z-index: 195; pointer-events: none;
  max-width: min(420px, calc(100vw - 32px));
  padding: 9px 16px; border-radius: 999px;
  background: rgba(15, 17, 20, .88); color: #fff; font-size: 14px; line-height: 1.5;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .28);
  opacity: 0; transform: translate(-50%, 8px); transition: opacity .18s ease, transform .18s ease;
}
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
@media (prefers-reduced-motion: reduce) { .toast { transition: none; } }

/* 全局浮动派单按钮：像聊天客服挂件一样固定在右下角，点开是锚定小面板（不是整屏遮罩），
   跟 lightbox/task-preview 那种"盖住全部内容"的弹窗刻意做成不同视觉语言 */
.quick-dispatch-fab {
  position: fixed; right: 24px; bottom: 24px; z-index: 190; width: 52px; height: 52px;
  border-radius: 50%; border: none; background: var(--accent); color: #fff; font-size: 22px;
  cursor: pointer; box-shadow: 0 4px 14px rgba(0, 0, 0, .25);
}
.quick-dispatch-fab:hover { filter: brightness(1.08); }
.quick-dispatch-popup {
  position: fixed; right: 24px; bottom: 88px; z-index: 191;
  width: 340px; max-width: calc(100vw - 32px); height: 480px; max-height: calc(100vh - 120px);
  background: #fff; border-radius: 14px; overflow: hidden; box-shadow: 0 10px 40px rgba(0, 0, 0, .3);
  animation: lightbox-in .12s ease;
}
.quick-dispatch-box { position: relative; width: 100%; height: 100%; }
.quick-dispatch-body { height: 100%; display: flex; flex-direction: column; }
.quick-dispatch-close {
  position: absolute; top: 10px; right: 10px; z-index: 1; width: 28px; height: 28px; border-radius: 50%;
  border: none; background: rgba(15, 17, 20, .5); color: #fff; font-size: 16px; line-height: 1; cursor: pointer;
}
.quick-dispatch-close:hover { background: rgba(15, 17, 20, .7); }
.quick-dispatch-box .chat-back { display: inline-block; }
/* 派单浮窗只有 340px 宽，/new 页那套 4 列网格挤在这里字都要竖排了，改单列铺满；
   .dash-grid.new-pick-grid 本身 (0,2,0)，这里多带一层 .quick-dispatch-box 稳赢，不用赌源码顺序 */
.quick-dispatch-box .dash-grid.new-pick-grid { grid-template-columns: 1fr; }
@media (max-width: 480px) {
  .quick-dispatch-popup { right: 16px; left: 16px; width: auto; bottom: 84px; }
  .quick-dispatch-fab { right: 16px; bottom: 16px; }
}

/* ---------- 通知 ---------- */
/* 导航里的通知入口：徽标压在铃铛右上角，数字由 chat.js 每 30 秒轮询更新，不整页刷新 */
.nav-notif { position: relative; display: inline-flex; align-items: center; gap: 4px; }
.nav-notif-icon { font-size: 14px; line-height: 1; }
.nav-notif-badge {
  position: absolute; top: -4px; right: -10px; min-width: 17px; height: 17px; padding: 0 4px;
  border-radius: 999px; background: #f53f3f; color: #fff; font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 0 0 2px var(--surface);
}
.nav-notif-badge[hidden] { display: none; }

.notif-page { max-width: 760px; margin: 0 auto; padding: 20px 0; }
.notif-head { margin-bottom: 16px; }
.notif-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.notif-total {
  display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
  padding: 0 6px; margin-left: 6px; border-radius: 999px; background: #f53f3f; color: #fff;
  font-size: 11px; font-weight: 700;
}
.notif-list { display: flex; flex-direction: column; gap: 8px; list-style: none; padding: 0; margin: 0; }
.notif-link {
  display: block; padding: 12px 14px; border: 1px solid var(--border); border-left: 3px solid #f53f3f;
  border-radius: 10px; background: var(--surface); color: inherit; text-decoration: none;
  transition: box-shadow .15s, border-color .15s;
}
.notif-link:hover { border-color: var(--accent); box-shadow: 0 4px 14px rgba(31, 35, 41, .07); }
.notif-item-top { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 12px; }
.notif-id { font-weight: 700; }
.notif-reason { color: var(--accent); background: var(--accent-soft); border-radius: 4px; padding: 1px 6px; }
.notif-time { margin-left: auto; color: var(--text-3); }
.notif-title { margin-top: 6px; font-size: 14px; font-weight: 600; }
.notif-preview { margin-top: 3px; font-size: 13px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.notif-empty-icon { font-size: 40px; margin-bottom: 10px; }
.notif-empty-hint { font-size: 13px; margin-top: 6px; }

/* ---------- 非图片附件 ---------- */
/* 气泡里的附件卡片：图片走缩略图，其余走这个（点了下载，服务端强制 attachment） */
.bubble-files { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.file-chip {
  display: flex; align-items: center; gap: 10px; min-width: 0; max-width: 320px;
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: inherit; text-decoration: none;
}
.file-chip:hover { border-color: var(--accent); background: var(--accent-soft); }
.file-chip-icon { flex: 0 0 auto; font-size: 20px; line-height: 1; }
.file-chip-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; }
.file-chip-name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip-meta { font-size: 11px; color: var(--text-3); }
.file-chip-dl { flex: 0 0 auto; color: var(--text-3); font-size: 15px; }
.file-chip:hover .file-chip-dl { color: var(--accent); }

/* 输入框里待发送的非图片附件：预览不出来，给图标+文件名+大小 */
.file-thumb {
  position: relative; display: flex; flex-direction: column; justify-content: center; gap: 2px;
  width: 128px; height: 84px; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--border); background: var(--bg);
}
.file-thumb-icon { font-size: 18px; line-height: 1; }
.file-thumb-name { font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-thumb-meta { font-size: 11px; color: var(--text-3); }

/* ---------- 通知下拉 ---------- */
.nav-notif-wrap { position: relative; display: inline-flex; }
.notif-dropdown {
  position: absolute; top: calc(100% + 10px); right: 0; z-index: 120;
  width: 340px; max-width: calc(100vw - 24px); max-height: 70vh;
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(31, 35, 41, .18);
  animation: lightbox-in .12s ease;
}
.notif-dropdown[hidden] { display: none; }
.notif-dd-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; font-weight: 600; color: var(--text-2);
}
.notif-dd-count {
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: #f53f3f; color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.notif-dd-body { flex: 1 1 auto; overflow-y: auto; }
.notif-dd-item { display: block; padding: 10px 14px; color: inherit; border-bottom: 1px solid var(--bg); }
.notif-dd-item:last-child { border-bottom: none; }
.notif-dd-item:hover { background: var(--accent-soft); }
.notif-dd-item-top { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 11px; }
.notif-dd-id { font-weight: 700; }
.notif-dd-time { margin-left: auto; color: var(--text-3); }
.notif-dd-title { margin-top: 4px; font-size: 13px; font-weight: 600; }
.notif-dd-who { margin-top: 2px; font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.notif-dd-empty, .notif-dd-loading { padding: 28px 14px; text-align: center; color: var(--text-3); font-size: 13px; }
.notif-dd-all {
  flex: 0 0 auto; display: block; padding: 10px 14px; text-align: center;
  border-top: 1px solid var(--border); background: var(--bg);
  font-size: 13px; font-weight: 600; color: var(--accent);
}
.notif-dd-all:hover { background: var(--accent-soft); }
@media (max-width: 720px) { .notif-dropdown { right: -60px; } }

/* ---------- MCP 服务目录 ---------- */
.svc-page { max-width: 820px; margin: 0 auto; padding: 20px 0; }
.svc-sub { font-size: 13px; color: var(--text-3); margin-top: 4px; }
.svc-card {
  margin-top: 14px; padding: 18px 20px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 1px 2px rgba(31, 35, 41, .04);
}
.svc-card-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.svc-name { font-size: 17px; display: flex; align-items: center; gap: 8px; }
.svc-code { font-size: 12px; font-weight: 400; color: var(--text-3); background: var(--bg); border-radius: 4px; padding: 2px 7px; }
.svc-summary { font-size: 14px; color: var(--text-2); margin: 6px 0 10px; }
.svc-doc { margin-top: 12px; border-top: 1px solid var(--bg); padding-top: 10px; }
.svc-doc > summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.svc-doc-body { margin-top: 10px; font-size: 14px; }
.svc-empty { text-align: center; padding: 60px 20px; color: var(--text-3); }
.svc-empty-hint { font-size: 13px; margin-top: 8px; }
.svc-doc-input { width: 100%; font-size: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; margin-top: 6px; }
.svc-form-hint { font-size: 12px; color: #c0392b; }
.svc-copy { margin-left: auto; flex: 0 0 auto; padding: 4px 12px; font-size: 12px; }
.svc-copy.is-copied { border-color: #2da44e; color: #2da44e; }

/* ---------- 项目环境 ---------- */
/* 环境标签：跟项目标签同一族，但用不同底色区分——项目是"归谁管"，环境是"在哪出的" */
.tag-env {
  font-size: 12px; color: #0a6b3b; background: #e6f6ec;
  border-radius: 4px; padding: 1px 7px; white-space: nowrap;
}
/* /new 页的环境按钮：一个项目一般不超过三个，按钮比下拉少一次点击、还能一眼看全 */
.env-row { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin-bottom: 6px; }
.env-label { font-size: 12px; color: var(--text-3); flex: 0 0 auto; }
.env-btn {
  flex: 0 0 auto; padding: 4px 12px; font-size: 13px; cursor: pointer;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface); color: var(--text-2);
}
.env-btn:hover { border-color: var(--accent); color: var(--accent); }
.env-btn.is-on { background: var(--accent); border-color: var(--accent); color: #fff; }
/* 后台项目管理里的环境编辑区：默认收起（chat.js:foldEnvBlocks），
   点项目行上的「环境 N」展开。左侧留白表示从属于上面那个项目 */
.env-toggle { flex: 0 0 auto; white-space: nowrap; }
.env-toggle.is-on { color: var(--accent); }
.admin-env-block {
  background: var(--bg); padding: 8px 12px 10px 30px;
  display: flex; flex-direction: column; gap: 5px;
  border-left: 3px solid var(--accent-soft);
}
.admin-env-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.admin-env-row input[type="text"], .admin-env-row input[type="url"], .admin-env-row input[type="number"] {
  padding: 4px 8px; font-size: 12px;
}
.admin-env-head { color: var(--text-3); font-size: 11px; padding-bottom: 2px; }
.admin-env-head .admin-sort-input { border: none; background: none; }
.admin-env-name { flex: 0 0 130px; }
.admin-env-url { flex: 1 1 auto; min-width: 0; }
.admin-env-row-new { opacity: .7; }
.admin-env-row-new:focus-within { opacity: 1; }
