/* catChat — 墨色终端
 *
 * 取向：不是「套了个深色主题」，是**夜里开着的一台机器**——底色是墨，
 * 靠面的明度差分层次，只有动作才上色（薄荷绿），只有告警才用琥珀。
 *
 * 三条自定规矩（来自 HTML 交付物设计原则）：
 *   1. 断点换布局，不是缩放：窄屏把看板从「列」换成「按状态分组」。
 *   2. 只允许一个滚动容器：弹窗里不再套滚动框。
 *   3. 层级靠字号 + 字重 + 明度三件套拉开，不靠堆线框。
 */

:root {
  /* 面：四层，靠明度分层 */
  --bg: #0a0d12;
  --surface-1: #0f141b;
  --surface-2: #141b24;
  --surface-3: #1a232f;

  /* 线：只分界，不装饰 */
  --line: #24303f;
  --line-soft: #1a232f;

  /* 字：三档明度 */
  --text: #e9eff8;
  --text-dim: #9dabc0;
  --text-faint: #7d8da5;

  /* 色：动作与状态 */
  --accent: #5eead4;
  --accent-ink: #04231f;
  --accent-soft: rgba(94, 234, 212, 0.12);
  --info: #7aa2ff;
  --warn: #f2b03d;
  --warn-soft: rgba(242, 176, 61, 0.12);
  --danger: #f87171;
  --danger-soft: rgba(248, 113, 113, 0.12);
  --ok: #4ade80;
  --ok-soft: rgba(74, 222, 128, 0.12);

  /* 尺度：只用 4 的倍数 */
  --s1: 4px;
  --s2: 8px;
  --s3: 12px;
  --s4: 16px;
  --s5: 24px;
  --s6: 32px;

  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-pill: 999px;

  --fs-tag: 11.5px;
  --fs-sm: 12.5px;
  --fs-md: 13.5px;
  --fs-lg: 15px;
  --fs-xl: 19px;

  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.35);
  --sh-2: 0 18px 48px rgba(0, 0, 0, 0.55);

  --mono: ui-monospace, "Cascadia Code", "JetBrains Mono", Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13.5px/1.6 -apple-system, "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea, select { font: inherit; color: inherit; }
code, pre { font-family: var(--mono); }

/* 焦点：键盘走到哪儿必须看得见；鼠标点不给噪点 */
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(94, 234, 212, 0.25); }

/* 滚动条：细、暗、不抢戏 */
* { scrollbar-width: thin; scrollbar-color: #2b3746 transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: #2b3746; border-radius: 999px; border: 3px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #3a4a5e; background-clip: content-box; }
*::-webkit-scrollbar-track { background: transparent; }

/* ---------------------------------------------------------------- 按钮 */
.primary {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 10px;
  transition: background 120ms ease, transform 120ms ease;
}
.primary:hover { background: #7ff0dd; }
.primary:active { transform: translateY(1px); }

.ghost {
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--text-dim);
  padding: 7px 12px;
  border-radius: 10px;
  transition: color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.ghost:hover { color: var(--text); border-color: #33435a; background: var(--surface-3); }
.ghost.key { color: var(--accent); border-color: rgba(94, 234, 212, 0.35); background: var(--accent-soft); }
.ghost.key:hover { background: rgba(94, 234, 212, 0.18); border-color: var(--accent); }

.small { font-size: var(--fs-sm); padding: 5px 10px; border-radius: 8px; }
.primary.small { padding: 6px 12px; }

.icon {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-faint);
  font-size: 16px; line-height: 1;
  transition: color 120ms ease, background 120ms ease;
}
.icon:hover { color: var(--text); background: var(--surface-3); }

/* ---------------------------------------------------------------- 首屏 */
.gate { position: fixed; inset: 0; display: grid; place-items: center; padding: var(--s4); }
.gate-card {
  width: min(400px, 100%);
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  padding: var(--s6) var(--s5);
}
.gate-card h1 { margin: 0 0 var(--s2); font-size: 24px; font-weight: 600; letter-spacing: -0.01em; }
.gate-card h1 .accent { color: var(--accent); }
.gate-card .sub { margin: 0 0 var(--s5); color: var(--text-dim); font-size: var(--fs-sm); line-height: 1.7; }
.gate-card input { margin-bottom: var(--s2); }
.gate-card .primary { width: 100%; margin-top: var(--s1); }
.hint { margin: 0 0 var(--s3); color: var(--text-faint); font-size: var(--fs-sm); line-height: 1.65; }
.err { margin: var(--s3) 0 0; color: var(--danger); font-size: var(--fs-sm); min-height: 18px; }

input, textarea, select {
  width: 100%;
  padding: 9px 12px;
  background: var(--surface-3);
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease;
}
input::placeholder, textarea::placeholder { color: #6d7b91; }
input:focus, textarea:focus, select:focus { border-color: rgba(94, 234, 212, 0.5); background: var(--surface-2); }

/* ---------------------------------------------------------------- 主框架 */
.app { display: flex; height: 100vh; }

.sidebar {
  flex: 0 0 248px;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border-right: 1px solid var(--line);
  padding: var(--s4) var(--s3);
  gap: var(--s3);
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
  font-size: var(--fs-md); font-weight: 500; color: var(--text-dim);
}
.brand b { color: var(--text); font-weight: 600; }
.me { font-size: var(--fs-sm); color: var(--text-faint); }
.group-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; margin: 0 -6px; }
.group-item {
  padding: 9px 10px;
  border-radius: 10px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 120ms ease, border-color 120ms ease;
}
.group-item:hover { background: var(--surface-2); }
.group-item.active { background: var(--accent-soft); border-color: rgba(94, 234, 212, 0.28); }
.gi-top { display: flex; align-items: center; gap: 6px; }
.gi-name { font-size: var(--fs-md); font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gi-badge {
  margin-left: auto; flex: 0 0 auto;
  font-size: 10px; line-height: 15px; padding: 0 5px;
  border-radius: var(--r-pill);
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid rgba(94, 234, 212, 0.3);
}
.gi-sub { font-size: var(--fs-tag); color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 1px; }
.side-foot { display: flex; gap: 6px; flex-wrap: wrap; border-top: 1px solid var(--line-soft); padding-top: var(--s3); }
.side-foot .ghost { padding: 4px 8px; font-size: var(--fs-tag); }

/* FP-16 主人站内通知：侧栏按钮上的未读徽标 + 通知列表 */
.notice-dot {
  display: inline-block; margin-left: 5px; padding: 0 6px; border-radius: 999px;
  background: var(--danger); color: var(--bg); font-size: var(--fs-tag);
  line-height: 16px; min-width: 8px; text-align: center; vertical-align: middle;
}
.on-item { display: flex; gap: 10px; align-items: flex-start; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
.on-item:last-child { border-bottom: none; }
.on-item .on-main { flex: 1; min-width: 0; }
.on-item .on-title { font-weight: 600; }
.on-item .on-title.unread { color: var(--danger); }
.on-item .on-kind { color: var(--text-faint); font-size: var(--fs-tag); margin-left: 6px; font-weight: 400; }
.on-item .on-body { color: var(--text-faint); font-size: var(--fs-sm); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }
.on-item .on-meta { color: var(--text-faint); font-size: var(--fs-tag); margin-top: 4px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg); }

.chat-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s4);
  padding: var(--s4) var(--s5);
  border-bottom: 1px solid var(--line-soft);
  background: var(--surface-1);
}
.chat-head h2 { margin: 0; font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.005em; }
.chat-head .topic { margin: 2px 0 0; font-size: var(--fs-sm); color: var(--text-faint); }
.head-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }

/* ---------------------------------------------------------------- 消息 */
.messages {
  flex: 1;
  overflow-y: auto;
  padding: var(--s4) var(--s5);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.msg {
  display: flex; gap: var(--s3);
  padding: 8px 10px;
  border-radius: 10px;
  width: 100%;
  max-width: 860px;      /* 行长上限：再宽眼睛找不到下一行 */
  margin: 0 auto;
  transition: background 120ms ease;
}
.msg:hover { background: rgba(255, 255, 255, 0.02); }
.avatar {
  flex: 0 0 30px; height: 30px;
  border-radius: 9px;
  display: grid; place-items: center;
  font-size: var(--fs-sm); font-weight: 600;
  background: var(--surface-3); color: var(--text-dim);
}
.avatar.owner { background: rgba(242, 176, 61, 0.16); color: var(--warn); }
.avatar.agent { background: var(--accent-soft); color: var(--accent); }
.msg-body { min-width: 0; flex: 1; }
.msg-meta { display: flex; align-items: baseline; gap: 7px; margin-bottom: 2px; }
.msg-name { font-size: var(--fs-md); font-weight: 600; color: var(--text); }
.msg-name.owner { color: var(--warn); }
.msg-tag {
  font-size: 10.5px; color: var(--text-faint);
  border: 1px solid var(--line); border-radius: var(--r-pill);
  padding: 0 6px; line-height: 16px;
}
.msg-tag.human { color: var(--warn); border-color: rgba(242, 176, 61, 0.3); }
.msg-time { font-size: 11px; color: #74849c; font-variant-numeric: tabular-nums; }
.msg-text { font-size: var(--fs-md); line-height: 1.72; color: var(--text); word-break: break-word; }
.msg-text p { margin: 0 0 6px; }
.msg-text p:last-child { margin-bottom: 0; }
.msg-text code { background: var(--surface-3); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.msg-reply {
  font-size: var(--fs-sm); color: var(--text-faint);
  border-left: 2px solid var(--line); padding-left: 8px; margin: 0 0 4px;
}
.msg-file { display: inline-block; margin-top: 5px; font-size: var(--fs-sm); color: var(--info); text-decoration: none; }
/* FP-26③：出站剥离/疑似密钥徽标 */
.msg-badges { display: flex; gap: 6px; margin-top: 5px; flex-wrap: wrap; }
.msg-badge {
  font-size: 10px; line-height: 1.5; padding: 1px 7px; border-radius: 999px;
  border: 1px solid rgba(242, 176, 61, 0.35); color: var(--warn);
  background: rgba(242, 176, 61, 0.08);
}
.msg-badge.secret { border-color: rgba(229, 83, 75, 0.4); color: #e5534b; background: rgba(229, 83, 75, 0.08); }
.recalled { font-size: var(--fs-sm); color: var(--text-faint); font-style: italic; }

/* 空态：整屏黑中间一句话最敷衍，给它三件能做的事 */
.empty {
  margin: auto;
  max-width: 460px;
  text-align: center;
  padding: var(--s5);
  color: var(--text-faint);
  font-size: var(--fs-md);
  line-height: 1.9;
}
.empty strong { display: block; margin-bottom: var(--s2); color: var(--text-dim); font-size: var(--fs-lg); font-weight: 500; }
.empty .empty-hints { margin-top: var(--s4); display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }

/* ---------------------------------------------------------------- 输入条 */
.composer {
  display: flex; gap: var(--s2); align-items: flex-end;
  width: calc(100% - 2 * var(--s5));
  max-width: 860px;
  margin: 0 auto var(--s4);
  padding: var(--s2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 14px;
  position: relative;
  transition: border-color 120ms ease;
}
.composer:focus-within { border-color: rgba(94, 234, 212, 0.45); }
.composer textarea {
  flex: 1; resize: none; border: none; background: transparent;
  padding: 7px 8px; max-height: 160px; line-height: 1.6;
}
.composer textarea:focus { background: transparent; border-color: transparent; }
.composer .send { flex: 0 0 auto; padding: 9px 18px; }
.mention-popup {
  position: absolute; bottom: calc(100% + 8px); left: 0;
  width: 260px; max-height: 220px; overflow-y: auto;
  background: var(--surface-3); border: 1px solid var(--line);
  border-radius: var(--r-md); box-shadow: var(--sh-2); padding: 4px; z-index: 20;
}
.mention-item { padding: 7px 10px; border-radius: 6px; font-size: var(--fs-sm); color: var(--text-dim); cursor: pointer; }
.mention-item.active, .mention-item:hover { background: var(--accent-soft); color: var(--text); }

/* ---------------------------------------------------------------- 成员侧栏 */
.members-pane {
  flex: 0 0 264px;
  border-left: 1px solid var(--line);
  background: var(--surface-1);
  display: flex; flex-direction: column;
}
.pane-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s3) var(--s4);
  font-size: var(--fs-md); font-weight: 500; color: var(--text-dim);
  border-bottom: 1px solid var(--line-soft);
}
#members-list { overflow-y: auto; padding: var(--s3); }
.pane-actions { display: flex; align-items: center; gap: 6px; }

/* ---------------------------------------------------------------- 弹窗 */
/* 单一滚动容器：卡片不滚，内容区滚。
   原来 pre 里再套一个滚动条，等于让用户在两个滚动条之间猜哪个能动。 */
.modal {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(4, 6, 9, 0.66);
  backdrop-filter: blur(4px);
  display: grid; place-items: center;
  padding: var(--s4);
}
.modal-card {
  position: relative;
  width: min(680px, 100%);
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  background: var(--surface-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-2);
  overflow: hidden;
}
.modal-card.wide { width: min(1200px, 100%); }
#modal-body { overflow-y: auto; padding: var(--s5); }
.modal-x { position: absolute; top: 10px; right: 10px; z-index: 2; }
.modal-card h3 { margin: 0 0 var(--s1); font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.01em; }
.modal-card p.muted { color: var(--text-faint); font-size: var(--fs-sm); }
.modal-card input, .modal-card select, .modal-card textarea { margin-bottom: var(--s2); }

.row { display: flex; gap: var(--s2); margin-top: var(--s4); flex-wrap: wrap; }

/* 交接说明：整段可读，不裁切、不横滚 */
.brief {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 12px;
  line-height: 1.75;
  color: var(--text-dim);
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: var(--s4);
}
.sqsub {
  margin: var(--s5) 0 var(--s3);
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
  display: flex; align-items: center; gap: var(--s2);
}
.sqsub::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* ---------------------------------------------------------------- 看板 */
/* 看板保持一行：换行会在末尾留下孤零零的一列，反而更难读。
   横向滚动是这类界面的常规交互，但要给「右边还有」的视觉暗示。 */
.board {
  display: flex;
  flex-wrap: nowrap;
  gap: 10px;
  align-items: stretch;
  overflow-x: auto;
  padding-bottom: 6px;
  scroll-snap-type: x proximity;
  -webkit-mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(to right, #000 0, #000 calc(100% - 28px), transparent 100%);
}
.board::-webkit-scrollbar { height: 8px; }
.tcol {
  flex: 0 0 172px;
  width: 172px;
  scroll-snap-align: start;
  min-height: 120px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 10px;
  display: flex; flex-direction: column; gap: var(--s2);
}
.tcol-h {
  display: flex; align-items: center; gap: 6px;
  font-size: var(--fs-sm); font-weight: 500; color: var(--text-dim);
  padding: 2px 2px 4px;
}
.tcount {
  margin-left: auto;
  min-width: 20px; text-align: center;
  font-size: 10.5px; color: var(--text-faint);
  background: var(--surface-3); border-radius: var(--r-pill); padding: 1px 6px;
  font-variant-numeric: tabular-nums;
}
.tdot { width: 7px; height: 7px; border-radius: 50%; flex: 0 0 auto; }
.tcard {
  background: var(--surface-1);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 9px 10px;
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 120ms ease;
}
.tcard:hover { border-color: var(--line); }
.tcard-top { display: flex; align-items: center; gap: 5px; }
.tkey { font-family: var(--mono); font-size: 10.5px; color: #74849c; flex: 1; }
.ttitle {
  font-size: var(--fs-md); font-weight: 500; line-height: 1.5; color: var(--text);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.tmeta {
  font-size: var(--fs-tag); color: var(--text-faint);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.tacts { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.tacts .ghost { padding: 2px 6px; font-size: 11px; border-radius: 7px; white-space: nowrap; }
.tempty {
  font-size: var(--fs-tag); color: #74849c; text-align: center;
  border: 1px dashed var(--line-soft); border-radius: 9px; padding: 10px 6px;
}
/* 两个徽标各占一头会互相挤：都靠右、由 .tkey 让位 */
.trun, .tstale {
  font-size: 10px; line-height: 16px; padding: 0 6px;
  border-radius: var(--r-pill); white-space: nowrap; flex: 0 0 auto;
}
.trun { color: var(--accent); background: var(--accent-soft); border: 1px solid rgba(94, 234, 212, 0.3); }
.tstale { color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(242, 176, 61, 0.32); }

.tnew { display: flex; gap: var(--s2); align-items: center; margin: 0 0 var(--s4); }
.tnew input { flex: 1 1 auto; margin: 0; }
.tnew select { flex: 0 0 176px; width: 176px; margin: 0; }

/* ---------------------------------------------------------------- 小队 / 项目 / 自动化 */
.sqcard, .pjcard, .apcard {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  padding: 12px 14px;
  margin-bottom: var(--s2);
}
.sqhead, .pjhead, .aphead { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-md); flex-wrap: wrap; }
.sqhead strong, .pjhead strong, .aphead strong { font-weight: 600; }
.sqhead .muted, .pjhead .muted, .aphead .muted { color: var(--text-faint); font-size: var(--fs-tag); }
.sqdel { margin-left: auto; }
.sqmem { font-size: var(--fs-sm); color: var(--text-dim); margin-top: 5px; }
.sqrule { font-size: var(--fs-tag); color: var(--text-faint); margin-top: 6px; padding-left: 9px; border-left: 2px solid var(--line); }
.sqnew { margin: var(--s4) 0 0; padding: var(--s4); border: 1px dashed var(--line); border-radius: var(--r-md); }
.sqnew input, .sqnew select { margin-bottom: var(--s2); }
.sqpick { display: flex; flex-wrap: wrap; gap: var(--s3); margin: 4px 0 var(--s3); font-size: var(--fs-sm); color: var(--text-dim); }
.sqpick label { display: inline-flex; align-items: center; gap: 6px; }
.sqpick input { width: auto; margin: 0; }

.sqtable { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.sqtable td { padding: 7px 8px; border-bottom: 1px solid var(--line-soft); vertical-align: middle; }
.sqtable tr:last-child td { border-bottom: none; }
.sqtable select { margin: 0; padding: 5px 8px; font-size: var(--fs-sm); width: auto; min-width: 148px; }
.sqcol { color: var(--text); white-space: nowrap; font-weight: 500; }
.sqnow { color: var(--text-faint); font-size: var(--fs-tag); white-space: nowrap; }
#sq-save { margin-top: var(--s4); }

.pjoff { opacity: 0.55; }
.pjcount { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.pjdesc { font-size: var(--fs-sm); color: var(--text-dim); margin-top: 5px; }
.pjrow { display: flex; align-items: center; gap: var(--s2); margin-top: var(--s3); font-size: var(--fs-sm); flex-wrap: wrap; }
.pjrow select { width: auto; margin: 0; padding: 5px 8px; font-size: var(--fs-sm); }
.pjrow .muted { color: var(--text-faint); font-size: var(--fs-tag); }

.apoff { opacity: 0.6; }
.apbadge { font-size: 10.5px; color: var(--warn); background: var(--warn-soft); border: 1px solid rgba(242, 176, 61, 0.32); border-radius: var(--r-pill); padding: 0 7px; }
.apcount { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-faint); }
.apdesc { font-size: var(--fs-sm); color: var(--text-dim); margin-top: 5px; }
.aptrs { margin-top: var(--s3); display: flex; flex-direction: column; gap: 6px; }
.aptr { display: flex; align-items: center; gap: var(--s2); font-size: var(--fs-sm); flex-wrap: wrap; }
.aptr code { font-size: 11.5px; background: var(--surface-1); border: 1px solid var(--line-soft); border-radius: 6px; padding: 2px 7px; color: var(--text-dim); }
.apkind { font-size: 10.5px; color: var(--info); background: rgba(122, 162, 255, 0.12); border: 1px solid rgba(122, 162, 255, 0.3); border-radius: var(--r-pill); padding: 0 7px; }
.aphook { font-size: 10.5px; word-break: break-all; max-width: 340px; }
.aperr { color: var(--danger); font-size: var(--fs-tag); }
.apnone { font-size: var(--fs-tag); color: var(--text-faint); }
.apruns { margin-top: var(--s3); display: flex; gap: 5px; flex-wrap: wrap; }
.aprunchip { font-family: var(--mono); font-size: 10.5px; border-radius: var(--r-pill); padding: 1px 8px; border: 1px solid var(--line); color: var(--text-dim); }
.aprunchip.created { color: var(--ok); border-color: rgba(74, 222, 128, 0.3); background: var(--ok-soft); }
.aprunchip.skipped { color: var(--warn); border-color: rgba(242, 176, 61, 0.3); background: var(--warn-soft); }
.aprunchip.failed { color: var(--danger); border-color: rgba(248, 113, 113, 0.3); background: var(--danger-soft); }
.apacts { display: flex; gap: 6px; margin-top: var(--s3); flex-wrap: wrap; }

/* ---------------------------------------------------------------- 评论 / 插话 */
.cmt {
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-left: 2px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  margin-bottom: var(--s2);
}
.cmt-h { display: flex; align-items: baseline; gap: var(--s2); font-size: var(--fs-sm); margin-bottom: 3px; flex-wrap: wrap; }
.cmt-h strong { font-weight: 600; color: var(--text); }
.cmt-h .muted { color: #74849c; font-size: 11px; font-variant-numeric: tabular-nums; }
.cmt-at { margin-left: auto; font-size: 11px; color: var(--info); }
.cmt-b { font-size: var(--fs-md); line-height: 1.7; color: var(--text-dim); word-break: break-word; }
.cmt-b p { margin: 0 0 4px; }
.cnew, .steerbox { display: flex; gap: var(--s2); margin: var(--s3) 0 0; }
.cnew input, .steerbox input { flex: 1 1 auto; margin: 0; }
.cnew button, .steerbox button { flex: 0 0 auto; }

/* ---------------------------------------------------------------- 窄屏：换布局 */
@media (max-width: 900px) {
  /* 侧栏从「左边的柱」变「顶上的一条」：群列表横滚，不再挤占正文 */
  .app { flex-direction: column; }
  .sidebar {
    flex: 0 0 auto;
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--line);
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: var(--s2) var(--s3);
    gap: var(--s2);
  }
  .brand { order: 1; gap: var(--s2); }
  .me { display: none; }
  .side-foot { order: 2; margin-left: auto; border-top: none; padding-top: 0; }
  .group-list {
    order: 4; flex-direction: row; width: 100%;
    overflow-x: auto; overflow-y: hidden;
    margin: 0; padding-bottom: 2px; gap: 6px;
  }
  .group-item { flex: 0 0 auto; max-width: 180px; }
  .gi-sub { display: none; }
  .chat-head { padding: var(--s3) var(--s4); flex-wrap: wrap; }
  .messages { padding: var(--s3) var(--s4); }
  .composer { width: calc(100% - 2 * var(--s4)); }
  .members-pane { position: fixed; right: 0; top: 0; bottom: 0; z-index: 30; width: min(300px, 86vw); box-shadow: var(--sh-2); }
}

@media (max-width: 700px) {
  /* 看板不该横滚：六列在手机上就是六屏。改成按状态分组的纵向列表 */
  .board { display: block; overflow-x: visible; -webkit-mask-image: none; mask-image: none; }
  .tcol { max-width: none; min-width: 0; margin-bottom: var(--s2); }
  .tacts { flex-wrap: wrap; }
  .tnew { flex-wrap: wrap; }
  .tnew select { flex: 1 1 100%; width: 100%; }
  #modal-body { padding: var(--s4); }
  .modal-card { max-height: 92vh; border-radius: var(--r-md); }
  .chat-head .head-actions { justify-content: flex-start; }
}

/* 说明折叠：默认收起，避免把评论和动作顶出屏幕。
   展开后仍只有一层滚动（弹窗自己那层），不另开滚动框。 */
.briefwrap {
  border: 1px solid var(--line-soft);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin: 0;
}
.briefwrap > summary {
  cursor: pointer;
  list-style: none;
  padding: 10px 14px;
  font-size: var(--fs-sm);
  color: var(--text-dim);
  display: flex; align-items: center; gap: var(--s2);
}
.briefwrap > summary::-webkit-details-marker { display: none; }
.briefwrap > summary::before {
  content: "▸";
  color: var(--text-faint);
  font-size: 11px;
  transition: transform 120ms ease;
}
.briefwrap[open] > summary::before { transform: rotate(90deg); }
.briefwrap[open] > summary { border-bottom: 1px solid var(--line-soft); }
.briefwrap .brief { border: none; background: transparent; border-radius: 0; padding: 14px; }

/* 智能体档案编辑 */
.field-label { display: block; margin: 14px 0 6px; font-size: var(--fs-sm); color: var(--text-dim); font-weight: 500; }
.modal-card textarea { resize: vertical; line-height: 1.65; }
.agent-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.skill-row { border: 1px solid var(--line-soft); border-radius: 10px; padding: 10px; margin-bottom: 8px; background: var(--surface-2); }
.skill-row .sk-name { margin-bottom: 6px; }
.skill-row .sk-del { margin-top: 6px; }

/* 记忆：只读列表。条目之间靠留白和一条淡线分开，不再套第二层滚动框。 */
.mem-list { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.mem-thread, .mem-item {
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 12px 14px;
  background: var(--surface-2);
}
.mem-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.mem-head b { font-weight: 600; color: var(--text); }
.mem-meta { color: var(--text-faint); font-size: var(--fs-sm); line-height: 1.6; }
.mem-text {
  margin-top: 6px;
  color: var(--text);
  font-size: var(--fs-md);
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
}
.mem-item .agent-actions { margin-top: 6px; }
.mem-empty { color: var(--text-faint); font-size: var(--fs-sm); }
.sqtable thead th {
  text-align: left; font-size: 10.5px; font-weight: 500; color: var(--text-faint);
  padding: 0 8px 6px; border-bottom: 1px solid var(--line-soft);
}

/* 协作群（2026-11-20）：章程正文、接力进度、岗位槽位、类型徽标 */
.charter-box {
  width: 100%;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  padding: 12px 14px;
  font-size: var(--fs-md);
  line-height: 1.7;
  font-family: inherit;
}
.charter-box.readonly { white-space: pre-wrap; word-break: break-word; max-height: 46vh; overflow-y: auto; }
textarea.charter-box { resize: vertical; }
.collab-head { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.collab-line { font-size: var(--fs-sm); color: var(--text-dim); line-height: 1.6; }
.collab-warn { color: var(--warn); }
.relay-bar { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.relay-fill { height: 100%; background: var(--accent); transition: width 160ms ease; }
.relay-fill.hot { background: var(--danger); }
.slot-row {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  font-size: var(--fs-sm); line-height: 1.6;
  border-bottom: 1px dashed var(--line-soft);
  padding: 4px 0;
}
.slot-title { color: var(--text-dim); }
.slot-member { color: var(--text); }
.slot-empty .slot-member { color: var(--text-faint); }
.members-hr { border-top: 1px solid var(--line-soft); margin: 10px 0; }
.role-note { color: var(--text-dim); white-space: pre-wrap; word-break: break-word; }
.msg-tag.warn { color: var(--warn); border-color: rgba(242, 176, 61, 0.3); }

/* ================================================================
   精修层（2026-11-14）
   依据 ui-ux-pro-max 的判据：可读性、触控、动效时长、无障碍优先于装饰。
   只加两类东西：① 让内容更易读 ② 让交互有回应。不加纯装饰。
   ================================================================ */

:root {
  /* 动效：进 200ms 出 140ms，ease-out 进场，不用 linear */
  --dur-1: 140ms;
  --dur-2: 200ms;
  --ease-out: cubic-bezier(0.2, 0.8, 0.2, 1);
  --ease-in: cubic-bezier(0.4, 0, 1, 1);

  /* 高度：三级就够，别每处随手写一个 */
  --el-1: 0 1px 2px rgba(0, 0, 0, 0.4);
  --el-2: 0 6px 18px rgba(0, 0, 0, 0.35);
  --el-3: 0 24px 60px rgba(0, 0, 0, 0.55);
}

/* 正文从 13.5 提到 14：中文小字在暗底上比英文更吃力，13.5 偏小 */
body { font-size: 14px; line-height: 1.65; }
.msg-text { font-size: 14px; line-height: 1.72; }
.cmt-b { font-size: 14px; }
.brief { font-size: 12.5px; line-height: 1.8; }

/* 中文优先字体栈：Windows 上雅黑比 Segoe 的汉字更实 */
body, input, textarea, select, button {
  font-family: -apple-system, "PingFang SC", "HarmonyOS Sans SC", "Microsoft YaHei",
    "Segoe UI", system-ui, sans-serif;
}

/* ---- 动效：只在有因果的地方动 ---- */
button, .ghost, .primary, .icon, .group-item, .tcard, .cmt {
  transition-duration: var(--dur-1);
  transition-timing-function: var(--ease-out);
}
button:active { transform: scale(0.98); }
.tcard:hover { transform: translateY(-1px); box-shadow: var(--el-2); }
.tcard:active { transform: translateY(0) scale(0.995); }
.group-item:active { transform: scale(0.995); }

/* 弹窗从触发点长出来：scale 0.98 + 淡入，而不是凭空出现 */
.modal { animation: scrim-in var(--dur-2) var(--ease-out); }
.modal-card { animation: sheet-in var(--dur-2) var(--ease-out); }
@keyframes scrim-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sheet-in {
  from { opacity: 0; transform: translateY(6px) scale(0.985); }
  to { opacity: 1; transform: none; }
}

/* 新消息淡入：只在节点插入时跑一次，不干扰轮询 */
.msg { animation: msg-in var(--dur-2) var(--ease-out); }
@keyframes msg-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: none; } }

/* 系统设置要求减弱动效时，一根都不留 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ---- 触控：手指比鼠标粗，粗指针设备上按钮不得小于 44 ---- */
@media (pointer: coarse) {
  .ghost, .primary, .icon, .group-item { min-height: 44px; }
  .small, .primary.small, .ghost.small { min-height: 40px; padding: 8px 12px; }
  .icon { min-width: 44px; }
  input, textarea, select { min-height: 44px; }
  .tacts .ghost { min-height: 36px; }
  .tacts { gap: 6px; }
}

/* ---- 看板卡片：用左边一条状态色标出「这一步在哪」，比顶部小圆点好扫 ---- */
.tcard { border-left: 2px solid var(--line); }
.tcol[data-status="in_progress"] .tcard { border-left-color: rgba(94, 234, 212, 0.55); }
.tcol[data-status="in_review"] .tcard { border-left-color: rgba(122, 162, 255, 0.55); }
.tcol[data-status="blocked"] .tcard { border-left-color: rgba(248, 113, 113, 0.5); }
.tcol[data-status="done"] .tcard { border-left-color: rgba(74, 222, 128, 0.45); }
.tcol[data-status="cancelled"] .tcard { border-left-color: rgba(125, 141, 165, 0.35); }

/* ---- 消息日期分隔：长对话里靠它定位，比翻时间戳快 ---- */
.day-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 14px auto 8px; width: 100%; max-width: 860px;
  color: var(--text-faint); font-size: 11.5px;
}
.day-sep::before, .day-sep::after { content: ""; flex: 1; height: 1px; background: var(--line-soft); }

/* ---- 加载态：按钮在等结果时别让人重复点 ---- */
button[disabled] { opacity: 0.55; cursor: not-allowed; }
button.is-busy { position: relative; color: transparent !important; }
button.is-busy::after {
  content: ""; position: absolute; inset: 0; margin: auto;
  width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid currentColor; border-top-color: transparent;
  color: var(--text-dim);
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ================================================================
   布局对齐层（参照 fixed sidebar，2026-11-14）
   只动尺寸与结构，不动任何色值——配色待定，整层随时可摘。
   窄屏保留原有 900/700 换布局策略；64px 收起态仅在桌面生效。
   ================================================================ */
:root {
  --rail-w: 240px;
  --rail-mini: 64px;
  --head-h: 56px;
  --nav-h: 40px;
}

.brand-actions { display: flex; align-items: center; gap: 2px; }
.brand-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon { width: 32px; height: 32px; }
.chat-head { min-height: var(--head-h); }
.head-actions .ghost.small { min-height: 32px; }
.group-item { min-height: var(--nav-h); border-radius: 8px; }

@media (min-width: 901px) {
  .app:not([data-rail="collapsed"]) .sidebar {
    flex-basis: var(--rail-w);
    width: var(--rail-w);
  }

  .app[data-rail="collapsed"] .sidebar {
    flex-basis: var(--rail-mini);
    width: var(--rail-mini);
    padding-left: 8px;
    padding-right: 8px;
    align-items: center;
  }
  .app[data-rail="collapsed"] .brand { width: 100%; justify-content: center; }
  .app[data-rail="collapsed"] .brand-actions { flex-direction: column; }
  .app[data-rail="collapsed"] .brand-name,
  .app[data-rail="collapsed"] .me,
  .app[data-rail="collapsed"] .gi-top,
  .app[data-rail="collapsed"] .gi-sub { display: none; }

  .app[data-rail="collapsed"] .group-list { width: 100%; margin: 0; gap: 6px; }
  .app[data-rail="collapsed"] .group-item {
    width: 48px;
    padding: 0;
    display: grid;
    place-items: center;
  }
  .app[data-rail="collapsed"] .group-item::before {
    content: attr(data-initial);
    font-size: 15px;
    font-weight: 600;
    color: var(--text-dim);
  }
  .app[data-rail="collapsed"] .group-item.active::before { color: var(--accent); }

  .app[data-rail="collapsed"] .side-foot {
    flex-direction: column;
    width: 100%;
    align-items: center;
  }
  .app[data-rail="collapsed"] .side-foot .ghost {
    width: 44px;
    min-width: 44px;
    padding: 0;
    font-size: 0;
    display: grid;
    place-items: center;
  }
  .app[data-rail="collapsed"] .side-foot .ghost::after {
    content: attr(data-short);
    font-size: 13px;
  }
}
