:root {
  color-scheme: light;
  --bg: #f4f6fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --ok: #16a34a;
  --warn: #f59e0b;
  --err: #dc2626;
}

* { box-sizing: border-box; }
/* hidden 必须覆盖类选择器上的 display:grid/flex，否则登录成功后隐藏不生效。 */
[hidden] { display: none !important; }
/* 页面所有文字内容都允许选中复制（含消息、团队名、成员、弹窗文本）。 */
html, body, .app-shell, .team-tabs, .workspace, .chat, .messages, .side, .pop-menu, .modal-card {
  -webkit-user-select: text; user-select: text;
}
html, body { margin: 0; height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--ink);
  background: var(--bg);
  /* 关键：整页不滚动，滚动只发生在消息区与成员列表内部 */
  overflow: hidden;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }
input, select, textarea {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 11px;
  background: #fff;
  color: var(--ink);
}
textarea { width: 100%; resize: vertical; line-height: 1.5; }

.login-screen {
  height: 100%;
  display: grid;
  place-items: center;
  padding: 24px;
  background: radial-gradient(circle at 20% 10%, #dbeafe 0, transparent 35%), var(--bg);
}
.login-card {
  width: min(440px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 30px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, .10);
}
.logo {
  width: 54px; height: 54px; border-radius: 16px;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #2563eb, #7c3aed);
  color: #fff; font-size: 26px; font-weight: 800;
  margin-bottom: 16px;
}
.login-card h1 { margin: 0 0 8px; font-size: 24px; }
.sub, .hint { color: var(--muted); line-height: 1.6; }
.hint { font-size: 13px; margin-bottom: 0; }
.login-card button { width: 100%; margin-top: 12px; padding: 12px 14px; }
.primary { border: 0; border-radius: 10px; background: var(--primary); color: #fff; font-weight: 700; }
.primary:hover { background: var(--primary-dark); }
.primary.danger { background: #dc2626; }
.primary.danger:hover { background: #b91c1c; }
.secondary { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-weight: 700; }
.ghost { border: 1px solid rgba(255,255,255,.25); border-radius: 10px; background: transparent; color: #fff; padding: 7px 12px; }
.ghost:hover { background: rgba(255,255,255,.12); }
.error { color: var(--err); background: #fef2f2; border-radius: 9px; padding: 10px 12px; margin: 12px 0; font-size: 14px; }

/* 固定视口高度：顶部、团队栏、底栏都不动，只有中间区域内部滚动 */
.app-shell {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.topbar {
  height: 58px; flex: 0 0 58px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 18px; background: #0f172a; color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; flex-shrink: 0; white-space: nowrap; }
.brand strong { white-space: nowrap; }
.brand-dot { width: 10px; height: 10px; border-radius: 50%; background: #60a5fa; box-shadow: 0 0 0 4px rgba(96,165,250,.2); flex-shrink: 0; }
.top-actions { display: flex; align-items: center; gap: 12px; min-width: 0; }
/* 右上角：添加到桌面快捷入口（醒目、点击区足够大） */
.top-actions .install-btn {
  border: 1px solid #3b82f6; border-radius: 9px; background: #2563eb;
  color: #fff; font-size: 13px; font-weight: 700; padding: 8px 12px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; line-height: 1.2;
  box-shadow: 0 2px 8px rgba(37,99,235,.35);
}
.top-actions .install-btn:hover { background: #1d4ed8; border-color: #1d4ed8; }
.top-actions .install-btn:active { transform: translateY(1px); }
/* 安装弹窗：醒目的主操作按钮 */
.install-main-actions { display: flex; flex-direction: column; gap: 10px; margin: 14px 0 12px; }
.install-big {
  display: block; width: 100%; padding: 14px 16px; font-size: 15px; font-weight: 800;
  border-radius: 12px; border: 1px solid #2563eb;
  background: linear-gradient(135deg, #2563eb, #1d4ed8); color: #fff; cursor: pointer;
  box-shadow: 0 4px 14px rgba(37,99,235,.3);
}
.install-big:active { transform: translateY(1px); }
.install-big + .install-big { background: #fff; color: #1d4ed8; box-shadow: none; }
.install-big + .install-big:active { background: #f8fbff; }
.install-steps-wrap { margin: 12px 0 4px; border-top: 1px solid var(--line); padding-top: 10px; }
.install-steps-wrap summary { cursor: pointer; color: var(--primary); font-size: 13px; font-weight: 700; }
.install-steps { margin: 10px 0 4px; padding-left: 22px; color: var(--ink); font-size: 14px; line-height: 1.9; }
.install-steps li { margin-bottom: 4px; }
/* 装到桌面弹窗：网址复制行 */
.install-card .install-url-row { display: flex; gap: 8px; margin: 4px 0 8px; }
.install-card .install-url-row input {
  flex: 1; min-width: 0; padding: 9px 10px; border: 1px solid var(--line);
  border-radius: 9px; background: #f8fafc; color: var(--ink); font-size: 12px;
}
.install-card .install-url-row button { flex-shrink: 0; white-space: nowrap; }
.install-url-tip { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.6; }
.ghost2 { border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); padding: 9px 16px; cursor: pointer; font-size: 13px; }
.ghost2:hover { background: #f8fafc; }
.status, .device { font-size: 12px; color: #cbd5e1; }
.status.ok { color: #86efac; }
.status.off { color: #fca5a5; }

/* 团队标签栏：完整团队名平铺、可横向滚动、选中变红 */
.team-tabs {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  overflow-y: hidden;
  white-space: nowrap;
  scrollbar-width: thin;
}
.team-tab {
  flex: 0 0 auto;
  position: relative;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f8fafc;
  color: var(--ink);
  padding: 8px 16px;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
}
.team-tab:hover { border-color: #93c5fd; background: #eff6ff; }
/* 选中的团队名字变红 */
.team-tab.active {
  color: var(--err);
  border-color: var(--err);
  background: #fef2f2;
  box-shadow: 0 0 0 2px rgba(220,38,38,.08);
}
.team-tab.drag-over { box-shadow: 0 0 0 2px var(--primary); }
.team-tab.dragging { opacity: .45; }
.team-tab .tab-grip { color: #94a3b8; font-size: 12px; margin-right: 6px; cursor: grab; }
.team-add {
  flex: 0 0 auto;
  width: 36px; height: 36px; border-radius: 50%;
  border: 1px dashed #94a3b8;
  background: #fff; color: #475569;
  font-size: 22px; line-height: 1;
  display: grid; place-items: center;
}
.team-add:hover { border-color: var(--primary); color: var(--primary); background: #eff6ff; }
.team-tabs-empty { color: var(--muted); font-size: 13px; }

/* 主工作区：固定高度网格，内部各自滚动 */
.workspace {
  --side-w: 240px;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--side-w) 10px minmax(0, 1fr);
  gap: 6px;
  padding: 14px 16px;
  overflow: hidden;
}
.splitter {
  position: relative;
  cursor: col-resize;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
}
.splitter:hover { background: #eff6ff; }
.splitter.dragging { background: #dbeafe; }
.splitter-grip {
  width: 4px; height: 42px; border-radius: 4px;
  background: #cbd5e1;
}
.splitter:hover .splitter-grip, .splitter.dragging .splitter-grip { background: var(--primary); }
.side { min-height: 0; display: flex; flex-direction: column; gap: 12px; --task-h: 300px; }
/* 侧栏上下分隔条：只调整成员卡 / 任务看板卡的高度 */
.side-splitter {
  flex: 0 0 10px;
  position: relative;
  cursor: row-resize;
  display: flex; align-items: center; justify-content: center;
  border-radius: 6px;
  touch-action: none;
  user-select: none;
}
.side-splitter:hover { background: #eff6ff; }
.side-splitter.dragging { background: #dbeafe; }
.side-splitter-grip {
  width: 42px; height: 4px; border-radius: 4px;
  background: #cbd5e1;
}
.side-splitter:hover .side-splitter-grip, .side-splitter.dragging .side-splitter-grip { background: var(--primary); }
.member-card {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.member-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 14px 10px;
  border-bottom: 1px solid var(--line);
}
.member-card-head h3 { margin: 0; font-size: 15px; }
.member-count { color: var(--muted); font-size: 12px; }
/* 成员列表独立滚动 */
.member-list { flex: 1; min-height: 0; overflow-y: auto; padding: 8px; }
.member-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-radius: 10px;
}
.member-item:hover { background: #f8fafc; }
.member-item.me { background: #eff6ff; }
.member-avatar {
  flex: 0 0 auto;
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: linear-gradient(135deg, #93c5fd, #6366f1);
  color: #fff; font-size: 13px; font-weight: 700;
}
.member-info { min-width: 0; flex: 1; }
.member-name {
  font-size: 13px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-pos {
  font-size: 11px; color: var(--muted); margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.member-me {
  flex: 0 0 auto;
  font-size: 10px; color: var(--primary);
  border: 1px solid #bfdbfe; border-radius: 999px;
  padding: 1px 6px;
}
.member-empty { color: var(--muted); font-size: 13px; padding: 18px 8px; text-align: center; }

/* 任务看板（左侧栏下半部分）：任务 / 进行中 / 已完成，按角色权限显示真实任务 */
.task-card {
  flex: 0 0 var(--task-h, 300px);
  min-height: 120px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
}
.task-card-head {
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px 9px;
  border-bottom: 1px solid var(--line);
}
.task-card-head h3 { margin: 0; font-size: 15px; }
.task-card-hint {
  flex: 0 0 auto;
  font-size: 10px; color: var(--muted);
  border: 1px dashed var(--line); border-radius: 999px;
  padding: 0 7px; line-height: 17px;
}
.task-groups { flex: 1; min-height: 0; overflow-y: auto; padding: 6px 8px 10px; }
.task-group + .task-group { margin-top: 4px; }
.task-group-head {
  width: 100%;
  display: flex; align-items: center; gap: 6px;
  padding: 7px 6px;
  background: none; border: 0; border-radius: 8px;
  font: inherit; color: inherit;
  cursor: pointer; text-align: left;
}
.task-group-head:hover { background: #fef2f2; }
.task-caret {
  flex: 0 0 auto;
  font-size: 12px; line-height: 1; color: #dc2626;
  transition: transform .15s ease;
}
.task-group.collapsed .task-caret { transform: rotate(-90deg); }
.task-group-title {
  flex: 1; min-width: 0;
  font-size: 13px; font-weight: 800;
  color: #dc2626;                 /* 三项标题统一红色 */
  letter-spacing: .3px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-group-body { padding: 2px 0 4px; }
.task-group.collapsed .task-group-body { display: none; }
.task-item {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 7px 9px; border-radius: 9px;
  cursor: default;
}
.task-item.task-clickable { cursor: pointer; }
.task-item.task-clickable:hover {
  border-color: var(--primary); background: #f5f9ff;
  box-shadow: 0 1px 4px rgba(37,99,235,.12);
}
.task-item + .task-item { margin-top: 4px; }
.task-item {
  border: 1px solid var(--line);
  background: #fff;
}
.task-dot {
  flex: 0 0 auto; width: 7px; height: 7px; border-radius: 50%;
  margin-top: 6px; background: #cbd5e1;
}
.task-item.st-doing .task-dot { background: #2563eb; }
.task-item.st-done .task-dot { background: #16a34a; }
.task-item.st-todo .task-dot { background: #f59e0b; }
.task-item .task-main { min-width: 0; flex: 1; }
.task-item .task-title {
  font-size: 12.5px; line-height: 1.4; color: var(--ink);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.task-item .task-sub {
  margin-top: 2px; font-size: 11px; color: var(--muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.task-item .task-detail {
  margin-top: 3px; font-size: 11px; line-height: 1.35; color: #64748b;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; word-break: break-word;
}
.task-advance {
  flex: 0 0 auto; align-self: center;
  border: 1px solid var(--line); background: #f8fafc; color: #475569;
  border-radius: 999px; padding: 2px 9px; font-size: 11px; line-height: 18px;
  cursor: pointer;
}
.task-advance:hover { background: #eef2ff; color: #1d4ed8; border-color: #bfdbfe; }
.task-group-count {
  flex: 0 0 auto; min-width: 17px; text-align: center;
  font-size: 10px; font-weight: 700; color: #fff; background: #dc2626;
  border-radius: 999px; padding: 0 5px; line-height: 16px;
}
.task-empty {
  padding: 8px 10px; font-size: 11px; color: #94a3b8; text-align: center;
}


/* 消息区独立滚动，不带动整页 */
.chat {
  min-width: 0; min-height: 0;
  display: flex; flex-direction: column;
  background: #fff; border: 1px solid var(--line); border-radius: 16px; overflow: hidden;
}
.messages { flex: 1; min-height: 0; min-width: 0; overflow-y: auto; overflow-x: hidden; padding: 18px; background: #f8fafc; }
.msg { display: flex; max-width: 100%; margin-bottom: 14px; }
.msg.mine { justify-content: flex-end; }
.bubble {
  max-width: min(760px, 82%);
  min-width: 0;
  overflow: hidden;
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
  padding: 11px 13px; box-shadow: 0 4px 14px rgba(15,23,42,.04);
}
.msg.mine .bubble { background: #dbeafe; border-color: #bfdbfe; }
/* 从任务看板跳转过来时高亮一下对应消息 */
.msg.flash .bubble {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, .35), 0 4px 14px rgba(15, 23, 42, .08);
  transition: box-shadow .2s ease;
}
.meta { display: flex; flex-wrap: wrap; gap: 8px; font-size: 11px; color: var(--muted); margin-bottom: 6px; }
.body { white-space: pre-wrap; word-break: break-word; line-height: 1.65; }
.attachs { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.attach {
  display: inline-flex; align-items: center; gap: 6px;
  border: 1px solid #cbd5e1; border-radius: 9px; padding: 7px 9px;
  background: #fff; color: #1d4ed8; font-size: 12px; text-decoration: none;
}
/* 聊天里的图片一律缩成缩略图，绝不撑破气泡/产生横向滚动；点开看原图 */
.attach-image {
  display: inline-block; max-width: 100%; cursor: zoom-in;
}
.attach-image img {
  display: block; max-width: 240px; max-width: min(240px, 100%);
  max-height: 180px; width: auto; height: auto;
  object-fit: contain; border-radius: 8px; border: 1px solid var(--line);
}
/* 兜底：任何图片都不得溢出气泡宽度 */
.bubble img, .attachs img { box-sizing: border-box; }

.lightbox {
  position: fixed; inset: 0; z-index: 9999;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 12px; padding: 40px 20px;
  background: rgba(15, 23, 42, .9);
}
.lightbox img {
  max-width: 94vw; max-height: 82vh; width: auto; height: auto;
  object-fit: contain; border-radius: 8px; box-shadow: 0 12px 48px rgba(0,0,0,.5);
}
.lightbox-cap { color: #e2e8f0; font-size: 13px; text-align: center; word-break: break-all; }
.lightbox-tip { color: #94a3b8; font-size: 12px; text-align: center; margin-top: 2px; }
.lightbox-save {
  border: 1px solid rgba(74,222,128,.55); background: rgba(34,197,94,.28); color: #fff;
  border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.lightbox-save:active { transform: translateY(1px); }
.lightbox-close {
  position: absolute; top: 18px; right: 22px;
  width: 40px; height: 40px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.15); color: #fff; font-size: 28px; line-height: 1;
  cursor: pointer;
}
.lightbox-close:hover { background: rgba(255,255,255,.3); }

.composer {
  flex: 0 0 auto; border-top: 1px solid var(--line); padding: 12px; background: #fff;
  position: relative; z-index: 3; /* 始终盖在消息区之上，输入框/发送/管理/附件按钮不被遮挡 */
}
/* 待发送附件小宫格：只做本地预览、不上传；高度封顶 + 内部滚动，尽量少占历史消息窗口 */
.pending-files {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(66px, 1fr));
  gap: 8px;
  margin-top: 8px; padding: 8px;
  border: 1px dashed #93c5fd; border-radius: 10px; background: #f8fbff;
  max-height: 160px; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
.pending-files::-webkit-scrollbar { width: 7px; }
.pending-files::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 8px; }
.pending-cell {
  position: relative; min-width: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 66px; padding: 4px;
  border: 1px solid #cbd5e1; border-radius: 9px; background: #fff;
  font-size: 12px; color: var(--ink); cursor: pointer;
  overflow: hidden;
}
.pending-cell:hover { border-color: #93c5fd; background: #f8fbff; }
.pending-cell.is-image { padding: 0; }
.pending-cell > img {
  display: block; width: 100%; height: 100%;
  object-fit: cover; border-radius: 8px;
}
.pending-ico { font-size: 24px; line-height: 1; }
.pending-ext { margin-top: 3px; font-size: 9px; color: #64748b; font-weight: 700; }
.pending-name {
  display: block; max-width: 100%; width: 100%;
  padding: 1px 2px; margin-top: auto;
  font-size: 9px; line-height: 1.3; text-align: center;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  background: rgba(255,255,255,.82);
}
.pending-cell.is-image .pending-name {
  position: absolute; left: 0; right: 0; bottom: 0;
}
.pending-del {
  position: absolute; top: -6px; right: -6px; z-index: 2;
  width: 19px; height: 19px; padding: 0; line-height: 17px;
  border: 1px solid #cbd5e1; border-radius: 50%;
  background: #fff; color: #ef4444; font-size: 15px; text-align: center;
  cursor: pointer; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.pending-del:hover { background: #ef4444; color: #fff; border-color: #ef4444; }
.composer-bar { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.composer-bar .primary { margin-left: auto; padding: 10px 18px; }
.composer-bar #skillManageBtn, .composer-bar #devModeBtn {
  border: 1px solid var(--line); border-radius: 9px; background: #f8fafc;
  color: var(--ink); font-size: 13px; font-weight: 700; padding: 7px 11px; cursor: pointer;
}
.composer-bar #devModeBtn.on { background: #dbeafe; border-color: #93c5fd; color: #1d4ed8; }
.dev-mode-tip {
  margin-top: 8px; padding: 8px 10px; border-radius: 9px;
  background: #eff6ff; border: 1px solid #bfdbfe; color: #1d4ed8; font-size: 12px; line-height: 1.5;
}
/* 开发模式：选择要修改的技能（一个技能只对应一个文件） */
.dev-skill-bar {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin-top: 8px; font-size: 12px;
}
.dev-skill-label { color: var(--muted); flex: 0 0 auto; }
.dev-skill-bar select {
  flex: 0 1 auto; max-width: 240px; min-width: 120px;
  padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: #fff; font: inherit; font-size: 12px; color: var(--ink);
}
.dev-skill-bar #devSkillHint { flex: 1 1 100%; }
.file-btn { font-size: 13px; color: var(--muted); cursor: pointer; }
.skill-card h4 { margin: 16px 0 8px; font-size: 14px; }
.skill-list { display: flex; flex-direction: column; gap: 8px; max-height: 220px; overflow-y: auto; }
.skill-item {
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px;
  display: flex; align-items: center; gap: 10px; background: #fff;
}
.skill-item .skill-meta { flex: 1; min-width: 0; }
.skill-item .skill-name { font-weight: 700; font-size: 14px; }
.skill-item .skill-dev {
  color: var(--muted); font-size: 12px; margin-top: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.skill-item .skill-acts { flex: 0 0 auto; display: flex; gap: 6px; }
.skill-item button { flex: 0 0 auto; padding: 6px 11px; font-size: 12px; }

.toast {
  position: fixed; left: 50%; top: 18px; transform: translateX(-50%);
  z-index: 9999; background: #0f172a; color: #fff;
  border-radius: 10px; padding: 10px 14px; font-size: 13px;
  box-shadow: 0 10px 30px rgba(15,23,42,.25);
}

/* + 号弹出的操作菜单 */
.pop-menu {
  position: fixed; z-index: 300;
  min-width: 168px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 12px 34px rgba(15,23,42,.18);
  padding: 6px;
}
.pop-menu button {
  display: block; width: 100%; text-align: left;
  border: 0; background: transparent; color: var(--ink);
  padding: 10px 12px; border-radius: 8px; font-size: 14px;
}
.pop-menu button:hover { background: #eff6ff; color: var(--primary); }
.pop-menu button.danger-item { color: #dc2626; }
.pop-menu button.danger-item:hover { background: #fef2f2; color: #b91c1c; }
.member-item { position: relative; cursor: default; }
.member-item.can-edit { cursor: pointer; }
.member-item.can-edit::after {
  content: '⋯'; color: #94a3b8; font-size: 16px; font-weight: 700;
  padding: 0 2px; line-height: 1;
}

/* 邀请码 / 加入团队弹窗 */
.modal {
  position: fixed; inset: 0; z-index: 400;
  display: grid; place-items: center;
  background: rgba(15,23,42,.45); padding: 20px;
}
.modal-card {
  width: min(460px, 100%); background: #fff;
  border-radius: 16px; padding: 24px;
  box-shadow: 0 24px 60px rgba(15,23,42,.28);
}
.modal-card h3 { margin: 0 0 10px; font-size: 18px; }
.modal-card .muted { color: var(--muted); font-size: 13px; line-height: 1.6; margin: 0 0 16px; }
.modal-card input { width: 100%; }

/* 任务详情 / 编辑弹窗 */
.task-modal-card { width: min(520px, 100%); }
.task-edit-body .field { display: block; margin-top: 14px; font-size: 13px; color: var(--muted); }
.task-edit-body .field input,
.task-edit-body .field textarea,
.task-edit-body .field select {
  width: 100%; margin-top: 6px; padding: 9px 11px;
  border: 1px solid var(--line); border-radius: 9px; background: #fff; color: var(--ink);
}
.task-edit-body .field textarea { line-height: 1.5; resize: vertical; }
.task-edit-row { display: flex; gap: 12px; }
.task-edit-row .field { flex: 1; min-width: 0; }
.task-edit-body .field select { appearance: auto; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.modal-actions button { padding: 10px 18px; }
.invite-code-row { display: flex; align-items: center; gap: 10px; }
.invite-code-row code {
  flex: 1; min-width: 0; text-align: center;
  font-size: 22px; font-weight: 800; letter-spacing: 3px;
  padding: 12px; background: #f1f5f9; color: var(--primary);
  border: 1px dashed #93c5fd; border-radius: 10px;
  -webkit-user-select: text; user-select: text;
}
.invite-code-row button { flex: 0 0 auto; padding: 12px 14px; }

/* 手机端底部导航：默认隐藏，窄屏显示 */
.mobile-nav { display: none; }

@media (max-width: 860px) {
  .workspace { grid-template-columns: 1fr; padding: 10px; gap: 0; }
  .splitter { display: none; }
  .topbar { padding: 0 10px; gap: 6px; }
  /* 手机窄屏：精简顶栏，避免把品牌名挤成竖排、安装按钮被压到点不到 */
  .topbar { height: auto; min-height: 54px; padding: 8px 10px; flex-wrap: wrap; row-gap: 6px; }
  .topbar .brand strong { font-size: 14px; }
  .topbar .brand-dot { width: 8px; height: 8px; }
  .topbar .top-actions { gap: 8px; margin-left: auto; }
  /* 状态与设备名在手机端隐藏，腾出空间给「装到桌面」和「退出」 */
  .topbar .status, .topbar .device { display: none; }
  .topbar .install-btn { font-size: 13px; padding: 9px 12px; }
  .topbar .ghost { padding: 9px 12px; font-size: 12px; }
  .bubble { max-width: 92%; }
  .messages { padding: 12px; }
  /* 手机端：暂存附件区可稍高，但仍封顶并内部滚动，保证底部输入/发送/管理/附件按钮常驻 */
  .pending-files { max-height: 26vh; }
  .composer { padding-bottom: calc(12px + env(safe-area-inset-bottom, 0)); }

  /* 底部导航条 */
  .mobile-nav {
    flex: 0 0 auto;
    display: flex;
    background: #fff;
    border-top: 1px solid var(--line);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .mobile-nav-item {
    position: relative;
    flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 3px; padding: 9px 4px 8px;
    border: 0; background: none; color: var(--muted);
    font-size: 11px; font-weight: 700;
  }
  .mobile-nav-item.active { color: var(--primary); }
  .mobile-nav-item .mn-ico { width: 22px; height: 22px; }
  .mobile-nav-item .mn-badge {
    position: absolute; top: 4px; left: 50%; margin-left: 6px;
    min-width: 16px; height: 16px; padding: 0 4px;
    display: inline-flex; align-items: center; justify-content: center;
    font-size: 10px; line-height: 16px; color: #fff; background: #dc2626;
    border-radius: 999px;
  }

  /* 视图切换：由 workspace 的 data-mobile-view 属性控制三选一 */
  .side-splitter { display: none; }
  .workspace[data-mobile-view="chat"] .side { display: none; }
  .workspace[data-mobile-view="chat"] .chat { display: flex; }

  .workspace[data-mobile-view="members"] .chat { display: none; }
  .workspace[data-mobile-view="members"] .member-card { flex: 1 1 auto; }
  .workspace[data-mobile-view="members"] .task-card { display: none; }

  .workspace[data-mobile-view="tasks"] .chat { display: none; }
  .workspace[data-mobile-view="tasks"] .member-card { display: none; }
  .workspace[data-mobile-view="tasks"] .task-card {
    display: flex; flex: 1 1 auto; height: auto; min-height: 0;
  }
}

/* 本地账号登录/注册 */
.auth-tabs { display: flex; gap: 8px; margin: 18px 0 6px; }
.auth-tab {
  flex: 1; width: auto !important; margin-top: 0 !important; padding: 10px 12px !important;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--muted); font-weight: 700;
}
.auth-tab.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.field { display: block; margin-top: 12px; font-size: 13px; color: var(--muted); }
.field input {
  display: block; width: 100%; margin-top: 6px; padding: 11px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); font-size: 15px;
}
.field input:focus { outline: 2px solid rgba(37,99,235,.25); border-color: var(--primary); }
#authSubmit { margin-top: 18px !important; }

/* ===== 全屏安装助手 ===== */
.install-overlay {
  position: fixed; inset: 0; z-index: 4000; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8,15,30,.62); backdrop-filter: blur(3px);
}
.install-overlay[hidden] { display: none; }
.install-sheet {
  width: min(520px, 100%); max-height: 92vh; overflow-y: auto;
  background: #fff; color: var(--ink); border-radius: 20px 20px 0 0;
  padding: 20px 18px calc(22px + env(safe-area-inset-bottom));
  box-shadow: 0 -8px 40px rgba(0,0,0,.25);
}
@media (min-width: 640px) {
  .install-overlay { align-items: center; }
  .install-sheet { border-radius: 20px; max-height: 90vh; padding-bottom: 22px; }
}
.install-sheet-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.install-title { font-size: 20px; font-weight: 800; }
.install-env { margin-top: 4px; font-size: 12px; color: var(--muted); }
.install-x { flex-shrink: 0; width: 34px; height: 34px; border-radius: 50%; border: 1px solid var(--line); background: #f8fafc; color: var(--ink); font-size: 16px; cursor: pointer; }
.install-cta {
  display: flex; align-items: center; gap: 14px; width: 100%; text-align: left;
  padding: 15px 16px; margin-bottom: 16px; border: none; border-radius: 14px; cursor: pointer;
  background: linear-gradient(135deg,#16a34a,#15803d); color: #fff;
  box-shadow: 0 6px 18px rgba(22,163,74,.35);
}
.install-cta[hidden] { display: none; }
.install-cta:active { transform: translateY(1px); }
.install-cta .cta-ico { font-size: 30px; line-height: 1; }
.install-cta .cta-txt { display: flex; flex-direction: column; gap: 3px; }
.install-cta .cta-txt b { font-size: 16px; }
.install-cta .cta-txt small { font-size: 12px; opacity: .9; }
.install-block { margin-bottom: 18px; }
.install-block-title { font-size: 14px; font-weight: 800; margin-bottom: 10px; }
.stepno { display: inline-flex; align-items: center; justify-content: center; width: 20px; height: 20px; border-radius: 50%; background: #2563eb; color: #fff; font-size: 12px; margin-right: 6px; }
.install-howto { display: flex; gap: 16px; align-items: center; }
.phone-demo {
  position: relative; flex-shrink: 0; width: 92px; height: 158px; border: 3px solid #1f2937;
  border-radius: 16px; background: #0f172a; overflow: hidden;
}
.pd-notch { position: absolute; top: 5px; left: 50%; transform: translateX(-50%); width: 34px; height: 6px; border-radius: 6px; background: #374151; }
.pd-screen { position: absolute; inset: 14px 6px 22px; background: linear-gradient(160deg,#eef2ff,#dbeafe); border-radius: 8px; padding: 16px 10px; }
.pd-logo { width: 26px; height: 26px; border-radius: 8px; background: #2563eb; color: #fff; font-weight: 800; font-size: 15px; display: flex; align-items: center; justify-content: center; margin-bottom: 12px; }
.pd-line { height: 5px; border-radius: 3px; background: #bfdbfe; margin-bottom: 7px; }
.pd-line.short { width: 60%; }
.pd-menu { position: absolute; min-width: 24px; height: 24px; padding: 0 5px; display: none; align-items: center; justify-content: center; font-size: 14px; font-weight: 800; color: #fff; background: #ef4444; border-radius: 6px; box-shadow: 0 0 0 3px rgba(239,68,68,.28); z-index: 3; }
.pd-menu.show { display: flex; }
.pd-menu-top { top: 16px; right: 8px; }
.pd-menu-bottom { bottom: 4px; left: 50%; transform: translateX(-50%); }
.install-steps { margin: 0; padding-left: 20px; flex: 1; color: var(--ink); font-size: 13.5px; line-height: 1.75; }
.install-steps li { margin-bottom: 7px; }
.install-steps b { color: #2563eb; }
.install-url-row { display: flex; gap: 8px; }
.install-url-row input { flex: 1; min-width: 0; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: #f8fafc; color: var(--ink); font-size: 12px; }
.install-copy { flex-shrink: 0; padding: 0 18px; border: none; border-radius: 10px; background: #2563eb; color: #fff; font-weight: 700; font-size: 13px; cursor: pointer; }
.install-copy:active { transform: translateY(1px); }
.install-foot { margin: 4px 0 0; font-size: 12px; color: var(--muted); line-height: 1.6; }

/* ===== 附件：可长按分享 / 点击在线预览 ===== */
.attach { cursor: pointer; }
.attach-ico { font-size: 15px; line-height: 1; }
.attach-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-hint { color: #64748b; font-size: 11px; border-left: 1px solid #e2e8f0; padding-left: 6px; margin-left: 2px; }
.attach.pressed, .attach-image.pressed { outline: 2px solid #2563eb; outline-offset: 2px; }

/* 文件在线预览层 */
.file-viewer {
  position: fixed; inset: 0; z-index: 5000; display: flex; flex-direction: column;
  background: #0f172a;
}
.file-viewer[hidden] { display: none; }
.fv-head {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
  background: #111c33; border-bottom: 1px solid #1e293b;
}
.fv-title { flex: 1; min-width: 0; color: #e2e8f0; font-size: 13px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fv-tools { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.fv-btn {
  border: 1px solid #334155; background: #1e293b; color: #dbeafe;
  border-radius: 8px; padding: 6px 12px; font-size: 12px; font-weight: 700; cursor: pointer;
}
.fv-btn:active { transform: translateY(1px); }
.fv-close {
  width: 34px; height: 34px; border: none; border-radius: 50%;
  background: rgba(255,255,255,.12); color: #fff; font-size: 22px; line-height: 1; cursor: pointer;
}
.fv-body { flex: 1 1 auto; overflow: auto; -webkit-overflow-scrolling: touch; background: #fff; }
.fv-body.night { background: #0f172a; }
.fv-foot {
  flex: 0 0 auto; padding: 8px 12px calc(8px + env(safe-area-inset-bottom));
  background: #111c33; color: #94a3b8; font-size: 12px; text-align: center;
}
.fv-foot:empty { display: none; }
.fv-body iframe { width: 100%; height: 100%; border: none; display: block; }
.fv-body img { display: block; max-width: 100%; margin: 0 auto; }
.fv-body video { display: block; width: 100%; max-height: 100%; background: #000; }
.fv-body pre {
  margin: 0; padding: 14px; font-size: 12px; line-height: 1.7; color: #0f172a;
  white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, Menlo, Consolas, monospace;
}
/* 表格预览 */
.fv-sheet-wrap { padding: 0 0 20px; }
.fv-sheet-tabs {
  position: sticky; top: 0; z-index: 2; display: flex; gap: 6px; overflow-x: auto;
  padding: 8px 10px; background: #f8fafc; border-bottom: 1px solid #e2e8f0;
}
.fv-sheet-tab {
  flex-shrink: 0; border: 1px solid #cbd5e1; background: #fff; color: #334155;
  border-radius: 7px; padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.fv-sheet-tab.active { background: #2563eb; border-color: #2563eb; color: #fff; font-weight: 700; }
.fv-table-scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
.fv-body table.xl {
  border-collapse: collapse; font-size: 12px; color: #0f172a; background: #fff;
  min-width: 100%;
}
.fv-body table.xl td, .fv-body table.xl th {
  border: 1px solid #dfe6ee; padding: 5px 8px; white-space: nowrap;
  max-width: 260px; overflow: hidden; text-overflow: ellipsis;
}
.fv-body table.xl tr:first-child td { background: #eef4ff; font-weight: 700; }
.fv-empty { padding: 40px 20px; text-align: center; color: #64748b; font-size: 13px; line-height: 1.8; }

/* 长按操作面板 */
.attach-sheet {
  position: fixed; inset: 0; z-index: 5200; display: flex; align-items: flex-end; justify-content: center;
  background: rgba(8,15,30,.55);
}
.attach-sheet[hidden] { display: none; }
.as-card {
  width: min(440px, 100%); background: #fff; border-radius: 18px 18px 0 0;
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px;
}
@media (min-width: 640px) { .attach-sheet { align-items: center; } .as-card { border-radius: 18px; } }
.as-name {
  font-size: 13px; font-weight: 700; color: #0f172a; padding: 6px 4px 10px;
  border-bottom: 1px solid #eef2f7; margin-bottom: 4px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.as-card button {
  width: 100%; padding: 13px; border-radius: 12px; border: 1px solid #e2e8f0;
  background: #f8fafc; color: #0f172a; font-size: 14px; font-weight: 700; cursor: pointer;
}
.as-card button:active { transform: translateY(1px); }
.as-card button.ghost2 { color: #64748b; font-weight: 500; }
.attach-head { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
/* 长按附件时禁止系统"保存图片"菜单抢事件，统一走我们的操作面板 */
.attach-image img { -webkit-touch-callout: none; }
.attach { -webkit-touch-callout: none; user-select: none; -webkit-user-select: none; }
.lightbox-tools { position: absolute; top: 16px; right: 18px; display: flex; align-items: center; gap: 10px; z-index: 3; }
.lightbox-share {
  border: 1px solid rgba(255,255,255,.4); background: rgba(255,255,255,.15); color: #fff;
  border-radius: 10px; padding: 8px 16px; font-size: 13px; font-weight: 700; cursor: pointer;
}
.lightbox-share:active { transform: translateY(1px); }
.lightbox-close { position: static; }

/* ===== 思维记录（每条回答都可展开） ===== */
.think {
  margin: 6px 0 8px;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #8b5cf6;
  border-radius: 9px;
  background: #faf9ff;
  overflow: hidden;
}
.think-sum {
  cursor: pointer;
  list-style: none;
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 700;
  color: #6d28d9;
  user-select: none;
}
.think-sum::-webkit-details-marker { display: none; }
.think-sum::after { content: '▾'; float: right; opacity: .6; }
.think[open] .think-sum::after { content: '▴'; }
.think-body {
  padding: 2px 12px 10px;
  font-size: 12.5px;
  line-height: 1.75;
  color: #334155;
  white-space: pre-wrap;
  word-break: break-word;
}
.think-refs { padding: 0 12px 10px; }
.think-ref {
  font-size: 11.5px;
  line-height: 1.6;
  color: #64748b;
  padding: 3px 0 3px 8px;
  border-left: 2px solid #ddd6fe;
  margin-bottom: 3px;
}
/* 微信聊天文件引导 */
.wx-steps {
  margin: 4px 0 6px; padding-left: 20px;
  font-size: 13px; line-height: 1.8; color: #334155;
}
.wx-steps b { color: #2563eb; }
.composer-bar .file-btn { color: var(--ink); font-weight: 700; }

/* 消息同步失败时的重试块（保留已显示的历史，不清屏） */
.msg-retry {
  margin: 40px auto; max-width: 320px; padding: 18px 16px; text-align: center;
  border: 1px dashed var(--line); border-radius: 12px; background: #fff;
  font-size: 13px; color: var(--muted); line-height: 1.7;
}
.msg-retry button { margin-top: 12px; }
/* 图片缩略图还没下载完：先给个浅色占位，不撑破布局 */
.attach-image img.img-wait {
  min-width: 96px; min-height: 96px;
  background: linear-gradient(100deg, #eef2f7 30%, #f8fafc 50%, #eef2f7 70%);
  background-size: 200% 100%;
  animation: img-shimmer 1.2s linear infinite;
}
@keyframes img-shimmer { 0% { background-position: 120% 0; } 100% { background-position: -20% 0; } }

/* 转发到微信的说明文字 */
.wx-share-tip {
  margin: 4px 0 6px; font-size: 12.5px; line-height: 1.7; color: #475569;
  background: #f8fafc; border: 1px solid #e2e8f0; border-radius: 9px; padding: 9px 11px;
}

/* 总技能：版本记录 */
.skill-history { margin-top: 14px; border-top: 1px dashed var(--line); padding-top: 10px; }
.skill-history-title { font-size: 12px; font-weight: 800; color: var(--muted); margin-bottom: 6px; }
.skill-history-item { font-size: 12px; color: #475569; line-height: 1.9; }

/* 待发送提示：可点击打开管理面板，空内容时不占位 */
.file-hint-btn {
  background: #fff7ed; border: 1px solid #fed7aa; color: #c2410c;
  border-radius: 8px; padding: 5px 10px; font-size: 12.5px; font-weight: 700;
  cursor: pointer; white-space: nowrap;
}
.file-hint-btn:empty { display: none; }
.file-hint-btn:active { transform: translateY(1px); }

/* 待发送 / 发送失败 管理面板 */
.outbox-card { width: min(520px, 100%); }
.outbox-list { margin: 4px 0 6px; max-height: 52vh; overflow: auto; }
.outbox-empty { color: var(--muted); font-size: 13px; text-align: center; padding: 18px 8px; }
.outbox-item {
  border: 1px solid var(--line); border-radius: 11px; padding: 11px 12px;
  margin-bottom: 9px; background: #fff;
}
.outbox-item-head { display: flex; align-items: center; gap: 8px; }
.outbox-item-name {
  font-size: 13.5px; font-weight: 800; color: var(--ink);
  flex: 1; min-width: 0; word-break: break-all;
}
.outbox-item .badge {
  font-size: 11px; font-weight: 800; padding: 2px 8px; border-radius: 999px; white-space: nowrap;
}
.badge-queued { background: #fef3c7; color: #b45309; }
.badge-sending { background: #dbeafe; color: #1d4ed8; }
.outbox-item-meta { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.6; }
.outbox-item-err { color: #dc2626; }
.outbox-item-del {
  margin-top: 8px; padding: 6px 12px; font-size: 12.5px; font-weight: 700;
  color: #dc2626; background: #fef2f2; border: 1px solid #fecaca;
  border-radius: 8px; cursor: pointer;
}
.outbox-item-del:active { transform: translateY(1px); }
#outboxClear.danger { color: #dc2626; border-color: #fecaca; }

/* 乐观气泡：点发送后立即显示"发送中"的消息+附件 */
.msg.optimistic .bubble { opacity: .82; }
.msg.optimistic.pending-failed .bubble { opacity: 1; border-color: #fecaca; }
.optimistic-state {
  color: #2563eb; font-weight: 800; margin-left: 6px;
}
.msg.pending-failed .optimistic-state { color: #dc2626; }
.optimistic-failbar {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 6px;
}
.optimistic-failbar button {
  padding: 5px 12px; font-size: 12px; font-weight: 700; border-radius: 8px; cursor: pointer;
  border: 1px solid var(--line); background: #fff; color: var(--ink);
}
.optimistic-failbar button:first-child { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.optimistic-failbar button:active { transform: translateY(1px); }
